From f882e8c2bb0a63d64481b092251897411def786e Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:37:42 +0900 Subject: [PATCH 01/20] Refactor: test page --- src/ui/pages/page-test.tsx | 95 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/src/ui/pages/page-test.tsx b/src/ui/pages/page-test.tsx index 58a9c97..a9a10ad 100644 --- a/src/ui/pages/page-test.tsx +++ b/src/ui/pages/page-test.tsx @@ -1,10 +1,99 @@ import React from 'react'; -import AdminLayout from '../components/molecule/admin/Layout/admin-layout'; +import ChatForm from '../components/molecule/user/chat-form/chat-form'; +import ChatCard from '../components/atom/chat-card/chat-card'; const PageTest: React.FC = () => { return ( -
- +
+ +
+
+ + + + + +
); }; From 8c5f2a2a2aaa614d3707b768579ed07b32d6acea Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:38:07 +0900 Subject: [PATCH 02/20] Feat: type store.ts add --- src/store/store.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/store/store.ts diff --git a/src/store/store.ts b/src/store/store.ts new file mode 100644 index 0000000..124cb0e --- /dev/null +++ b/src/store/store.ts @@ -0,0 +1,13 @@ +import { create } from 'zustand'; + +interface TypeState { + type: null | 'SUSI' | 'PYEONIP' | 'JEONGSI'; + setSelectedType: (button: TypeState['type']) => void; // button 타입을 TypeState['type']로 정의 +} + +const useTypeStore = create()((set) => ({ + type: null, + setSelectedType: (button) => set({ type: button }), // setSelectedType 정의 +})); + +export default useTypeStore; From 699b41b7eb442dfee604e2742bae750f5698f7d4 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:38:30 +0900 Subject: [PATCH 03/20] Refactor: type Props change --- .../molecule/user/header/header.tsx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ui/components/molecule/user/header/header.tsx b/src/ui/components/molecule/user/header/header.tsx index ea4bd56..2f5449a 100644 --- a/src/ui/components/molecule/user/header/header.tsx +++ b/src/ui/components/molecule/user/header/header.tsx @@ -6,7 +6,7 @@ import maruEgg from '../../../../../assets/maru-egg.png'; import IconButton from '../../../atom/icon/icon-button'; interface HeaderProps { - type: string; + type: null | 'SUSI' | 'PYEONIP' | 'JEONGSI'; } const Header = ({ type }: HeaderProps) => { @@ -30,14 +30,18 @@ const Header = ({ type }: HeaderProps) => {
마루에그 캐릭터
명지대학교 입학처 챗봇
-
    -
  • -
    -

    {type} 

    -

    질문중

    -
    -
  • -
+ {type && ( +
    +
  • +
    +

    + {type === 'SUSI' ? '수시' : type === 'JEONGSI' ? '정시' : '편입'}  +

    +

    질문중

    +
    +
  • +
+ )}
From 91cc6a8923d8c5528396cd69e396de56138ec07a Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:38:55 +0900 Subject: [PATCH 04/20] Refactor: add maru egg image --- .../components/atom/chat-card/chat-card.tsx | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/ui/components/atom/chat-card/chat-card.tsx b/src/ui/components/atom/chat-card/chat-card.tsx index 94ca626..ab918ae 100644 --- a/src/ui/components/atom/chat-card/chat-card.tsx +++ b/src/ui/components/atom/chat-card/chat-card.tsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { cn } from '../../../../utils/style'; - +import maru from '../../../../assets/maru-egg.png'; interface ChatCardProps { content: string; role: 'user' | 'system'; @@ -10,20 +10,23 @@ interface ChatCardProps { const ChatCard = ({ content, role }: ChatCardProps) => { return ( -
+
+ {role === 'user' ? null : }
-
- {content} +
+
+ {content} +
From 09c736eb8f6b1ae9343b91344f8bf82b6811ccff Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:39:10 +0900 Subject: [PATCH 05/20] Chore: add zustand --- package-lock.json | 38 +++++++++++++++++++++++++++++++++++++- package.json | 3 ++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33c1f06..76c0f62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,8 @@ "swr": "^2.2.5", "tailwind-merge": "^2.3.0", "typescript": "^4.9.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "zustand": "^4.5.4" }, "devDependencies": { "@chromatic-com/storybook": "^1.5.0", @@ -31640,6 +31641,41 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zustand": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.4.tgz", + "integrity": "sha512-/BPMyLKJPtFEvVL0E9E9BTUM63MNyhPGlvxk1XjrfWTUlV+BR8jufjsovHzrtR6YNcBEcL7cMHovL1n9xHawEg==", + "dependencies": { + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0.6", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } + }, + "node_modules/zustand/node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/package.json b/package.json index 6176ae1..68cce1f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "swr": "^2.2.5", "tailwind-merge": "^2.3.0", "typescript": "^4.9.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "zustand": "^4.5.4" }, "scripts": { "start": "react-scripts start", From 755a695d786f4752b26e5ef98ee32efa0e632cb7 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:39:38 +0900 Subject: [PATCH 06/20] Refactor: maru-egg page --- src/ui/pages/maru-egg.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ui/pages/maru-egg.tsx b/src/ui/pages/maru-egg.tsx index e68fce9..08e4f7f 100644 --- a/src/ui/pages/maru-egg.tsx +++ b/src/ui/pages/maru-egg.tsx @@ -1,12 +1,22 @@ import React from 'react'; - import Header from '../components/molecule/user/header/header'; +import useTypeStore from '../../store/store'; const MaruEgg: React.FC = () => { + const { setSelectedType, type } = useTypeStore(); + const handleButtonClick = (selectedType: 'SUSI' | 'PYEONIP' | 'JEONGSI') => { + setSelectedType(selectedType); + }; + return (
-
+
+
+ + + +
); }; From 02d329310b24eb6c2f9afe182b680e9d6ebe76db Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 15:39:55 +0900 Subject: [PATCH 07/20] Refactor: admin change tailwindcss and import --- src/routes/admin-routes.tsx | 2 +- src/ui/pages/admin/login.tsx | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/routes/admin-routes.tsx b/src/routes/admin-routes.tsx index 256b693..fb18e99 100644 --- a/src/routes/admin-routes.tsx +++ b/src/routes/admin-routes.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { Route, Routes } from 'react-router-dom'; -import Login from '../ui/pages/admin/login'; import PrivateRoute from './private-route'; import FileList from '../ui/pages/admin/file-list'; import AdminLayout from '../ui/components/molecule/admin/Layout/admin-layout'; +import Login from '../ui/pages/admin/login'; const AdminRoutes: React.FC = () => { const token = sessionStorage.getItem('Authorization'); diff --git a/src/ui/pages/admin/login.tsx b/src/ui/pages/admin/login.tsx index 83c868a..21aa925 100644 --- a/src/ui/pages/admin/login.tsx +++ b/src/ui/pages/admin/login.tsx @@ -12,7 +12,6 @@ export default function Login() { const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); - try { await handleLogin(email, password); } catch (err: any) { @@ -28,7 +27,6 @@ export default function Login() { Sign in to your account
-
@@ -44,7 +42,7 @@ export default function Login() { required value={email} onChange={(e) => setEmail(e.target.value)} - className="block w-full rounded-md border-0 py-1.5 px-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-lg sm:leading-6" + className="block w-full rounded-md border-0 px-2 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-lg sm:leading-6" />
@@ -64,7 +62,7 @@ export default function Login() { required value={password} onChange={(e) => setPassword(e.target.value)} - className="block w-full rounded-md border-0 py-1.5 px-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-lg sm:leading-6" + className="block w-full rounded-md border-0 px-2 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-lg sm:leading-6" />
@@ -75,9 +73,9 @@ export default function Login() { className="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-lg font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" > {isLoading ? ( - 'Sign in' - ) : ( } size="large" /> + ) : ( + 'Sign in' )}
From 27492869716d3c3778849ed35b196c149c988a08 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 16:07:51 +0900 Subject: [PATCH 08/20] Refactor: Chat-card tailwind max width --- src/ui/components/atom/chat-card/chat-card.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/components/atom/chat-card/chat-card.tsx b/src/ui/components/atom/chat-card/chat-card.tsx index ab918ae..675a2eb 100644 --- a/src/ui/components/atom/chat-card/chat-card.tsx +++ b/src/ui/components/atom/chat-card/chat-card.tsx @@ -13,13 +13,13 @@ const ChatCard = ({ content, role }: ChatCardProps) => {
{role === 'user' ? null : }
Date: Fri, 2 Aug 2024 16:11:53 +0900 Subject: [PATCH 09/20] Refactor: maxwidth css fix --- src/ui/components/atom/chat-card/chat-card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/components/atom/chat-card/chat-card.tsx b/src/ui/components/atom/chat-card/chat-card.tsx index 675a2eb..223d650 100644 --- a/src/ui/components/atom/chat-card/chat-card.tsx +++ b/src/ui/components/atom/chat-card/chat-card.tsx @@ -13,7 +13,7 @@ const ChatCard = ({ content, role }: ChatCardProps) => {
{role === 'user' ? null : }
Date: Fri, 2 Aug 2024 16:31:08 +0900 Subject: [PATCH 10/20] Refactor: Chat-form css --- src/ui/components/molecule/user/chat-form/chat-form.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ui/components/molecule/user/chat-form/chat-form.tsx b/src/ui/components/molecule/user/chat-form/chat-form.tsx index 5569adf..cb5f1fd 100644 --- a/src/ui/components/molecule/user/chat-form/chat-form.tsx +++ b/src/ui/components/molecule/user/chat-form/chat-form.tsx @@ -6,8 +6,8 @@ import { postQuestion } from '../../../../../api/post-question'; import { cn } from '../../../../../utils/style'; interface ChatFormProps { - type: string; - category: string; + type: 'SUSI' | 'PYEONIP' | 'JEONGSI'; + category?: 'PAST_QUESTIONS' | 'INTERVIEW_PRACTICAL_TEST' | 'PASSING_RESULT' | 'ADMISSION_GUIDELINE'; } const ChatForm = ({ type, category }: ChatFormProps) => { @@ -32,10 +32,7 @@ const ChatForm = ({ type, category }: ChatFormProps) => { }; return ( - + From 0e2683a52cb5de1a7698a8b634e19078aab120d3 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 16:31:19 +0900 Subject: [PATCH 11/20] Refactor: add category type undefined --- src/api/post-question.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/post-question.ts b/src/api/post-question.ts index e704749..8b218cc 100644 --- a/src/api/post-question.ts +++ b/src/api/post-question.ts @@ -1,6 +1,6 @@ import { server_axiosInstance } from '../utils/axios'; -export async function postQuestion(category: string, type: string, content: string): Promise { +export async function postQuestion(category: string | undefined, type: string, content: string): Promise { const data = { type, category, From 48a124bb93b69cc33afa2b992674b449f607e78c Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 17:16:44 +0900 Subject: [PATCH 12/20] Feat: Message store --- src/store/chat-store.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/store/chat-store.ts diff --git a/src/store/chat-store.ts b/src/store/chat-store.ts new file mode 100644 index 0000000..9d0e4dc --- /dev/null +++ b/src/store/chat-store.ts @@ -0,0 +1,13 @@ +import { create } from 'zustand'; + +interface ChatState { + messages: { content: string; role: 'user' | 'system' }[]; + addMessage: (message: { content: string; role: 'user' | 'system' }) => void; +} + +const useChatStore = create((set) => ({ + messages: [], + addMessage: (message) => set((state) => ({ messages: [...state.messages, message] })), +})); + +export default useChatStore; From 921e4b22dbb1aa94571f2816d7f0346a0a367806 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 17:16:58 +0900 Subject: [PATCH 13/20] Rename: store to type-store --- src/store/{store.ts => type-store.ts} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/store/{store.ts => type-store.ts} (53%) diff --git a/src/store/store.ts b/src/store/type-store.ts similarity index 53% rename from src/store/store.ts rename to src/store/type-store.ts index 124cb0e..dd8a6f6 100644 --- a/src/store/store.ts +++ b/src/store/type-store.ts @@ -2,12 +2,12 @@ import { create } from 'zustand'; interface TypeState { type: null | 'SUSI' | 'PYEONIP' | 'JEONGSI'; - setSelectedType: (button: TypeState['type']) => void; // button 타입을 TypeState['type']로 정의 + setSelectedType: (button: TypeState['type']) => void; } const useTypeStore = create()((set) => ({ type: null, - setSelectedType: (button) => set({ type: button }), // setSelectedType 정의 + setSelectedType: (button) => set({ type: button }), })); export default useTypeStore; From 7033f7380e2ba3c7046fefba4742cb2897723b63 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 17:17:23 +0900 Subject: [PATCH 14/20] refactor: add ChatStore and storybook --- .../molecule/user/chat-form/chat-form.stories.tsx | 7 +++---- src/ui/components/molecule/user/chat-form/chat-form.tsx | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ui/components/molecule/user/chat-form/chat-form.stories.tsx b/src/ui/components/molecule/user/chat-form/chat-form.stories.tsx index 8e49cd1..1a540b1 100644 --- a/src/ui/components/molecule/user/chat-form/chat-form.stories.tsx +++ b/src/ui/components/molecule/user/chat-form/chat-form.stories.tsx @@ -10,8 +10,7 @@ const meta = { layout: 'centered', }, args: { - type: 'question', - category: 'general', + type: 'SUSI', }, } satisfies Meta; @@ -20,7 +19,7 @@ type Story = StoryObj; export const Default: Story = { args: { - type: 'question', - category: 'general', + type: 'SUSI', + category: 'PAST_QUESTIONS', }, }; diff --git a/src/ui/components/molecule/user/chat-form/chat-form.tsx b/src/ui/components/molecule/user/chat-form/chat-form.tsx index cb5f1fd..ae85b2c 100644 --- a/src/ui/components/molecule/user/chat-form/chat-form.tsx +++ b/src/ui/components/molecule/user/chat-form/chat-form.tsx @@ -4,6 +4,7 @@ import IconButton from '../../../atom/icon/icon-button'; import { ReactComponent as SendIcon } from '../../../../../assets/Send.svg'; import { postQuestion } from '../../../../../api/post-question'; import { cn } from '../../../../../utils/style'; +import useChatStore from '../../../../../store/chat-store'; interface ChatFormProps { type: 'SUSI' | 'PYEONIP' | 'JEONGSI'; @@ -22,8 +23,10 @@ const ChatForm = ({ type, category }: ChatFormProps) => { const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); try { + useChatStore.getState().addMessage({ content, role: 'user' }); const response = await postQuestion(category, type, content); console.log('전송 성공:', response); + useChatStore.getState().addMessage({ content: response.answer.content, role: 'system' }); setContent(''); setDisabled(true); } catch (error) { From 91dd41b3fd947cfdf893a896bd9078b22d514f6d Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 17:17:40 +0900 Subject: [PATCH 15/20] Refactor: style add fixed --- src/ui/components/molecule/user/header/header.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/components/molecule/user/header/header.tsx b/src/ui/components/molecule/user/header/header.tsx index 2f5449a..a39f46b 100644 --- a/src/ui/components/molecule/user/header/header.tsx +++ b/src/ui/components/molecule/user/header/header.tsx @@ -23,7 +23,7 @@ const Header = ({ type }: HeaderProps) => { }; return ( -
+
From df1a5a690e2a37b26c8b113638b6b1d3917fb9c3 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Fri, 2 Aug 2024 17:17:57 +0900 Subject: [PATCH 16/20] Refactor: Test page --- src/ui/pages/maru-egg.tsx | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/ui/pages/maru-egg.tsx b/src/ui/pages/maru-egg.tsx index 08e4f7f..9233107 100644 --- a/src/ui/pages/maru-egg.tsx +++ b/src/ui/pages/maru-egg.tsx @@ -1,22 +1,51 @@ import React from 'react'; import Header from '../components/molecule/user/header/header'; -import useTypeStore from '../../store/store'; +import useTypeStore from '../../store/type-store'; +import ChatCard from '../components/atom/chat-card/chat-card'; +import ChatForm from '../components/molecule/user/chat-form/chat-form'; +import useChatStore from '../../store/chat-store'; const MaruEgg: React.FC = () => { const { setSelectedType, type } = useTypeStore(); + const { messages } = useChatStore(); const handleButtonClick = (selectedType: 'SUSI' | 'PYEONIP' | 'JEONGSI') => { setSelectedType(selectedType); }; return (
-
-
+ +
+ + {type !== null && ( + + )} + {type !== null && ( + + )} + {messages.map((msg, index) => { + return ; + })}
+ {type !== null && ( +
+ +
+ )}
); }; From 0c2da6268136afc67b1c0cae743f0814a2e088e4 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Sat, 3 Aug 2024 01:55:36 +0900 Subject: [PATCH 17/20] refactor: add loading --- src/store/chat-store.ts | 12 +++++++++++- .../components/molecule/user/chat-form/chat-form.tsx | 11 +++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/store/chat-store.ts b/src/store/chat-store.ts index 9d0e4dc..78b0f48 100644 --- a/src/store/chat-store.ts +++ b/src/store/chat-store.ts @@ -2,12 +2,22 @@ import { create } from 'zustand'; interface ChatState { messages: { content: string; role: 'user' | 'system' }[]; + loading: boolean; addMessage: (message: { content: string; role: 'user' | 'system' }) => void; + setLoading: (loading: boolean) => void; + updateLastMessage: (content: string) => void; } const useChatStore = create((set) => ({ messages: [], + loading: false, addMessage: (message) => set((state) => ({ messages: [...state.messages, message] })), + setLoading: (loading) => set({ loading }), + updateLastMessage: (content) => + set((state) => { + const updatedMessages = [...state.messages]; + updatedMessages[updatedMessages.length - 1].content = content; + return { messages: updatedMessages }; + }), })); - export default useChatStore; diff --git a/src/ui/components/molecule/user/chat-form/chat-form.tsx b/src/ui/components/molecule/user/chat-form/chat-form.tsx index ae85b2c..ac91833 100644 --- a/src/ui/components/molecule/user/chat-form/chat-form.tsx +++ b/src/ui/components/molecule/user/chat-form/chat-form.tsx @@ -24,13 +24,16 @@ const ChatForm = ({ type, category }: ChatFormProps) => { e.preventDefault(); try { useChatStore.getState().addMessage({ content, role: 'user' }); - const response = await postQuestion(category, type, content); - console.log('전송 성공:', response); - useChatStore.getState().addMessage({ content: response.answer.content, role: 'system' }); + useChatStore.getState().addMessage({ content: '답변을 생성중입니다...', role: 'system' }); + useChatStore.getState().setLoading(true); setContent(''); + const response = await postQuestion(category, type, content); + useChatStore.getState().updateLastMessage(response.answer.content); + useChatStore.getState().setLoading(false); setDisabled(true); } catch (error) { - console.error('전송 실패:', error); + useChatStore.getState().setLoading(false); + useChatStore.getState().updateLastMessage('답변 생성에 실패했습니다. 새로고침해주세요'); } }; From 3b9358bf4957ea96a07e8d1f9f6f6b817631d112 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Sat, 3 Aug 2024 01:55:59 +0900 Subject: [PATCH 18/20] refactor: reload page --- src/ui/components/molecule/user/header/header.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/components/molecule/user/header/header.tsx b/src/ui/components/molecule/user/header/header.tsx index a39f46b..a2ba20a 100644 --- a/src/ui/components/molecule/user/header/header.tsx +++ b/src/ui/components/molecule/user/header/header.tsx @@ -10,11 +10,10 @@ interface HeaderProps { } const Header = ({ type }: HeaderProps) => { - const navigate = useNavigate(); const [menuOpen, setMenuOpen] = useState(false); const handleRefreshClick = () => { - navigate('/'); + window.location.reload(); console.log('새로고침'); }; From 89cfaebad45578e87f29117cd5dc4d236ebebf70 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Sat, 3 Aug 2024 01:56:21 +0900 Subject: [PATCH 19/20] refactor: tailwindcss refactor --- src/ui/components/atom/chat-card/chat-card.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/components/atom/chat-card/chat-card.tsx b/src/ui/components/atom/chat-card/chat-card.tsx index 223d650..4ce1919 100644 --- a/src/ui/components/atom/chat-card/chat-card.tsx +++ b/src/ui/components/atom/chat-card/chat-card.tsx @@ -7,13 +7,12 @@ interface ChatCardProps { content: string; role: 'user' | 'system'; } - const ChatCard = ({ content, role }: ChatCardProps) => { return (
{role === 'user' ? null : }
Date: Sat, 3 Aug 2024 01:56:42 +0900 Subject: [PATCH 20/20] refactor: tailwindcss page refactor --- src/ui/pages/maru-egg.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/pages/maru-egg.tsx b/src/ui/pages/maru-egg.tsx index 9233107..c7fb09b 100644 --- a/src/ui/pages/maru-egg.tsx +++ b/src/ui/pages/maru-egg.tsx @@ -13,10 +13,10 @@ const MaruEgg: React.FC = () => { }; return ( -
+
-
+