{
@@ -1234,7 +1272,8 @@ function LibraryItems(props: LibraryItemsProps): JSX.Element {
outline: 'none',
},
'&> div': {
- bg: '$thBackground3',
+ bg: '$thLeftMenuBackground',
+ // bg: '$thLibraryBackground',
},
'&:focus': {
outline: 'none',
@@ -1246,6 +1285,7 @@ function LibraryItems(props: LibraryItemsProps): JSX.Element {
'&:hover': {
'> div': {
bg: '$thBackgroundActive',
+ boxShadow: '$cardBoxShadow',
},
'> a': {
bg: '$thBackgroundActive',
diff --git a/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx b/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx
index 0c9000ea2..958b30b73 100644
--- a/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx
+++ b/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx
@@ -19,8 +19,11 @@ import { SavedSearch } from '../../../lib/networking/fragments/savedSearchFragme
import { ToggleCaretDownIcon } from '../../elements/icons/ToggleCaretDownIcon'
import Link from 'next/link'
import { ToggleCaretRightIcon } from '../../elements/icons/ToggleCaretRightIcon'
+import { SplitButton } from '../../elements/SplitButton'
+import { AvatarDropdown } from '../../elements/AvatarDropdown'
+import { PrimaryDropdown } from '../PrimaryDropdown'
-export const LIBRARY_LEFT_MENU_WIDTH = '233px'
+export const LIBRARY_LEFT_MENU_WIDTH = '275px'
type LibraryFilterMenuProps = {
setShowAddLinkModal: (show: boolean) => void
@@ -119,6 +122,7 @@ export function LibraryFilterMenu(props: LibraryFilterMenuProps): JSX.Element {
+
{/* This spacer pushes library content to the right of
@@ -241,8 +245,16 @@ function Subscriptions(
>
{!collapsed ? (
<>
-
-
+
+
)
}
+
+const Footer = (props: LibraryFilterMenuProps): JSX.Element => {
+ return (
+
+
+
+ props.setShowAddLinkModal(true)}
+ />
+
+
+ )
+}
diff --git a/packages/web/components/templates/homeFeed/LibraryHeader.tsx b/packages/web/components/templates/homeFeed/LibraryHeader.tsx
index e9f0c3168..3d444209f 100644
--- a/packages/web/components/templates/homeFeed/LibraryHeader.tsx
+++ b/packages/web/components/templates/homeFeed/LibraryHeader.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useRef, useState } from 'react'
+import { useEffect, useMemo, useRef, useState } from 'react'
import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
import { theme } from '../../tokens/stitches.config'
import { FormInput } from '../../elements/FormElements'
@@ -14,13 +14,8 @@ import {
X,
} from 'phosphor-react'
import { LayoutType } from './HomeFeedContainer'
-import { PrimaryDropdown } from '../PrimaryDropdown'
import { OmnivoreSmallLogo } from '../../elements/images/OmnivoreNameLogo'
-import {
- DEFAULT_HEADER_HEIGHT,
- HeaderSpacer,
- useGetHeaderHeight,
-} from './HeaderSpacer'
+import { DEFAULT_HEADER_HEIGHT, HeaderSpacer } from './HeaderSpacer'
import { LIBRARY_LEFT_MENU_WIDTH } from '../../templates/homeFeed/LibraryFilterMenu'
import { CardCheckbox } from '../../patterns/LibraryCards/LibraryCardStyles'
import { Dropdown, DropdownOption } from '../../elements/DropdownElements'
@@ -37,6 +32,11 @@ import { CaretDownIcon } from '../../elements/icons/CaretDownIcon'
import { PinnedButtons } from './PinnedButtons'
import { usePersistedState } from '../../../lib/hooks/usePersistedState'
import { PinnedSearch } from '../../../pages/settings/pinned-searches'
+import { HeaderCheckboxIcon } from '../../elements/icons/HeaderCheckboxIcon'
+import { HeaderSearchIcon } from '../../elements/icons/HeaderSearchIcon'
+import { HeaderToggleGridIcon } from '../../elements/icons/HeaderToggleGridIcon'
+import { HeaderToggleListIcon } from '../../elements/icons/HeaderToggleListIcon'
+import useWindowDimensions from '../../../lib/hooks/useGetWindowDimensions'
export type MultiSelectMode = 'off' | 'none' | 'some' | 'visible' | 'search'
@@ -47,28 +47,17 @@ type LibraryHeaderProps = {
searchTerm: string | undefined
applySearchQuery: (searchQuery: string) => void
- alwaysShowHeader: boolean
- allowSelectMultiple: boolean
-
showFilterMenu: boolean
setShowFilterMenu: (show: boolean) => void
- showAddLinkModal: () => void
-
numItemsSelected: number
multiSelectMode: MultiSelectMode
setMultiSelectMode: (mode: MultiSelectMode) => void
performMultiSelectAction: (action: BulkAction, labelIds?: string[]) => void
-
- handleLinkSubmission: (
- link: string,
- timezone: string,
- locale: string
- ) => Promise
}
-const controlWidths = (
+export const headerControlWidths = (
layout: LayoutType,
multiSelectMode: MultiSelectMode
) => {
@@ -76,22 +65,34 @@ const controlWidths = (
width: '95%',
'@mdDown': {
width: multiSelectMode !== 'off' ? '100%' : '95%',
- display: multiSelectMode !== 'off' ? 'flex' : 'none',
},
'@media (min-width: 930px)': {
- width: layout == 'GRID_LAYOUT' ? '660px' : '640px',
+ width: '620px',
},
'@media (min-width: 1280px)': {
- width: '1000px',
+ width: '940px',
},
'@media (min-width: 1600px)': {
- width: '1340px',
+ width: '1232px',
},
}
}
export function LibraryHeader(props: LibraryHeaderProps): JSX.Element {
- const headerHeight = useGetHeaderHeight()
+ const [small, setSmall] = useState(false)
+
+ useEffect(() => {
+ const handleScroll = () => {
+ setSmall(window.scrollY > 40)
+ }
+ if (typeof window !== 'undefined') {
+ window.addEventListener('scroll', handleScroll)
+ }
+ return () => {
+ window.removeEventListener('scroll', handleScroll)
+ }
+ }, [])
+
return (
<>
- {/* These will display/hide depending on breakpoints */}
-
{/* This spacer is put in to push library content down
@@ -125,6 +124,8 @@ export function LibraryHeader(props: LibraryHeaderProps): JSX.Element {
}
function LargeHeaderLayout(props: LibraryHeaderProps): JSX.Element {
+ const dimensions = useWindowDimensions()
+ const [showSearchBar, setShowSearchBar] = useState(false)
const [pinnedSearches, setPinnedSearches] = usePersistedState<
PinnedSearch[] | null
>({
@@ -133,101 +134,91 @@ function LargeHeaderLayout(props: LibraryHeaderProps): JSX.Element {
isSessionStorage: false,
})
- return (
-
-
-
-
-
-
-
-
- )
-}
-
-function SmallHeaderLayout(props: LibraryHeaderProps): JSX.Element {
- const [showInlineSearch, setShowInlineSearch] = useState(false)
+ const isWideWindow = useMemo(() => {
+ return dimensions.width >= 480
+ }, [dimensions])
return (
- {showInlineSearch ? (
-
-
-
+ {props.multiSelectMode !== 'off' ? (
+
+
) : (
<>
- {props.multiSelectMode === 'off' && }
-
+ {(!showSearchBar || isWideWindow) && (
+ <>
+
+
+
+
+ >
+ )}
+
+ {showSearchBar ? (
+
+ ) : (
+
+ )}
+
+
>
)}
@@ -243,7 +234,6 @@ export function MenuHeaderButton(props: MenuHeaderButtonProps): JSX.Element {
return (
void
+ setShowSearchBar: (show: boolean) => void
compact?: boolean
onClose?: () => void
- handleLinkSubmission: (
- link: string,
- timezone: string,
- locale: string
- ) => Promise
}
export function SearchBox(props: SearchBoxProps): JSX.Element {
@@ -325,9 +311,9 @@ export function SearchBox(props: SearchBoxProps): JSX.Element {
width: '100%',
maxWidth: '521px',
bg: '$thLibrarySearchbox',
- borderRadius: '6px',
+ borderRadius: '100px',
border: focused
- ? '2px solid $omnivoreCtaYellow'
+ ? '2px solid $searchActiveOutline'
: '2px solid transparent',
boxShadow: focused
? 'none'
@@ -373,14 +359,7 @@ export function SearchBox(props: SearchBoxProps): JSX.Element {
- {searchTerm && searchTerm.length ? (
-
- {
+
+ {/*
-
- ) : (
-
-
- requestAnimationFrame(() => inputRef?.current?.focus())
+ } else {
+ props.setShowSearchBar(false)
}
- tabIndex={-1}
- >
- /
-
-
- )}
+ }}
+ tabIndex={-1}
+ >
+ clear
+ */}
+ {
+ if (searchTerm && searchTerm.length && searchTerm != 'in:inbox') {
+ event.preventDefault()
+ setSearchTerm('in:inbox')
+ props.applySearchQuery('')
+ } else {
+ props.setShowSearchBar(false)
+ }
+ }}
+ tabIndex={-1}
+ >
+
+
+
)
@@ -464,24 +443,11 @@ type ControlButtonBoxProps = {
updateLayout: (layout: LayoutType) => void
setShowInlineSearch?: (show: boolean) => void
- showAddLinkModal: () => void
-
- allowSelectMultiple: boolean
-
numItemsSelected: number
multiSelectMode: MultiSelectMode
setMultiSelectMode: (mode: MultiSelectMode) => void
performMultiSelectAction: (action: BulkAction, labelIds?: string[]) => void
-
- searchTerm: string | undefined
- applySearchQuery: (searchQuery: string) => void
-
- handleLinkSubmission: (
- link: string,
- timezone: string,
- locale: string
- ) => Promise
}
function MultiSelectControls(props: ControlButtonBoxProps): JSX.Element {
@@ -571,7 +537,6 @@ function SearchControlButtonBox(
): JSX.Element {
return (
<>
-
)}
-
>
)
}
@@ -667,97 +628,87 @@ const MuliSelectControl = (props: ControlButtonBoxProps): JSX.Element => {
)
}
-function ControlButtonBox(props: ControlButtonBoxProps): JSX.Element {
- return (
- <>
-
-
- {props.multiSelectMode !== 'off' && (
-
-
- {props.numItemsSelected}{' '}
-
- selected
-
-
-
- )}
- {props.multiSelectMode !== 'off' ? (
- <>
-
-
- >
- ) : (
-
- )}
-
+// function ControlButtonBox(props: ControlButtonBoxProps): JSX.Element {
+// return (
+// <>
- {props.setShowInlineSearch && props.multiSelectMode === 'off' && (
-
-
-
-
- )}
- >
- )
-}
+//
+//
+// {props.numItemsSelected}{' '}
+//
+// selected
+//
+//
+//
+// )}
+// {/* {props.multiSelectMode !== 'off' ? (
+// <>
+//
+//
+// >
+// ) : (
+//
+// )} */}
+// {/* */}
+
+// // {props.setShowInlineSearch && props.multiSelectMode === 'off' && (
+// //
+// //
+// //
+// //
+// // )}
+// >
+// )
+// }
diff --git a/packages/web/components/templates/homeFeed/PinnedButtons.tsx b/packages/web/components/templates/homeFeed/PinnedButtons.tsx
index 5b62ad40c..da7a979d4 100644
--- a/packages/web/components/templates/homeFeed/PinnedButtons.tsx
+++ b/packages/web/components/templates/homeFeed/PinnedButtons.tsx
@@ -8,11 +8,16 @@ import { MoreOptionsIcon } from '../../elements/images/MoreOptionsIcon'
import { PinnedSearch } from '../../../pages/settings/pinned-searches'
import { useRouter } from 'next/router'
import { usePersistedState } from '../../../lib/hooks/usePersistedState'
+import { LayoutType } from './HomeFeedContainer'
+import { MultiSelectMode } from './LibraryHeader'
type PinnedButtonsProps = {
items: PinnedSearch[]
searchTerm: string | undefined
applySearchQuery: (searchQuery: string) => void
+
+ multiSelectMode: MultiSelectMode
+ layout: LayoutType
}
export const PinnedButtons = (props: PinnedButtonsProps): JSX.Element => {
@@ -22,53 +27,82 @@ export const PinnedButtons = (props: PinnedButtonsProps): JSX.Element => {
initialValue: false,
isSessionStorage: false,
})
+ const [opacity, setOpacity] = useState(1.0)
+
+ useEffect(() => {
+ const handleScroll = () => {
+ const scrollTop = window.scrollY
+ const opacityValue = 1 - scrollTop / 15
+ setOpacity(opacityValue >= 0 ? opacityValue : 0)
+ }
+
+ window.addEventListener('scroll', handleScroll)
+
+ return () => {
+ window.removeEventListener('scroll', handleScroll)
+ }
+ }, [])
if (hidePinnedSearches || !props.items.length) {
return <>>
}
return (
-
- {props.items.map((item) => {
- const style =
- item.search == props.searchTerm ? 'ctaPill' : 'ctaPillUnselected'
- return (
-
- )
- })}
+
+
+ {props.items.map((item) => {
+ const style =
+ item.search == props.searchTerm ? 'ctaPill' : 'ctaPillUnselected'
+ return (
+
+ )
+ })}
+
+
{
function handleResize() {
diff --git a/packages/web/lib/hooks/useReaderSettings.tsx b/packages/web/lib/hooks/useReaderSettings.tsx
index 9a77c4042..cbd7c134b 100644
--- a/packages/web/lib/hooks/useReaderSettings.tsx
+++ b/packages/web/lib/hooks/useReaderSettings.tsx
@@ -31,6 +31,9 @@ export type ReaderSettings = {
setJustifyText: (set: boolean) => void
highContrastText: boolean | undefined
setHighContrastText: (set: boolean) => void
+
+ highlightOnRelease: boolean | undefined
+ setHighlightOnRelease: (set: boolean) => void
}
export const useReaderSettings = (): ReaderSettings => {
@@ -61,6 +64,13 @@ export const useReaderSettings = (): ReaderSettings => {
initialValue: false,
})
+ const [highlightOnRelease, setHighlightOnRelease] = usePersistedState<
+ boolean | undefined
+ >({
+ key: `--display-highlight-on-release`,
+ initialValue: false,
+ })
+
const [justifyText, setJustifyText] = usePersistedState({
key: `--display-justify-text`,
initialValue: false,
@@ -216,5 +226,7 @@ export const useReaderSettings = (): ReaderSettings => {
setJustifyText,
highContrastText,
setHighContrastText,
+ highlightOnRelease,
+ setHighlightOnRelease,
}
}
diff --git a/packages/web/pages/[username]/[slug]/index.tsx b/packages/web/pages/[username]/[slug]/index.tsx
index 228880ba7..530a89a58 100644
--- a/packages/web/pages/[username]/[slug]/index.tsx
+++ b/packages/web/pages/[username]/[slug]/index.tsx
@@ -563,6 +563,9 @@ export default function Home(): JSX.Element {
setShowHighlightsModal={setShowHighlightsModal}
justifyText={readerSettings.justifyText ?? undefined}
highContrastText={readerSettings.highContrastText ?? undefined}
+ highlightOnRelease={
+ readerSettings.highlightOnRelease ?? undefined
+ }
articleMutations={{
createHighlightMutation,
deleteHighlightMutation,