Skip to content

Commit

Permalink
feat: add links to navbar history items
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Feb 7, 2023
1 parent c38a353 commit 67bb111
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import prettyBytes from 'pretty-bytes';
import { NextLink } from '@mantine/next';
import relativeTime from 'dayjs/plugin/relativeTime';
import { ReactNode, useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import { AppRouter } from '../server/trpc/router';
import { trpc } from '../utils/trpc';
import { MadeWith } from './madeWith';
Expand All @@ -48,6 +49,9 @@ const useStyles = createStyles((theme) => ({
history: {
textDecoration: 'none',
},
historyItem: {
cursor: 'pointer',
},
badge: {
padding: 5,
minWidth: 20,
Expand Down Expand Up @@ -142,13 +146,16 @@ function HistoryItem({ chapter }: { chapter: HistoryItemType }) {

function History({ data }: { data: HistoryType }) {
const { classes } = useStyles();
const router = useRouter();

return (
<Timeline lineWidth={2} className={classes.history}>
{data.map((chapter) => {
return (
<Timeline.Item
key={chapter.id}
className={classes.historyItem}
onClick={() => router.push(`/manga/${chapter.mangaId}`)}
lineVariant="dotted"
bullet={<Image mt={20} alt="header" src={chapter.manga.metadata.cover} height={40} width={26} />}
title={<HistoryItemTitle chapter={chapter} />}
Expand Down

0 comments on commit 67bb111

Please sign in to comment.