From f13fc9c35abc48996e7c02c2c515c1098a457460 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 21 Dec 2022 12:29:32 +0800 Subject: [PATCH 1/5] Only save labels from the modal when the user finishes selection This prevents creating issues by calling the setlabels mutation too frequently if a user is rapidly changing labels, if that happens a failure in the API could cause the user's changes to be overwritten. --- .../web/components/patterns/HighlightBar.tsx | 77 ++++++++++++------- .../templates/article/ArticleActionsMenu.tsx | 2 +- .../templates/article/HighlightsLayer.tsx | 28 +++++++ .../templates/article/HighlightsModal.tsx | 2 +- .../templates/article/SetLabelsControl.tsx | 10 ++- .../templates/article/SetLabelsModal.tsx | 47 ++++++++--- .../templates/homeFeed/HomeFeedContainer.tsx | 2 +- .../mutations/setLabelsForHighlight.ts | 8 +- .../networking/mutations/setLabelsMutation.ts | 3 +- .../web/pages/[username]/[slug]/index.tsx | 5 +- 10 files changed, 136 insertions(+), 48 deletions(-) diff --git a/packages/web/components/patterns/HighlightBar.tsx b/packages/web/components/patterns/HighlightBar.tsx index 92e5a6ae4..8fbde3083 100644 --- a/packages/web/components/patterns/HighlightBar.tsx +++ b/packages/web/components/patterns/HighlightBar.tsx @@ -6,9 +6,8 @@ import { AnchoredPopover } from '../patterns/AnchoredPopover' import { StyledText } from '../elements/StyledText' import { Button } from '../elements/Button' import { HStack, Box } from '../elements/LayoutPrimitives' -import { TrashIcon } from '../elements/images/TrashIcon' import { PenWithColorIcon } from '../elements/images/PenWithColorIcon' -import { Note, Trash, TrashSimple } from 'phosphor-react' +import { Note, Tag, Trash } from 'phosphor-react' type PageCoordinates = { pageX: number @@ -38,7 +37,7 @@ export function HighlightBar(props: HighlightBarProps): JSX.Element { ) : ( - + <> + + + + + )}