This commit is contained in:
User
2025-02-07 18:24:52 -05:00
parent 75d4a616dd
commit b7f9b0aff7
17 changed files with 304 additions and 245 deletions

View File

@@ -66,7 +66,7 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
}
const ComicChapterLink = (props) => {
const isNew = Date.now() - Date.parse(props.datetime_created) < 6.048e+8;
const isNew = Date.now() - Date.parse(props.datetime_created) < 6.048e+8; // 1 week
const isRead = histories.includes(props.uuid);
return (
@@ -226,7 +226,7 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
<TabsContent value={ group }>
<div
className="w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 2xl:grid-cols-12 gap-1">
{ (chapters.total > (chapters.limit + chapters.offset) && chapters.offset > 0) && (
{ (chapters.total > chapters.limit && chapters.offset > 0) && (
<Button size="sm" variant="outline" asChild>
<Link href="?" only={['chapters', 'offset']} headers={{ offset: parseInt(chapters.offset) - chapters.limit }}>
<ChevronsLeft /> Prev
@@ -236,7 +236,7 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
{ chapters.list.sort((a, b) => ascending ? (a.index - b.index) : (b.index - a.index)).map(c => (
<ComicChapterLink key={ c.uuid } { ...c } />
) ) }
{ (chapters.total > chapters.limit && chapters.total > chapters.offset) && (
{ (chapters.total > (chapters.limit + chapters.offset)) && (
<Button size="sm" variant="outline" asChild>
<Link href="?" only={['chapters', 'offset']} headers={{ offset: parseInt(chapters.offset) + chapters.limit }}>
Next <ChevronsRight />

View File

@@ -86,7 +86,7 @@ export default function Histories({ auth, histories }) {
</Link>
</Button>
</div>
<Table>
<Table className="mt-2">
<TableHeader>
<TableRow>
<TableHead>Select</TableHead>
@@ -120,22 +120,16 @@ export default function Histories({ auth, histories }) {
)) }
</TableBody>
</Table>
<div>
<div className="pt-2">
<Pagination className="justify-end">
<PaginationContent>
{ histories.current_page > 1 && (
<PaginationItem>
<PaginationPrevious href={ histories.prev_page_url } only={['histories']} />
{ histories.links.map((h, i) => (
<PaginationItem key={ i }>
{ h.label.includes('Previous') && <PaginationPrevious href={ h.url } only={['histories']} isActive={ h.active } /> }
{ !h.label.includes('Previous') && !h.label.includes('Next') && <PaginationLink href={ h.url } only={['histories']} isActive={ h.active }>{ h.label }</PaginationLink> }
{ h.label.includes('Next') && <PaginationNext href={ h.url } only={['histories']} isActive={ h.active } /> }
</PaginationItem>
) }
<PaginationItem>
<PaginationLink href="#">{ histories.current_page }</PaginationLink>
</PaginationItem>
{ histories.current_page < histories.last_page && (
<PaginationItem>
<PaginationNext href={ histories.next_page_url } only={['histories']} />
</PaginationItem>
) }
) ) }
</PaginationContent>
</Pagination>
</div>

View File

@@ -67,23 +67,23 @@ export default function Histories({ auth, histories }) {
</TableRow>
</TableHeader>
<TableBody>
{ histories.map((comic, i) =>
comic.histories.map((record, j) => (
<TableRow key={ j }>
{ (j === 0) ? <TableCell className="w-[40%]" rowspan={ comic.histories.length }>
<Link href={ route('comics.chapters', comic.comic.comic_pathword) }>
{ comic.comic.comic_name }
</Link>
</TableCell> : null }
<TableCell>
<Link href={ route('comics.read', [comic.comic.comic_pathword, record.chapter_uuid]) }>
{ record.chapter_name }
</Link>
</TableCell>
<TableCell>{ record.read_at }</TableCell>
</TableRow>
) )
) }
{ histories.map((comic, i) => comic.histories.map((record, j) => (
<TableRow key={ j }>
{ (j === 0) && <TableCell className="w-[40%]" rowSpan={ comic.histories.length }>
<Link href={ route('comics.chapters', comic.comic.comic_pathword) }>
{ comic.comic.comic_name }
</Link>
</TableCell> }
<TableCell>
<Link href={ route('comics.read', [comic.comic.comic_pathword, record.chapter_uuid]) }>
{ record.chapter_name }
</Link>
</TableCell>
<TableCell>
{ record.read_at }
</TableCell>
</TableRow>
) ) ) }
</TableBody>
</Table>
</div>

View File

@@ -14,9 +14,11 @@ export default function Index({ comics, offset, auth }) {
const url = new URL(window.location); // searchParams
const [favourites, setFavourites] = useState(auth.user?.favourites ?? []);
const [favourites, setFavourites] = useState((auth?.user?.favourites !== null) ? auth.user.favourites : []);
const { toast } = useToast();
const itemsPerPage = 30;
/**
* On click handler for the star
* Do posting and make a toast
@@ -84,19 +86,21 @@ export default function Index({ comics, offset, auth }) {
</Head>
<div className="p-3 pt-1 pb-1 flex flex-wrap justify-center" scroll-region="true"
style={{ overflowAnchor: "none", height: "calc(100dvh - 90px)", overflowY: "scroll" }}>
<div className="grid 2xl:grid-cols-6 xl:grid-cols-4 sm:grid-cols-2 gap-2">
<div className="grid 2xl:grid-cols-6 xl:grid-cols-4 grid-cols-2 gap-2">
<ComicCards { ...comics } />
</div>
<Pagination className="justify-end pt-2">
<PaginationContent>
{ parseInt(offset) !== 0 &&
<PaginationItem>
<PaginationPrevious href={ `${ url.pathname }?${ url.searchParams }` } only={['comics', 'offset']} headers={{ offset: parseInt(offset) - 30 }} />
<PaginationPrevious href={ `${ url.pathname }?${ url.searchParams }` } only={['comics', 'offset']} headers={{ offset: parseInt(offset) - itemsPerPage }} />
</PaginationItem>
}
{ parseInt(comics.total) > parseInt(offset) + itemsPerPage &&
<PaginationItem>
<PaginationNext href={ `${ url.pathname }?${ url.searchParams }` } only={['comics', 'offset']} headers={{ offset: parseInt(offset) + itemsPerPage }} />
</PaginationItem>
}
<PaginationItem>
<PaginationNext href={ `${ url.pathname }?${ url.searchParams }` } only={['comics', 'offset']} headers={{ offset: parseInt(offset) + 30 }} />
</PaginationItem>
</PaginationContent>
</Pagination>
</div>

View File

@@ -11,6 +11,19 @@ export default function Updates({ auth }) {
<title>Updates</title>
</Head>
<div className="p-3 pt-1">
<Card className="w-[90%] m-3 mx-auto">
<CardHeader>
<CardTitle>0.1.5</CardTitle>
<CardDescription>Release: 07 Feb 2025</CardDescription>
</CardHeader>
<CardContent>
<ul>
<li>General bug fixes and system improvements</li>
<li>Toggle reading history</li>
<li>Queue driver, Horizon is now default driver</li>
</ul>
</CardContent>
</Card>
<Card className="w-[90%] m-3 mx-auto">
<CardHeader>
<CardTitle>0.1.4</CardTitle>