Skip to content

Commit

Permalink
Refactor: Test page
Browse files Browse the repository at this point in the history
  • Loading branch information
swgvenghy committed Aug 2, 2024
1 parent 91dd41b commit df1a5a6
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions src/ui/pages/maru-egg.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="min-w-[360px]">
<div className="bg-background-default"></div>
<Header type={type} />
<div>

<div className="max-h-max min-h-full w-full bg-background-default px-4 pb-24 pt-16">
<ChatCard
content={`안녕하세요 입학처 챗봇 MARU-EGG입니다!
궁금하신 내용 안내 도와드리겠습니다.
알아보고 싶은 전형을 선택해주세요!`}
role="system"
/>
<button onClick={() => handleButtonClick('SUSI')}>Select SUSI</button>
<button onClick={() => handleButtonClick('PYEONIP')}>Select PYEONIP</button>
<button onClick={() => handleButtonClick('JEONGSI')}>Select JEONGSI</button>
{type !== null && (
<ChatCard role="user" content={type === 'SUSI' ? '수시' : type === 'JEONGSI' ? '정시' : '편입'} />
)}
{type !== null && (
<ChatCard
role="system"
content={`안녕하세요 입학처 챗봇 MARU-EGG입니다!
궁금하신 내용 안내 도와드리겠습니다.
`}
/>
)}
{messages.map((msg, index) => {
return <ChatCard key={index} content={msg.content} role={msg.role} />;
})}
</div>
{type !== null && (
<div className="fixed bottom-0 w-full bg-white px-4 py-3">
<ChatForm type={type} />
</div>
)}
</div>
);
};
Expand Down

0 comments on commit df1a5a6

Please sign in to comment.