From 61126e028890af40ac16893a6f56ef324d1c7ca8 Mon Sep 17 00:00:00 2001 From: Kentaro Mizuki <66548698+harsssh@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:08:42 +0900 Subject: [PATCH 1/4] =?UTF-8?q?GET=20/scraps/:id=20=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=83=8F=E3=83=B3=E3=83=89=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E3=80=81=E3=83=A2=E3=83=87=E3=83=AB=E8=A9=B0=E6=9B=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/routes/scraps.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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', From 1a60627ace9827bfb41784bcd8058e1786b80190 Mon Sep 17 00:00:00 2001 From: Kentaro Mizuki <66548698+harsssh@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:08:57 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fragment=20=E3=81=AE=E5=8F=B3=E4=B8=8B?= =?UTF-8?q?=E3=81=AB=E6=8A=95=E7=A8=BF=E8=80=85=E3=81=AE=20id=20=E3=82=92?= =?UTF-8?q?=E5=87=BA=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/component/FragmentViewer.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client/component/FragmentViewer.tsx b/src/client/component/FragmentViewer.tsx index b3cfadf..9667f80 100644 --- a/src/client/component/FragmentViewer.tsx +++ b/src/client/component/FragmentViewer.tsx @@ -2,7 +2,7 @@ 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' @@ -74,7 +74,14 @@ export function FragmentViewer({ fragment={fragment} /> ) : ( - + <> + + + + {fragment.authorId} + + + )} From 84af88da0de7094889afe0a020e25a5966f98b72 Mon Sep 17 00:00:00 2001 From: Kentaro Mizuki <66548698+harsssh@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:16:55 +0900 Subject: [PATCH 3/4] =?UTF-8?q?markdown=20=E3=82=AF=E3=83=A9=E3=82=B9?= =?UTF-8?q?=E3=82=92=E5=BD=93=E3=81=A6=E3=82=8B=E4=BD=8D=E7=BD=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/component/FragmentViewer.tsx | 3 +-- .../Markdown.module.css} | 0 src/client/component/markdown/Markdown.tsx | 7 ++++++- 3 files changed, 7 insertions(+), 3 deletions(-) rename src/client/component/{FragmentViewer.module.css => markdown/Markdown.module.css} (100%) diff --git a/src/client/component/FragmentViewer.tsx b/src/client/component/FragmentViewer.tsx index 9667f80..ebf56d5 100644 --- a/src/client/component/FragmentViewer.tsx +++ b/src/client/component/FragmentViewer.tsx @@ -6,7 +6,6 @@ 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)} 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 = { From 551e55c31c9f89f3f9852f373f8fcb417a55afad Mon Sep 17 00:00:00 2001 From: Kentaro Mizuki <66548698+harsssh@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:19:31 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9C=AC=E6=96=87=E3=81=AE=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E8=80=85ID=E3=81=AE=E4=BD=99=E7=99=BD=E3=82=92?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/component/FragmentViewer.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/component/FragmentViewer.tsx b/src/client/component/FragmentViewer.tsx index ebf56d5..34a8b9b 100644 --- a/src/client/component/FragmentViewer.tsx +++ b/src/client/component/FragmentViewer.tsx @@ -73,14 +73,14 @@ export function FragmentViewer({ fragment={fragment} /> ) : ( - <> + {fragment.authorId} - + )}