import React, { } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { Document } from '../accessor/document'; import { Link, Paper, Theme, Box, useTheme, Typography } from '@mui/material'; import { ThumbnailContainer } from '../page/reader/reader'; import { TagChip } from '../component/tagchip'; export const makeContentInfoUrl = (id: number) => `/doc/${id}`; export const makeContentReaderUrl = (id: number) => `/doc/${id}/reader`; const useStyles = ((theme: Theme) => ({ thumbnail_content: { maxHeight: '400px', maxWidth: 'min(400px, 100vw)', }, tag_list: { display: 'flex', justifyContent: 'flex-start', flexWrap: 'wrap', overflowY: 'hidden', '& > *': { margin: theme.spacing(0.5), }, }, title: { marginLeft: theme.spacing(1), }, infoContainer: { padding: theme.spacing(2), }, subinfoContainer: { display: 'grid', gridTemplateColumns: '100px auto', overflowY: 'hidden', alignItems: 'baseline', }, short_subinfoContainer: { [theme.breakpoints.down("md")]: { display: 'none', }, }, short_root: { overflowY: 'hidden', display: 'flex', flexDirection: 'column', [theme.breakpoints.up("sm")]: { height: 200, flexDirection: 'row', }, }, short_thumbnail_anchor: { background: '#272733', display: 'flex', alignItems: 'center', justifyContent: 'center', [theme.breakpoints.up("sm")]: { width: theme.spacing(25), height: theme.spacing(25), flexShrink: 0, } }, short_thumbnail_content: { maxWidth: '100%', maxHeight: '100%', }, })) export const ContentInfo = (props: { document: Document, children?: React.ReactNode, classes?: { root?: string, thumbnail_anchor?: string, thumbnail_content?: string, tag_list?: string, title?: string, infoContainer?: string, subinfoContainer?: string }, gallery?: string, short?: boolean }) => { //const classes = useStyles(); const theme = useTheme(); const document = props.document; const propclasses = props.classes ?? {}; /*const rootName = props.short ? classes.short_root : classes.root; const thumbnail_anchor = props.short ? classes.short_thumbnail_anchor : ""; const thumbnail_content = props.short ? classes.short_thumbnail_content : classes.thumbnail_content; const subinfoContainer = props.short ? classes.short_subinfoContainer : classes.subinfoContainer;*/ const url = props.gallery === undefined ? makeContentReaderUrl(document.id) : makeContentInfoUrl(document.id); return ( {document.deleted_at === null ? () : (Deleted)} {document.title} {props.short ? ({document.tags.map(x => () )}) : ( ) } ); } function ComicDetailTag(prop: { tags: string[]/*classes:{ tag_list:string }*/}) { let allTag = prop.tags; const tagKind = ["artist", "group", "series", "type", "character"]; let tagTable: { [kind: string]: string[] } = {}; for (const kind of tagKind) { const tags = allTag.filter(x => x.startsWith(kind + ":")).map(x => x.slice(kind.length + 1)); tagTable[kind] = tags; allTag = allTag.filter(x => !x.startsWith(kind + ":")); } return ( {tagKind.map(key => ( {key} {tagTable[key].length !== 0 ? tagTable[key].join(", ") : "N/A"} ))} Tags {allTag.map(x => ())} ); }