From 781a983780041819b154da2ed3fe2e97683624ac Mon Sep 17 00:00:00 2001 From: kiyeong Date: Tue, 3 Dec 2024 01:14:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B6=94=EC=B2=9C=20=EC=8B=9C=20?= =?UTF-8?q?=EB=A1=9C=EB=94=A9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Main/components/DetailModal.tsx | 264 ++++++++++++++++------------ 1 file changed, 149 insertions(+), 115 deletions(-) diff --git a/src/Main/components/DetailModal.tsx b/src/Main/components/DetailModal.tsx index ff9aee9..2950c1d 100644 --- a/src/Main/components/DetailModal.tsx +++ b/src/Main/components/DetailModal.tsx @@ -14,6 +14,8 @@ import { Divider, Select, Textarea, + Center, + Spinner, Flex, } from "@chakra-ui/react"; import { useState, useEffect } from "react"; @@ -51,6 +53,7 @@ const DetailModal = ({ isOpen, onClose, content }: DetailModalProps) => { const [friends, setFriends] = useState([]); // 친구 목록 const [selectedFriend, setSelectedFriend] = useState(""); // 선택된 친구 이메일 const [recommendReason, setRecommendReason] = useState(""); // 추천 이유 + const [isLoading, setIsLoading] = useState(false); // 로딩 상태 관리 useEffect(() => { if (isOpen) { @@ -83,6 +86,8 @@ const DetailModal = ({ isOpen, onClose, content }: DetailModalProps) => { } try { + setIsLoading(true); // 로딩 상태 시작 + const selectedFriendObj = friends.find( (friend) => friend.friendEmail === selectedFriend ); @@ -97,12 +102,22 @@ const DetailModal = ({ isOpen, onClose, content }: DetailModalProps) => { ); toast({ - title: "추천 성공", - description: `${selectedFriendObj.friendName}님에게 콘텐츠를 추천했습니다!`, - status: "success", + position: "top", duration: 1500, isClosable: true, - position: "top", + render: () => ( + + 추천 성공🎉
+ {`${selectedFriendObj.friendName}님에게 추천 카톡메세지를 보냈어요!`} +
+ ), }); // 초기화 @@ -119,6 +134,8 @@ const DetailModal = ({ isOpen, onClose, content }: DetailModalProps) => { isClosable: true, position: "top", }); + } finally { + setIsLoading(false); // 로딩 상태 종료 } }; @@ -157,126 +174,143 @@ const DetailModal = ({ isOpen, onClose, content }: DetailModalProps) => { } }; + // 로딩 상태의 모달 + const LoadingModal = () => ( + {}} isCentered> + + +
+ +
+
+
+ ); + if (!content) return null; return ( - - - - - - {content.title} - - - - - Type: {content.type} - - - Director: {content.director} - - - Cast: {content.cast} - - - Country: {content.country} - - - Date Added: {content.dateAdded} - - - Release Year: {content.releaseYear} - - - Rating: {content.rating} - - - Duration: {content.duration} - - - Genres: {content.listedIn} - - - Description: {content.description} + <> + {/* 로딩 모달 */} + {isLoading && } + + + + + + + {content.title} + + + + + Type: {content.type} + + + Director: {content.director} + + + Cast: {content.cast} + + + Country: {content.country} + + + Date Added: {content.dateAdded} + + + Release Year: {content.releaseYear} + + + Rating: {content.rating} + + + Duration: {content.duration} + + + Genres: {content.listedIn} + + + Description: {content.description} + + + + + + + + + + + + 🔗 친구에게 추천하기 - - -