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

[Refactor/#88] 2차 QA 전체 사항 수정 #93

Merged
merged 23 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
53589dd
refactor: scan data 타입 수정
sikkzz Feb 14, 2025
8d12a86
refactor: 홈 이동 모달 스타일 수정
sikkzz Feb 14, 2025
9d75d16
refactor: 키보드 위치 계산
sikkzz Feb 14, 2025
afa0029
refactor: 미사용 주석 삭제
sikkzz Feb 15, 2025
a8033b5
refactor: 이미지 변경, 홈 이동 모달 수정
sikkzz Feb 15, 2025
aec74d5
refactor: icon button color 수정
sikkzz Feb 15, 2025
e9b6ff1
refactor: select style state 수정
sikkzz Feb 15, 2025
b15c977
refactor: 홈 이동 모달 backdrop 클릭 삭제
sikkzz Feb 15, 2025
08bf8bc
refactor: 리뷰 생성 loading 로직 수정
sikkzz Feb 15, 2025
97d8538
refactor: global font 재설정
sikkzz Feb 15, 2025
b90a78f
feat: 말투 예시 모달 추가
sikkzz Feb 15, 2025
23e01f1
refactor: 영수증 인식 실패 페이지 이동 추가
sikkzz Feb 15, 2025
b7ac780
refactor: select style 여백 수정
sikkzz Feb 15, 2025
f849417
refactor: 말투 예시 데이터 수정
sikkzz Feb 15, 2025
0110235
feat: 리뷰 생성 실패 페이지 제작
sikkzz Feb 15, 2025
02a7550
feat: 리뷰 생성 실패 페이지 연결
sikkzz Feb 15, 2025
f24c389
refactor: meta viewport setting
sikkzz Feb 15, 2025
ab096a5
refactor: body scroll 속성 수정
sikkzz Feb 15, 2025
fd295f2
refactor: 그래픽 이미지 수정
sikkzz Feb 15, 2025
6d698bd
refactor: input 수정
sikkzz Feb 15, 2025
d0149c1
refactor: 이미지 lazy loading 추가
sikkzz Feb 15, 2025
590f953
refactor: 태그 추가 시 선택된 상태로 추가
sikkzz Feb 15, 2025
985d760
refactor: 영수증 정보 스크롤 수정
sikkzz Feb 15, 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
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"
/>
<title>misik</title>
</head>
<body>
Expand Down
Binary file added public/assets/img/img-graphic-logo-blur.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 modified public/assets/img/img-graphic-logo.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 modified public/assets/img/img-style-cute.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 modified public/assets/img/img-style-friendly.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 modified public/assets/img/img-style-trust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions src/components/CreateReviewLoading/CreateReviewLoading.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Home/Home.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
margin-top: 3.75rem;

& > img {
width: 14.375rem;
height: 14.375rem;
width: 22.5rem;
height: 22.5rem;
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ const Home = () => {

const { scanData } = useScanDataStore();

const { navigateToReceiptEdit } = useRoute();
const { navigateToReceiptEdit, navigateToRecognitionFail } = useRoute();

useEffect(() => {
if (scanData.parsed && scanData.parsed.length > 0) {
if (scanData === "error") {
navigateToRecognitionFail();
}

if (typeof scanData !== "string" && scanData.parsed && scanData.parsed.length > 0) {
navigateToReceiptEdit();
}
}, [scanData]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.Modal {
padding: 1.875rem 1.25rem 1.25rem;
display: flex;
flex-direction: column;
align-items: center;

& > p {
margin-top: 0.375rem;
Expand All @@ -16,25 +19,3 @@
width: 8.75rem;
}
}

.ShowButtonWrapper {
display: flex;
align-items: flex-end;
justify-content: center;
justify-self: center;
gap: 0.375rem;
margin-top: 0.25rem;
width: 6.6875rem;
height: 1.75rem;
cursor: pointer;

& > svg > path {
fill: rgba(0, 0, 0, 0.15);
}

&.isChecked {
& > svg > path {
fill: rgb(54, 54, 66);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { useState } from "react";

import classNames from "classnames";

import styles from "@/components/HomeNavigateConfirmModal/HomeNavigateConfirmModal.module.scss";
import Button from "@/components/ui/Button/Button";
import Icon from "@/components/ui/Icon/Icon";
import Modal from "@/components/ui/Modal/Modal";
import Text from "@/components/ui/Text/Text";

Expand All @@ -18,13 +13,8 @@ interface HomeNavigateConfirmModalProps {
}

const HomeNavigateConfirmModalStory = ({ isOpen, handleClose }: HomeNavigateConfirmModalProps) => {
const [isShowButtonChecked, setIsShowButtonChecked] = useState(false);

const handleShowButtonClick = () => {
setIsShowButtonChecked((prev) => !prev);
};
return (
<Modal isOpen={isOpen} onClose={handleClose}>
<Modal isOpen={isOpen}>
<div className={styles.Modal}>
<Text variant="titleSm" color="primary" align="center" as="h2">
홈으로 가시겠어요?
Expand All @@ -36,17 +26,6 @@ const HomeNavigateConfirmModalStory = ({ isOpen, handleClose }: HomeNavigateConf
<Button text="아니요" variant="tertiary" onClick={handleClose} />
<Button text="네" variant="primary" onClick={handleClose} />
</div>
<button
className={classNames(styles.ShowButtonWrapper, {
[styles.isChecked]: isShowButtonChecked,
})}
onClick={handleShowButtonClick}
>
<Icon name="checkCircle" />
<Text variant="bodyXsm" color={isShowButtonChecked ? "primary" : "tertiary"}>
다시 안볼래요
</Text>
</button>
</div>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { useState } from "react";

import classNames from "classnames";

import styles from "@/components/HomeNavigateConfirmModal/HomeNavigateConfirmModal.module.scss";
import Button from "@/components/ui/Button/Button";
import Icon from "@/components/ui/Icon/Icon";
import Modal from "@/components/ui/Modal/Modal";
import Text from "@/components/ui/Text/Text";

Expand All @@ -14,35 +9,27 @@ import { useGenerateReviewStore } from "@/store/useGenerateReviewStore";
import { useCreateReviewStore } from "@/store/useReviewStore";
import { useScanDataStore } from "@/store/useScanDataStore";

interface HomeNavigateConfirmModalProps {
export interface ModalProps {
isOpen: boolean;
handleClose: () => void;
}

const HomeNavigateConfirmModal = ({ isOpen, handleClose }: HomeNavigateConfirmModalProps) => {
const HomeNavigateConfirmModal = ({ isOpen, handleClose }: ModalProps) => {
const { navigateToHome } = useRoute();

const { resetGenerateReviewData } = useGenerateReviewStore();
const { resetCreateReviewData } = useCreateReviewStore();
const { resetScanData } = useScanDataStore();

// 이후 상태 초기값 재설정
const [isShowButtonChecked, setIsShowButtonChecked] = useState(false);

const handleShowButtonClick = () => {
setIsShowButtonChecked((prev) => !prev);
};

const handleNavigateHome = () => {
handleClose();
resetGenerateReviewData();
resetCreateReviewData();
resetScanData();
navigateToHome();
};

return (
<Modal isOpen={isOpen} onClose={handleClose}>
<Modal isOpen={isOpen}>
<div className={styles.Modal}>
<Text variant="titleSm" color="primary" align="center" as="h2">
홈으로 가시겠어요?
Expand All @@ -54,17 +41,6 @@ const HomeNavigateConfirmModal = ({ isOpen, handleClose }: HomeNavigateConfirmMo
<Button text="아니요" variant="tertiary" onClick={handleClose} />
<Button text="네" variant="primary" onClick={handleNavigateHome} />
</div>
<button
className={classNames(styles.ShowButtonWrapper, {
[styles.isChecked]: isShowButtonChecked,
})}
onClick={handleShowButtonClick}
>
<Icon name="checkCircle" />
<Text variant="bodyXsm" color={isShowButtonChecked ? "primary" : "tertiary"}>
다시 안볼래요
</Text>
</button>
</div>
</Modal>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/ReceiptEdit/ReceiptEdit.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
padding-bottom: 2.5rem;
height: calc(100vh - 2.75rem);
overflow: hidden;
overflow-y: auto;
position: relative;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -52,4 +53,5 @@
align-items: center;
gap: 0.875rem;
z-index: 1;
margin-top: 2.5rem;
}
67 changes: 53 additions & 14 deletions src/components/ReceiptEdit/ReceiptEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,44 @@ import { useRoute } from "@/hooks/common/useRoute";
import { useCreateReviewStore } from "@/store/useReviewStore";
import { useScanDataStore } from "@/store/useScanDataStore";

const useKeyboardAvoidance = () => {
const [keyboardVisible, setKeyboardVisible] = useState(false);
const [keyboardHeight, setKeyboardHeight] = useState(0);

useEffect(() => {
const handleVisualViewportChange = () => {
const isKeyboardVisible = !!(
window.visualViewport && window.visualViewport.height < window.innerHeight
);
setKeyboardVisible(isKeyboardVisible);

if (isKeyboardVisible) {
setKeyboardHeight(
window.visualViewport ? window.innerHeight - window.visualViewport.height : 0,
);
} else {
setKeyboardHeight(0);
}
};

if (window.visualViewport) {
window.visualViewport.addEventListener("resize", handleVisualViewportChange);
handleVisualViewportChange();
}

return () => {
if (window.visualViewport) {
window.visualViewport.removeEventListener("resize", handleVisualViewportChange);
}
};
}, []);

return { keyboardVisible, keyboardHeight };
};

const ReceiptEdit = () => {
const { keyboardVisible, keyboardHeight } = useKeyboardAvoidance();

const { navigateToHome, navigateToSelectTag } = useRoute();

const { scanData, resetScanData } = useScanDataStore();
Expand All @@ -21,14 +58,16 @@ const ReceiptEdit = () => {
const [focusState, setFocusState] = useState<{ [key: string]: boolean }>({});

useEffect(() => {
if (Array.isArray(scanData.parsed) && scanData.parsed.length > 0) {
if (
typeof scanData !== "string" &&
Array.isArray(scanData.parsed) &&
scanData.parsed.length > 0
) {
setFormData(scanData.parsed);

const initialFocusState = scanData.parsed.reduce(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(acc: any, data: any) => {
const keys = Object.keys(data);
keys.forEach((key) => (acc[key] = false));
(acc: { [key: string]: boolean }, data: { key: string; value: string }) => {
acc[data.key] = false;
return acc;
},
{} as { [key: string]: boolean },
Expand All @@ -45,14 +84,9 @@ const ReceiptEdit = () => {
setFocusState((prevState) => ({ ...prevState, [key]: false }));
};

const handleInputChange = (index: number, key: string, value: string) => {
const handleInputChange = (key: string, value: string) => {
setFormData((prevData) =>
prevData.map((item, idx) => {
if (idx === index) {
return { ...item, [key]: value };
}
return item;
}),
prevData.map((item) => (item.key === key ? { ...item, value } : item)),
);
};

Expand Down Expand Up @@ -105,15 +139,20 @@ const ReceiptEdit = () => {
onFocus={() => handleFocus(data.key)}
onBlur={() => handleBlur(data.key)}
isFocus={focusState[data.key] || false}
onChange={(e) => handleInputChange(index, data.key, e.target.value)}
onChange={(e) => handleInputChange(data.key, e.target.value)}
/>
</div>
</div>
))}
</div>
</div>

<div className={styles.Bottom}>
<div
className={styles.Bottom}
style={{
marginBottom: keyboardVisible ? `${keyboardHeight}px` : "0",
}}
>
{Object.values(focusState).some((isFocus) => isFocus) ? (
<Button
text="수정하기"
Expand Down
33 changes: 25 additions & 8 deletions src/components/SelectStyle/SelectStyle.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,31 @@
}
}

.Title {
.Top {
z-index: 1;
}

.Title {
margin-top: 2.5rem;

& > h2 {
margin-top: 0.625rem;
}
}

.ExampleButtonBox {
display: flex;
justify-content: center;
margin-top: 1rem;

button {
padding: 0.375rem 0.75rem;
border-radius: 0.875rem;
background-color: var(--color-white);
width: 5.9375rem;
}
}

.Image {
display: flex;
justify-content: center;
Expand All @@ -43,6 +59,14 @@
}
}

.Bottom {
z-index: 1;

button {
margin-top: 2.5rem;
}
}

.StyleButtonList {
display: flex;
flex-direction: column;
Expand All @@ -63,10 +87,3 @@
}
}
}

.Bottom {
display: flex;
align-items: center;
gap: 0.875rem;
z-index: 1;
}
Loading