Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 67bb111

Browse files
committed
feat: add links to navbar history items
1 parent c38a353 commit 67bb111

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/navbar.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import prettyBytes from 'pretty-bytes';
3030
import { NextLink } from '@mantine/next';
3131
import relativeTime from 'dayjs/plugin/relativeTime';
3232
import { ReactNode, useEffect, useState } from 'react';
33+
import { useRouter } from 'next/router';
3334
import { AppRouter } from '../server/trpc/router';
3435
import { trpc } from '../utils/trpc';
3536
import { MadeWith } from './madeWith';
@@ -48,6 +49,9 @@ const useStyles = createStyles((theme) => ({
4849
history: {
4950
textDecoration: 'none',
5051
},
52+
historyItem: {
53+
cursor: 'pointer',
54+
},
5155
badge: {
5256
padding: 5,
5357
minWidth: 20,
@@ -142,13 +146,16 @@ function HistoryItem({ chapter }: { chapter: HistoryItemType }) {
142146

143147
function History({ data }: { data: HistoryType }) {
144148
const { classes } = useStyles();
149+
const router = useRouter();
145150

146151
return (
147152
<Timeline lineWidth={2} className={classes.history}>
148153
{data.map((chapter) => {
149154
return (
150155
<Timeline.Item
151156
key={chapter.id}
157+
className={classes.historyItem}
158+
onClick={() => router.push(`/manga/${chapter.mangaId}`)}
152159
lineVariant="dotted"
153160
bullet={<Image mt={20} alt="header" src={chapter.manga.metadata.cover} height={40} width={26} />}
154161
title={<HistoryItemTitle chapter={chapter} />}

0 commit comments

Comments
 (0)