diff --git a/components/notifications-filter.js b/components/notifications-filter.js index 31574033d..86d36fd1d 100644 --- a/components/notifications-filter.js +++ b/components/notifications-filter.js @@ -1,10 +1,8 @@ import { useState, useCallback, useMemo } from 'react' -import { useShowModal } from './modal' import { useRouter } from 'next/router' import { NOTIFICATION_CATEGORIES } from '../lib/constants' import { Checkbox, Form, SubmitButton } from './form' -import FilterIcon from '@/svgs/equalizer-line.svg' -import styles from './notifications-filter.module.css' +import styles from './notifications.module.css' export const getFiltersFromInc = (inc) => { const filters = new Set(inc?.split(',') || []) @@ -17,7 +15,7 @@ export const getSavedFilters = () => { return savedFilters ? new Set(savedFilters) : new Set() } -export function NotificationsFilter ({ onClose }) { +export default function NotificationsFilter ({ onClose }) { const router = useRouter() const appliedFilters = useMemo(() => { @@ -65,7 +63,7 @@ export function NotificationsFilter ({ onClose }) { onClose?.() }} > -
+
{NOTIFICATION_CATEGORIES.map((category) => ( ) } - -export default function NotificationsHeader () { - const showModal = useShowModal() - const router = useRouter() - - const hasActiveFilters = useMemo(() => { - const incFilters = getFiltersFromInc(router.query.inc) - return incFilters.size > 0 - }) - - return ( -
-

notifications

- { - showModal((onClose) => ( - - )) - }} - /> -
- ) -} diff --git a/components/notifications-filter.module.css b/components/notifications-filter.module.css deleted file mode 100644 index 456ced399..000000000 --- a/components/notifications-filter.module.css +++ /dev/null @@ -1,14 +0,0 @@ -.filterIcon { - cursor: pointer; - fill: var(--theme-grey); -} -.filterIcon:hover { - fill: var(--theme-brandColor); - filter: drop-shadow(0 0 2px var(--bs-primary)); -} - -.filterIconActive { - cursor: pointer; - fill: var(--theme-brandColor); - filter: drop-shadow(0 0 2px var(--bs-primary)); -} \ No newline at end of file diff --git a/components/notifications.js b/components/notifications.js index eba3accf1..1cf004974 100644 --- a/components/notifications.js +++ b/components/notifications.js @@ -40,10 +40,12 @@ import { paidActionCacheMods } from './use-paid-mutation' import { useRetryCreateItem } from './use-item-submit' import { payBountyCacheMods } from './pay-bounty' import { useToast } from './toast' +import { useShowModal } from './modal' +import NotificationsFilter, { getFiltersFromInc } from './notifications-filter' import classNames from 'classnames' import HolsterIcon from '@/svgs/holster.svg' import SaddleIcon from '@/svgs/saddle.svg' -import NotificationsHeader from './notifications-filter' +import FilterIcon from '@/svgs/equalizer-line.svg' function Notification ({ n, fresh }) { const type = n.__typename @@ -741,6 +743,35 @@ export function NotificationAlert () { ) } +export function NotificationsHeader () { + const showModal = useShowModal() + const router = useRouter() + + const hasActiveFilters = useMemo(() => { + const incFilters = getFiltersFromInc(router.query.inc) + return incFilters.size > 0 + }) + + return ( +
+
+

notifications

+ { + showModal((onClose) => ( + + )) + }} + /> +
+ +
+ ) +} + const nid = n => n.__typename + n.id + n.sortTime export default function Notifications ({ ssrData }) { @@ -776,7 +807,6 @@ export default function Notifications ({ ssrData }) { return ( <> - {notifications.map(n => - + )