diff --git a/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx b/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx index 15076cc65..ca8a66a3a 100644 --- a/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx +++ b/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx @@ -1,4 +1,4 @@ -import { Box, HStack, VStack } from './../../elements/LayoutPrimitives' +import { Box, HStack, SpanBox, VStack } from './../../elements/LayoutPrimitives' import Dropzone from 'react-dropzone' import * as Progress from '@radix-ui/react-progress' import type { @@ -6,7 +6,10 @@ import type { LibraryItemsQueryInput, } from '../../../lib/networking/queries/useGetLibraryItemsQuery' import { useGetLibraryItemsQuery } from '../../../lib/networking/queries/useGetLibraryItemsQuery' -import { useGetViewerQuery } from '../../../lib/networking/queries/useGetViewerQuery' +import { + useGetViewerQuery, + UserBasicData, +} from '../../../lib/networking/queries/useGetViewerQuery' import { LinkedItemCardAction } from '../../patterns/LibraryCards/CardTypes' import { LinkedItemCard } from '../../patterns/LibraryCards/LinkedItemCard' import { useRouter } from 'next/router' @@ -679,25 +682,6 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element { const [, updateState] = useState({}) - const StyledToggleButton = styled('button', { - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - p: '0px', - backgroundColor: 'transparent', - border: 'none', - cursor: 'pointer', - width: '32px', - height: '32px', - borderRadius: '4px', - '&:hover': { - opacity: 0.8, - }, - '&[data-state="on"]': { - bg: 'rgb(43, 43, 43)', - }, - }) - const DragnDropContainer = styled('div', { width: '100%', height: '80%', @@ -800,22 +784,16 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element { searchTerm={props.searchTerm} applySearchQuery={props.applySearchQuery} /> - - - + > + + {props.isValidating && props.items.length == 0 && } - {/* - - Library - - - { - updateLayout('GRID_LAYOUT') - }} - > - - - { - updateLayout('LIST_LAYOUT') - }} - > - - - - - - */} + + - {/* {viewerData?.me && ( - - {Object.keys(SAVED_SEARCHES).map((key) => { - const isInboxTerm = (term: string) => { - return !term || term === 'in:inbox' - } - - const searchQuery = SAVED_SEARCHES[key] - const style = - searchQuery === props.searchTerm || - (!props.searchTerm && isInboxTerm(searchQuery)) - ? 'ctaDarkYellow' - : 'ctaLightGray' - return ( - - ) - })} - - )} */} { @@ -1263,3 +1162,142 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element { ) } + +type LegacyMobileTopNavProps = { + viewer?: UserBasicData + searchTerm?: string + applySearchQuery: (searchQuery: string) => void + + layout: LayoutType + updateLayout: (layout: LayoutType) => void + + setShowAddLinkModal: (show: boolean) => void +} + +function LegacyMobileTopNav(props: LegacyMobileTopNavProps): JSX.Element { + const StyledToggleButton = styled('button', { + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + p: '0px', + backgroundColor: 'transparent', + border: 'none', + cursor: 'pointer', + width: '32px', + height: '32px', + borderRadius: '4px', + '&:hover': { + opacity: 0.8, + }, + '&[data-state="on"]': { + bg: 'rgb(43, 43, 43)', + }, + }) + + return ( + <> + + + Library + + + { + props.updateLayout('GRID_LAYOUT') + }} + > + + + { + props.updateLayout('LIST_LAYOUT') + }} + > + + + + + + + + {props.viewer && ( + + {Object.keys(SAVED_SEARCHES).map((key) => { + const isInboxTerm = (term: string) => { + return !term || term === 'in:inbox' + } + + const searchQuery = SAVED_SEARCHES[key] + const style = + searchQuery === props.searchTerm || + (!props.searchTerm && isInboxTerm(searchQuery)) + ? 'ctaDarkYellow' + : 'ctaLightGray' + return ( + + ) + })} + + )} + + ) +} diff --git a/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx b/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx index 6e9e10d35..40dbf4ae6 100644 --- a/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx +++ b/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx @@ -14,7 +14,14 @@ import { FormInput } from '../../elements/FormElements' import { searchBarCommands } from '../../../lib/keyboardShortcuts/navigationShortcuts' import { useKeyboardShortcuts } from '../../../lib/keyboardShortcuts/useKeyboardShortcuts' import { Button, IconButton } from '../../elements/Button' -import { Circle, MagnifyingGlass, Plus, Textbox, X } from 'phosphor-react' +import { + Circle, + DotsThree, + MagnifyingGlass, + Plus, + Textbox, + X, +} from 'phosphor-react' import { OmnivoreNameLogo } from '../../elements/images/OmnivoreNameLogo' import { OmnivoreFullLogo } from '../../elements/images/OmnivoreFullLogo' import { AvatarDropdown } from '../../elements/AvatarDropdown' @@ -27,24 +34,36 @@ import { Checkbox } from '@radix-ui/react-checkbox' export function LibraryFilterMenu(): JSX.Element { return ( - - - - + <> + + + + - - + + + {/* This spacer pushes library content to the right of + the fixed left side menu. */} + + ) } @@ -62,32 +81,40 @@ function SavedSearches(): JSX.Element { function Subscriptions(): JSX.Element { const { subscriptions } = useGetSubscriptionsQuery() - console.log('subscriptions: ', subscriptions) + const [viewAll, setViewAll] = useState(false) return ( - - {subscriptions.slice(0, 4).map((item) => { + { + window.location.href = '/settings/subscriptions' + }} + > + {subscriptions.slice(0, viewAll ? undefined : 4).map((item) => { return })} - - View All - + ) } function Labels(): JSX.Element { const { labels } = useGetLabelsQuery() - console.log('labels: ', labels) + const [viewAll, setViewAll] = useState(false) return ( - - {labels.slice(0, 4).map((item) => { + { + window.location.href = '/settings/labels' + }} + > + {labels.slice(0, viewAll ? undefined : 4).map((item) => { return })} - - View All - + ) } @@ -95,6 +122,8 @@ function Labels(): JSX.Element { type MenuPanelProps = { title: string children: ReactNode + editFunc?: () => void + editTitle?: string } function MenuPanel(props: MenuPanelProps): JSX.Element { @@ -108,19 +137,46 @@ function MenuPanel(props: MenuPanelProps): JSX.Element { alignment="start" distribution="start" > - - {props.title} - + + + {props.title} + + + {props.editTitle && props.editFunc && ( + + } + > + { + if (props.editFunc) { + props.editFunc() + } + }} + /> + + )} + + {props.children} ) @@ -217,3 +273,29 @@ function AddLinkButton(): JSX.Element { ) } + +type ViewAllButtonProps = { + state: boolean + setState: (state: boolean) => void +} + +function ViewAllButton(props: ViewAllButtonProps): JSX.Element { + return ( + + ) +} diff --git a/packages/web/components/templates/homeFeed/LibraryHeader.tsx b/packages/web/components/templates/homeFeed/LibraryHeader.tsx index 6bf65a93c..2fd2d6793 100644 --- a/packages/web/components/templates/homeFeed/LibraryHeader.tsx +++ b/packages/web/components/templates/homeFeed/LibraryHeader.tsx @@ -42,6 +42,9 @@ const recentlySavedStartDate = new Date( const FOCUSED_BOXSHADOW = '0px 0px 2px 2px rgba(255, 234, 159, 0.56)' +const HEADER_HEIGHT = '105px' +const MOBILE_HEIGHT = '44px' + export function LibraryHeader(props: LibrarySearchBarProps): JSX.Element { const [focused, setFocused] = useState(false) const inputRef = useRef(null) @@ -60,38 +63,51 @@ export function LibraryHeader(props: LibrarySearchBarProps): JSX.Element { ) return ( - - + - - - - - + + + + + + + {/* This spacer is put in to push library content down + below the fixed header height. */} + + ) }