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/#119] 반려동물 등록 연결 완 #123

Merged
merged 40 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4daeedd
design: 버튼 레이아웃 수정
yarimu Jan 18, 2025
6216b92
fix: placeholder 명 수정
yarimu Jan 18, 2025
cfd4013
feat: step4에서 폼 제출 함수 제거
yarimu Jan 18, 2025
965a6bb
design: 버튼 레이아웃 조정
yarimu Jan 18, 2025
392acc7
design: 부위 뷰 레이아웃 조정
yarimu Jan 18, 2025
49c3479
rename: 폴더명 변경 및 구조 이동
yarimu Jan 18, 2025
019ac61
chore: import 경로 수정
yarimu Jan 18, 2025
99d3fc3
feat: 질병까지 연결
yarimu Jan 18, 2025
828ee7e
design: 하단 버튼 레이아웃 조정
yarimu Jan 18, 2025
4e04c91
feat: 부위 선택 제한
yarimu Jan 18, 2025
52cee75
feat: 증상까지 연결하고 목데이터 분리했는데 질병도 담기는 오류
yarimu Jan 19, 2025
cce4a2e
fix: 폼 제출 오류 해결
yarimu Jan 19, 2025
e0b9720
feat: 뒤로가기 버튼 구현
yarimu Jan 19, 2025
173dd95
feat: 증상 컴포넌트 뒤로가기 구현
yarimu Jan 19, 2025
a49d758
chore: 오타수정
yarimu Jan 19, 2025
be158f3
chore: 콘솔 제거
yarimu Jan 19, 2025
7fdffaa
feat: 반려동물 등록 최종 연결
yarimu Jan 19, 2025
f9a5fd7
feat: 질병 선택시 증상에서 질병이동 구현(반려동물 등록 연결 최종)
yarimu Jan 19, 2025
fec14a6
fix: 오류 해결중
yarimu Jan 19, 2025
e9b15ec
fix: 모든 문제 해결
yarimu Jan 19, 2025
9ef73b9
rename: 핸들 함수 네이밍 변경
yarimu Jan 19, 2025
a2f719d
fix: 증상은 제출 안되는 문제 해결
yarimu Jan 20, 2025
6db4669
comment: api추가 부분 주석
yarimu Jan 20, 2025
a533e62
feat: 타입, 함수 작성(동물 종류 조회 api)
yarimu Jan 20, 2025
90bc7fc
chore: 목데이터 삭제
yarimu Jan 20, 2025
d9aeab5
feat: (죄송합니다) petType api 연결
yarimu Jan 20, 2025
b6802bd
design: 로그인 페이지 퍼블리싱
yarimu Jan 20, 2025
832c209
feat: 온보딩 플로우 연결
yarimu Jan 20, 2025
2aea16d
fix: api형식에 바꾼 공통 컴포넌트 사용하는 컴포넌트 수정
yarimu Jan 20, 2025
3f7991d
design: 색상 변경사항 반영
yarimu Jan 20, 2025
bd1fe6f
feat: UX Writing 변경사항 반영
yarimu Jan 20, 2025
dfdea1a
design: 이미지 첨부
yarimu Jan 20, 2025
588d9fb
chore: 파일명 수정
yarimu Jan 20, 2025
1fd8382
fix: TextField 공통 컴포넌트 수정
yarimu Jan 20, 2025
ea9ae2d
feat: 프로그래스바 추가
yarimu Jan 20, 2025
e919e31
design: 세부 레이아웃 조정
yarimu Jan 20, 2025
59bca96
feat: 질병&증상 신체조회 api 연동
yarimu Jan 20, 2025
82f4f70
chore: 안쓰는 파일 삭제
yarimu Jan 20, 2025
6eb9630
refactor: 폼제출 로직 변경
yarimu Jan 20, 2025
96dac5b
refactor: 참 거짓 관련 코드리뷰 반영
yarimu Jan 20, 2025
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
3 changes: 3 additions & 0 deletions public/svgs/ic_Left Icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/api/domain/registerPet/animal/hook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useQuery } from "@tanstack/react-query";
import { getAnimal } from "@api/domain/registerPet/animal/index";

export const ANIMALS_QUERY_KEY = {
ANIMALS_QUERY_KEY: () => ["animals"],
};

export const useAnimalGet = () => {
return useQuery({
queryKey: ANIMALS_QUERY_KEY.ANIMALS_QUERY_KEY(),
queryFn: () => {
return getAnimal();
},
});
};
10 changes: 10 additions & 0 deletions src/api/domain/registerPet/animal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { paths } from "@type/schema";
import { API_PATH } from "@api/constants/apiPath";
import { get } from "@api/index";

export type animalGetResponse = paths["/api/dev/animals"]["get"]["responses"]["200"]["content"]["*/*"];

export const getAnimal = async () => {
const { data } = await get<animalGetResponse>(API_PATH.ANIMALS, {});
return data.data;
};
14 changes: 14 additions & 0 deletions src/api/domain/registerPet/bodies/hook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useQuery } from "@tanstack/react-query";
import { getBodies } from "@api/domain/registerPet/bodies/index";

export const BODY_QUERY_KEY = {
// 키값 동적으로
BODY_QUERY_KEY: (petProblem: string) => ["bodies", petProblem],
};

export const useBodiesGet = (petProblem: string) => {
return useQuery({
queryKey: BODY_QUERY_KEY.BODY_QUERY_KEY(petProblem),
queryFn: () => getBodies(petProblem),
});
};
14 changes: 14 additions & 0 deletions src/api/domain/registerPet/bodies/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { paths } from "@type/schema";
import { get } from "@api/index";
import { API_PATH } from "@api/constants/apiPath";

// 신체부위 조회 api
export type bodiesGetRequest = paths["/api/dev/bodies"]["get"]["parameters"]["query"];
export type bodiesGetResponse = paths["/api/dev/bodies"]["get"]["responses"]["200"]["content"]["*/*"];

export const getBodies = async (petProblem: string): Promise<bodiesGetResponse> => {
const validProblem = petProblem === "symptom" || petProblem === "disease" ? petProblem : "symptom";

const { data } = await get<bodiesGetResponse>(`${API_PATH.BODY}?petProblem=${validProblem}`);
return data;
};
Binary file added src/asset/image/genderBori.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/asset/image/genderCoco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/asset/image/image 1733.png
Binary file not shown.
Binary file added src/asset/image/nicknameCoco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/asset/image/petNameBori.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/asset/svg/IcLeftIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { SVGProps } from "react";
const SvgIcLeftIcon = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20" {...props}>
<path
fill="#222"
fillRule="evenodd"
d="M10 1.6c-4.97 0-9 3.113-9 6.952 0 2.388 1.558 4.493 3.932 5.745l-.999 3.647c-.088.323.28.58.563.393l4.377-2.889q.554.056 1.127.057c4.97 0 9-3.113 9-6.953S14.97 1.6 10 1.6"
clipRule="evenodd"
/>
</svg>
);
export default SvgIcLeftIcon;
9 changes: 5 additions & 4 deletions src/asset/svg/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export { default as Check } from "./Check";
export { default as IcBottomSheetLine } from "./IcBottomSheetLine";
export { default as IcoMessage } from "./IcoMessage";
export { default as IcoSkeleton } from "./IcoSkeleton";
export { default as IcEllipse57 } from "./IcEllipse57";
export { default as IcIcons } from "./IcIcons";
export { default as IcImagePlus } from "./IcImagePlus";
export { default as IcLeftIcon } from "./IcLeftIcon";
export { default as IcNormal } from "./IcNormal";
export { default as IcRight } from "./IcRight";
export { default as IcRightIcon } from "./IcRightIcon";
Expand All @@ -28,10 +27,12 @@ export { default as IcSearch } from "./IcSearch";
export { default as IcSearchFillter } from "./IcSearchFillter";
export { default as IcSearchFillterBlue } from "./IcSearchFillterBlue";
export { default as IcSettings } from "./IcSettings";
export { default as IcTemporary } from "./IcTemporary";
export { default as IcTest } from "./IcTest";
export { default as IcToastError } from "./IcToastError";
export { default as IcUp } from "./IcUp";
export { default as IcTemporary } from "./IcTemporary";
export { default as IcoMessage } from "./IcoMessage";
export { default as IcoSkeleton } from "./IcoSkeleton";
export { default as Plus } from "./Plus";
export { default as React } from "./React";
export { default as Vite } from "./Vite";
export { default as Vite } from "./Vite";
3 changes: 3 additions & 0 deletions src/common/component/TextField/styles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const styles = {
display: "flex",
alignItems: "center",
gap: "1rem",
width: "inherit",
},
}),
input: recipe({
Expand All @@ -61,6 +62,8 @@ export const styles = {
letterSpacing: "-0.28px",
fontWeight: 500,
height: "auto",
minWidth: "100%",

maxWidth: "100%",
color: color.gray.gray900,
border: "none",
Expand Down
20 changes: 19 additions & 1 deletion src/page/onboarding/index/Onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
import { useState } from "react";
import Login from "./component/Login/Login";
import Nickname from "./component/nickname/Nickname";
import Complete from "@page/onboarding/complete/Complete";

const Onboarding = () => {
return <></>;
const [step, setStep] = useState(0);

const getComponent = () => {
switch (step) {
case 0:
return <Login setStep={setStep} />;
case 1:
return <Nickname setStep={setStep}/>;
case 2:
return <Complete />;
}
};

return <>{getComponent()}</>;
};
export default Onboarding;
25 changes: 25 additions & 0 deletions src/page/onboarding/index/component/Login/Login.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { style } from "@vanilla-extract/css";
import { font } from "@style/styles.css";
export const layout = style({
display: "flex",
justifyContent: "center",
padding: "13.5rem 2rem 0 2rem",
});

export const buttonStyle = style([
font.body01,
{
position: "absolute",
bottom: "3.2rem",
width: "33.5rem",
display: "grid",
gridTemplateColumns: "auto 1fr",
justifyItems: "center",

height: "4.4rem",
padding: "1.2rem 2.8rem",

borderRadius: "8px",
backgroundColor: "#FEE500",
},
]);
28 changes: 28 additions & 0 deletions src/page/onboarding/index/component/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as styles from "./Login.css";
import { IcLeftIcon } from "@asset/svg";
import { IcoSkeleton } from "@asset/svg";


interface LoginProps {
setStep: React.Dispatch<React.SetStateAction<number>>;
}

const Login = ({ setStep }: LoginProps) => {
const handleLogin = () => {
// 로그인
setStep(1);
};

return (
<div className={styles.layout}>
<IcoSkeleton width={254} height={258} />
<div className={styles.buttonStyle} onClick={handleLogin}>
<IcLeftIcon width={20} height={20} />

<span>카카오톡 로그인</span>
</div>
</div>
);
};

export default Login;
12 changes: 8 additions & 4 deletions src/page/onboarding/index/component/nickname/Nickname.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import { useNavigate } from "react-router-dom";
import { ONBOARDING_GUIDE } from "@page/onboarding/index/constant/onboardingGuide";
import Title from "@page/onboarding/index/common/title/Title";
import Docs from "@page/onboarding/index/common/docs/Docs";
import onboardingImg from "@asset/image/image 1730.png";
import { validateNickname } from "@shared/util/validateNickname";
import { Button } from "@common/component/Button";
import { TextField } from "@common/component/TextField";
import nicknameCoco from "@asset/image/nicknameCoco.png";

const Nickname = () => {
interface NicknamePros {
setStep: React.Dispatch<React.SetStateAction<number>>;
}

const Nickname = ({ setStep }: NicknamePros) => {
// 상태 하나로 관리
const [nickname, setNickname] = useState("");

Expand All @@ -33,15 +37,15 @@ const Nickname = () => {

// 다음 버튼
const handleNext = () => {
console.log("다음 pr에서 구현할래욥.");
setStep(2);
};

return (
<>
{/* 상단 영역 */}
<div className={styles.layout}>
<div>
<img src={onboardingImg} alt="onboarding-character" className={styles.imgStyle} />
<img src={nicknameCoco} alt="onboarding-character" className={styles.imgStyle} />
<Title text={ONBOARDING_GUIDE.nickname.title} />
<Docs text={ONBOARDING_GUIDE.nickname.docs} />
</div>
Expand Down
32 changes: 16 additions & 16 deletions src/page/onboarding/index/constant/onboardingGuide.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// 워딩 최종 확인할 때 컴포넌트 명이랑 키값 맞추기
export const ONBOARDING_GUIDE = {
nickname: {
title: "사용할 닉네임을 입력해 주세요.",
docs: "닉네임은 2~8자 한글, 영문, 숫자만 가능해요!",
title: "사용할 닉네임을 입력해 주세요",
docs: "닉네임은 2~8자 한글, 영문, 숫자만 가능해요",
},
petName: {
title: "반려동물 이름을 알려주세요 !",
docs: "반려동물 이름을 8자 미만 한글만 가능해요",
title: "반려동물 이름을 알려주세요",
docs: "8자 이하 한글만 가능해요",
},
petType: {
title: "어떤 반려동물과 함께 하시나요 ?",
docs: "함께 생활하고 있는 반려동물을 선택해주세요.",
title: "어떤 반려동물과 함께 하시나요?",
docs: "함께 생활하고 있는 반려동물을 선택해주세요",
},
petGender: {
title: "반려동물의 성별을 알려주세요.",
docs: "중성화한 경우, 처음 성별을 선택해 주세요 !",
title: "반려동물의 성별을 알려주세요",
docs: "중성화한 경우, 처음 성별을 선택해 주세요",
},
petSpecies: {
title: "반려동물의 종류를 알려주세요.",
docs: "반려동물은 어떤 종인가요 ?",
title: "반려동물의 종류를 알려주세요",
docs: "반려동물은 어떤 종인가요?",
},
petAge: {
title: "반려동물의 나이를 입력해주세요 !",
docs: "몇 살인지 알려주세요 🐾",
title: "반려동물의 나이를 입력해주세요",
docs: "태어난 지 몇 년이나 되었는지 숫자로 입력해주세요",
},
isPetDisease: {
title: "반려동물 건강 관련 고민이 있나요?",
docs: "자세히 알려주시면 더 많은 도움을 드릴 수 있어요",
},
petDisease: {
title: "반려동물이 앓고 있는 질병이나 궁금한 병이 있나요 ?",
docs: "증상이 나타나는 부위가 어디인가요?",
title: "질병 부위를 선택하면 맞춤형 정보를 추천해드려요",
docs: "최대 2개까지 선택할 수 있어요",
},
petSymptom: {
title: "반려동물 증상이 나타나거나 궁금하신 부위가 어디인가요?",
docs: "증상이 나타나는 부위가 어디인가요?",
title: "증상 부위를 선택하면 맞춤형 정보를 추천해드려요",
docs: "최대 2개까지 선택할 수 있어요",
},
};
4 changes: 2 additions & 2 deletions src/page/registerPet/complete/Complete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Docs from "@page/onboarding/index/common/docs/Docs";
import Title from "@page/onboarding/index/common/title/Title";
import { Button } from "@common/component/Button";
import img from "@asset/image/beforeRegisterGraphic.png";

import { PATH } from "@route/path";
const Complete = () => {
const navigate = useNavigate();
const handleSkip = () => {
navigate("/main");
navigate(PATH.MAIN);
};

return (
Expand Down
Loading
Loading