From 78c6b5728011fcd3e8e07eade19f68f7e3a51551 Mon Sep 17 00:00:00 2001 From: sangmaaaaan Date: Thu, 7 Nov 2024 22:40:00 +0900 Subject: [PATCH 1/5] style: fix dropdown border color --- src/ui/components/atom/dropdown/dropdown.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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} From a7c7510cbb797ee325721d2d5577eb1a1954cc11 Mon Sep 17 00:00:00 2001 From: sangmaaaaan Date: Fri, 15 Nov 2024 13:44:01 +0900 Subject: [PATCH 2/5] Refactor: Retrieve typoe info using Typestore --- src/hooks/use-preset-button.hooks.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/hooks/use-preset-button.hooks.ts b/src/hooks/use-preset-button.hooks.ts index 8562958..fcb4e32 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); From b440d1d60c363231f724ff12d83c6fc9339e033d Mon Sep 17 00:00:00 2001 From: sangmaaaaan Date: Fri, 15 Nov 2024 13:50:04 +0900 Subject: [PATCH 3/5] refactor: Simplify handleResultButtonClick logic in QuestionPresetButtons --- .../user-domain/question-preset-buttons.tsx | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) 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()}>조건 재설정
From 38be048020e8f80a5a40f8e1bc1bac67b2044834 Mon Sep 17 00:00:00 2001 From: sangmaaaaan Date: Fri, 15 Nov 2024 13:50:21 +0900 Subject: [PATCH 4/5] style: fix dropdown border color --- src/ui/pages/maru-egg.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 && }
From 497f8c6c406c8387d3b2bec6649c2b60542925aa Mon Sep 17 00:00:00 2001 From: sangmaaaaan Date: Fri, 15 Nov 2024 13:53:33 +0900 Subject: [PATCH 5/5] feat: Implement TextInput component with forwardRef and custom value change handler --- src/ui/components/atom/text-input/text-input.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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} /> ); });