This commit is contained in:
User
2025-01-04 13:02:50 -05:00
parent da807296f3
commit 489e054614
20 changed files with 377 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
import { useState } from 'react';
import { Head, Link, router } from '@inertiajs/react';
import { Plus, Star, ArrowDownNarrowWide, ArrowUpNarrowWide, ChevronsLeft, ChevronsRight } from 'lucide-react';
import { Plus, Star, ArrowDownNarrowWide, ArrowUpNarrowWide, ChevronsLeft, ChevronsRight, Trash2 } from 'lucide-react';
import AppLayout from '@/Layouts/AppLayout.jsx';
@@ -23,11 +23,27 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
const favouriteOnClickHandler = (pathword) => {
axios.post(route('comics.postFavourite'), { pathword: pathword }).then(res => {
setFavourites(res.data);
toast({
title: "All set",
description: `${comic.comic.name} is now in / remove your favorite list.`,
});
});
}
toast({
title: "All set",
description: `${comic.comic.name} is now in / remove your favorite list.`,
const removeAllHistoriesOnClickHandler = (pathword) => {
router.visit(route('comics.destroyHistory', { pathword: pathword }), {
method: 'DELETE',
replace: false,
preserveScroll: true,
preserveState: true,
showProgress: false,
only: ['histories'],
onSuccess: () => {
toast({
title: "All set",
description: `All histories have been removed.`,
});
}
});
}
@@ -101,6 +117,12 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
<td className="text-right w-24 pr-3">Alias</td>
<td>{ comic.comic.alias }</td>
</tr>
<tr>
<td className="text-right pr-3">Status</td>
<td>
{ comic.comic.region.display } / { comic.comic.status.display }
</td>
</tr>
<tr>
<td className="text-right pr-3">Category</td>
<td>
@@ -115,9 +137,9 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
<td className="text-right pr-3">Authors</td>
<td>
{ comic.comic.author.map(a => (
<Badge key={ a.path_word } className="m-2" variant="outline">
<Link href={ route('comics.author', [a.path_word]) }>{ a.name }</Link>
</Badge>
<Badge key={ a.path_word } className="m-2" variant="outline">
<Link href={ route('comics.author', [a.path_word]) }>{ a.name }</Link>
</Badge>
) ) }
</td>
</tr>
@@ -149,10 +171,32 @@ export default function Chapters({ auth, comic, chapters, histories, offset }) {
</TabsTrigger>
)) }
</TabsList>
<div>
<Button variant="link" size="icon" onClick={ () => toggleAscending() }>
{ ascending ? <ArrowDownNarrowWide /> : <ArrowUpNarrowWide /> }
</Button>
<div className="flex justify-end">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button variant="link" size="icon" onClick={ () => toggleAscending() }>
{ ascending ? <ArrowDownNarrowWide /> : <ArrowUpNarrowWide /> }
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Set order as { ascending ? 'Descending' : 'Ascending' }</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button variant="link" size="icon" onClick={ () => removeAllHistoriesOnClickHandler(comic.comic.path_word) }>
<Trash2 />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Remove all histories for this comic</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</div>
<TabsContent value={ group }>