feat(space): 종료 결과 모달과 current session thought 복원 추가
This commit is contained in:
138
src/widgets/space-focus-hud/ui/CompletionResultModal.tsx
Normal file
138
src/widgets/space-focus-hud/ui/CompletionResultModal.tsx
Normal file
@@ -0,0 +1,138 @@
|
||||
'use client';
|
||||
|
||||
import { copy } from '@/shared/i18n';
|
||||
import { cn } from '@/shared/lib/cn';
|
||||
import type { CompletionResult } from '@/features/focus-session';
|
||||
|
||||
interface CompletionResultModalProps {
|
||||
open: boolean;
|
||||
result: CompletionResult | null;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
const formatFocusedMinutes = (focusedSeconds: number) => {
|
||||
const safeSeconds = Math.max(0, focusedSeconds);
|
||||
return Math.round(safeSeconds / 60);
|
||||
};
|
||||
|
||||
export const CompletionResultModal = ({
|
||||
open,
|
||||
result,
|
||||
onClose,
|
||||
}: CompletionResultModalProps) => {
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const focusedMinutes = formatFocusedMinutes(result.focusedSeconds);
|
||||
const hasThoughts = result.thoughts.length > 0;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'pointer-events-none fixed inset-0 z-[70] flex items-center justify-center px-4 transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]',
|
||||
open ? 'opacity-100' : 'opacity-0',
|
||||
)}
|
||||
aria-hidden={!open}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
'absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(5,7,11,0.22)_0%,rgba(2,6,23,0.68)_52%,rgba(2,6,23,0.84)_100%)] backdrop-blur-[14px] transition-opacity duration-300',
|
||||
open ? 'opacity-100' : 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
|
||||
<section
|
||||
className={cn(
|
||||
'relative w-full max-w-[38rem] overflow-hidden rounded-[32px] border border-white/12 bg-[linear-gradient(180deg,rgba(18,22,30,0.96)_0%,rgba(8,11,17,0.94)_100%)] text-white shadow-[0_30px_100px_rgba(2,6,23,0.5)] transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]',
|
||||
open ? 'pointer-events-auto translate-y-0 scale-100' : 'pointer-events-none translate-y-4 scale-[0.975]',
|
||||
)}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="completion-result-title"
|
||||
>
|
||||
<div
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute inset-0 bg-[radial-gradient(100%_85%_at_50%_0%,rgba(255,255,255,0.12)_0%,rgba(255,255,255,0.02)_42%,rgba(255,255,255,0)_100%)]"
|
||||
/>
|
||||
<div className="relative px-7 py-7 md:px-9 md:py-8">
|
||||
<header className="text-center">
|
||||
<div className="mx-auto flex h-14 w-14 items-center justify-center rounded-[18px] border border-white/10 bg-white/[0.06] shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]">
|
||||
<span className="text-[20px] text-white/88">✦</span>
|
||||
</div>
|
||||
<p className="mt-5 text-[11px] font-medium tracking-[0.14em] text-white/34">
|
||||
{copy.space.completionResult.eyebrow}
|
||||
</p>
|
||||
<h3
|
||||
id="completion-result-title"
|
||||
className="mx-auto mt-2 max-w-[24rem] text-[1.65rem] font-light leading-[1.16] tracking-[-0.03em] text-white/96 md:text-[1.9rem]"
|
||||
>
|
||||
{copy.space.completionResult.title}
|
||||
</h3>
|
||||
<p className="mx-auto mt-3 max-w-[28rem] text-[14px] leading-[1.7] text-white/56">
|
||||
{copy.space.completionResult.description}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div className="mt-7 grid gap-4">
|
||||
<div className="rounded-[28px] border border-white/8 bg-black/16 px-5 py-5 text-center shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]">
|
||||
<p className="text-[11px] font-medium uppercase tracking-[0.18em] text-white/34">
|
||||
{copy.space.completionResult.focusedLabel}
|
||||
</p>
|
||||
<p className="mt-3 text-[2.6rem] font-light tracking-[-0.05em] text-white/96 md:text-[3.2rem]">
|
||||
{copy.space.completionResult.focusedValue(focusedMinutes)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="rounded-[24px] border border-white/8 bg-black/14 px-5 py-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]">
|
||||
<p className="text-[10px] font-medium uppercase tracking-[0.22em] text-white/34">
|
||||
{copy.space.completionResult.goalLabel}
|
||||
</p>
|
||||
<p className="mt-2 text-[15px] font-medium leading-[1.45] tracking-[-0.01em] text-white/90">
|
||||
{result.completedGoal}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{hasThoughts ? (
|
||||
<div className="rounded-[24px] border border-white/8 bg-black/14 px-5 py-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]">
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<p className="text-[10px] font-medium uppercase tracking-[0.22em] text-white/34">
|
||||
{copy.space.completionResult.thoughtsLabel}
|
||||
</p>
|
||||
<p className="text-[11px] text-white/38">
|
||||
{copy.space.completionResult.thoughtCount(result.thoughts.length)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mt-3 space-y-2.5">
|
||||
{result.thoughts.map((thought) => (
|
||||
<div
|
||||
key={thought.id}
|
||||
className="rounded-[18px] border border-white/7 bg-white/[0.04] px-4 py-3"
|
||||
>
|
||||
<p className="text-[13px] leading-[1.6] text-white/84">
|
||||
{thought.text}
|
||||
</p>
|
||||
<p className="mt-2 text-[10px] uppercase tracking-[0.16em] text-white/32">
|
||||
{thought.sceneName}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<footer className="mt-6 flex justify-center">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="inline-flex min-h-[3.5rem] min-w-[14rem] items-center justify-center rounded-[18px] border border-white/14 bg-white/[0.12] px-5 py-3 text-center text-[13px] font-medium tracking-[0.01em] text-white transition-all duration-200 hover:border-white/22 hover:bg-white/[0.17] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/12"
|
||||
>
|
||||
{copy.space.completionResult.confirmButton}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user