diff --git a/app/history/[title]/History.tsx b/app/history/[title]/History.tsx index 8ed9a04c..3b4aefdf 100644 --- a/app/history/[title]/History.tsx +++ b/app/history/[title]/History.tsx @@ -22,13 +22,13 @@ const History = ({ title }: { title: string }) => { className={styles.historyBox} key={String(history.thisVersionCreatedAt)} > -
+

#{history.index}

- + -
+ + 작성자 · {history.nickName} ))} diff --git a/app/history/[title]/detail/[id]/HistoryDetail.tsx b/app/history/[title]/detail/[id]/HistoryDetail.tsx index 5db56740..d79650c0 100644 --- a/app/history/[title]/detail/[id]/HistoryDetail.tsx +++ b/app/history/[title]/detail/[id]/HistoryDetail.tsx @@ -3,6 +3,7 @@ import { FC } from "react"; import Link from "next/link"; import Container from "@/components/Container"; +import { VersionDifferent } from "@/enum"; import { useSuspenseQuery } from "@tanstack/react-query"; import { historyQuery } from "@/services/history/history.query"; import * as styles from "./style.css"; @@ -21,33 +22,33 @@ const HistoryDetail: FC<{ id: number; title: string }> = ({ id, title }) => { docsType={history.docsType} lastModifiedAt={history.versionDocs.thisVersionCreatedAt} > -
+
작성자 · {history.versionDocs.nickName} -
+
    {history.diff.map((dif: HistoryType, historyId: number) => { const operationIcon = (() => { switch (dif.operation) { - case "INSERT": + case VersionDifferent.INSERT: return "+"; - case "DELETE": + case VersionDifferent.DELETE: return "-"; - case "EQUAL": - return ""; + case VersionDifferent.EQUAL: + return; default: return dif.operation; } })(); return ( -
    -
    {operationIcon}
    -
    {dif.text}
    -
    +
  • + {operationIcon} +

    {dif.text}

    +
  • ); })} -
-
+ + ); }; diff --git a/app/history/[title]/detail/[id]/page.tsx b/app/history/[title]/detail/[id]/page.tsx index d4680107..0a3a564f 100644 --- a/app/history/[title]/detail/[id]/page.tsx +++ b/app/history/[title]/detail/[id]/page.tsx @@ -13,9 +13,10 @@ interface PageProps { } export const generateMetadata = async ({ params: { title, id } }: PageProps): Promise => { + const decodedTitle = decodeURI(title); return generateOpenGraph({ - title: `역사#${decodeURI(title)}_${id}`, - description: `${decodeURI(title)} 문서의 ${id}번째 역사입니다.`, + title: `역사#${decodedTitle}_${id}`, + description: `${decodedTitle} 문서의 ${id}번째 역사입니다.`, }); }; diff --git a/app/history/[title]/page.tsx b/app/history/[title]/page.tsx index 721fe263..ad101eee 100644 --- a/app/history/[title]/page.tsx +++ b/app/history/[title]/page.tsx @@ -12,9 +12,10 @@ interface PageProps { } export const generateMetadata = async ({ params: { title } }: PageProps): Promise => { + const decodedTitle = decodeURI(title); return generateOpenGraph({ - title: `역사#${decodeURI(title)}`, - description: `${decodeURI(title)} 문서의 역사입니다.`, + title: `역사#${decodedTitle}`, + description: `${decodedTitle} 문서의 역사입니다.`, }); }; diff --git a/enum/index.ts b/enum/index.ts index 503db2e3..b6dceb59 100644 --- a/enum/index.ts +++ b/enum/index.ts @@ -1 +1,2 @@ export { default as EditorType } from "./editorType.enum"; +export { default as VersionDifferent } from "./versionDifferent.enum"; diff --git a/enum/versionDifferent.enum.ts b/enum/versionDifferent.enum.ts new file mode 100644 index 00000000..9a4c2757 --- /dev/null +++ b/enum/versionDifferent.enum.ts @@ -0,0 +1,7 @@ +enum VersionDifferent { + INSERT = "INSERT", + DELETE = "DELETE", + EQUAL = "EQUAL", +} + +export default VersionDifferent;