diff --git a/src/components/Icons.jsx b/src/components/Icons.jsx index adf4ad6..0376557 100644 --- a/src/components/Icons.jsx +++ b/src/components/Icons.jsx @@ -119,6 +119,12 @@ export function Icons() { + + + + + + {/* By Sam Herbert (@sherb), for everyone. More http://goo.gl/7AJzbL */} @@ -173,9 +179,15 @@ export function Icons() { ); } -export const Icon = ({ name, ...rest }) => { +export const Icon = ({ name, color, size, ...rest }) => { return ( - + ); diff --git a/src/components/ItemTile.jsx b/src/components/ItemTile.jsx index b99e7c0..c97204b 100644 --- a/src/components/ItemTile.jsx +++ b/src/components/ItemTile.jsx @@ -1,7 +1,8 @@ import { h } from 'preact'; import { getHumanDate } from '../utils'; import Modal from './Modal'; -import { HStack } from './Stack'; +import { HStack, Stack } from './Stack'; +import { Icon } from './Icons'; export function ItemTile({ item, @@ -23,26 +24,6 @@ export function ItemTile({ onClick={onClick} >
- {onToggleVisibilityBtnClick ? ( - - ) : null} {onForkBtnClick ? (
-
right
+
+ + + {item.isPublic ? 'Public' : ''} + +
diff --git a/src/components/Share.jsx b/src/components/Share.jsx index b9fdd41..4a2e51c 100644 --- a/src/components/Share.jsx +++ b/src/components/Share.jsx @@ -5,6 +5,7 @@ import Switch from './Switch'; import { itemService } from '../itemService'; import { alertsService } from '../notifications'; import { Button } from './common'; +import { Icon } from './Icons'; const FREE_PUBLIC_ITEM_COUNT = 1; const BASE_URL = location.origin; @@ -25,9 +26,18 @@ export function Share({ user, item, onVisibilityChange }) { setVal(newVal); if (newVal) { const token = await window.user.getIdToken(); - const res = await fetch( - `http://127.0.0.1:5001/web-maker-app/us-central1/toggleVisibility?token=${token}&itemId=${item.id}` - ); + let res; + try { + res = await fetch( + `http://127.0.0.1:5001/web-maker-app/us-central1/toggleVisibility?token=${token}&itemId=${item.id}` + ); + } catch (e) { + alertsService.add('Could not change visibility'); + setTimeout(() => { + setVal(!newVal); + }, 1000); + return; + } if (res.status >= 200 && res.status < 400) { setPublicItemCount(publicItemCount + 1); @@ -50,26 +60,32 @@ export function Share({ user, item, onVisibilityChange }) { }; return ( - - - Access - - {item.isPublic && ( -

- Public at{' '} - - {BASE_URL}/create/{item.id} - {' '} - -

- )} -
+
+ + + Access + + {item.isPublic && ( +

+ Public at{' '} + + {BASE_URL}/create/{item.id} + {' '} + +

+ )} +
+
{!user?.isPro ? (