Skip to content

Commit 7821606

Browse files
authored
Merge pull request #8 from Snowgent/feature/#3-onboarding
#3 [CHORE] 온보딩 페이지 마무리
2 parents 7695a7a + abb23ab commit 7821606

File tree

7 files changed

+50
-17
lines changed

7 files changed

+50
-17
lines changed

src/api/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
export const apiClient = axios.create({
4-
baseURL: import.meta.env.VITE_API_BASE_URL || 'https://backendbase.site',
4+
baseURL: 'https://backendbase.site',
55
headers: {
66
'Content-Type': 'multipart/form-data',
77
},

src/components/chat/FileSendButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useRef, useState } from 'react';
2-
import { apiClient } from '../../api/api';
32
import axios from 'axios';
43

54
interface UploadResponse {
@@ -32,9 +31,11 @@ const FileSendButton = ({ onUploadSuccess }: FileSendButtonProps) => {
3231
const formData = new FormData();
3332
formData.append('file', file);
3433

34+
const uploadUrl = import.meta.env.VITE_UPLOAD_URL;
35+
console.log('Uploading to:', uploadUrl);
3536
console.log('Uploading file:', file.name);
3637

37-
const response = await apiClient.post<UploadResponse>('/chat/upload', formData, {
38+
const response = await axios.post<UploadResponse>(uploadUrl, formData, {
3839
headers: {
3940
'Content-Type': 'multipart/form-data',
4041
},

src/components/onboarding/FormButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const FormButton = ({ type, onClick }: { type: string; onClick: () => void }) => {
22
const buttonStyle =
3-
'bg-[#1d4ed8] w-full text-white py-3 rounded-lg text-center font-medium cursor-pointer';
3+
'bg-[#0D2D84] w-full text-white py-3 rounded-lg text-center font-medium cursor-pointer';
44

55
const grayButtonStyle =
66
'bg-gray-300 w-full text-gray-700 py-3 rounded-lg text-center font-medium cursor-pointer';

src/components/onboarding/MultiSelect.tsx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
1-
const MultiSelect = ({ title }: { title: string }) => {
1+
import { useState } from 'react';
2+
3+
interface MultiSelectProps {
4+
title: string;
5+
options?: string[];
6+
}
7+
8+
const MultiSelect = ({
9+
title,
10+
options = ['10대 이하', '20대', '30대', '40대', '50대', '60대 이상'],
11+
}: MultiSelectProps) => {
12+
const [selectedOptions, setSelectedOptions] = useState<string[]>([]);
13+
14+
const toggleOption = (option: string) => {
15+
setSelectedOptions((prev) =>
16+
prev.includes(option) ? prev.filter((item) => item !== option) : [...prev, option],
17+
);
18+
};
19+
220
return (
321
<div className="flex flex-col gap-6">
422
{/* 제목 */}
523
<p className="text-[24px] font-semibold">{title}을 선택하세요</p>
6-
{/* 입력칸 */}
7-
<input type="text" className="rounded-xl border border-gray-200 px-2 py-4 text-[20px]" />
24+
{/* 6개 그리드 버튼 */}
25+
<div className="grid grid-cols-2 gap-4 md:grid-cols-3">
26+
{options.map((option, index) => (
27+
<button
28+
key={index}
29+
onClick={() => toggleOption(option)}
30+
className={`rounded-xl border-2 px-4 py-8 text-[18px] font-medium duration-200 ${
31+
selectedOptions.includes(option)
32+
? 'border-[#0D2D84] bg-[#0D2D84] text-white'
33+
: 'border-gray-200 bg-white text-gray-700 hover:bg-gray-50'
34+
}`}
35+
>
36+
{option}
37+
</button>
38+
))}
39+
</div>
840
</div>
941
);
1042
};

src/components/onboarding/SingleSelect.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const defaultOptions = [
2-
{ id: 1, name: 'option1' },
3-
{ id: 2, name: 'option2' },
4-
{ id: 3, name: 'option3' },
5-
{ id: 4, name: 'option4' },
6-
{ id: 5, name: 'option5' },
7-
{ id: 6, name: 'option6' },
8-
{ id: 7, name: 'option7' },
2+
{ id: 1, name: '식품 소분업' },
3+
{ id: 2, name: '기타식품판매업' },
4+
{ id: 3, name: '일반음식점' },
5+
{ id: 4, name: '휴게음식점' },
6+
{ id: 5, name: '제과점' },
7+
{ id: 6, name: '단란주점/유흥주점' },
8+
{ id: 7, name: '즉석판매제조·가공업' },
99
];
1010

1111
const SingleSelect = ({ title }: { title: string }) => {

src/pages/chat/ChatPageTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default function ChatPageTest() {
123123
{
124124
id: Date.now().toString(),
125125
role: 'assistant',
126-
content: '업로드 완료되었습니다. 재고 관리 채팅을 시작하세요',
126+
content: '재고 파일이 업로드 완료되었습니다. \n 채팅을 시작해보세요 !',
127127
},
128128
]);
129129
};

src/pages/onboarding/Onboarding.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import MultiSelect from '../../components/onboarding/MultiSelect';
1010
const Onboarding = () => {
1111
const navigate = useNavigate();
1212
const [currentStep, setCurrentStep] = useState(1);
13-
const totalSteps = 5;
13+
const totalSteps = 6;
1414

1515
const handlePrev = () => {
1616
if (currentStep > 1) {
@@ -58,7 +58,7 @@ const Onboarding = () => {
5858
</div>
5959
<div className="h-2 w-full rounded-full bg-gray-200">
6060
<div
61-
className="h-2 rounded-full bg-blue-500 transition-all duration-300"
61+
className="h-2 rounded-full bg-[#0D2D84] transition-all duration-300"
6262
style={{ width: `${(currentStep / totalSteps) * 100}%` }}
6363
/>
6464
</div>

0 commit comments

Comments
 (0)