Skip to content

Commit

Permalink
revert: removal of algo button
Browse files Browse the repository at this point in the history
  • Loading branch information
sshanzel committed Oct 2, 2024
1 parent c788a2d commit 61d69a2
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion packages/shared/src/components/feeds/FeedNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ import { Tab, TabContainer } from '../tabs/TabContainer';
import { useActiveFeedNameContext } from '../../contexts';
import useActiveNav from '../../hooks/useActiveNav';
import { useFeeds, useViewSize, ViewSize } from '../../hooks';
import usePersistentContext from '../../hooks/usePersistentContext';
import {
algorithmsList,
DEFAULT_ALGORITHM_INDEX,
DEFAULT_ALGORITHM_KEY,
} from '../layout/common';
import { MobileFeedActions } from './MobileFeedActions';
import { useFeedName } from '../../hooks/feed/useFeedName';
import SettingsContext from '../../contexts/SettingsContext';
import { PlusIcon } from '../icons';
import { Dropdown } from '../fields/Dropdown';
import { PlusIcon, SortIcon } from '../icons';
import { IconSize } from '../Icon';
import { ButtonSize, ButtonVariant } from '../buttons/common';
import { useScrollTopClassName } from '../../hooks/useScrollTopClassName';
import { useFeatureTheme } from '../../hooks/utils/useFeatureTheme';
import { webappUrl } from '../../lib/constants';
Expand Down Expand Up @@ -51,6 +60,12 @@ function FeedNav(): ReactElement {
const { isSortableFeed } = useFeedName({ feedName });
const { home: shouldRenderNav } = useActiveNav(feedName);
const isMobile = useViewSize(ViewSize.MobileL);
const [selectedAlgo, setSelectedAlgo] = usePersistentContext(
DEFAULT_ALGORITHM_KEY,
DEFAULT_ALGORITHM_INDEX,
[0, 1],
DEFAULT_ALGORITHM_INDEX,
);
const featureTheme = useFeatureTheme();
const scrollClassName = useScrollTopClassName({ enabled: !!featureTheme });
const { feeds } = useFeeds();
Expand Down Expand Up @@ -137,6 +152,26 @@ function FeedNav(): ReactElement {
<Tab key={label} label={label} url={url} />
))}
</TabContainer>
{isMobile && sortingEnabled && isSortableFeed && (
<StickyNavIconWrapper className="translate-x-[calc(100vw-100%)]">
<Dropdown
className={{
label: 'hidden',
chevron: 'hidden',
button: '!px-1',
}}
dynamicMenuWidth
shouldIndicateSelected
buttonSize={ButtonSize.Small}
buttonVariant={ButtonVariant.Tertiary}
icon={<SortIcon size={IconSize.Medium} />}
selectedIndex={selectedAlgo}
options={algorithmsList}
onChange={(_, index) => setSelectedAlgo(index)}
drawerProps={{ displayCloseButton: true }}
/>
</StickyNavIconWrapper>
)}
<StickyNavIconWrapper className="hidden translate-x-[calc(100vw-180%)] tablet:flex laptop:hidden">
<NotificationsBell compact />
</StickyNavIconWrapper>
Expand Down

0 comments on commit 61d69a2

Please sign in to comment.