History Links
LocalStorage for reading mode Debugging with Sentry
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { Head, router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Head, Link, router } from '@inertiajs/react';
|
||||
import AppLayout from '@/Layouts/AppLayout.jsx';
|
||||
|
||||
import { BreadcrumbItem, BreadcrumbPage, BreadcrumbSeparator } from "@/components/ui/breadcrumb";
|
||||
@@ -24,16 +24,9 @@ export default function Histories({ auth, histories }) {
|
||||
}
|
||||
}
|
||||
|
||||
const deleteButtonOnClickHandler = (e) => {
|
||||
if (ids.length === 0) {
|
||||
toast({
|
||||
title: "Error",
|
||||
description: `No items selected.`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const deleteButtonOnClickHandler = () => {
|
||||
router.visit(route('comics.destroyHistories'), {
|
||||
data: { ids: ids },
|
||||
data: (ids.length > 0) ? { ids: ids } : { ids: 'all' },
|
||||
method: "PATCH",
|
||||
only: ['histories'],
|
||||
onSuccess: data => {
|
||||
@@ -58,15 +51,17 @@ export default function Histories({ auth, histories }) {
|
||||
<title>Histories</title>
|
||||
</Head>
|
||||
<div className="p-3 pt-1 w-[90%] mx-auto">
|
||||
<div className="flex justify-end">
|
||||
<Button size="sm" onClick={ () => deleteButtonOnClickHandler() }>Delete Selected</Button>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button size="sm" variant="destructive" onClick={ () => deleteButtonOnClickHandler() }>
|
||||
{ ids.length > 0 ? `Delete selected (${ids.length})` : "Delete All" }
|
||||
</Button>
|
||||
</div>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Select</TableHead>
|
||||
<TableHead>Comic</TableHead>
|
||||
<TableHead>Chapter</TableHead>
|
||||
<TableHead>Comic</TableHead>
|
||||
<TableHead>Read at</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -80,8 +75,16 @@ export default function Histories({ auth, histories }) {
|
||||
onChange={ (e) => checkboxOnChangeHandler(e) } />
|
||||
</label>
|
||||
</TableCell>
|
||||
<TableCell>{ h.name }</TableCell>
|
||||
<TableCell>{ h.comic.name }</TableCell>
|
||||
<TableCell>
|
||||
<Link href={ route('comics.read', [h.comic.pathword, h.chapter_uuid]) }>
|
||||
{ h.name }
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Link href={ route('comics.chapters', [h.comic.pathword]) }>
|
||||
{ h.comic.name }
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell>{ h.created_at }</TableCell>
|
||||
</TableRow>
|
||||
)) }
|
||||
|
||||
Reference in New Issue
Block a user