Skip to content

Commit da16f49

Browse files
committed
[feat] 추천페이지 비로그인 유저시 preview 컴포넌트 추가
1 parent 244be2b commit da16f49

File tree

3 files changed

+86
-2
lines changed

3 files changed

+86
-2
lines changed

src/app/recommend/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
'use client';
2+
13
import ChatSection from '@/domains/recommend/components/ChatSection';
24
import Bg from '@/shared/assets/images/recommend_bg.webp';
5+
import { useAuthStore } from '@/domains/shared/store/auth';
6+
import ChatPreview from '@/domains/recommend/components/ChatPreview';
37

48
function Page() {
9+
const { user } = useAuthStore();
10+
511
return (
612
<div
713
className="relative bg-repeat bg-auto w-full flex flex-col"
814
style={{ backgroundImage: `url(${Bg.src})` }}
915
>
1016
<h1 className="sr-only">취향추천하기</h1>
11-
<ChatSection />
17+
{user ? <ChatSection /> : <ChatPreview />}
1218
</div>
1319
);
1420
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import Ssury from '@/shared/assets/ssury/ssury_shaker.webp';
2+
import Image from 'next/image';
3+
import Send from '@/shared/assets/icons/send_36.svg';
4+
import Link from 'next/link';
5+
import { setPreLoginPath } from '@/domains/shared/auth/utils/setPreLoginPath';
6+
7+
function ChatPreview() {
8+
return (
9+
<section className="relative flex-1 flex flex-col w-full">
10+
<div className="page-layout max-w-1024 py-12">
11+
<article aria-label="취향추천 챗봇 메시지" className="">
12+
<header className="flex items-end">
13+
<div className="relative w-15 md:w-20 h-15 md:h-20">
14+
<Image
15+
src={Ssury}
16+
alt="쑤리아바타"
17+
width={80}
18+
height={80}
19+
className="object-cover w-15 h-15 md:w-20 md:h-20"
20+
/>
21+
</div>
22+
<p>쑤리</p>
23+
</header>
24+
25+
{/* 메시지 그룹 */}
26+
<div className="flex flex-col gap-3 mt-3 pl-3">
27+
<div>
28+
<div className="flex flex-col w-fit max-w-[80%] min-w-[120px] p-3 rounded-2xl rounded-tl-none bg-white text-black opacity-0 animate-fadeIn">
29+
<div>
30+
<p className="whitespace-pre-line">취향에 맞는 칵테일, 저와 함께 찾아볼까요?</p>
31+
<Link
32+
href="/login"
33+
onNavigate={async () => {
34+
await setPreLoginPath(window.location.pathname);
35+
}}
36+
className="block p-2 mt-3 flex-center font-semibold bg-gray-light rounded-3xl hover:bg-secondary hover:shadow-[inset_0_0_6px_rgba(255,196,1,1)] active:bg-secondary active:shadow-[inset_0_0_6px_rgba(255,196,1,1)]"
37+
>
38+
간편 로그인으로 빠르게 이용하기
39+
</Link>
40+
</div>
41+
</div>
42+
</div>
43+
</div>
44+
</article>
45+
46+
<div className="fixed left-0 bottom-0 w-full px-3 py-4 flex-center bg-primary">
47+
<form onSubmit={(e) => e.preventDefault()} className="w-full max-w-[64rem]">
48+
<div className="flex items-end gap-2">
49+
<label htmlFor="chatInput" className="sr-only">
50+
질문 입력창
51+
</label>
52+
<textarea
53+
id="chatInput"
54+
name="chatInput"
55+
placeholder={'로그인 후 이용해주세요.'}
56+
disabled
57+
className={`
58+
w-[calc(100%-3rem)] md:w-[calc(100%-3.75rem)] px-4 py-2 md:py-3.5
59+
rounded-lg h-[40px] md:h-[52px] max-h-[160px] md:max-h-[280px]
60+
bg-white text-primary placeholder:text-gray-dark resize-none outline-none
61+
disabled:bg-gray disabled:text-gray-dark disabled:cursor-not-allowed
62+
`}
63+
/>
64+
<button
65+
type="button"
66+
aria-label="보내기"
67+
className="flex-center w-10 md:w-13 h-10 md:h-13 rounded-xl border-1 border-white bg-secondary/20"
68+
>
69+
<Send className="text-secondary" />
70+
</button>
71+
</div>
72+
</form>
73+
</div>
74+
</div>
75+
</section>
76+
);
77+
}
78+
export default ChatPreview;

src/domains/recommend/components/ChatSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import { useState } from 'react';
44
import MessageInput from './user/MessageInput';
55
import { fetchSendStepMessage, fetchSendTextMessage } from '../api/chat';
6-
import { useAuthStore } from '@/domains/shared/store/auth';
76
import { ChatMessage, stepPayload } from '../types/recommend';
87
import ChatList from './ChatList';
98
import { useChatInit } from '../hook/useChatInit';
109
import { useSelectedOptions } from '../hook/useSelectedOptions';
10+
import { useAuthStore } from '@/domains/shared/store/auth';
1111

1212
function ChatSection() {
1313
const [messages, setMessages] = useState<ChatMessage[]>([]);

0 commit comments

Comments
 (0)