From b7a431c29259ca072e7eac0e20324a22559c6a79 Mon Sep 17 00:00:00 2001 From: anton Date: Tue, 1 Dec 2026 22:47:26 +0900 Subject: [PATCH] feat(frontend): sort lists newest first and hide past events by default (#710) Concert, fan meeting, auction and drop lists keep the server's newest-first order instead of re-sorting by status. Past events are hidden until the new 'show past events' checkbox is ticked, then shown greyed out and dark. The ended tabs are removed because the checkbox replaces them. --- frontend/src/app/(main)/auctions/auctions.css | 3 - frontend/src/app/(main)/auctions/page.tsx | 57 +++++++++-------- frontend/src/app/(main)/concerts/page.tsx | 61 ++++++++++++++----- frontend/src/app/(main)/drops/drops.css | 9 ++- frontend/src/app/(main)/drops/page.tsx | 31 +++++----- frontend/src/app/(main)/fan-meetings/page.tsx | 40 ++++++------ frontend/src/app/(main)/main.css | 42 +++++++++++++ frontend/src/components/Cards.tsx | 15 +++-- frontend/src/components/PastToggle.tsx | 12 ++++ frontend/src/lib/types.ts | 2 + 10 files changed, 188 insertions(+), 84 deletions(-) create mode 100644 frontend/src/components/PastToggle.tsx diff --git a/frontend/src/app/(main)/auctions/auctions.css b/frontend/src/app/(main)/auctions/auctions.css index 5b14e6ab..911d9564 100644 --- a/frontend/src/app/(main)/auctions/auctions.css +++ b/frontend/src/app/(main)/auctions/auctions.css @@ -215,9 +215,6 @@ color: var(--au-red); animation: fq-beat 1s infinite; } -.fq-au-row.is-closed { - opacity: 0.6; -} .fq-au-go { font-size: 20px; font-weight: 800; diff --git a/frontend/src/app/(main)/auctions/page.tsx b/frontend/src/app/(main)/auctions/page.tsx index 02a61387..877e6fae 100644 --- a/frontend/src/app/(main)/auctions/page.tsx +++ b/frontend/src/app/(main)/auctions/page.tsx @@ -10,6 +10,7 @@ import { IntroGate } from "@/lib/intro"; import Chip from "@/components/casino/Chip"; import Odometer from "@/components/casino/Odometer"; import LoadError from "@/components/LoadError"; +import PastToggle from "@/components/PastToggle"; import Tabs from "@/components/Tabs"; import { api } from "@/lib/api"; import { useAuth } from "@/lib/auth"; @@ -18,13 +19,14 @@ import { useLoad, useNow } from "@/lib/hooks"; import type { AuctionDetail, AuctionPage, AuctionStatus, AuctionSummary, MyBidPage } from "@/lib/types"; import "./auctions.css"; -type F = "ALL" | "MINE" | AuctionStatus; -const ORDER: Record = { OPEN: 0, SCHEDULED: 1, CLOSED: 2 }; +type F = "ALL" | "MINE" | Exclude; export default function AuctionsPage() { const now = useNow(); const [f, setF] = useState("ALL"); + const [showPast, setShowPast] = useState(false); const { profile } = useAuth(); + // 상태를 넘기지 않으면 서버가 등록 순서의 역순(최신순)으로 준다. 화면에서는 순서를 바꾸지 않는다 const { data, error } = useLoad(() => api("/api/auctions?size=40").then((r) => r.items)); // 목록 API에는 현재가가 없어서, 진행 중인 경매만 상세를 읽어 현재가를 보여 준다 const liveIds = (data ?? []).filter((a) => a.status === "OPEN").slice(0, 8).map((a) => a.auctionId); @@ -34,26 +36,31 @@ export default function AuctionsPage() { ); const prices = { data: Object.fromEntries((liveDetails.data ?? []).map((d) => [d.auctionId, d.highestBid?.amount ?? d.startingPriceAmount])) as Record }; const mine = useLoad(() => (profile ? api("/api/me/bids?size=100").then((r) => r.items) : Promise.resolve([])), [profile?.memberId]); - const sorted = [...(data ?? [])].sort((a, b) => ORDER[a.status] - ORDER[b.status] || +new Date(a.endsAt) - +new Date(b.endsAt)); - const count = (x: F) => data?.filter((a) => x === "ALL" || a.status === x).length; + // 끝난 경매는 체크했을 때만 같은 최신순 자리에 어둡게 섞여 보인다 + const sorted = (data ?? []).filter((a) => showPast || a.status !== "CLOSED"); + const match = (x: F, a: AuctionSummary) => x === "ALL" || a.status === x; + const shown = sorted.filter((a) => match(f, a)); + const count = (x: F) => (data ? sorted.filter((a) => match(x, a)).length : undefined); return (
{data && liveDetails.data ? :
}
- +
+ + {f === "MINE" ? null : a.status === "CLOSED").length} />} +
{error ? ( @@ -91,14 +98,12 @@ export default function AuctionsPage() { ) ) : data ? (
    - {sorted - .filter((a) => f === "ALL" || a.status === f) - .map((a, i) => ( -
  • - -
  • - ))} - {sorted.filter((a) => f === "ALL" || a.status === f).length === 0 ? ( + {shown.map((a, i) => ( +
  • + +
  • + ))} + {shown.length === 0 ? (
  • 해당하는 경매가 없어요.

    @@ -114,11 +119,11 @@ export default function AuctionsPage() { ); } -/** lot은 정렬된 전체 목록에서의 순번이다. 필터를 바꿔도 같은 경매는 같은 번호를 유지한다 */ +/** lot은 지금 보이는 전체 목록에서의 순번이다. 탭을 바꿔도 같은 경매는 같은 번호를 유지한다 */ function Row({ a, lot, now, price, delay }: { a: AuctionSummary; lot: string; now: number; price?: number; delay: number }) { const urgent = a.status === "OPEN" && msLeft(a.endsAt, now) < 15 * 60_000; return ( - + {lot}
    diff --git a/frontend/src/app/(main)/concerts/page.tsx b/frontend/src/app/(main)/concerts/page.tsx index 85a762e7..f922918e 100644 --- a/frontend/src/app/(main)/concerts/page.tsx +++ b/frontend/src/app/(main)/concerts/page.tsx @@ -1,13 +1,15 @@ "use client"; import DomainBox from "@/components/finale/DomainBox"; +import LineArt from "@/components/LineArt"; import { useState } from "react"; import { CardSkeletons, ConcertCard } from "@/components/Cards"; +import PastToggle from "@/components/PastToggle"; import Tabs from "@/components/Tabs"; import LoadError from "@/components/LoadError"; import { api } from "@/lib/api"; import { useLoad } from "@/lib/hooks"; -import type { ConcertPage, PerformanceInfo } from "@/lib/types"; +import type { ConcertDetail, ConcertPage, PerformanceInfo } from "@/lib/types"; import ConcertShow from "./ConcertShow"; import { IntroGate } from "@/lib/intro"; @@ -20,32 +22,61 @@ function splitTitle(title: string) { type F = "ALL" | "ON_SALE" | "SCHEDULED"; +/** 공연 기간 마지막 날이 오늘(이 기기 날짜)보다 앞이면 지난 공연이다 */ +function isPast(c: ConcertDetail, today: string) { + return !!c.periodEndDate && c.periodEndDate < today; +} +/** 이 기기 기준 오늘 날짜 (YYYY-MM-DD) */ +function localToday() { + const d = new Date(); + return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`; +} + export default function ConcertsPage() { const [f, setF] = useState("ALL"); + const [showPast, setShowPast] = useState(false); + // 서버가 등록일 최신순으로 준다. 화면에서는 순서를 바꾸지 않는다 const { data, error } = useLoad(() => api("/api/concerts?size=40").then((r) => r.content)); - // 연출에 세울 대표 공연: 예매 중인 공연이 있으면 그 공연, 없으면 첫 공연 - const star = data?.find((c) => c.status === "ON_SALE") ?? data?.[0]; + const today = localToday(); + const live = (data ?? []).filter((c) => !isPast(c, today)); + const past = (data ?? []).filter((c) => isPast(c, today)); + // 연출에 세울 대표 공연: 예매 중인 공연이 있으면 그 공연, 없으면 끝나지 않은 첫 공연 + const star = live.find((c) => c.status === "ON_SALE") ?? live[0] ?? data?.[0]; const perfs = useLoad(() => (star ? api(`/api/concerts/${star.concertId}/performances`) : Promise.resolve([])), [star?.concertId]); const starList = [...(perfs.data ?? [])].sort((a, b) => +new Date(a.startsAt) - +new Date(b.startsAt)); const starName = star ? splitTitle(star.title) : null; - const list = (data ?? []).filter((c) => f === "ALL" || (f === "ON_SALE" ? c.status === "ON_SALE" : c.status !== "ON_SALE")); + const match = (x: F, c: ConcertDetail) => x === "ALL" || (x === "ON_SALE" ? c.status === "ON_SALE" : c.status !== "ON_SALE"); + // 지난 공연은 전체 탭에서만, 체크했을 때 같은 최신순 자리에 어둡게 섞여 보인다 + const list = (data ?? []).filter((c) => (isPast(c, today) ? showPast && f === "ALL" : match(f, c))); + const count = (x: F) => (data ? live.filter((c) => match(x, c)).length + (x === "ALL" && showPast ? past.length : 0) : undefined); return ( <>

    좌석을 직접 골라 예매하는 지정석 공연이에요.

    - c.status === "ON_SALE").length }, - { value: "SCHEDULED", label: "예매 예정", count: data?.filter((c) => c.status !== "ON_SALE").length }, - ]} - /> +
    + + +
    - {error ? : data ?
    {list.map((c) => )}
    : } + {error ? ( + + ) : !data ? ( + + ) : list.length === 0 ? ( +

    해당하는 공연이 없어요.

    + ) : ( +
    {list.map((c) => )}
    + )}
    diff --git a/frontend/src/app/(main)/drops/drops.css b/frontend/src/app/(main)/drops/drops.css index 8088f0ec..56c51d6e 100644 --- a/frontend/src/app/(main)/drops/drops.css +++ b/frontend/src/app/(main)/drops/drops.css @@ -431,16 +431,19 @@ opacity: clamp(0, var(--p) * 2.2 - 0.3, 1); transform: translateY(calc((1 - clamp(0, var(--p) * 2.2 - 0.3, 1)) * 30px)); } +/* 지난 드롭은 전원이 꺼진 화면처럼 흑백으로 어둡게. 가리키면 조금 켜진다 */ .fq-dl-archive-card .fq-poster { - filter: grayscale(1) brightness(0.8); + filter: grayscale(1) brightness(0.45); transition: filter 0.5s var(--ux-ease); } -.fq-dl-archive-card:hover .fq-poster { - filter: grayscale(0.2); +.fq-dl-archive-card:hover .fq-poster, +.fq-dl-archive-card:focus-visible .fq-poster { + filter: grayscale(0.7) brightness(0.75); } .fq-dl-archive-card b { font-size: 15px; font-weight: 800; + color: var(--ux-ink-3); } .fq-dl-archive-card small { font-size: 12.5px; diff --git a/frontend/src/app/(main)/drops/page.tsx b/frontend/src/app/(main)/drops/page.tsx index 77df8582..e2012311 100644 --- a/frontend/src/app/(main)/drops/page.tsx +++ b/frontend/src/app/(main)/drops/page.tsx @@ -9,6 +9,7 @@ import { useEffect, useRef, useState } from "react"; import { firstWord } from "@/components/Cards"; import ChapterHud from "@/components/chapter/ChapterHud"; import LoadError from "@/components/LoadError"; +import PastToggle from "@/components/PastToggle"; import Poster, { PALETTES } from "@/components/Poster"; import Tabs from "@/components/Tabs"; import { api } from "@/lib/api"; @@ -19,8 +20,8 @@ import { useScrollProgress } from "@/lib/scroll"; import type { DropItem, DropPage } from "@/lib/types"; import "./drops.css"; -type F = "ALL" | "ON_SALE" | "UPCOMING" | "ENDED"; -type State = Exclude; +type F = "ALL" | "ON_SALE" | "UPCOMING"; +type State = Exclude | "ENDED"; type Row = { d: DropItem; s: State }; /** 서버 상태와 시각으로 지금 상태를 정한다. 기간이 지나면 서버 값보다 시각을 따른다 */ @@ -34,7 +35,6 @@ function productWord(title: string) { const words = (title.split(">").pop() ?? title).trim().split(/\s+/).filter((w) => !["공식", "투어", "한정판", "세트"].includes(w)); return words[0] ?? firstWord(title); } -const ORDER: Record = { ON_SALE: 0, UPCOMING: 1, ENDED: 2 }; const colorOf = (dropId: number) => PALETTES[(dropId + 1) % PALETTES.length]; /** @@ -42,18 +42,21 @@ const colorOf = (dropId: number) => PALETTES[(dropId + 1) % PALETTES.length]; * 1) 커튼: 화면이 고정된 채 물결 커튼이 끝까지 내려오고 제목이 커졌다가 걷힌다. * 2) 진열대: 카드마다 멈춰 서고, 멈춘 동안 무대가 그 카드 색으로 물들며 뒤로 큰 상품 이름이 흐른다. * 3) 다음 드롭: 오픈 예정 드롭을 화면 가득한 카운트다운으로 보여 준다. - * 4) 지난 드롭: 끝난 드롭을 흑백으로 모은다. + * 4) 지난 드롭: 지난 이벤트도 보기를 체크하면 끝난 드롭을 꺼진 것처럼 어둡게 모은다. */ export default function DropsPage() { const now = useNow(); const [f, setF] = useState("ALL"); - const { data, error } = useLoad(() => api("/api/drops").then((r) => r.items)); - const all: Row[] = (data ?? []).map((d) => ({ d, s: stateOf(d, now) })).sort((a, b) => ORDER[a.s] - ORDER[b.s] || +new Date(a.d.opensAt) - +new Date(b.d.opensAt)); - // 전체 보기에서는 끝난 드롭을 진열대 대신 아래 지난 드롭 장에 모은다 - const rail = f === "ALL" ? all.filter((x) => x.s !== "ENDED") : all.filter((x) => x.s === f); + const [showPast, setShowPast] = useState(false); + // 서버가 등록일 최신순으로 준다. 화면에서는 순서를 바꾸지 않는다 + const { data, error } = useLoad(() => api("/api/drops?sort=NEWEST").then((r) => r.items)); + const all: Row[] = (data ?? []).map((d) => ({ d, s: stateOf(d, now) })); + // 끝난 드롭은 진열대에 올리지 않고, 체크했을 때만 아래 지난 드롭 장에 모은다 + const rail = all.filter((x) => x.s !== "ENDED" && (f === "ALL" || x.s === f)); const ended = all.filter((x) => x.s === "ENDED"); - const next = all.find((x) => x.s === "UPCOMING"); - const count = (x: F) => (data ? (x === "ALL" ? all.length : all.filter((y) => y.s === x).length) : undefined); + // 다음 드롭은 목록 순서와 상관없이 가장 먼저 열리는 드롭이다 + const next = all.filter((x) => x.s === "UPCOMING").sort((a, b) => +new Date(a.d.opensAt) - +new Date(b.d.opensAt))[0]; + const count = (x: F) => (data ? all.filter((y) => y.s !== "ENDED" && (x === "ALL" || y.s === x)).length : undefined); const live = count("ON_SALE") ?? 0; return ( @@ -63,7 +66,7 @@ export default function DropsPage() { -
    +
    +
    {error ? ( @@ -94,7 +97,7 @@ export default function DropsPage() {
    {f === "ALL" && next ? : null} - {f === "ALL" && ended.length ? : null} + {showPast && ended.length ? : null}
    ); @@ -328,7 +331,7 @@ function NextDrop({ row, now }: { row: Row; now: number }) { ); } -/** 4장. 끝난 드롭을 흑백으로 모은다 */ +/** 4장. 끝난 드롭을 꺼진 것처럼 어둡게 모은다 */ function Archive({ rows }: { rows: Row[] }) { const ref = useRef(null); useScrollProgress(ref, undefined, "enter"); diff --git a/frontend/src/app/(main)/fan-meetings/page.tsx b/frontend/src/app/(main)/fan-meetings/page.tsx index b70ce425..0001362e 100644 --- a/frontend/src/app/(main)/fan-meetings/page.tsx +++ b/frontend/src/app/(main)/fan-meetings/page.tsx @@ -5,6 +5,7 @@ import { useState } from "react"; import { CardSkeletons, FanMeetingCard } from "@/components/Cards"; import DomainBox from "@/components/finale/DomainBox"; import LoadError from "@/components/LoadError"; +import PastToggle from "@/components/PastToggle"; import Tabs from "@/components/Tabs"; import { api } from "@/lib/api"; import { useLoad } from "@/lib/hooks"; @@ -12,16 +13,19 @@ import type { FanMeetingPage, FanMeetingStatus } from "@/lib/types"; import LotteryShow from "@/components/lottery/LotteryShow"; import { IntroGate } from "@/lib/intro"; -type F = "ALL" | "OPEN" | "SCHEDULED" | "ENDED"; +type F = "ALL" | "OPEN" | "SCHEDULED"; +/** 응모가 끝난 상태. 목록에서는 지난 팬미팅으로 다룬다 */ const ENDED: FanMeetingStatus[] = ["CLOSED", "DRAWING", "PAYMENT_IN_PROGRESS", "RECRUITMENT_COMPLETED"]; -// 응모 중, 예정, 마감 순으로 보여 주고 취소된 행사는 목록에서 뺀다 -const ORDER: Partial> = { OPEN: 0, SCHEDULED: 1 }; export default function FanMeetingsPage() { const [f, setF] = useState("ALL"); + const [showPast, setShowPast] = useState(false); + // 서버가 등록 순서의 역순(최신순)으로 준다. 화면에서는 순서를 바꾸지 않고, 취소된 행사만 뺀다 const { data, error } = useLoad(() => api("/api/fan-meetings?size=100").then((r) => r.items.filter((m) => m.status !== "CANCELLED"))); - const all = [...(data ?? [])].sort((a, b) => (ORDER[a.status] ?? 2) - (ORDER[b.status] ?? 2) || +new Date(a.meetingAt) - +new Date(b.meetingAt)); - const match = (x: F, s: FanMeetingStatus) => x === "ALL" || (x === "ENDED" ? ENDED.includes(s) : s === x); + const all = data ?? []; + const isPast = (s: FanMeetingStatus) => ENDED.includes(s); + // 지난 팬미팅은 전체 탭에서만, 체크했을 때 같은 최신순 자리에 어둡게 섞여 보인다 + const match = (x: F, s: FanMeetingStatus) => (isPast(s) ? showPast && x === "ALL" : x === "ALL" || s === x); const list = all.filter((m) => match(f, m.status)); const count = (x: F) => (data ? all.filter((m) => match(x, m.status)).length : undefined); return ( @@ -29,17 +33,19 @@ export default function FanMeetingsPage() {

    응모한 팬 중에서 추첨으로 참가자를 정해요. 당첨되면 결제 기한 안에 결제해 주세요.

    - +
    + + isPast(m.status)).length : undefined} /> +
    {error ? ( @@ -48,7 +54,7 @@ export default function FanMeetingsPage() { ) : list.length === 0 ? (

    해당하는 팬미팅이 없어요.

    ) : ( -
    {list.map((m) => )}
    +
    {list.map((m) => )}
    )}
    diff --git a/frontend/src/app/(main)/main.css b/frontend/src/app/(main)/main.css index af538f33..bbc3e6dc 100644 --- a/frontend/src/app/(main)/main.css +++ b/frontend/src/app/(main)/main.css @@ -176,6 +176,48 @@ font-size: 11.5px; } +/* ── 목록 위 막대: 필터 탭과 지난 이벤트 체크박스 ── */ +.fq-list-bar { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 12px 18px; +} +.fq-past-toggle { + display: inline-flex; + align-items: center; + gap: 8px; + font-size: 14px; + font-weight: 750; + color: var(--ux-ink-2); + cursor: pointer; + user-select: none; +} +.fq-past-toggle input { + width: 16px; + height: 16px; + margin: 0; + accent-color: var(--ux-accent); + cursor: pointer; +} +.fq-past-toggle small { + min-width: 20px; + padding: 2px 6px; + border-radius: 999px; + background: color-mix(in srgb, currentColor 16%, transparent); + font-size: 11.5px; + text-align: center; +} +/* 지난 이벤트: 전원이 꺼진 화면처럼 흑백으로 어둡게. 가리키면 조금 켜진다 */ +.fq-past { + filter: grayscale(1) brightness(0.45); + transition: filter 0.4s var(--ux-ease); +} +.fq-past:hover, +.fq-past:focus-visible { + filter: grayscale(0.7) brightness(0.75); +} + /* ── 상세 2단 ─────────────────────────────── */ .fq-detail-grid { display: grid; diff --git a/frontend/src/components/Cards.tsx b/frontend/src/components/Cards.tsx index bfd415e7..6b54d8fb 100644 --- a/frontend/src/components/Cards.tsx +++ b/frontend/src/components/Cards.tsx @@ -57,12 +57,14 @@ export function AuctionCard({ a }: { a: AuctionSummary }) { ); } -export function ConcertCard({ c }: { c: ConcertDetail }) { +/** past는 공연 기간이 끝난 공연이다. 목록에서 꺼진 것처럼 어둡게 보인다 */ +export function ConcertCard({ c, past = false }: { c: ConcertDetail; past?: boolean }) { + const onSale = !past && c.status === "ON_SALE"; return ( - - + +
    - {c.status === "ON_SALE" ? "예매 중" : "예매 예정"} + {past ? "공연 종료" : onSale ? "예매 중" : "예매 예정"}

    {c.title}

    @@ -79,11 +81,12 @@ export const FM_STATUS: Record = { RECRUITMENT_COMPLETED: { label: "모집 완료", tone: "is-mute" }, }; -export function FanMeetingCard({ f }: { f: FanMeetingSummary }) { +/** past는 응모가 끝난 팬미팅이다. 목록에서 꺼진 것처럼 어둡게 보인다 */ +export function FanMeetingCard({ f, past = false }: { f: FanMeetingSummary; past?: boolean }) { const now = useNow(); const s = FM_STATUS[f.status] ?? { label: f.status, tone: "" }; return ( - +
    diff --git a/frontend/src/components/PastToggle.tsx b/frontend/src/components/PastToggle.tsx new file mode 100644 index 00000000..0883f714 --- /dev/null +++ b/frontend/src/components/PastToggle.tsx @@ -0,0 +1,12 @@ +"use client"; + +/** 목록에 지난 이벤트를 함께 보여 줄지 고르는 체크박스. 기본은 꺼져 있다 */ +export default function PastToggle({ checked, onChange, count }: { checked: boolean; onChange: (v: boolean) => void; count?: number }) { + return ( + + ); +} diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index 4784a15b..16ade152 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -69,6 +69,8 @@ export type ConcertDetail = { title: string; status: string; createdAt: string; + /** 공연 기간 마지막 날 (YYYY-MM-DD). 정하지 않은 공연은 null */ + periodEndDate?: string | null; }; export type ConcertPage = { content: ConcertDetail[];