diff --git a/packages/web/components/elements/LabelChip.tsx b/packages/web/components/elements/LabelChip.tsx
index a18ad44a0..73c249664 100644
--- a/packages/web/components/elements/LabelChip.tsx
+++ b/packages/web/components/elements/LabelChip.tsx
@@ -1,10 +1,6 @@
-import { getLuminance } from 'color2k'
-import { useRouter } from 'next/router'
-import { Button } from './Button'
import { SpanBox, HStack } from './LayoutPrimitives'
import { Circle, X } from 'phosphor-react'
import { isDarkTheme } from '../../lib/themeUpdater'
-import { theme } from '../tokens/stitches.config'
type LabelChipProps = {
text: string
diff --git a/packages/web/components/elements/MobileInstallHelp.tsx b/packages/web/components/elements/MobileInstallHelp.tsx
index 98e430cc6..9f23377c4 100644
--- a/packages/web/components/elements/MobileInstallHelp.tsx
+++ b/packages/web/components/elements/MobileInstallHelp.tsx
@@ -7,7 +7,6 @@ import {
import { Box, HStack } from '../elements/LayoutPrimitives'
import { StyledText, StyledAnchor } from '../elements/StyledText'
import { TooltipWrapped } from './Tooltip'
-import Link from 'next/link'
const TooltipStyle = {
backgroundColor: '#F9D354',
diff --git a/packages/web/components/elements/SplitButton.tsx b/packages/web/components/elements/SplitButton.tsx
index 8add1554a..fca43c9d5 100644
--- a/packages/web/components/elements/SplitButton.tsx
+++ b/packages/web/components/elements/SplitButton.tsx
@@ -1,8 +1,5 @@
-import { ReactNode, useEffect, useMemo, useRef } from 'react'
-import { styled } from '../tokens/stitches.config'
-import { Box, HStack, VStack } from './LayoutPrimitives'
+import { HStack, VStack } from './LayoutPrimitives'
import { Button } from './Button'
-import { Dropdown, DropdownOption } from './DropdownElements'
import { CaretDownIcon } from './icons/CaretDownIcon'
type ShowLinkMode = 'none' | 'link' | 'pdf'
diff --git a/packages/web/components/elements/images/OmnivoreFestiveLogo.tsx b/packages/web/components/elements/images/OmnivoreFestiveLogo.tsx
index a294b7970..f585d796f 100644
--- a/packages/web/components/elements/images/OmnivoreFestiveLogo.tsx
+++ b/packages/web/components/elements/images/OmnivoreFestiveLogo.tsx
@@ -14,22 +14,21 @@ export function OmnivoreFestiveLogo(
const href = props.href || '/home'
return (
- (
-
+ }}
+ >
-
- )
- );
+
+ )
}
diff --git a/packages/web/components/elements/images/OmnivoreFullLogo.tsx b/packages/web/components/elements/images/OmnivoreFullLogo.tsx
index 5aa52ff11..a0b890ff0 100644
--- a/packages/web/components/elements/images/OmnivoreFullLogo.tsx
+++ b/packages/web/components/elements/images/OmnivoreFullLogo.tsx
@@ -1,6 +1,3 @@
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-import { useEffect, useState } from 'react'
import { config } from '../../tokens/stitches.config'
import { OmnivoreLogoBase } from './OmnivoreLogoBase'
diff --git a/packages/web/components/patterns/HighlightBar.tsx b/packages/web/components/patterns/HighlightBar.tsx
index 9ce3b9cec..c85f41301 100644
--- a/packages/web/components/patterns/HighlightBar.tsx
+++ b/packages/web/components/patterns/HighlightBar.tsx
@@ -1,21 +1,8 @@
import { isAndroid } from '../../lib/deviceType'
-
import { styled, theme } from '../tokens/stitches.config'
-
-import { StyledText } from '../elements/StyledText'
import { Button } from '../elements/Button'
import { HStack, Box } from '../elements/LayoutPrimitives'
-import { PenWithColorIcon } from '../elements/images/PenWithColorIcon'
-import {
- Note,
- Tag,
- Trash,
- Copy,
- Circle,
- CopySimple,
- CheckCircle,
-} from 'phosphor-react'
-import { TrashIcon } from '../elements/icons/TrashIcon'
+import { Circle, CheckCircle } from 'phosphor-react'
import { LabelIcon } from '../elements/icons/LabelIcon'
import { NotebookIcon } from '../elements/icons/NotebookIcon'
import { highlightColor, highlightColors } from '../../lib/themeUpdater'
diff --git a/packages/web/components/patterns/HighlightHoverActions.tsx b/packages/web/components/patterns/HighlightHoverActions.tsx
index 0599bd4c2..d027c879b 100644
--- a/packages/web/components/patterns/HighlightHoverActions.tsx
+++ b/packages/web/components/patterns/HighlightHoverActions.tsx
@@ -1,20 +1,8 @@
import { useState } from 'react'
-import { Box, SpanBox } from '../elements/LayoutPrimitives'
-import { LibraryItemNode } from '../../lib/networking/queries/useGetLibraryItemsQuery'
+import { Box } from '../elements/LayoutPrimitives'
import { Button } from '../elements/Button'
import { theme } from '../tokens/stitches.config'
-import {
- ArchiveBox,
- Book,
- BookOpen,
- Copy,
- DotsThree,
- Notebook,
- Tag,
- Trash,
- Tray,
-} from 'phosphor-react'
-//import { CardMenu } from '../CardMenu'
+import { BookOpen, Copy } from 'phosphor-react'
import { UserBasicData } from '../../lib/networking/queries/useGetViewerQuery'
import { Highlight } from '../../lib/networking/fragments/highlightFragment'
import { showErrorToast, showSuccessToast } from '../../lib/toastHelpers'
diff --git a/packages/web/components/patterns/HighlightView.tsx b/packages/web/components/patterns/HighlightView.tsx
index 9a8d573a6..435b51c23 100644
--- a/packages/web/components/patterns/HighlightView.tsx
+++ b/packages/web/components/patterns/HighlightView.tsx
@@ -9,15 +9,11 @@ import {
SpanBox,
HStack,
} from '../elements/LayoutPrimitives'
-import { styled, theme } from '../tokens/stitches.config'
+import { styled } from '../tokens/stitches.config'
import { HighlightViewNote } from './HighlightNotes'
import ReactMarkdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
-import {
- highlightColor,
- highlightColorVar,
- isDarkTheme,
-} from '../../lib/themeUpdater'
+import { highlightColorVar } from '../../lib/themeUpdater'
import { ReadableItem } from '../../lib/networking/queries/useGetLibraryItemsQuery'
import { UserBasicData } from '../../lib/networking/queries/useGetViewerQuery'
import {
@@ -54,7 +50,6 @@ const StyledQuote = styled(Blockquote, {
})
export function HighlightView(props: HighlightViewProps): JSX.Element {
- const isDark = isDarkTheme()
const [noteMode, setNoteMode] = useState<'preview' | 'edit'>('preview')
const [isOpen, setIsOpen] = useState(false)
diff --git a/packages/web/components/patterns/LibraryCards/LibraryCardStyles.tsx b/packages/web/components/patterns/LibraryCards/LibraryCardStyles.tsx
index 66a2fa81c..4b0e171e4 100644
--- a/packages/web/components/patterns/LibraryCards/LibraryCardStyles.tsx
+++ b/packages/web/components/patterns/LibraryCards/LibraryCardStyles.tsx
@@ -1,8 +1,8 @@
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
-import { ChangeEvent, useMemo } from 'react'
+import { useMemo } from 'react'
import { LibraryItemNode } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
-import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
+import { HStack, SpanBox } from '../../elements/LayoutPrimitives'
import { RecommendedFlairIcon } from '../../elements/icons/RecommendedFlairIcon'
import { PinnedFlairIcon } from '../../elements/icons/PinnedFlairIcon'
import { FavoriteFlairIcon } from '../../elements/icons/FavoriteFlairIcon'
diff --git a/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx b/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx
index fc8cf7e29..98653cba6 100644
--- a/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx
+++ b/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx
@@ -195,7 +195,7 @@ const LibraryGridCardContent = (props: LinkedItemCardProps): JSX.Element => {
const handleCheckChanged = useCallback(() => {
const newValue = !isChecked
setIsChecked(item.id, newValue)
- }, [setIsChecked, isChecked, props])
+ }, [item, setIsChecked, isChecked, props])
return (
diff --git a/packages/web/components/patterns/LibraryCards/LibraryHoverActions.tsx b/packages/web/components/patterns/LibraryCards/LibraryHoverActions.tsx
index 488fa5b5a..48c486a44 100644
--- a/packages/web/components/patterns/LibraryCards/LibraryHoverActions.tsx
+++ b/packages/web/components/patterns/LibraryCards/LibraryHoverActions.tsx
@@ -4,14 +4,7 @@ import { LibraryItemNode } from '../../../lib/networking/queries/useGetLibraryIt
import { LinkedItemCardAction } from './CardTypes'
import { Button } from '../../elements/Button'
import { theme } from '../../tokens/stitches.config'
-import {
- ArchiveBox,
- DotsThree,
- Notebook,
- Tag,
- Trash,
- Tray,
-} from 'phosphor-react'
+import { DotsThree } from 'phosphor-react'
import { CardMenu } from '../CardMenu'
import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery'
import { ArchiveIcon } from '../../elements/icons/ArchiveIcon'
diff --git a/packages/web/components/patterns/SettingsHeader.tsx b/packages/web/components/patterns/SettingsHeader.tsx
index e50bfe10f..a7cabd1f5 100644
--- a/packages/web/components/patterns/SettingsHeader.tsx
+++ b/packages/web/components/patterns/SettingsHeader.tsx
@@ -1,7 +1,5 @@
-import { Box, HStack } from '../elements/LayoutPrimitives'
-import { OmnivoreNameLogo } from '../elements/images/OmnivoreNameLogo'
+import { HStack } from '../elements/LayoutPrimitives'
import { UserBasicData } from '../../lib/networking/queries/useGetViewerQuery'
-import { PrimaryDropdown } from '../templates/PrimaryDropdown'
import { DEFAULT_HEADER_HEIGHT } from '../templates/homeFeed/HeaderSpacer'
import { LogoBox } from '../elements/LogoBox'
diff --git a/packages/web/components/templates/PrimaryDropdown.tsx b/packages/web/components/templates/PrimaryDropdown.tsx
index d674fcd80..e6d462c24 100644
--- a/packages/web/components/templates/PrimaryDropdown.tsx
+++ b/packages/web/components/templates/PrimaryDropdown.tsx
@@ -279,7 +279,7 @@ function ThemeSection(props: PrimaryDropdownProps): JSX.Element {
updateTheme(newTheme)
setDisplayTheme(newTheme)
},
- [displayTheme, setDisplayTheme]
+ [setDisplayTheme]
)
return (
diff --git a/packages/web/components/templates/PrimaryLayout.tsx b/packages/web/components/templates/PrimaryLayout.tsx
index 3ccd71fd0..ee734c9ad 100644
--- a/packages/web/components/templates/PrimaryLayout.tsx
+++ b/packages/web/components/templates/PrimaryLayout.tsx
@@ -7,10 +7,8 @@ import { useKeyboardShortcuts } from '../../lib/keyboardShortcuts/useKeyboardSho
import { useRouter } from 'next/router'
import { ConfirmationModal } from '../patterns/ConfirmationModal'
import { KeyboardShortcutListModal } from './KeyboardShortcutListModal'
-import { logoutMutation } from '../../lib/networking/mutations/logoutMutation'
-import { deinitAnalytics, setupAnalytics } from '../../lib/analytics'
+import { setupAnalytics } from '../../lib/analytics'
import { primaryCommands } from '../../lib/keyboardShortcuts/navigationShortcuts'
-import { applyStoredTheme } from '../../lib/themeUpdater'
import { logout } from '../../lib/logout'
import { useApplyLocalTheme } from '../../lib/hooks/useApplyLocalTheme'
diff --git a/packages/web/components/templates/article/AddBulkLabelsModal.tsx b/packages/web/components/templates/article/AddBulkLabelsModal.tsx
index a8b819ba2..f6026df58 100644
--- a/packages/web/components/templates/article/AddBulkLabelsModal.tsx
+++ b/packages/web/components/templates/article/AddBulkLabelsModal.tsx
@@ -28,9 +28,8 @@ export function AddBulkLabelsModal(
const [tabCount, setTabCount] = useState(-1)
const [inputValue, setInputValue] = useState('')
const [tabStartValue, setTabStartValue] = useState('')
- const [errorMessage, setErrorMessage] = useState(
- undefined
- )
+ const [errorMessage, setErrorMessage] =
+ useState(undefined)
const errorTimeoutRef = useRef()
const [highlightLastLabel, setHighlightLastLabel] = useState(false)
const [isSaving, setIsSaving] = useState(false)
diff --git a/packages/web/components/templates/article/HighlightViewItem.tsx b/packages/web/components/templates/article/HighlightViewItem.tsx
index df2440929..2371f29e9 100644
--- a/packages/web/components/templates/article/HighlightViewItem.tsx
+++ b/packages/web/components/templates/article/HighlightViewItem.tsx
@@ -2,7 +2,7 @@ import { useState } from 'react'
import { Highlight } from '../../../lib/networking/fragments/highlightFragment'
import { ReadableItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery'
-import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
+import { HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
import { HighlightView } from '../../patterns/HighlightView'
type HighlightViewItemProps = {
diff --git a/packages/web/components/templates/article/Notebook.tsx b/packages/web/components/templates/article/Notebook.tsx
index 55b77eb49..90aaff720 100644
--- a/packages/web/components/templates/article/Notebook.tsx
+++ b/packages/web/components/templates/article/Notebook.tsx
@@ -1,5 +1,4 @@
import { Box, HStack, VStack, SpanBox } from '../../elements/LayoutPrimitives'
-import { StyledText } from '../../elements/StyledText'
import { theme } from '../../tokens/stitches.config'
import type { Highlight } from '../../../lib/networking/fragments/highlightFragment'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
@@ -17,7 +16,6 @@ import { TrashIcon } from '../../elements/icons/TrashIcon'
import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery'
import { ReadableItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
import { SetHighlightLabelsModalPresenter } from './SetLabelsModalPresenter'
-import { Button } from '../../elements/Button'
import { ArticleNotes } from '../../patterns/ArticleNotes'
import { useGetArticleQuery } from '../../../lib/networking/queries/useGetArticleQuery'
import { formattedShortTime } from '../../../lib/dateFormatting'
@@ -59,9 +57,8 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element {
const [noteText, setNoteText] = useState('')
const [showConfirmDeleteHighlightId, setShowConfirmDeleteHighlightId] =
useState(undefined)
- const [labelsTarget, setLabelsTarget] = useState(
- undefined
- )
+ const [labelsTarget, setLabelsTarget] =
+ useState(undefined)
const noteState = useRef({
isCreating: false,
note: undefined,
@@ -87,34 +84,37 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element {
}
})()
},
- []
+ [props]
)
- const createNote = useCallback((text: string) => {
- noteState.current.isCreating = true
- noteState.current.createStarted = new Date()
- ;(async () => {
- try {
- const success = await createHighlightMutation({
- id: newNoteId,
- shortId: nanoid(8),
- type: 'NOTE',
- articleId: props.item.id,
- annotation: text,
- })
- if (success) {
- noteState.current.note = success
+ const createNote = useCallback(
+ (text: string) => {
+ noteState.current.isCreating = true
+ noteState.current.createStarted = new Date()
+ ;(async () => {
+ try {
+ const success = await createHighlightMutation({
+ id: newNoteId,
+ shortId: nanoid(8),
+ type: 'NOTE',
+ articleId: props.item.id,
+ annotation: text,
+ })
+ if (success) {
+ noteState.current.note = success
+ noteState.current.isCreating = false
+ } else {
+ setErrorSaving('Error creating note')
+ }
+ } catch (error) {
+ console.error('error creating note: ', error)
noteState.current.isCreating = false
- } else {
setErrorSaving('Error creating note')
}
- } catch (error) {
- console.error('error creating note: ', error)
- noteState.current.isCreating = false
- setErrorSaving('Error creating note')
- }
- })()
- }, [])
+ })()
+ },
+ [props, newNoteId]
+ )
const highlights = useMemo(() => {
const result = articleData?.article.article.highlights
@@ -133,7 +133,7 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element {
if (highlights && props.onAnnotationsChanged) {
props.onAnnotationsChanged(highlights)
}
- }, [highlights])
+ }, [props, highlights])
const sortedHighlights = useMemo(() => {
const sorted = (a: number, b: number) => {
@@ -188,7 +188,7 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element {
}
createNote(text)
},
- [noteText, noteState, createNote, updateNote, highlights]
+ [noteState, createNote, updateNote]
)
const deleteDocumentNote = useCallback(() => {
@@ -204,7 +204,7 @@ export function NotebookContent(props: NotebookContentProps): JSX.Element {
noteState.current.note = undefined
})()
setNoteText('')
- }, [noteState, highlights])
+ }, [props, noteState, highlights])
const [errorSaving, setErrorSaving] = useState(undefined)
const [lastChanged, setLastChanged] = useState(undefined)
diff --git a/packages/web/components/templates/article/NotebookHeader.tsx b/packages/web/components/templates/article/NotebookHeader.tsx
index 284bd8cb3..81b9a7ed1 100644
--- a/packages/web/components/templates/article/NotebookHeader.tsx
+++ b/packages/web/components/templates/article/NotebookHeader.tsx
@@ -4,7 +4,7 @@ import { Sidebar } from 'phosphor-react'
import { theme } from '../../tokens/stitches.config'
import { Button } from '../../elements/Button'
import { ExportIcon } from '../../elements/icons/ExportIcon'
-import { useCallback, useMemo } from 'react'
+import { useCallback } from 'react'
import { UserBasicData } from '../../../lib/networking/queries/useGetViewerQuery'
import { ReadableItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
import { useGetArticleQuery } from '../../../lib/networking/queries/useGetArticleQuery'
diff --git a/packages/web/components/templates/article/NotebookModal.tsx b/packages/web/components/templates/article/NotebookModal.tsx
index 43e1da8ab..0250a2b44 100644
--- a/packages/web/components/templates/article/NotebookModal.tsx
+++ b/packages/web/components/templates/article/NotebookModal.tsx
@@ -9,7 +9,7 @@ import { StyledText } from '../../elements/StyledText'
import { theme } from '../../tokens/stitches.config'
import type { Highlight } from '../../../lib/networking/fragments/highlightFragment'
import { useCallback, useState } from 'react'
-import { ArrowsIn, ArrowsOut, X } from 'phosphor-react'
+import { X } from 'phosphor-react'
import { Dropdown, DropdownOption } from '../../elements/DropdownElements'
import { showErrorToast, showSuccessToast } from '../../../lib/toastHelpers'
import { diff_match_patch } from 'diff-match-patch'
@@ -37,17 +37,15 @@ export const getHighlightLocation = (patch: string): number | undefined => {
export function NotebookModal(props: NotebookModalProps): JSX.Element {
const [showConfirmDeleteNote, setShowConfirmDeleteNote] = useState(false)
- const [allAnnotations, setAllAnnotations] = useState(
- undefined
- )
+ const [allAnnotations, setAllAnnotations] =
+ useState(undefined)
- const [deletedHighlights, setDeletedAnnotations] = useState<
- Highlight[] | undefined
- >(undefined)
+ const [deletedHighlights, setDeletedAnnotations] =
+ useState(undefined)
const handleClose = useCallback(() => {
props.onClose(allAnnotations ?? [], deletedHighlights ?? [])
- }, [props, allAnnotations])
+ }, [props, allAnnotations, deletedHighlights])
const handleAnnotationsChange = useCallback((allAnnotations: Highlight[]) => {
setAllAnnotations(allAnnotations)
@@ -161,11 +159,6 @@ export function NotebookModal(props: NotebookModalProps): JSX.Element {
)
}
-type SizeToggleProps = {
- mode: 'normal' | 'maximized'
- setMode: (mode: 'normal' | 'maximized') => void
-}
-
function CloseButton(props: { close: () => void }): JSX.Element {
return (