diff --git a/renderer/components/timelines/Notifications.tsx b/renderer/components/timelines/Notifications.tsx index c70d2879..f019e12d 100644 --- a/renderer/components/timelines/Notifications.tsx +++ b/renderer/components/timelines/Notifications.tsx @@ -5,6 +5,8 @@ import { FormattedMessage, useIntl } from 'react-intl' import { Virtuoso } from 'react-virtuoso' import Notification from './notification/Notification' import { Input, Spinner } from '@material-tailwind/react' +import { useRouter } from 'next/router' +import Detail from '../detail/Detail' const TIMELINE_STATUSES_COUNT = 30 const TIMELINE_MAX_STATUSES = 2147483647 @@ -23,6 +25,7 @@ export default function Notifications(props: Props) { const { formatMessage } = useIntl() const scrollerRef = useRef(null) const streaming = useRef(null) + const router = useRouter() useEffect(() => { const f = async () => { @@ -99,47 +102,57 @@ export default function Notifications(props: Props) { return false }, [firstItemIndex, notifications, setNotifications, unreads]) + const timelineClass = () => { + if (router.query.detail) { + return 'timeline-with-drawer' + } + return 'timeline' + } + return ( -
-
-
- -
-
-
- -
-
-
-
- {notifications.length > 0 ? ( - { - scrollerRef.current = ref as HTMLElement - }} - firstItemIndex={firstItemIndex} - atTopStateChange={prependUnreads} - className="timeline-scrollable" - data={notifications} - endReached={loadMore} - itemContent={(_, notification) => ( - props.setAttachment(media)} - /> - )} - /> - ) : ( -
- +
+
+
+
+
- )} -
-
+
+
+ +
+
+
+
+ {notifications.length > 0 ? ( + { + scrollerRef.current = ref as HTMLElement + }} + firstItemIndex={firstItemIndex} + atTopStateChange={prependUnreads} + className="timeline-scrollable" + data={notifications} + endReached={loadMore} + itemContent={(_, notification) => ( + props.setAttachment(media)} + /> + )} + /> + ) : ( +
+ +
+ )} +
+
+ props.setAttachment(media)} /> + ) } diff --git a/renderer/components/timelines/notification/Follow.tsx b/renderer/components/timelines/notification/Follow.tsx index ec5acdca..5e720bfc 100644 --- a/renderer/components/timelines/notification/Follow.tsx +++ b/renderer/components/timelines/notification/Follow.tsx @@ -3,6 +3,7 @@ import { FaUserPlus } from 'react-icons/fa6' import { FormattedMessage, useIntl } from 'react-intl' import emojify from '@/utils/emojify' import { Avatar } from '@material-tailwind/react' +import { useRouter } from 'next/router' type Props = { notification: Entity.Notification @@ -10,6 +11,11 @@ type Props = { export default function Follow(props: Props) { const { formatMessage } = useIntl() + const router = useRouter() + + const openUser = (id: string) => { + router.push({ query: { id: router.query.id, timeline: router.query.timeline, user_id: id, detail: true } }) + } return (
@@ -17,7 +23,7 @@ export default function Follow(props: Props) {
-
+
openUser(props.notification.account.id)}>
-
- +
+ openUser(props.notification.account.id)} + variant="rounded" + style={{ width: '40px', height: '40px' }} + />
-
+
openUser(props.notification.account.id)}> 0) const { formatMessage } = useIntl() + const router = useRouter() const refresh = async () => { const res = await props.client.getStatus(status.id) props.onRefresh(res.data) } + const openStatus = () => { + router.push({ query: { id: router.query.id, timeline: router.query.timeline, status_id: status.id, detail: true } }) + } + + const openUser = (id: string) => { + router.push({ query: { id: router.query.id, timeline: router.query.timeline, user_id: id, detail: true } }) + } + return (
{actionIcon(props.notification)}
-
+
openUser(props.notification.account.id)}>
-
- +
+ openUser(status.account.id)} + variant="rounded" + style={{ width: '40px', height: '40px' }} + />
-
+
openUser(status.account.id)}> @{status.account.acct}
-
+
diff --git a/renderer/pages/accounts/[id]/[timeline].tsx b/renderer/pages/accounts/[id]/[timeline].tsx index 84904ecc..252e42af 100644 --- a/renderer/pages/accounts/[id]/[timeline].tsx +++ b/renderer/pages/accounts/[id]/[timeline].tsx @@ -48,18 +48,15 @@ export default function Page() { }, [router.query.modal, router.query.report_target_id]) if (!account || !client) return null - switch (router.query.timeline as string) { - case 'notifications': { - return - } - default: { - return ( - <> - - setAttachment(null)} attachment={attachment} /> - {report && setReport(null)} status={report} client={client} />} - - ) - } - } + return ( + <> + {(router.query.timeline as string) === 'notifications' ? ( + + ) : ( + + )} + setAttachment(null)} attachment={attachment} /> + {report && setReport(null)} status={report} client={client} />} + + ) }