diff --git a/src/client/component/FragmentViewer.tsx b/src/client/component/FragmentViewer.tsx index b3cfadf..34a8b9b 100644 --- a/src/client/component/FragmentViewer.tsx +++ b/src/client/component/FragmentViewer.tsx @@ -2,11 +2,10 @@ import EditFragmentForm from '@/client/component/EditFragmentForm' import { Markdown } from '@/client/component/markdown/Markdown' import useEditFragmentDraft from '@/client/hook/useEditFragmentDraft' import type { Fragment } from '@/common/model/fragment' -import { ActionIcon, Box, Card, Group, Stack } from '@mantine/core' +import { ActionIcon, Box, Card, Flex, Group, Stack, Text } from '@mantine/core' import { useHover } from '@mantine/hooks' import { IconPencil } from '@tabler/icons-react' import { useState } from 'react' -import classes from './FragmentViewer.module.css' interface FragmentViewerProps { fragment: Fragment @@ -66,7 +65,7 @@ export function FragmentViewer({ setShowEditor(true)} /> )} - + {showEditor ? ( setShowEditor(false)} @@ -74,7 +73,14 @@ export function FragmentViewer({ fragment={fragment} /> ) : ( - + + + + + {fragment.authorId} + + + )} diff --git a/src/client/component/FragmentViewer.module.css b/src/client/component/markdown/Markdown.module.css similarity index 100% rename from src/client/component/FragmentViewer.module.css rename to src/client/component/markdown/Markdown.module.css diff --git a/src/client/component/markdown/Markdown.tsx b/src/client/component/markdown/Markdown.tsx index 523267a..29b52bc 100644 --- a/src/client/component/markdown/Markdown.tsx +++ b/src/client/component/markdown/Markdown.tsx @@ -4,6 +4,7 @@ import type { Root, RootContent } from 'mdast' import { useEffect, useState } from 'react' import { remark } from 'remark' import remarkGfm from 'remark-gfm' +import classes from './Markdown.module.css' type MarkdownProps = { markdown: string @@ -24,7 +25,11 @@ export function Markdown({ markdown }: MarkdownProps) { ) } - return + return ( +
+ +
+ ) } type NodeRendererProps = { diff --git a/src/server/routes/scraps.ts b/src/server/routes/scraps.ts index 7ea41e9..96df89c 100644 --- a/src/server/routes/scraps.ts +++ b/src/server/routes/scraps.ts @@ -63,7 +63,14 @@ const scraps = honoFactory fragments: true, }, }) - return c.json(scrap) + if (!scrap) { + throw new HTTPException(404) + } + + const scrapModel: Scrap = { + ...scrap, + } + return c.json(scrapModel) }) .put( '/:id',