diff --git a/src/hooks/use-preset-button.hooks.ts b/src/hooks/use-preset-button.hooks.ts index f06be8c..0f4f5f4 100644 --- a/src/hooks/use-preset-button.hooks.ts +++ b/src/hooks/use-preset-button.hooks.ts @@ -1,10 +1,12 @@ import useChatStore, { referenceState } from '../store/chat-store'; import useTypeStore from '../store/type-category-store'; import { postQuestion } from '../api/post-question'; +import { useUserDetailTypeStore } from '../store/user-detail-type-store'; const usePresetButton = () => { const { type, category } = useTypeStore(); const { addMessage, setLoading, updateLastMessage, updateLastReference, updateReferenceDisabled } = useChatStore(); + const { selectedName } = useUserDetailTypeStore(); const handleReferenceButtonClick = (references: referenceState[]) => { let content = '๐Ÿ’ก๋‹ต๋ณ€ ์ถœ์ฒ˜๋ฅผ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”! ์ถœ์ฒ˜๋ฅผ ํด๋ฆญํ•˜๋ฉด ๋ชจ์ง‘์š”๊ฐ•์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”!\n'; @@ -38,6 +40,25 @@ const usePresetButton = () => { setLoading(false); }; + // const handleButtonClick = async (question: string, category?: string) => { + // try { + // addMessage({ content: question, role: 'user' }); + // addMessage({ content: 'loading', role: 'system' }); + // setLoading(true); + + // if (category === 'PASSING_RESULT' || category === 'PAST_QUESTIONS' || category === 'INTERVIEW_PRACTICAL_TEST') { + // const response = await customCategoryFetchResponse(question, category); + // updateStateWithResponse(response); + // } else { + // const response = await fetchResponse(question); + // updateStateWithResponse(response); + // } + // } catch (error) { + // setLoading(false); + // updateLastMessage('๋‹ต๋ณ€ ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ๋กœ๊ณ ์นจํ•ด์ฃผ์„ธ์š”'); + // } + // }; + const handleButtonClick = async (question: string, category?: string) => { try { addMessage({ content: question, role: 'user' }); @@ -45,7 +66,10 @@ const usePresetButton = () => { setLoading(true); if (category === 'PASSING_RESULT' || category === 'PAST_QUESTIONS' || category === 'INTERVIEW_PRACTICAL_TEST') { - const response = await customCategoryFetchResponse(question, category); + const response = await customCategoryFetchResponse( + `${selectedName}์ „ํ˜•์˜ ๋ชจ๋“  ํ•™๊ณผ์— ๋Œ€ํ•œ ${question}์•Œ๋ ค์ค˜`, + category, + ); updateStateWithResponse(response); } else { const response = await fetchResponse(question); diff --git a/src/ui/components/atom/dropdown/dropdown.tsx b/src/ui/components/atom/dropdown/dropdown.tsx index 24337ba..9c4b00e 100644 --- a/src/ui/components/atom/dropdown/dropdown.tsx +++ b/src/ui/components/atom/dropdown/dropdown.tsx @@ -26,13 +26,16 @@ const Dropdown: React.FC = ({ type }) => { - + {type === 'PYEONIP' ? // ํŽธ์ž…์˜ ๊ฒฝ์šฐ, ํ•œ ๋ฒˆ์— ์ „์ฒด ๋ชฉ๋ก ํ‘œ์‹œ items.map((item, index) => ( handleNameClick(item.middleName)} > {item.middleName} @@ -41,7 +44,7 @@ const Dropdown: React.FC = ({ type }) => { : // ์ˆ˜์‹œ, ์ •์‹œ์˜ ๊ฒฝ์šฐ, ์ค‘๊ฐ„ ์ด๋ฆ„์„ ์ƒ์œ„ ๋ฉ”๋‰ด๋กœ, ๋งˆ์ง€๋ง‰ ์ด๋ฆ„์„ ํ•˜์œ„ ๋ฉ”๋‰ด๋กœ ํ‘œ์‹œ items.map((item, index) => ( - + {item.middleName} @@ -50,7 +53,7 @@ const Dropdown: React.FC = ({ type }) => { {item.lastNames.map((lastName, subIndex) => ( handleNameClick(lastName)} > {lastName} diff --git a/src/ui/components/atom/text-input/text-input.tsx b/src/ui/components/atom/text-input/text-input.tsx index ed39834..420ed6e 100644 --- a/src/ui/components/atom/text-input/text-input.tsx +++ b/src/ui/components/atom/text-input/text-input.tsx @@ -1,14 +1,14 @@ import React from 'react'; import { cn } from '../../../../utils/style'; -export interface TextInputProps extends React.InputHTMLAttributes { +export interface TextInputProps extends React.TextareaHTMLAttributes { value?: string; onValueChange?: (value: string) => void; disabled?: boolean; } const TextInput = React.forwardRef(function TextArea( - { disabled = false, placeholder, onValueChange, value }, + { disabled = false, placeholder, onValueChange, value, onKeyDown }, ref, ) { return ( @@ -26,6 +26,7 @@ const TextInput = React.forwardRef(function onChange={(e) => { onValueChange?.(e.target.value); }} + onKeyDown={onKeyDown} /> ); }); diff --git a/src/ui/components/user-domain/question-preset-buttons.tsx b/src/ui/components/user-domain/question-preset-buttons.tsx index 8c1ce44..56182ab 100644 --- a/src/ui/components/user-domain/question-preset-buttons.tsx +++ b/src/ui/components/user-domain/question-preset-buttons.tsx @@ -2,13 +2,48 @@ import * as React from 'react'; import useChatStore from '../../../store/chat-store'; import PresetButton from '../atom/preset/preset-button'; import usePresetButton from '../../../hooks/use-preset-button.hooks'; +import { useUserDetailTypeStore } from '../../../store/user-detail-type-store'; +import useTypeStore from '../../../store/type-category-store'; export const QuestionPresetButtons = () => { const { lastReference, referenceButtonDisabled } = useChatStore(); const { handleReferenceButtonClick, handleButtonClick } = usePresetButton(); - const handleReultButtonClick = (content: string) => { - handleButtonClick(content, 'PASSING_RESULT'); + const { type } = useTypeStore(); + const { selectedName } = useUserDetailTypeStore(); // ์„ ํƒ๋œ ์„ธ๋ถ€ ์ „ํ˜• ๊ฐ€์ ธ์˜ค๊ธฐ + + const handleResultButtonClick = (content: string) => { + if (type && selectedName) { + console.log(type, selectedName); + handleButtonClick(content, 'PASSING_RESULT'); + } }; + // const handleResultButtonClick = (content: string) => { + // let typeLabel = ''; + // if (type) { + // switch (type) { + // case 'SUSI': + // typeLabel = '์ˆ˜์‹œ์ „ํ˜•'; + // break; + // case 'JEONGSI': + // typeLabel = '์ •์‹œ์ „ํ˜•'; + // break; + // case 'PYEONIP': + // typeLabel = 'ํŽธ์ž…์ „ํ˜•'; + // break; + // default: + // typeLabel = type; // ๊ธฐ๋ณธ์ ์œผ๋กœ ์›๋ž˜ ํƒ€์ž…์„ ์‚ฌ์šฉ + // } + // } + + // if (typeLabel && selectedName) { + // // ์‹ค์ œ ์ „๋‹ฌ๊ฐ’์€ ์ „์ฒด ์ •๋ณด๋ฅผ ํฌํ•จ + // const fullContent = `${typeLabel}์˜ ${selectedName}์˜ ${content}๋ฅผ ์•Œ๋ ค์ค˜`; + // handleButtonClick('์ž…์‹œ๊ฒฐ๊ณผ', 'PAS'); + // } else { + // // ํ•™๊ณผ ์„ ํƒ ์š”์ฒญ ๋ฉ”์‹œ์ง€ + // handleButtonClick('์›ํ•˜์‹œ๋Š” ํ•™๊ณผ๋ฅผ ์„ ํƒํ•ด ์ฃผ์„ธ์š”.', 'DEPARTMENT_SELECTION'); + // } + // }; return (
@@ -18,7 +53,7 @@ export const QuestionPresetButtons = () => { handleButtonClick('์ „ํ˜•์ผ์ •')}>์ „ํ˜•์ผ์ • handleButtonClick('๋ธ”๋ผ์ธ๋“œ ๋ฉด์ ‘ ์œ ์˜์‚ฌํ•ญ')}>๋ฉด์ ‘์œ ์˜์‚ฌํ•ญ handleButtonClick('์ œ์ถœ์„œ๋ฅ˜ ์œ ์˜์‚ฌํ•ญ')}>์ œ์ถœ์„œ๋ฅ˜ - handleReultButtonClick('์ž…์‹œ๊ฒฐ๊ณผ')}>์ž…์‹œ๊ฒฐ๊ณผ + handleResultButtonClick('์ž…์‹œ๊ฒฐ๊ณผ')}>์ž…์‹œ๊ฒฐ๊ณผ handleButtonClick('์‹ค๊ธฐ๊ณ ์‚ฌ')}>์‹ค๊ธฐ๊ณ ์‚ฌ window.location.reload()}>์กฐ๊ฑด ์žฌ์„ค์ •
diff --git a/src/ui/pages/maru-egg.tsx b/src/ui/pages/maru-egg.tsx index 5871d92..9024eb8 100644 --- a/src/ui/pages/maru-egg.tsx +++ b/src/ui/pages/maru-egg.tsx @@ -28,7 +28,7 @@ const MaruEgg: React.FC = () => { return (
-
+
{showOnboarding && }