diff --git a/packages/web/components/elements/ModalPrimitives.tsx b/packages/web/components/elements/ModalPrimitives.tsx
index 2790897e9..a9c0975c3 100644
--- a/packages/web/components/elements/ModalPrimitives.tsx
+++ b/packages/web/components/elements/ModalPrimitives.tsx
@@ -29,7 +29,7 @@ const Modal = styled(Content, {
boxShadow: theme.shadows.cardBoxShadow.toString(),
position: 'fixed',
'&:focus': { outline: 'none' },
- zIndex:'1',
+ zIndex: '1',
})
export const ModalContent = styled(Modal, {
@@ -43,6 +43,7 @@ export const ModalContent = styled(Modal, {
maxWidth: '95%',
width: '95%',
},
+ zIndex: '10',
})
export type ModalTitleBarProps = {
@@ -57,9 +58,7 @@ export const ModalTitleBar = (props: ModalTitleBarProps) => {
alignment="center"
css={{ height: '68px', width: '100%' }}
>
-
- {props.title}
-
+ {props.title}
)
@@ -98,7 +94,10 @@ export const ModalButtonBar = (props: ModalButtonBarProps) => {
},
}}
>
-
- props.articleActionHandler('showHighlights')}>
- props.articleActionHandler('showHighlights')}
>
-
-
-
+
+
+
+
-
+
- {
- props.articleActionHandler('delete')
- }}
- >
- {
+ props.articleActionHandler('delete')
+ }}
>
-
-
-
+
+
+
+
- {!props.article?.isArchived ? (
+ {!props.article?.isArchived ? (
props.articleActionHandler('archive')}
@@ -184,27 +234,26 @@ export function ArticleActionsMenu(props: ArticleActionsMenuProps): JSX.Element
tooltipContent="Unarchive"
tooltipSide={props.layout == 'side' ? 'right' : 'bottom'}
>
-
+
)}
- {/*
+ {/*
*/}
-
- {readerSettings.showEditDisplaySettingsModal && (
- readerSettings.setShowEditDisplaySettingsModal(false)}
- />
- )}
+
+ {readerSettings.showEditDisplaySettingsModal && (
+
+ readerSettings.setShowEditDisplaySettingsModal(false)
+ }
+ />
+ )}
>
)
}
diff --git a/packages/web/components/templates/article/HighlightsModal.tsx b/packages/web/components/templates/article/HighlightsModal.tsx
index 8e5fa0607..c59e080da 100644
--- a/packages/web/components/templates/article/HighlightsModal.tsx
+++ b/packages/web/components/templates/article/HighlightsModal.tsx
@@ -22,6 +22,9 @@ import { StyledTextArea } from '../../elements/StyledTextArea'
import { ConfirmationModal } from '../../patterns/ConfirmationModal'
import { DotsThree } from 'phosphor-react'
import { Dropdown, DropdownOption } from '../../elements/DropdownElements'
+import { SetLabelsModal } from './SetLabelsModal'
+import { Label } from '../../../lib/networking/fragments/labelFragment'
+import { setLabelsForHighlight } from '../../../lib/networking/mutations/setLabelsForHighlight'
type HighlightsModalProps = {
highlights: Highlight[]
@@ -33,6 +36,10 @@ type HighlightsModalProps = {
export function HighlightsModal(props: HighlightsModalProps): JSX.Element {
const [showConfirmDeleteHighlightId, setShowConfirmDeleteHighlightId] =
useState(undefined)
+ const [labelsTarget, setLabelsTarget] = useState(
+ undefined
+ )
+ const [, updateState] = useState({})
return (
@@ -42,7 +49,7 @@ export function HighlightsModal(props: HighlightsModalProps): JSX.Element {
event.preventDefault()
props.onOpenChange(false)
}}
- css={{ overflow: 'auto', px: '24px', zIndex: '10' }}
+ css={{ overflow: 'auto', px: '24px' }}
>
@@ -53,6 +60,7 @@ export function HighlightsModal(props: HighlightsModalProps): JSX.Element {
highlight={highlight}
showDelete={!!props.deleteHighlightAction}
scrollToHighlight={props.scrollToHighlight}
+ setSetLabelsTarget={setLabelsTarget}
setShowConfirmDeleteHighlightId={
setShowConfirmDeleteHighlightId
}
@@ -73,7 +81,7 @@ export function HighlightsModal(props: HighlightsModalProps): JSX.Element {
- {showConfirmDeleteHighlightId ? (
+ {showConfirmDeleteHighlightId && (
{
@@ -90,7 +98,25 @@ export function HighlightsModal(props: HighlightsModalProps): JSX.Element {
/>
}
/>
- ) : null}
+ )}
+ {labelsTarget && (
+ {
+ const result = setLabelsForHighlight(
+ labelsTarget.id,
+ labels.map((label) => label.id)
+ )
+ return result
+ }}
+ />
+ )}
)
}
@@ -100,6 +126,8 @@ type ModalHighlightViewProps = {
showDelete: boolean
scrollToHighlight?: (arg: string) => void
deleteHighlightAction: () => void
+
+ setSetLabelsTarget: (highlight: Highlight) => void
setShowConfirmDeleteHighlightId: (id: string | undefined) => void
}
@@ -125,7 +153,12 @@ function ModalHighlightView(props: ModalHighlightViewProps): JSX.Element {
}}
title="Copy"
/>
- {/* {}} title="Labels" /> */}
+ {
+ props.setSetLabelsTarget(props.highlight)
+ }}
+ title="Labels"
+ />
{
props.setShowConfirmDeleteHighlightId(props.highlight.id)
diff --git a/packages/web/components/templates/article/SetLabelsControl.tsx b/packages/web/components/templates/article/SetLabelsControl.tsx
index 2afb1e06e..b4a23f0f7 100644
--- a/packages/web/components/templates/article/SetLabelsControl.tsx
+++ b/packages/web/components/templates/article/SetLabelsControl.tsx
@@ -9,18 +9,19 @@ import { Label } from '../../../lib/networking/fragments/labelFragment'
import { useGetLabelsQuery } from '../../../lib/networking/queries/useGetLabelsQuery'
import { Check, Circle, PencilSimple, Plus } from 'phosphor-react'
import { isTouchScreenDevice } from '../../../lib/deviceType'
-import { setLabelsMutation } from '../../../lib/networking/mutations/setLabelsMutation'
import { createLabelMutation } from '../../../lib/networking/mutations/createLabelMutation'
import { showErrorToast, showSuccessToast } from '../../../lib/toastHelpers'
import { randomLabelColorHex } from '../../../utils/settings-page/labels/labelColorObjects'
import { useRouter } from 'next/router'
-import { ArticleAttributes } from '../../../lib/networking/queries/useGetArticleQuery'
+
+export interface LabelsProvider {
+ labels?: Label[]
+}
type SetLabelsControlProps = {
- linkId: string
- labels: Label[] | undefined
- article?: ArticleAttributes
- articleActionHandler: (action: string, arg?: unknown) => void
+ provider: LabelsProvider
+ onSave: (labels: Label[] | undefined) => void
+ save: (labels: Label[]) => Promise