Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 홈 화면 API 연동 #57

Merged
merged 27 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
41c18ab
feat: 로그인할 때 저장되는 유저 정보에 테스트 여부 추가 (#46)
AAminha May 18, 2024
a2a8d70
Merge branch 'develop' of https://github.com/KUSITMS-29th-TEAM-D/Fron…
AAminha May 18, 2024
75d9389
feat: 유저 상태에 따라 홈 화면이 다르게 구성되도록 구현 (#46)
AAminha May 18, 2024
2a4078c
fix: TopNavigation 모바일 버전 수정 및 상황에 따라 보여지는 뷰 다르게 구현 (#46)
AAminha May 18, 2024
7978627
fix: 특정 페이지만 foot가 보이도록 수정 ("#46)
AAminha May 18, 2024
3312ae4
design: 모바일 뷰 디자인 수정 (#46)
AAminha May 18, 2024
7492485
fix: 특정 페이지에서 메뉴 아이콘 안보이도록 수정 (#46)
AAminha May 18, 2024
d725f08
Merge branch 'develop' of https://github.com/KUSITMS-29th-TEAM-D/Fron…
AAminha May 22, 2024
f6acdb5
fix: DiagnoseSection 연결 path 수정 (#46)
AAminha May 22, 2024
db7ef99
fix: API 결과값에 맞게 수정 (#46)
AAminha May 22, 2024
f09e366
feat: SelectAmountModal 컴포넌트 구현 (#46)
AAminha May 22, 2024
e116438
fix: QA 반영
AAminha May 22, 2024
118f074
feat: NonTesterMemberView 수정 중 코드 참고를 위한 커밋 (#46)
AAminha May 22, 2024
d80108d
fix: API response 형식에 맞춰 RecommendSectionTemplate 수정 (#46)
AAminha May 22, 2024
914b983
fix: NonMemberView API 연동에 맞춰 수정 (#46)
AAminha May 22, 2024
9b06f16
fix: PreviewCard 컴포넌트 hot props 삭제 (#46)
AAminha May 22, 2024
0b274a7
design: DropdownContent 스크롤 속성 수정 (#46)
AAminha May 22, 2024
0412d51
feat: 홈 화면에 필요한 상수 추가 및 관련 타입 추가 (#46)
AAminha May 22, 2024
befffb3
feat: useDebounce 구현 및 프로그램 조회 관련 훅 구현 (#46)
AAminha May 22, 2024
bb100d3
feat: NonTesterMemberView API 연동 (#46)
AAminha May 22, 2024
f421b5a
fix: 최소금액보다 최대금액이 작을 경우 버튼 비활성화되도록 수정 (#46)
AAminha May 22, 2024
5711a02
feat: TestMemberView API 연동 (#46)
AAminha May 22, 2024
0ca1145
design: qa 수정 사항 반영
AAminha May 22, 2024
f7d07bc
style: qa 사항 반영
AAminha May 22, 2024
bc3fee6
feat: 브랜딩 프로그램 조회 (비로그인 ver) API 연동 및 잘못 연결된 API 교체 (#46)
AAminha May 22, 2024
58411fd
feat: SideNavigation에 로그아웃 기능 구현 (#46)
AAminha May 22, 2024
07c8dd0
Merge branch 'develop' of https://github.com/KUSITMS-29th-TEAM-D/Fron…
AAminha May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/apis/programAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { authClient, noAuthClient } from '@/apis/client';

export const programAPI = {
// 메인 홈 자기이해 프로그램 조회
getUnderstanding: async (start: number, end: number, programForm: string) => {
const requestInformation = {
startPrice: start,
endPrice: end === 0 ? null : end,
form: programForm.replace('·', ''),
};

const response = await authClient.post(
'/api/programs/home/self-understanding',
requestInformation
);
return response.data;
},
// 메인 홈 브랜딩 프로그램 조회
getBranding: async (interest: string[], imageKeywords: string[]) => {
const requestInformation: { [key: string]: string[] } = {};

if (interest.length > 0) {
requestInformation.interest = interest;
}

if (imageKeywords.length > 0) {
requestInformation.imageKeywords = imageKeywords;
}

const response = await authClient.post('/api/programs/home/branding', requestInformation);
return response.data;
},
// 메인 홈 브랜딩 프로그램 조회 (비로그인)
getBrandingNonLogin: async (interest: string[], imageKeywords: string[]) => {
const requestInformation: { [key: string]: string[] } = {};

if (interest.length > 0) {
requestInformation.interest = interest;
}

if (imageKeywords.length > 0) {
requestInformation.imageKeywords = imageKeywords;
}

const response = await noAuthClient.post(
'/api/programs/branding/non-login',
requestInformation
);
return response.data;
},
};
5 changes: 5 additions & 0 deletions src/apis/userAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ export const userAPI = {
const response = await noAuthClient.get(`/api/users/check-nickname/${nickname}`);
return response.data;
},
// 로그아웃
logout: async () => {
const response = await noAuthClient.post('/api/users/logout');
return response.data;
},
};
13 changes: 9 additions & 4 deletions src/components/DesignResultPage/ResultView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const ResultView = ({ children, definition, ...props }: ResultViewProps)
<span className="highlight">{userService.getUserNickname()}</span>님은 이런 브랜드가
되고 싶군요!
</div>
<div className="brand">{definition}</div>
<div className="brand">{definition}</div>
{children}
</StyledContent>
</StyledInnerContainer>
Expand Down Expand Up @@ -47,7 +47,7 @@ const StyledContent = styled.div`
align-items: center;
gap: 24px;

width: 830px;
width: 930px;

.title {
${({ theme }) => theme.font.desktop.title2};
Expand All @@ -59,8 +59,13 @@ const StyledContent = styled.div`
}

.brand {
${({ theme }) => theme.font.desktop.h2};
color: ${({ theme }) => theme.color.primary600};
// 디자인 시스템에 없는 폰트 스타일
font-family: 'Spoqa Han Sans Neo';
font-weight: 500;
font-size: 48px;
line-height: 48px;

color: ${({ theme }) => theme.color.gray900};
text-align: center;
margin-bottom: 32px;
word-break: keep-all;
Expand Down
2 changes: 1 addition & 1 deletion src/components/HomePage/BrandingSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const BrandingSection = ({ isLoggedIn }: BrandingSectionProps) => {
height="48px"
style={{ marginTop: '24px' }}
onClick={() => {
navigate('test/design');
navigate('/understand');
}}
>
자기이해 바로가기
Expand Down
3 changes: 3 additions & 0 deletions src/components/HomePage/CardCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ export const CardCarousel = ({ gap = '24px', children }: CardCarouselProps) => {
};

const SliderWrapper = styled.div<{ $gap: string }>`
width: 100%;

.slick-list {
padding: 5px;

.slick-track {
width: 100% !important;
display: flex;
gap: ${({ $gap }) => $gap};
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/HomePage/DiagnoseSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ import { SectionContainer } from '@/styles';

// TODO: 추후 페이지 경로 수정
const DIAGNOSE_CARD = [
{ title: 'Discover 이해', subtitle: '과거의 나와 대화하기', img: DiscoverImg, path: '/' },
{ title: 'Define 정의', subtitle: '성격/진단 테스트', img: DefineImg, path: '/' },
{ title: 'Design 설계', subtitle: '차별점 도출하기', img: DesignImg, path: '/' },
{
title: 'Discover 이해',
subtitle: '과거의 나와 대화하기',
img: DiscoverImg,
path: '/test/discover',
},
{ title: 'Define 정의', subtitle: '성격/진단 테스트', img: DefineImg, path: '/test/define' },
{ title: 'Design 설계', subtitle: '차별점 도출하기', img: DesignImg, path: '/test/design' },
];

export const DiagnoseSection = () => {
Expand Down
57 changes: 7 additions & 50 deletions src/components/HomePage/NonMemberView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,23 @@ import { useState } from 'react';

import { useTheme } from 'styled-components';

import TestImage from '@/assets/test1.png';
import { BrandingSection } from '@/components/HomePage/BrandingSection';
import { DiagnoseSection } from '@/components/HomePage/DiagnoseSection';
import { RecommendSectionTemplate } from '@/components/HomePage/RecommendSectionTemplate';
import { Dropdown } from '@/components/common/Dropdown/Dropdown';
import { IMAGE_KEYWORD_LIST, INTEREST_LIST } from '@/constants/onboarding';

const Dummy = [
{
id: 1,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: true,
path: '',
},
{
id: 2,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: true,
path: '',
},
{
id: 3,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: false,
path: '',
},
{
id: 4,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: false,
path: '',
},
{
id: 5,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: false,
path: '',
},
];
import { useGetBrandingProgramsNonLogin } from '@/hooks/useGetBrandingProgramsNonLogin';

export const NonMemberView = () => {
const [selectedInterest, setSelectedInterest] = useState<string[]>([]);
const [selectedKeywords, setSelectedKeywords] = useState<string[]>([]);
const theme = useTheme();

const { data: brandingPrograms } = useGetBrandingProgramsNonLogin(
selectedInterest,
selectedKeywords
);

return (
<>
<BrandingSection />
Expand All @@ -70,7 +27,7 @@ export const NonMemberView = () => {
title="나의 브랜딩을 위해"
subTitle="셀피스는 나를 더 잘 알기위한 프로그램을 추천해요."
backgroundColor={theme.color.white}
recommendItems={Dummy}
recommendItems={brandingPrograms}
refreshHandler={() => {
setSelectedInterest([]);
setSelectedKeywords([]);
Expand Down
109 changes: 42 additions & 67 deletions src/components/HomePage/NonTesterMemberView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,55 @@ import { useState } from 'react';

import styled, { css, useTheme } from 'styled-components';

import { ReactComponent as CheckIcon } from '@/assets/icons/check.svg';
import TestImage from '@/assets/test1.png';
import { BrandingSection } from '@/components/HomePage/BrandingSection';
import { RecommendSectionTemplate } from '@/components/HomePage/RecommendSectionTemplate';
import { Dropdown } from '@/components/common/Dropdown/Dropdown';
import { SelectAmountModal } from '@/components/common/Modal/SelectAmountModal';
import { IMAGE_KEYWORD_LIST, INTEREST_LIST } from '@/constants/onboarding';
import { useGetBrandingProgramsNonLogin } from '@/hooks/useGetBrandingProgramsNonLogin';
import { useGetUnderstandingPrograms } from '@/hooks/useGetUnderstandingProgram';

const Dummy = [
{
id: 1,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: true,
path: '',
},
{
id: 2,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: true,
path: '',
},
{
id: 3,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: false,
path: '',
},
{
id: 4,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: false,
path: '',
},
{
id: 5,
img: TestImage,
title:
'감성있는 이탈리안 파스타 만들기 감성있는 이탈리안 파스타 만들기ㄴㅇㄹㄴㅇㄹㄴㄹㄴㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㄴㅇㄹㅇ',
keywords: ['소통하는', '감성있는', '평화로운'],
hot: false,
path: '',
},
];

// TODO: 금액 모달 구현
export const NonTesterMemberView = () => {
const theme = useTheme();
const [selectedInterest, setSelectedInterest] = useState<string[]>([]);
const [selectedKeywords, setSelectedKeywords] = useState<string[]>([]);
const [selectedFree, setSelectedFree] = useState<boolean>(false);
/* const [showAmountModal, setShowAmountModal] = useState<boolean>(false); */
const [showAmountModal, setShowAmountModal] = useState<boolean>(false);
const [selectedProgramForm, setSelectedProgramForm] = useState('온·오프라인');
const [selectedAmount, setSelectedAmount] = useState<{ min: number; max: number }>({
min: 0,
max: 0,
});
const theme = useTheme();

const { data: brandingPrograms } = useGetBrandingProgramsNonLogin(
selectedInterest,
selectedKeywords
);
const { data: understandingPrograms } = useGetUnderstandingPrograms(
selectedAmount.min,
selectedAmount.max,
selectedProgramForm
);

return (
<>
{showAmountModal && (
<SelectAmountModal
selectedAmount={selectedAmount}
handleCancel={() => {
setShowAmountModal(false);
}}
handleConfirm={(newSelected) => {
setSelectedAmount(newSelected);
setShowAmountModal(false);
}}
/>
)}
Comment on lines +36 to +47
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모달창 호출

<BrandingSection isLoggedIn />
<RecommendSectionTemplate
title="나를 더 잘 이해하기 위해"
subTitle="나를 브랜딩할 수 있는 경험을 추천해드릴게요."
backgroundColor={theme.color.primary50}
recommendItems={Dummy}
recommendItems={brandingPrograms}
refreshHandler={() => {
setSelectedInterest([]);
setSelectedKeywords([]);
Expand Down Expand Up @@ -121,25 +95,16 @@ export const NonTesterMemberView = () => {
title="퍼스널브랜딩을 더 잘하고싶다면?"
subTitle="셀피스는 나를 더 잘 알기위한 프로그램을 추천해요."
backgroundColor={theme.color.white}
recommendItems={Dummy}
recommendItems={understandingPrograms}
refreshHandler={() => {
setSelectedFree(false);
setSelectedProgramForm('온·오프라인');
setSelectedAmount({ min: 0, max: 0 });
}}
>
<>
<StyledFilterButton
onClick={() => {
setSelectedFree((prev) => !prev);
}}
$active={selectedFree}
>
<CheckIcon />
<span>무료</span>
</StyledFilterButton>
<StyledFilterAmount
onClick={() => {
//setShowAmountModal((prev) => !prev);
setShowAmountModal((prev) => !prev);
}}
>
<span>금액</span>
Expand All @@ -150,6 +115,15 @@ export const NonTesterMemberView = () => {
<span className="unit">원</span>
</div>
</StyledFilterAmount>
<Dropdown
placeholder=""
contents={['온·오프라인', '온라인', '오프라인']}
selected={selectedProgramForm}
clickContentHandler={(newSelected: string) => {
setSelectedProgramForm(newSelected);
}}
width="312px"
/>
</>
</RecommendSectionTemplate>
</>
Expand Down Expand Up @@ -191,6 +165,7 @@ const StyledFilterAmount = styled(StyledFilterButton)`

div {
display: flex;
align-items: center;
gap: 4px;

.amount {
Expand Down
Loading