This commit is contained in:
User
2025-01-06 12:58:10 -05:00
parent 489e054614
commit 721192fce7
23 changed files with 227 additions and 197 deletions

View File

@@ -50,10 +50,12 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
const groupOnClickHandler = (pathword) => {
router.get(`/comic/${ comic.comic.path_word }?group=${ pathword }`, {}, {
only: ['chapters'],
preserveState: true
preserveState: true,
onSuccess: () => {
setGroup(pathword);
setAscending(true);
}
});
setGroup(pathword);
setAscending(true);
}
const ComicChapterLink = (props) => {
@@ -160,16 +162,17 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
</div>
</CardContent>
<CardContent>
<Tabs defaultValue={ group } className="w-full">
<Tabs defaultValue={ group } className="w-full" onValueChange={ (e) => groupOnClickHandler(e)} >
<div className="flex">
<TabsList className={ `grid w-full grid-cols-${ Object.entries(comic.groups).length } ` }>
{ Object.entries(comic.groups).map((g, i) => (
<TabsTrigger onClick={ () => groupOnClickHandler(g[1].path_word) }
key={ g[1].path_word }
value={ g[1].path_word }>
<TabsTrigger key={ g[1].path_word } value={ g[1].path_word }>
{ g[1].name }
<Badge key={ g[1].path_word } className="ml-2" variant="outline">
{ g[1].count }
</Badge>
</TabsTrigger>
)) }
) ) }
</TabsList>
<div className="flex justify-end">
<TooltipProvider>
@@ -200,7 +203,8 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
</div>
</div>
<TabsContent value={ group }>
<div className="w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 xl:grid-cols-12 gap-1">
<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 > 0) && (
<Button size="sm" variant="outline" asChild>
<Link href="?" only={['chapters', 'offset']} headers={{ offset: parseInt(chapters.offset) - chapters.limit }}>