From e7a1bf5aedec2f83709fbd00f771b023fb6bf26d Mon Sep 17 00:00:00 2001 From: monoid Date: Mon, 20 Jun 2022 17:37:33 +0900 Subject: [PATCH] delete button --- src/client/component/contentinfo.tsx | 34 ++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/client/component/contentinfo.tsx b/src/client/component/contentinfo.tsx index 326ca89..4d9a1a8 100644 --- a/src/client/component/contentinfo.tsx +++ b/src/client/component/contentinfo.tsx @@ -2,10 +2,11 @@ import React, { } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { Document } from '../accessor/document'; -import { Link, Paper, Theme, Box, useTheme, Typography, Grid } from '@mui/material'; +import { Link, Paper, Theme, Box, useTheme, Typography, Grid, Button } from '@mui/material'; import { ThumbnailContainer } from '../page/reader/reader'; import { TagChip } from '../component/tagchip'; +import DocumentAccessor from '../accessor/document'; export const makeContentInfoUrl = (id: number) => `/doc/${id}`; export const makeContentReaderUrl = (id: number) => `/doc/${id}/reader`; @@ -117,18 +118,35 @@ export const ContentInfo = (props: { {props.short ? ({document.tags.map(x => () )}) : ( - ) + ) } + {document.deleted_at != null && + + } ); } +async function documentDelete(id: number){ + const t = await DocumentAccessor.del(id); + if(t){ + alert("document deleted!"); + } + else{ + alert("document already deleted."); + } +} function ComicDetailTag(prop: { tags: string[];/*classes:{ tag_list:string }*/ path?: string; + createdAt?: number; + deletedAt?: number; }) { let allTag = prop.tags; const tagKind = ["artist", "group", "series", "type", "character"]; @@ -155,6 +173,18 @@ function ComicDetailTag(prop: { {prop.path} } + { prop.createdAt != undefined && <> + CreatedAt + + {new Date(prop.createdAt).toUTCString()} + + } + { prop.deletedAt != undefined && <> + DeletedAt + + {new Date(prop.deletedAt).toUTCString()} + + } Tags