-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 로그인 상태 관리 수정 및 토큰 갱신 (#32)
- Loading branch information
Showing
17 changed files
with
499 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export function AssetInfoSkeleton() { | ||
return ( | ||
<div className="relative h-308 w-300 rounded-10 bg-[#D9FFE5] p-21"> | ||
<div> | ||
<div className="h-7 w-20 animate-pulse rounded bg-gray-200" /> | ||
<div className="mt-10"> | ||
<div className="h-32 w-102 animate-pulse rounded bg-gray-200" /> | ||
<div className="pt-40"> | ||
<div className="h-30 w-120 animate-pulse rounded bg-gray-200" /> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="mt-30 flex h-105 w-264 animate-pulse flex-col items-center justify-center rounded-8 bg-gray-100"> | ||
<div className="h-4 w-32 rounded bg-gray-200" /> | ||
<div className="mt-4 h-8 w-40 rounded bg-gray-200" /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export function MyStockInfoSkeleton() { | ||
return ( | ||
<div className="relative h-308 w-300 rounded-10 bg-[#F5F5F5] p-21"> | ||
<div className="mb-10"> | ||
<div className="h-7 w-20 animate-pulse rounded bg-gray-200" /> | ||
<div className="mt-12 space-y-2"> | ||
<div className="h-5 w-28 animate-pulse rounded bg-gray-200" /> | ||
<div className="h-5 w-20 animate-pulse rounded bg-gray-200" /> | ||
</div> | ||
</div> | ||
<div className="mt-90"> | ||
<div className="mb-10 h-6 w-32 animate-pulse rounded bg-gray-200" /> | ||
<div className="space-y-4"> | ||
{[1, 2, 3].map((idx) => ( | ||
<div | ||
key={idx} | ||
className="flex items-center justify-between border-b border-gray-100 py-12 last:border-0" | ||
> | ||
<div className="flex items-center gap-8"> | ||
<div className="size-24 animate-pulse rounded bg-gray-200" /> | ||
<div className="space-y-2"> | ||
<div className="h-5 w-24 animate-pulse rounded bg-gray-200" /> | ||
<div className="h-4 w-16 animate-pulse rounded bg-gray-200" /> | ||
</div> | ||
</div> | ||
<div className="space-y-2 text-right"> | ||
<div className="h-5 w-20 animate-pulse rounded bg-gray-200" /> | ||
<div className="h-4 w-24 animate-pulse rounded bg-gray-200" /> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
"use client"; | ||
|
||
import clsx from "clsx"; | ||
import { useEffect } from "react"; | ||
|
||
import BaseModal from "@/components/common/modal"; | ||
|
||
interface RefreshModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
remainingRefreshes: number; | ||
onAccept: () => void; | ||
onDecline: () => void; | ||
} | ||
|
||
export default function RefreshModal({ | ||
isOpen, | ||
onClose, | ||
remainingRefreshes, | ||
onAccept, | ||
onDecline, | ||
}: RefreshModalProps) { | ||
useEffect(() => { | ||
if (!isOpen) { | ||
onClose(); | ||
} | ||
}, [isOpen, onClose]); | ||
|
||
const handleRefresh = () => { | ||
onAccept(); | ||
onClose(); | ||
}; | ||
|
||
const handleLogout = () => { | ||
onClose(); | ||
onDecline(); | ||
}; | ||
|
||
return ( | ||
<BaseModal isOpen={isOpen} onClose={onClose}> | ||
<div className="h-210 overflow-hidden rounded-2xl bg-white p-20 shadow-xl"> | ||
<div className="flex items-center gap-3 text-yellow-600"> | ||
<h2 className="text-24-700 text-gray-900">세션 연장</h2> | ||
</div> | ||
|
||
<div className="mt-10"> | ||
<p className="text-16-600 text-gray-600"> | ||
로그인 세션이 5분 후에 만료됩니다. | ||
<br /> | ||
세션을 연장하시겠습니까? | ||
</p> | ||
</div> | ||
|
||
<div className="mt-10 rounded-lg bg-blue-50 p-10"> | ||
<p className="text-16-600 text-blue-700"> | ||
남은 연장 횟수:{" "} | ||
<span className="text-14-600">{remainingRefreshes}회</span> | ||
</p> | ||
</div> | ||
|
||
<div className="mt-10 flex justify-end gap-8"> | ||
<button | ||
type="button" | ||
onClick={handleLogout} | ||
className={clsx( | ||
"rounded-lg border border-gray-300 px-8 py-6", | ||
"text-16-600 text-gray-700", | ||
"transition", | ||
"hover:bg-gray-50", | ||
"active:bg-gray-100", | ||
)} | ||
> | ||
로그아웃 | ||
</button> | ||
<button | ||
type="button" | ||
onClick={handleRefresh} | ||
disabled={remainingRefreshes <= 0} | ||
className={clsx( | ||
"rounded-lg bg-blue-600 px-8 py-6", | ||
"text-16-600 text-white", | ||
"transition", | ||
"hover:bg-blue-700", | ||
"active:bg-blue-800", | ||
"disabled:bg-gray-300", | ||
)} | ||
> | ||
연장하기 | ||
</button> | ||
</div> | ||
</div> | ||
</BaseModal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
"use client"; | ||
|
||
import { AnimatePresence, motion } from "framer-motion"; | ||
import { useEffect } from "react"; | ||
|
||
interface BaseModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
children: React.ReactNode; | ||
} | ||
|
||
const overlayVariants = { | ||
hidden: { opacity: 0 }, | ||
visible: { | ||
opacity: 1, | ||
transition: { duration: 0.2 }, | ||
}, | ||
}; | ||
|
||
const modalVariants = { | ||
hidden: { | ||
opacity: 0, | ||
scale: 0.75, | ||
y: 20, | ||
}, | ||
visible: { | ||
opacity: 1, | ||
scale: 1, | ||
y: 0, | ||
transition: { | ||
type: "spring", | ||
stiffness: 300, | ||
damping: 30, | ||
}, | ||
}, | ||
exit: { | ||
opacity: 0, | ||
scale: 0.75, | ||
y: 20, | ||
transition: { duration: 0.2 }, | ||
}, | ||
}; | ||
|
||
export default function BaseModal({ | ||
isOpen, | ||
onClose, | ||
children, | ||
}: BaseModalProps) { | ||
useEffect(() => { | ||
if (!isOpen) { | ||
return undefined; | ||
} | ||
|
||
function handleEscape(e: KeyboardEvent) { | ||
if (e.key === "Escape") { | ||
onClose(); | ||
} | ||
} | ||
|
||
document.body.style.overflow = "hidden"; | ||
window.addEventListener("keydown", handleEscape); | ||
|
||
return function cleanupModalEffect() { | ||
window.removeEventListener("keydown", handleEscape); | ||
document.body.style.overflow = "unset"; | ||
}; | ||
}, [isOpen, onClose]); | ||
|
||
return ( | ||
<AnimatePresence mode="wait"> | ||
{isOpen && ( | ||
<motion.div | ||
className="fixed inset-0 z-50 flex items-center justify-center p-4" | ||
initial="hidden" | ||
animate="visible" | ||
exit="hidden" | ||
> | ||
<motion.div | ||
className="absolute inset-0 bg-black/50 backdrop-blur-sm" | ||
variants={overlayVariants} | ||
initial="hidden" | ||
animate="visible" | ||
exit="hidden" | ||
onClick={onClose} | ||
/> | ||
<motion.div | ||
className="relative z-10 w-full max-w-md" | ||
variants={modalVariants} | ||
initial="hidden" | ||
animate="visible" | ||
exit="exit" | ||
> | ||
{children} | ||
</motion.div> | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.