diff --git a/client/src/itemDisplay.tsx b/client/src/itemDisplay.tsx index ac73a84e..b073f799 100644 --- a/client/src/itemDisplay.tsx +++ b/client/src/itemDisplay.tsx @@ -156,7 +156,7 @@ export const ItemDisplay = ({ margin-left: 2px; `} > - + )}
{ +export const StarredControl = ({ + item: { id, isStarred, message }, +}: StarredControlProps) => { const [setIsStarred] = useMutation(gqlSetIsStarred); + const [confirmModalElement, confirm] = useConfirmModal( + +
+ Are you sure you want +
to {isStarred ? "unstar" : "star"} this item? +
+
+ {message} +
+
+ ); const toggleIsStarred = () => { - //TODO consider modal here to confirm (in both directions) - setIsStarred({ variables: { itemId, isStarred: !isStarred } }); + confirm().then((isConfirmed) => { + isConfirmed && + setIsStarred({ variables: { itemId: id, isStarred: !isStarred } }); + }); }; return ( - +
+ {confirmModalElement} + +
); }; diff --git a/client/src/starred/starredMessages.tsx b/client/src/starred/starredMessages.tsx index 8b2d6fcc..b9cc1561 100644 --- a/client/src/starred/starredMessages.tsx +++ b/client/src/starred/starredMessages.tsx @@ -102,8 +102,9 @@ const StarredMessages = ({
Click here to open Pinboard, then simply send a message and then - click the to the left of your message. You - can also star other's messages if you think they're + click the to the left of your message. +
+ You can also star other's messages if you think they're important. )}