Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into feature/Choco-Express#22
  • Loading branch information
Chaem03 committed Sep 24, 2024
2 parents e521707 + 1673f57 commit 96661b9
Show file tree
Hide file tree
Showing 20 changed files with 376 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
VITE_BASE_URL=https://api.choco-express.site
VITE_BASE_URL=https://api.choco-express.site
VITE_KAKAO_KEY=b76dd44adf31465496f17842634d7c6b
VITE_KAKAO_ID=112476
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
uses: actions/checkout@v3
- name: Create .env file
run: |
echo "VITE_BASE_URL=${{ secrets.VITE_BASE_URL }}" > .env
echo "VITE_BASE_URL=${{ secrets.VITE_BASE_URL }}" >> .env
echo "VITE_KAKAO_KEY=${{ secrets.VITE_KAKAO_KEY }}" >> .env
echo "VITE_KAKAO_ID=${{ secrets.VITE_KAKAO_ID }}" >> .env
- name: Node.js
uses: actions/setup-node@v3
with:
Expand Down
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
<script
src="https://t1.kakaocdn.net/kakao_js_sdk/2.7.2/kakao.min.js"
integrity="sha384-TiCUE00h649CAMonG018J2ujOgDKW/kVWlChEuu4jK2vxfAAD0eZxzCKakxg55G4"
crossorigin="anonymous"
></script>
</body>
</html>
90 changes: 90 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
},
"dependencies": {
"axios": "^1.7.7",
"html2canvas": "^1.4.1",
"js-cookie": "^3.0.5",
"react": "^18.3.1",
"react-device-detect": "^2.2.3",
"react-dom": "^18.3.1",
"react-frame-component": "^5.2.7",
"react-router-dom": "^6.26.1",
Expand Down
9 changes: 9 additions & 0 deletions src/assets/images/bird.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions src/components/ChocoCheck/ChocoCheck22.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ const ChocoCheck22 = ({ currentPage, itemsPerPage, chocoData, error }) => {
const startIndex = (currentPage - 1) * itemsPerPage;
const currentItems = chocoData.slice(startIndex, startIndex + itemsPerPage);

// * handleChocoClick 함수가 수정되었습니다.
const handleChocoClick = (id, chocoType) => {
// chocoType 인자를 추가
// chocoType 인자
setSelectedChocoId(id);
console.log("Clicked Choco Id:", id, "Choco Type:", chocoType); // chocoType을 콘솔에 출력
navigate(`/detailletter/${id}`, { state: { chocoType } }); // * chocoType을 state로 함께 전달
console.log("Clicked Choco Id:", id, "Choco Type:", chocoType);
navigate(`/detailletter/${id}`, { state: { chocoType } }); // * chocoType을 state로
};

if (error) {
Expand All @@ -32,7 +31,6 @@ const ChocoCheck22 = ({ currentPage, itemsPerPage, chocoData, error }) => {
return (
<S.Card
key={item.id}
// * handleChocoClick 호출 시 chocoType을 인자로 추가
onClick={() => handleChocoClick(item.id, item.chocoType)}
selected={selectedChocoId === item.id}
>
Expand Down
5 changes: 2 additions & 3 deletions src/components/ChocoCheck/ChocoCheck33.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ const ChocoCheck33 = ({ currentPage, itemsPerPage, chocoData, error }) => {
const startIndex = (currentPage - 1) * itemsPerPage;
const currentItems = chocoData.slice(startIndex, startIndex + itemsPerPage);

// * handleChocoClick 함수가 수정되었습니다.
const handleChocoClick = (id, chocoType) => {
// chocoType 인자를 추가
// chocoType 추가
setSelectedChocoId(id);
console.log("Clicked Choco Id:", id, "Choco Type:", chocoType); // chocoType을 콘솔에 출력
console.log("Clicked Choco Id:", id, "Choco Type:", chocoType);
navigate(`/detailletter/${id}`, { state: { chocoType } }); // * chocoType을 state로 함께 전달
};

Expand Down
1 change: 1 addition & 0 deletions src/components/common/Heartbackground/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const ImgContainer = styled.div`

export const HEART = styled.img`
display: flex;
width: 100%;
`;
export const Logo = styled.img`
display: flex;
Expand Down
17 changes: 17 additions & 0 deletions src/hooks/useFormattedDate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { useState, useEffect } from "react";

export const useFormattedDate = (isoDate) => {
const [formattedDate, setFormattedDate] = useState("");

useEffect(() => {
const date = new Date(isoDate);
const formatted = date.toLocaleDateString("ko-KR", {
year: "numeric",
month: "long",
day: "numeric",
});
setFormattedDate(formatted);
}, [isoDate]);

return formattedDate;
};
8 changes: 5 additions & 3 deletions src/pages/DetailLetter/DetailLetter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,21 @@ const DetailLetter = () => {
const { chocoType } = state || {}; // * chocoType

// * chocoType과 letter 이미지 매핑
const letterDesignId = chocoType ? chocoType : 1; // chocoType을 사용하여 letterDesignId 결정
const letterDesignId = chocoType ? chocoType : 1;

const selectedLetter = LETTERS.find((letter) => letter.id === letterDesignId);

// 아래로는 삭제 코드
// 아래로는 삭제 코드 수정
const handleDeleteClick = async () => {
try {
const response = await instance.delete(`/api/choco/${id}`);

if (response.data) {
console.log("삭제가 완료되었습니다.");

navigate(-1);
} else {
console.error("Unexpected response structure:", response.data);
console.error("Unexpected response structure:", response);
alert("삭제에 실패했습니다.");
}
} catch (error) {
Expand Down
14 changes: 8 additions & 6 deletions src/pages/LoginPage/Styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const Wrapper = styled.div`
color: white;
gap: 20px;
height: 437px;
width: 100%;
align-items: center;
margin-top: 5rem;
`;
Expand All @@ -39,7 +40,7 @@ export const Btn_Kakaologin = styled.div`
cursor: pointer;
border-radius: 0.375rem; // 6px
background: #FEE500;
background: #fee500;
color: #000;
font-family: Pretendard;
Expand All @@ -60,8 +61,9 @@ export const Btn_Googlelogin = styled.div`
cursor: pointer;
border-radius: 0.375rem; // 6px
background: #FFF;
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.08), 0px 1px 2px 0px rgba(0, 0, 0, 0.25);
background: #fff;
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.08),
0px 1px 2px 0px rgba(0, 0, 0, 0.25);
color: rgba(0, 0, 0, 0.54);
font-family: Pretendard;
Expand All @@ -82,11 +84,11 @@ export const Btn_Naverlogin = styled.div`
cursor: pointer;
border-radius: 0.375rem; // 6px
background: #03C75A;
background: #03c75a;
color: #FFF;
color: #fff;
font-family: Pretendard;
font-size: 1.125rem; // 18px
font-style: normal;
font-weight: 600;
`;
`;
11 changes: 8 additions & 3 deletions src/pages/MyPage/MyPage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import * as S from "./style";
import { useNavigate } from "react-router-dom";
import HeartBackG from "@/components/common/Heartbackground/heartBackG";
import INSTA_URL from "@/assets/images/instaLogo.svg";
import { shareKakao } from "@/utils/shareKakao";

export const MyPage = ({ user = "test" }) => {
const navigate = useNavigate();
return (
<S.Container>
<HeartBackG />
Expand All @@ -16,10 +19,12 @@ export const MyPage = ({ user = "test" }) => {
<S.BoxBtn>상자 열어보기</S.BoxBtn>
</S.BtnContainer>
</S.BoxContainer>
<S.ShareBtn>URL 공유하고 더 많은 편지 받기</S.ShareBtn>
<S.ShareBtn>
<S.ShareBtn onClick={shareKakao}>
URL 공유하고 더 많은 편지 받기
</S.ShareBtn>
<S.ShareBtn onClick={() => navigate("/share")}>
<S.InstaLogo src={INSTA_URL} />
스토리로 상자 자랑하기
스토리로 자랑할 사진 다운 받기
</S.ShareBtn>
</S.Wrapper>
</S.Container>
Expand Down
1 change: 1 addition & 0 deletions src/pages/MyPage/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const ModifyBtn = styled.div`
top: 1rem;
right: 1.5rem;
position: absolute;
cursor: pointer;
`;

export const BoxImg = styled.div`
Expand Down
Loading

0 comments on commit 96661b9

Please sign in to comment.