From a7c73decfcf0fcf62b15f8a080c6c1cb9462931e Mon Sep 17 00:00:00 2001 From: nirii00 Date: Tue, 11 Mar 2025 10:06:59 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=EB=82=B4=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EB=AC=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 58 ------------------- src/apis/share.ts | 12 +++- src/main.tsx | 14 ++--- .../LetterBoardDetail/components/Header.tsx | 6 +- src/pages/LetterBoardDetail/index.tsx | 33 +++++++++-- 5 files changed, 47 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 3a421e6..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: MAIN CI - -on: - push: - branches: - - main - -jobs: - Deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Install pnpm - run: | - npm install -g pnpm - - - name: Get pnpm store path - id: pnpm-cache-path - run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV - - - name: Cache pnpm modules - id: cache - uses: actions/cache@v3 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - ${{ runner.os }}- - - - name: Install Dependencies - run: | - pnpm install --frozen-lockfile - pnpm store prune - - - name: Set up .env file - run: | - echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > .env.production - echo "HTTPS=true" >> .env.production - - - name: Build - run: pnpm run build - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Deploy to S3 - run: aws s3 sync ./dist s3://${{ secrets.AWS_BUCKET_NAME }} --delete - - - name: Invalidate CloudFront Cache - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*" diff --git a/src/apis/share.ts b/src/apis/share.ts index 37a3087..8b44cba 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -163,7 +163,6 @@ export const postSharePostLike = async (sharePostId: string) => { return response.data; } catch (error) { console.error('❌ 편지 좋아요 중 에러가 발생했습니다', error); - throw new Error('편지 좋아요 실패'); } }; @@ -175,6 +174,15 @@ export const getSharePostLikeCount = async (sharePostId: string) => { return response.data; } catch (error) { console.error('❌ 편지 좋아요 갯수 조회 중 에러가 발생했습니다', error); - throw new Error('편지 좋아요 갯수 조회 실패'); + } +}; + +export const deleteSharePost = async (sharePostId: string) => { + try { + const response = await client.delete(`/api/share-post/${sharePostId}`); + if (!response) throw new Error('error while deleting post'); + return response; + } catch (error) { + console.error('❌ 편지 좋아요 갯수 조회 중 에러가 발생했습니다', error); } }; diff --git a/src/main.tsx b/src/main.tsx index 4df6fa6..41bea78 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -15,11 +15,11 @@ queryClient.setDefaultOptions({ }); createRoot(document.getElementById('root')!).render( - - - - - - - , + // + + + + + , + // , ); diff --git a/src/pages/LetterBoardDetail/components/Header.tsx b/src/pages/LetterBoardDetail/components/Header.tsx index 26c306e..437ef61 100644 --- a/src/pages/LetterBoardDetail/components/Header.tsx +++ b/src/pages/LetterBoardDetail/components/Header.tsx @@ -14,6 +14,7 @@ interface HeaderProps { isWriter: boolean; onToggleLike: () => void; onOpenReportModal: () => void; + onDeleteLetter: () => void; isShareLetterPreview?: boolean; } @@ -23,10 +24,10 @@ const Header = ({ isWriter, onToggleLike, onOpenReportModal, + onDeleteLetter, isShareLetterPreview = false, }: HeaderProps) => { const navigate = useNavigate(); - return (
@@ -46,8 +47,7 @@ const Header = ({

{likeCount}

{isWriter ? ( - // TODO: 게시물 삭제 - + ) : ( )} - + {!isShareMode && } ); }; diff --git a/src/pages/RandomLetters/index.tsx b/src/pages/RandomLetters/index.tsx index c1b12d9..d71c3d1 100644 --- a/src/pages/RandomLetters/index.tsx +++ b/src/pages/RandomLetters/index.tsx @@ -75,6 +75,14 @@ const RandomLettersPage = () => { }, []); return ( <> + {openSelectModal && ( + + )} {openSelectedDetailModal ? ( ) : ( @@ -103,15 +111,6 @@ const RandomLettersPage = () => { setOpenSelectedDetailModal={setOpenSelectedDetailModal} /> )} - - {openSelectModal && ( - - )} From 77a3550647819adac00f508347362451459beacf Mon Sep 17 00:00:00 2001 From: nirii00 Date: Tue, 11 Mar 2025 11:28:05 +0900 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=EB=A1=A4=EB=A7=81=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=ED=8D=BC=20=EA=B2=8C=EC=8B=9C=ED=8C=90=EC=97=90=EC=84=9C=20z-i?= =?UTF-8?q?ndex=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/RollingPaper/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/RollingPaper/index.tsx b/src/pages/RollingPaper/index.tsx index 28fc0f6..06069c1 100644 --- a/src/pages/RollingPaper/index.tsx +++ b/src/pages/RollingPaper/index.tsx @@ -129,8 +129,8 @@ const RollingPaperPage = () => { )} + - ); From e3e0865ba09c1b21f6242a1d87b37a39f6687912 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Tue, 11 Mar 2025 11:33:03 +0900 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=EA=B3=B5=EC=9C=A0=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EB=AC=BC=20=EC=83=81=EC=84=B8=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=BD=94=EB=A9=98=ED=8A=B8=20=EA=B8=B8=EC=96=B4?= =?UTF-8?q?=EC=A7=88=20=EA=B2=BD=EC=9A=B0=20=EB=B2=97=EC=96=B4=EB=82=98?= =?UTF-8?q?=EB=8A=94=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/LetterBoardDetail/components/Letter.tsx | 2 +- src/pages/LetterBoardDetail/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/LetterBoardDetail/components/Letter.tsx b/src/pages/LetterBoardDetail/components/Letter.tsx index 58c80a2..468366f 100644 --- a/src/pages/LetterBoardDetail/components/Letter.tsx +++ b/src/pages/LetterBoardDetail/components/Letter.tsx @@ -14,7 +14,7 @@ const Letter = ({ letter, isWriter = false }: LetterProps) => {

To. {letter.receiverZipCode}

-

{letter.content}

+

{letter.content}

From. {letter.writerZipCode}

diff --git a/src/pages/LetterBoardDetail/index.tsx b/src/pages/LetterBoardDetail/index.tsx index fbfd0c8..9c7ed31 100644 --- a/src/pages/LetterBoardDetail/index.tsx +++ b/src/pages/LetterBoardDetail/index.tsx @@ -126,7 +126,7 @@ const LetterBoardDetailPage = () => {

FROM. {postDetail?.zipCode}

From 6c19f1f2363d965fe7bf45efee8f8fd60d43a783 Mon Sep 17 00:00:00 2001 From: nirii00 Date: Tue, 11 Mar 2025 11:48:58 +0900 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=EB=9E=9C=EB=8D=A4=ED=8E=B8=EC=A7=80?= =?UTF-8?q?=20=EB=AA=A8=EB=8B=AC=20z-index=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/share.ts | 2 +- src/pages/RandomLetters/components/Matched.tsx | 4 +++- src/pages/RandomLetters/components/MatchedLetter.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/apis/share.ts b/src/apis/share.ts index 8b44cba..f12d4ec 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -183,6 +183,6 @@ export const deleteSharePost = async (sharePostId: string) => { if (!response) throw new Error('error while deleting post'); return response; } catch (error) { - console.error('❌ 편지 좋아요 갯수 조회 중 에러가 발생했습니다', error); + console.error('❌ 편지 삭제 중 에러가 발생했습니다', error); } }; diff --git a/src/pages/RandomLetters/components/Matched.tsx b/src/pages/RandomLetters/components/Matched.tsx index 0bc3857..3e58736 100644 --- a/src/pages/RandomLetters/components/Matched.tsx +++ b/src/pages/RandomLetters/components/Matched.tsx @@ -5,6 +5,7 @@ import { deleteRandomLetterMatching } from '@/apis/randomLetter'; import ResultLetter from '@/components/ResultLetter'; import { formatNumber } from '@/utils/formatNumber'; import { timeFormatter } from '@/utils/timeFormatter'; +import useToastStore from '@/stores/toastStore'; export default function Matched({ matchedLetter, @@ -18,6 +19,7 @@ export default function Matched({ setOpenSelectedDetailModal: React.Dispatch>; }) { const navigate = useNavigate(); + const setToastActive = useToastStore((state) => state.setToastActive); const [isDisabled, setIsDisabled] = useState(false); @@ -43,7 +45,7 @@ export default function Matched({ const handleDeleteRandomLetterMatching = async () => { const res = await deleteRandomLetterMatching(); if (res?.status === 200) { - alert('매칭이 취소되었습니다.'); + setToastActive({ title: '매칭이 취소되었습니다.', toastType: 'Success' }); navigate(-1); } }; diff --git a/src/pages/RandomLetters/components/MatchedLetter.tsx b/src/pages/RandomLetters/components/MatchedLetter.tsx index 3ff4907..e54546a 100644 --- a/src/pages/RandomLetters/components/MatchedLetter.tsx +++ b/src/pages/RandomLetters/components/MatchedLetter.tsx @@ -14,7 +14,7 @@ const MatchedLetter = ({ matchedLetter }: { matchedLetter: MatchedLetter }) => { <>

From 470f95076a488ca0dad91ac91ac3f0a490dfcf2c Mon Sep 17 00:00:00 2001 From: nirii00 Date: Tue, 11 Mar 2025 12:07:13 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=EA=B3=B5=EC=9C=A0=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EB=AC=BC=20=EC=82=AD=EC=A0=9C=20api=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/share.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apis/share.ts b/src/apis/share.ts index f12d4ec..6018376 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -179,7 +179,7 @@ export const getSharePostLikeCount = async (sharePostId: string) => { export const deleteSharePost = async (sharePostId: string) => { try { - const response = await client.delete(`/api/share-post/${sharePostId}`); + const response = await client.delete(`/api/share-posts/${sharePostId}`); if (!response) throw new Error('error while deleting post'); return response; } catch (error) {