'use client';
import Link from 'next/link';
import { useMemo } from 'react';
import { useMediaCatalog, getSceneStageBackgroundStyle } from '@/entities/media';
import { usePlanTier } from '@/entities/plan';
import { getSceneById, SCENE_THEMES } from '@/entities/scene';
import { useFocusStats } from '@/features/stats';
import { copy } from '@/shared/i18n';
import { cn } from '@/shared/lib/cn';
const glassPanelClass =
'rounded-[2rem] border border-white/10 bg-[linear-gradient(160deg,rgba(8,12,18,0.46)_0%,rgba(8,12,18,0.2)_58%,rgba(8,12,18,0.52)_100%)] shadow-[0_24px_80px_rgba(3,7,18,0.28)] backdrop-blur-[24px]';
const metricTileClass =
'rounded-[1.45rem] border border-white/10 bg-[linear-gradient(145deg,rgba(255,255,255,0.08)_0%,rgba(255,255,255,0.04)_100%)] px-4 py-4 backdrop-blur-xl';
const DEFAULT_STATS_SCENE_ID = getSceneById('forest')?.id ?? SCENE_THEMES[0].id;
const reviewStageSceneByPreset = (presetId: string) => {
if (presetId.startsWith('forest')) {
return getSceneById('forest') ?? SCENE_THEMES[0];
}
return getSceneById(DEFAULT_STATS_SCENE_ID) ?? SCENE_THEMES[0];
};
const StatusAccessory = ({
label,
subtle = false,
}: {
label: string;
subtle?: boolean;
}) => {
return (
{label}
);
};
const SnapshotMetric = ({
label,
value,
hint,
}: {
label: string;
value: string;
hint: string;
}) => {
return (
);
};
const ReviewSection = ({
title,
summary,
metrics,
availability,
note,
accentClass,
}: {
title: string;
summary: string;
metrics: Array<{ id: string; label: string; value: string; hint: string }>;
availability: 'ready' | 'limited';
note?: string;
accentClass: string;
}) => {
return (
Weekly Review
{title}
{summary}
{availability === 'limited' ?
: null}
{metrics.length > 0 ? (
{metrics.map((metric) => (
))}
) : null}
{note ? (
{note}
) : null}
);
};
export const StatsOverviewWidget = () => {
const { stats } = copy;
const { isPro } = usePlanTier();
const { sceneAssetMap } = useMediaCatalog();
const { review, isLoading, error, source, refetch } = useFocusStats();
const activeScene = useMemo(
() => reviewStageSceneByPreset(review.carryForward.presetId),
[review.carryForward.presetId],
);
const sourceLabel = source === 'api' ? stats.sourceApi : stats.sourceMock;
const syncLabel = error ? error : isLoading ? stats.loading : stats.synced;
const carryForwardCtaLabel = isPro ? stats.reviewCarryCtaPro : review.carryForward.ctaLabel;
return (
{review.snapshotTitle}
{review.snapshotSummary}
{syncLabel}
{review.snapshotMetrics.map((metric) => (
))}
Carry Forward
다음 세션에 그대로 가져갈 흐름
{review.carryForward.keepDoing}
{isPro ?
: null}
다음 주에 바꿔볼 것
{review.carryForward.tryNext}
Atmosphere
{review.carryForward.presetLabel}
지금 가장 무리 없이 다시 들어갈 수 있는 기본 흐름입니다.
review는 지난 시간을 요약하는 화면이 아니라, 다음 세션을 더 가볍게 열기 위한
출발점입니다.
{carryForwardCtaLabel}
);
};