feat: refresh the home page and separate match event types

Add an inhouse hero, Hall of Fame, rankings, and event-specific schedules. Carry the event type through the API and admin tools, and improve results and player history displays.
This commit is contained in:
dahyeon committed 2026-11-10 22:13:55 +09:00
1 parent 7e0cd7cb19
commit 664af15255
58 files changed
+2316 -593

No files matched your search

@@ -1,4 +1,5 @@
import mongoose, { Schema, HydratedDocument } from 'mongoose';
import type { MatchEventType } from '@lolympus/contracts';
import type {
RiotPlatformRoute,
RiotRegionalRoute,
@@ -38,6 +39,8 @@ export const MATCH_STATUSES: MatchStatus[] = [
'finished',
];
export const MATCH_EVENT_TYPES = ['inhouse', 'tournament'] as const satisfies readonly MatchEventType[];
export type TeamSide = 'blue' | 'red';
export const TEAM_SIDES: TeamSide[] = ['blue', 'red'];
@@ -686,6 +689,7 @@ export interface Match extends MongooseTimestamps {
competitionId?: mongoose.Types.ObjectId;
shortCode?: string;
title: string;
eventType?: MatchEventType;
description: string;
mapId: number; // Riot Match-V5 mapId (11=소환사의 협곡, 12=ARAM 등)
status: MatchStatus;
@@ -1954,6 +1958,7 @@ export const MatchSchema = new Schema<Match>(
maxlength: 6,
},
title: { type: String, required: true },
eventType: { type: String, enum: MATCH_EVENT_TYPES, default: 'inhouse' },
description: { type: String, required: false, default: '' },
mapId: { type: Number, required: true, default: 11 },
status: {
@@ -79,3 +79,30 @@ describe('Grand final format validation', () => {
]);
});
});
describe('Match event type validation', () => {
it.each(['inhouse', 'tournament', undefined])(
'accepts %s in create and update requests',
(eventType) => {
expect(
validateSync(
plainToInstance(CreateMatchDto, {
title: 'Competition',
scheduledAt: '2026-07-13T10:00:00.000Z',
eventType,
}),
),
).toEqual([]);
expect(validateSync(plainToInstance(UpdateMatchDto, { eventType }))).toEqual(
[],
);
},
);
it.each(['double-elimination', null])('rejects %s as an event type', (eventType) => {
const dto = plainToInstance(UpdateMatchDto, { eventType });
expect(validateSync(dto)).toEqual([
expect.objectContaining({ property: 'eventType' }),
]);
});
});
@@ -1,4 +1,4 @@
import type { GrandFinalGameCount } from '@lolympus/contracts';
import type { GrandFinalGameCount, MatchEventType } from '@lolympus/contracts';
import { Type } from 'class-transformer';
import {
ArrayMaxSize,
@@ -15,11 +15,12 @@ import {
MaxLength,
Min,
MinLength,
ValidateIf,
ValidateNested,
ValidationArguments,
ValidationOptions,
} from 'class-validator';
import { POSITIONS } from '../../global/database/schema';
import { MATCH_EVENT_TYPES, POSITIONS } from '../../global/database/schema';
import type { MatchGameMode, Position } from '../../global/database/schema';
const LIVE_MATCH_GAME_MODES = [
@@ -83,6 +84,10 @@ export class CreateMatchDto {
@MaxLength(128)
title!: string;
@ValidateIf((_object, value) => value !== undefined)
@IsIn(MATCH_EVENT_TYPES)
eventType?: MatchEventType;
@IsOptional()
@IsString()
@MaxLength(2048)
@@ -150,6 +155,10 @@ export class UpdateMatchDto {
@MaxLength(128)
title?: string;
@ValidateIf((_object, value) => value !== undefined)
@IsIn(MATCH_EVENT_TYPES)
eventType?: MatchEventType;
@IsOptional()
@IsString()
@MaxLength(2048)
@@ -37,8 +37,11 @@ const finishedMatch = {
};
const singleSeries = {
status: 'completed',
entries: [{ gameWins: 2 }, { gameWins: 1 }],
outcome: { type: 'played', winnerTeamId: firstId.toString() },
entries: [
{ teamId: secondId.toString(), gameWins: 2 },
{ teamId: firstId.toString(), gameWins: 1 },
],
outcome: { type: 'played', winnerTeamId: secondId.toString() },
};
describe('summarizeMatchHistoryResult', () => {
@@ -55,7 +58,9 @@ describe('summarizeMatchHistoryResult', () => {
type: 'score',
teamAWins: 2,
teamBWins: 1,
winnerTeamName: '첫 팀',
teamAName: '둘째 팀',
teamBName: '첫 팀',
winnerTeamName: '둘째 팀',
});
expect(
summarizeMatchHistoryResult(
@@ -91,7 +96,7 @@ describe('summarizeMatchHistoryResult', () => {
).toEqual({
type: 'decision',
decision: 'forfeit',
winnerTeamName: '첫 팀',
winnerTeamName: '둘째 팀',
});
});
@@ -126,8 +131,8 @@ describe('summarizeMatchHistoryResult', () => {
const match = {
status: 'finished' as const,
teams: [
{ teamIndex: 1, name: '첫 팀', members: [] },
{ teamIndex: 2, name: '둘째 팀', members: [] },
{ teamIndex: 1, name: '첫 팀', members: [] },
],
result: {
winnerTeamIndex: 2,
@@ -152,6 +157,8 @@ describe('summarizeMatchHistoryResult', () => {
type: 'score',
teamAWins: 0,
teamBWins: 1,
teamAName: '첫 팀',
teamBName: '둘째 팀',
winnerTeamName: '둘째 팀',
});
expect(
@@ -23,7 +23,7 @@ export function summarizeMatchHistoryResult(
>;
if (!outcome) return;
const teamName = (teamId: string) => {
const teamName = (teamId: string | null) => {
const team = competition.teams.find(
(item) => String(item.teamId) === teamId,
);
@@ -44,6 +44,8 @@ export function summarizeMatchHistoryResult(
type: 'score',
teamAWins: teamA.gameWins,
teamBWins: teamB.gameWins,
teamAName: teamName(teamA.teamId),
teamBName: teamName(teamB.teamId),
winnerTeamName,
};
}
@@ -112,6 +114,8 @@ function summarizeLegacyResult(
type: 'score',
teamAWins,
teamBWins,
teamAName: teamA.name.trim() || `${teamA.teamIndex}팀`,
teamBName: teamB.name.trim() || `${teamB.teamIndex}팀`,
winnerTeamName: winner && (winner.name.trim() || `${winner.teamIndex}팀`),
};
}
@@ -75,6 +75,7 @@ describe('presentPublicMatch', () => {
communityId: oid('2').toString(),
competitionId: oid('3').toString(),
title: '내전',
eventType: 'inhouse',
doubleEliminationResetFinalEnabled: false,
scheduledAt: '2026-07-12T10:00:00.000Z',
participants: [
@@ -1,4 +1,8 @@
import type { MatchDetailResponse, MatchTierView } from '@lolympus/contracts';
import type {
MatchDetailResponse,
MatchEventType,
MatchTierView,
} from '@lolympus/contracts';
import type {
MatchGameMode,
MatchStatus,
@@ -13,6 +17,7 @@ interface PublicMatchSource {
competitionId?: IdLike;
shortCode?: string;
title: string;
eventType?: MatchEventType;
description: string;
mapId: number;
status: MatchStatus;
@@ -67,6 +72,7 @@ export function presentPublicMatch(
: {}),
...(source.shortCode ? { shortCode: source.shortCode } : {}),
title: source.title,
eventType: source.eventType ?? 'inhouse',
description: source.description,
mapId: source.mapId,
status: source.status,
@@ -1,10 +1,12 @@
import 'reflect-metadata';
import { GUARDS_METADATA } from '@nestjs/common/constants';
import mongoose from 'mongoose';
import { plainToInstance } from 'class-transformer';
import { METADATA_KEY_IS_PUBLIC_ACCESS_ALLOWED } from '../auth/allow-public-access.decorator';
import { ROLES_KEY } from '../auth/roles.decorator';
import { RolesGuard } from '../auth/roles.guard';
import type { UserDocument } from '../global/database/schema';
import { UpdateMatchDto } from './dto/create-match.dto';
import { MatchController } from './match.controller';
describe('MatchController history summaries', () => {
@@ -43,14 +45,40 @@ describe('MatchController history summaries', () => {
undefined,
'desc',
'true',
'tournament',
),
).resolves.toMatchObject({ matches: [{ ...summary, historyResult }] });
expect(matchService.listPage).toHaveBeenLastCalledWith(
expect.objectContaining({ eventType: 'tournament' }),
);
expect(matchService.getHistoryResults).toHaveBeenCalledWith(communityId, [
match,
]);
});
});
describe('MatchController partial updates', () => {
it('passes only supplied fields when reclassifying a match', async () => {
const communityId = new mongoose.Types.ObjectId();
const matchId = new mongoose.Types.ObjectId();
const user = { _id: new mongoose.Types.ObjectId(), communityId };
const matchService = {
update: jest.fn().mockResolvedValue({ participants: [] }),
serialize: jest.fn(),
};
const controller = new MatchController(matchService as never);
const body = plainToInstance(UpdateMatchDto, { eventType: 'tournament' });
await controller.updateMatch(user as UserDocument, communityId, matchId, body);
expect(matchService.update).toHaveBeenCalledWith({
communityId,
matchId,
patch: { eventType: 'tournament' },
});
});
});
describe('MatchController participant access', () => {
function createController() {
const joinedMatch = { _id: new mongoose.Types.ObjectId() };
@@ -1,5 +1,6 @@
import type {
MatchDetailResponse,
MatchEventType,
MatchListResponse,
} from '@lolympus/contracts';
import {
@@ -23,6 +24,7 @@ import { Roles } from '../auth/roles.decorator';
import { RolesGuard } from '../auth/roles.guard';
import { ParseObjectIdPipe } from '../common/parse-object-id.pipe';
import type { MatchStatus, UserDocument } from '../global/database/schema';
import { MATCH_EVENT_TYPES } from '../global/database/schema';
import {
AddParticipantDto,
CreateMatchDto,
@@ -51,6 +53,7 @@ export class MatchController {
hostUserId: currentUser._id,
data: {
title: body.title,
eventType: body.eventType,
description: body.description ?? '',
mapId: body.mapId ?? 11,
scheduledAt: body.scheduledAt,
@@ -85,10 +88,15 @@ export class MatchController {
@Query('scheduledTo') scheduledTo?: string,
@Query('sort') sort?: 'asc' | 'desc',
@Query('includeResults') includeResults?: string,
@Query('eventType') eventType?: MatchEventType,
): Promise<MatchListResponse> {
if (eventType !== undefined && !MATCH_EVENT_TYPES.includes(eventType)) {
throw new BadRequestException('Invalid eventType.');
}
const result = await this.matchService.listPage({
communityId,
status,
eventType,
limit: this.toOptionalNumber(limit),
page: this.toOptionalNumber(page),
offset: this.toOptionalNumber(offset),
@@ -280,6 +280,28 @@ describe('MatchService', () => {
expect(sort).toHaveBeenCalledWith({ scheduledAt: -1 });
});
it.each([
['inhouse', { $in: ['inhouse', null] }],
['tournament', 'tournament'],
] as const)(
'filters both results and pagination totals for %s events',
async (eventType, expectedEventType) => {
const communityId = new mongoose.Types.ObjectId();
const scheduledTo = new Date('2026-06-08T12:00:00.000Z');
const { service, MatchModel } = createServiceWithListModel();
await service.listPage({ communityId, scheduledTo, eventType });
const expectedFilter = {
communityId,
scheduledAt: { $lt: scheduledTo },
eventType: expectedEventType,
};
expect(MatchModel.find).toHaveBeenCalledWith(expectedFilter);
expect(MatchModel.countDocuments).toHaveBeenCalledWith(expectedFilter);
},
);
it('uses saved user preferences when joining without explicit positions', async () => {
const communityId = new mongoose.Types.ObjectId();
const userId = new mongoose.Types.ObjectId();
@@ -637,6 +659,26 @@ describe('MatchService', () => {
expect(match.set).not.toHaveBeenCalled();
});
it('allows reclassifying a finished match without altering its competition settings', async () => {
const communityId = new mongoose.Types.ObjectId();
const match = {
communityId,
status: 'finished',
set: jest.fn(),
save: jest.fn().mockResolvedValue(undefined),
};
const { service } = createService(match);
await service.update({
matchId: new mongoose.Types.ObjectId(),
communityId,
patch: { eventType: 'tournament' },
});
expect(match.set).toHaveBeenCalledWith({ eventType: 'tournament' });
expect(match.save).toHaveBeenCalledTimes(1);
});
it('rejects game count changes after recruiting', async () => {
const communityId = new mongoose.Types.ObjectId();
const match = {
+8 -1
View File
@@ -1,4 +1,4 @@
import type { MatchHistoryResult } from '@lolympus/contracts';
import type { MatchEventType, MatchHistoryResult } from '@lolympus/contracts';
import {
BadRequestException,
ConflictException,
@@ -57,6 +57,7 @@ interface UpdateMatchParams {
interface ListMatchesQuery {
communityId: mongoose.Types.ObjectId;
status?: MatchStatus;
eventType?: MatchEventType;
limit?: number;
scheduledFrom?: Date;
scheduledTo?: Date;
@@ -71,6 +72,7 @@ interface ListMatchesPageQuery extends ListMatchesQuery {
interface MatchListFilter {
communityId: mongoose.Types.ObjectId;
status?: MatchStatus;
eventType?: MatchEventType | { $in: (MatchEventType | null)[] };
scheduledAt?: {
$gte?: Date;
$lt?: Date;
@@ -712,6 +714,11 @@ export class MatchService {
communityId: query.communityId,
};
if (query.status) filter.status = query.status;
if (query.eventType) {
// MongoDB matches missing fields as well as explicit null values.
filter.eventType =
query.eventType === 'inhouse' ? { $in: ['inhouse', null] } : query.eventType;
}
if (query.scheduledFrom || query.scheduledTo) {
filter.scheduledAt = {};
if (query.scheduledFrom) filter.scheduledAt.$gte = query.scheduledFrom;
+165 -69
View File
@@ -1,10 +1,19 @@
import { BrowserRouter, Link, NavLink, Route, Routes } from "react-router";
import { lazy, Suspense, type ReactNode } from "react";
import {
BrowserRouter,
Link,
matchPath,
Navigate,
Route,
Routes,
useLocation,
useNavigate,
} from "react-router";
import { lazy, Suspense, useState, type FormEvent, type ReactNode } from "react";
import { useMsal } from "@azure/msal-react";
import { LogOut, Moon, Sun } from "lucide-react";
import { LogOut, Moon, Search, Sun } from "lucide-react";
import DevAuthSwitcher from "./components/DevAuthSwitcher";
import { DEFAULT_COMMUNITY_ID, setTheme, useTheme } from "./config";
import { useCommunity, useMe } from "./api/hooks";
import { useCommunity, useMatch, useMe } from "./api/hooks";
import { isMsalConfigured } from "./lib/auth/msal.config";
import AuthCallbackPage from "./pages/AuthCallback";
import HomePage from "./pages/HomePage";
@@ -30,7 +39,7 @@ const MatchFlowsPreview = import.meta.env.DEV
: null;
const NAV_ICON_BUTTON_CLASS =
"grid size-9 shrink-0 place-items-center rounded-field text-content-muted transition-colors hover:bg-sunken-strong hover:text-content";
"grid size-10 shrink-0 place-items-center rounded-field text-content-muted transition-colors hover:bg-sunken-strong hover:text-content md:size-11";
function MsalHeaderActions() {
const { accounts, instance } = useMsal();
@@ -39,7 +48,7 @@ function MsalHeaderActions() {
if (!account) {
return (
<Link
className="inline-flex h-9 items-center whitespace-nowrap rounded-full border border-line-strong px-2.5 text-[13px] font-semibold text-content transition-colors hover:bg-sunken sm:px-3.5"
className="inline-flex h-10 items-center whitespace-nowrap rounded-full border border-line-strong px-3.5 text-sm font-semibold text-content transition-colors hover:bg-sunken md:h-11 md:px-4 md:text-[15px]"
to="/login"
>
로그인
@@ -51,7 +60,7 @@ function MsalHeaderActions() {
return (
<div className="flex min-w-0 items-center gap-1">
<span className="hidden max-w-40 truncate text-[13px] font-medium text-content-muted sm:block">
<span className="hidden max-w-40 truncate text-sm font-medium text-content-muted lg:block">
{name}
</span>
<Tooltip content="로그아웃" placement="below">
@@ -61,7 +70,7 @@ function MsalHeaderActions() {
aria-label={`${name} 로그아웃`}
onClick={() => void instance.logoutRedirect()}
>
<LogOut className="size-4" aria-hidden="true" />
<LogOut className="size-[18px] md:size-5" aria-hidden="true" />
</button>
</Tooltip>
</div>
@@ -83,7 +92,7 @@ function ThemeToggle() {
aria-label={label}
onClick={() => setTheme(nextTheme)}
>
<Icon className="size-4" aria-hidden="true" />
<Icon className="size-[18px] md:size-5" aria-hidden="true" />
</button>
</Tooltip>
);
@@ -91,31 +100,78 @@ function ThemeToggle() {
function PrimaryNavLink({
to,
end,
sectionPaths = [],
children,
}: {
to: string;
end?: boolean;
sectionPaths?: string[];
children: ReactNode;
}) {
const { pathname } = useLocation();
const current = matchPath(to, pathname)
? "page"
: sectionPaths.some((pattern) => matchPath(pattern, pathname))
? "location"
: undefined;
return (
<NavLink
<Link
to={to}
end={end}
className={({ isActive }) =>
`relative inline-flex h-full items-center whitespace-nowrap px-3 text-sm font-semibold transition-colors ${
isActive
? "text-content after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:rounded-t-full after:bg-content"
: "text-content-muted hover:text-content"
}`
}
aria-current={current}
className={`relative inline-flex h-full items-center whitespace-nowrap px-2.5 text-base font-semibold transition-colors focus-visible:-outline-offset-2 sm:px-4 md:px-7 md:text-xl ${
current
? "text-content-strong after:absolute after:inset-x-2.5 after:bottom-0 after:h-[3px] after:rounded-t-full after:bg-primary sm:after:inset-x-4 md:after:inset-x-7"
: "text-content-subtle hover:text-content-strong"
}`}
>
{children}
</NavLink>
</Link>
);
}
/** 선수 이름으로 전적 순위표를 바로 찾는 머리글 검색. */
function HeaderPlayerSearch() {
const navigate = useNavigate();
const [value, setValue] = useState("");
function handleSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
const query = value.trim();
if (!query) return;
const params = new URLSearchParams({ view: "ranking", q: query });
void navigate(
`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats?${params.toString()}`,
);
setValue("");
}
return (
<form
role="search"
onSubmit={handleSubmit}
className="relative hidden w-56 min-w-0 md:block lg:w-72"
>
<Search
className="pointer-events-none absolute left-3.5 top-1/2 size-[18px] -translate-y-1/2 text-content-subtle"
aria-hidden="true"
/>
<input
type="search"
value={value}
onChange={(event) => setValue(event.target.value)}
placeholder="선수 이름 검색"
aria-label="선수 이름으로 전적 검색"
className="h-11 w-full rounded-full border border-line-strong bg-sunken pr-4 pl-10 text-[15px] text-content placeholder:text-content-muted focus-visible:bg-card focus-visible:placeholder:text-content-subtle"
/>
</form>
);
}
function AppHeader() {
const { pathname } = useLocation();
const matchId = matchPath("/match/:id/*", pathname)?.params.id;
const matchQuery = useMatch(matchId);
const isTournamentMatch = matchQuery.data?.eventType === "tournament";
const communityQuery = useCommunity(DEFAULT_COMMUNITY_ID);
const meQuery = useMe();
const communityLabel = communityQuery.data?.name ?? "LOLYMPUS";
@@ -123,55 +179,72 @@ function AppHeader() {
(membership) => membership.community?._id === DEFAULT_COMMUNITY_ID,
)?.user?.role;
const canManage = role === "owner" || role === "admin";
const statsPath = `/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`;
const adminPath = `/admin/communities/${DEFAULT_COMMUNITY_ID}`;
return (
<header className="sticky top-0 z-50 border-b border-line bg-card dark:bg-ink">
<div
className={`${pageWidthClass("xl")} grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] grid-rows-[var(--app-header-row-height)_var(--app-header-nav-height)] items-center sm:gap-x-3`}
>
<Link
className="col-start-2 row-start-1 flex h-full items-center text-content"
to="/"
aria-label={`${communityLabel} 홈`}
<>
<header className="h-(--app-header-row-height) shrink-0 border-b border-line bg-card dark:bg-ink">
<div
className={`${pageWidthClass("xl")} grid h-full grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center sm:gap-x-3`}
>
<span className="max-w-24 truncate text-[17px] font-extrabold tracking-[-0.02em] sm:max-w-40">
{communityLabel}
</span>
</Link>
{DEFAULT_COMMUNITY_ID && (
<nav
aria-label="주 메뉴"
className="col-span-3 row-start-2 flex h-full items-center justify-center sm:col-span-1 sm:col-start-1 sm:row-start-1 sm:justify-start"
<Link
className="col-start-2 row-start-1 flex h-full items-center text-content-strong"
to="/"
aria-label={`${communityLabel} 홈`}
>
<PrimaryNavLink to="/" end>
내전
</PrimaryNavLink>
<PrimaryNavLink
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`}
>
전적
</PrimaryNavLink>
{canManage && (
<PrimaryNavLink
to={`/admin/communities/${DEFAULT_COMMUNITY_ID}/matches`}
>
운영
</PrimaryNavLink>
)}
</nav>
)}
<div className="contents sm:col-start-3 sm:row-start-1 sm:flex sm:min-w-0 sm:items-center sm:justify-self-end sm:gap-1">
<div className="col-start-1 row-start-1 justify-self-start sm:shrink-0">
<ThemeToggle />
</div>
{isMsalConfigured && (
<div className="col-start-3 row-start-1 min-w-0 justify-self-end">
<MsalHeaderActions />
<span className="max-w-32 truncate text-xl font-extrabold tracking-[-0.02em] md:max-w-48 md:text-[22px]">
{communityLabel}
</span>
</Link>
<div className="contents sm:col-start-3 sm:row-start-1 sm:flex sm:min-w-0 sm:items-center sm:justify-end sm:gap-1 lg:gap-2">
{DEFAULT_COMMUNITY_ID && <HeaderPlayerSearch />}
<div className="col-start-1 row-start-1 justify-self-start sm:shrink-0">
<ThemeToggle />
</div>
)}
{isMsalConfigured && (
<div className="col-start-3 row-start-1 min-w-0 justify-self-end sm:shrink-0">
<MsalHeaderActions />
</div>
)}
</div>
</div>
</div>
</header>
</header>
{DEFAULT_COMMUNITY_ID && (
<nav
aria-label="주 메뉴"
className="sticky top-0 z-50 flex h-(--app-header-nav-height) shrink-0 justify-center gap-0.5 border-b border-line bg-card sm:gap-2 md:gap-5 dark:bg-ink"
>
<PrimaryNavLink to="/">홈</PrimaryNavLink>
<PrimaryNavLink
to="/inhouse"
sectionPaths={isTournamentMatch ? undefined : ["/match/*"]}
>
내전
</PrimaryNavLink>
<PrimaryNavLink
to="/tournaments"
sectionPaths={isTournamentMatch ? ["/match/*"] : undefined}
>
멸망전
</PrimaryNavLink>
<PrimaryNavLink
to={statsPath}
sectionPaths={[`${statsPath}/*`, "/users/:userId/history"]}
>
전적
</PrimaryNavLink>
{canManage && (
<PrimaryNavLink
to={`${adminPath}/matches`}
sectionPaths={[`${adminPath}/*`]}
>
운영
</PrimaryNavLink>
)}
</nav>
)}
</>
);
}
@@ -213,7 +286,7 @@ function LegalPage({
}) {
return (
<PlainPage width="md" className="py-12">
<h1 className="text-2xl font-extrabold text-content">{title}</h1>
<h1 className="text-2xl font-extrabold">{title}</h1>
<div className="lts-panel mt-6 space-y-4 p-6 text-sm leading-7 text-content-muted">
{children}
</div>
@@ -227,14 +300,14 @@ function NotFoundPage() {
<p className="tabular text-5xl font-extrabold text-content-disabled">
404
</p>
<h1 className="mt-4 text-xl font-bold text-content">
<h1 className="mt-4 text-xl font-bold">
페이지를 찾을 수 없습니다
</h1>
<p className="mt-2 text-sm text-content-muted">
주소가 바뀌었거나 삭제된 내전일 수 있습니다.
</p>
<Link
to="/"
to="/inhouse"
className="mt-6 inline-flex h-10 items-center rounded-field bg-primary px-5 text-sm font-bold text-primary-content"
>
내전 목록으로
@@ -243,17 +316,40 @@ function NotFoundPage() {
);
}
function HomeRoute() {
const { search, hash } = useLocation();
const params = new URLSearchParams(search);
if (params.get("history") === "all") {
params.delete("history");
return (
<Navigate
replace
to={{ pathname: "/inhouse", search: params.toString(), hash }}
/>
);
}
return <HomePage />;
}
function App() {
return (
<BrowserRouter>
<div
className={`lts-app-shell flex min-h-screen flex-col bg-body ${DEFAULT_COMMUNITY_ID ? "max-sm:[--app-header-nav-height:2.5rem]" : ""}`}
className={`lts-app-shell flex min-h-screen flex-col bg-body ${DEFAULT_COMMUNITY_ID ? "" : "[--app-header-nav-height:0px]"}`}
>
<AppHeader />
<div className="flex-1">
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/" element={<HomeRoute />} />
<Route
path="/inhouse"
element={<HomePage key="inhouse" eventType="inhouse" />}
/>
<Route
path="/tournaments"
element={<HomePage key="tournament" eventType="tournament" />}
/>
<Route path="/login" element={<LoginPage />} />
<Route path="/auth/callback" element={<AuthCallbackPage />} />
<Route path="/match/:id" element={<MatchDetailPage />} />
+5
View File
@@ -6,6 +6,7 @@ import type {
CompetitionDetailResponse,
CreateSeriesAdjudicationRequest,
MatchDetailResponse,
MatchEventType,
MatchLifecycleStatus,
MatchListResponse,
ReverseSeriesResultRequest,
@@ -64,6 +65,7 @@ const DDRAGON_MANIFEST_STALE_MS = 24 * 60 * 60 * 1000;
interface MatchesQueryOptions {
status?: MatchLifecycleStatus;
eventType?: MatchEventType;
limit?: number;
page?: number;
offset?: number;
@@ -97,6 +99,7 @@ function createMatchesPath(
) {
const searchParams = new URLSearchParams();
if (options.status) searchParams.set('status', options.status);
if (options.eventType) searchParams.set('eventType', options.eventType);
if (options.limit) searchParams.set('limit', String(options.limit));
if (options.page) searchParams.set('page', String(options.page));
if (options.offset) searchParams.set('offset', String(options.offset));
@@ -176,6 +179,7 @@ export function useMatches(
options.scheduledFrom ?? null,
options.scheduledTo ?? null,
options.sort ?? null,
options.eventType ?? null,
],
queryFn: async () => {
const response = await authScope.fetch<MatchListResponse>(
@@ -206,6 +210,7 @@ export function useMatchesPage(
options.scheduledTo ?? null,
options.sort ?? null,
options.includeResults ?? false,
options.eventType ?? null,
],
queryFn: () =>
authScope.fetch<MatchListResponse>(
+4
View File
@@ -1,5 +1,6 @@
import type {
GrandFinalGameCount,
MatchEventType,
MatchGameMode,
MatchPosition,
MatchPositionPreferenceView,
@@ -275,6 +276,7 @@ export interface MeResponse {
export interface MatchMutationRequest {
title: string;
eventType?: MatchEventType;
description?: string;
mapId?: number;
scheduledAt: string;
@@ -586,6 +588,8 @@ export interface ApiRecentMatchView {
summonerSpells: [number, number];
perks: ApiRunePerks;
teams: ApiRecentMatchTeam[];
/** 최대 연속 처치 수. API가 아직 내려주지 않아 화면은 없을 때를 견딘다. */
largestMultiKill?: number;
}
export interface ApiRecentMatchesResponse {
+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 12" shape-rendering="crispEdges">
<path fill="#2b1b12" d="M1 0h1v1h-1zM7 0h1v1h-1zM13 0h1v1h-1zM0 1h1v1h-1zM2 1h1v1h-1zM6 1h1v1h-1zM8 1h1v1h-1zM12 1h1v1h-1zM14 1h1v1h-1zM0 2h1v1h-1zM2 2h1v1h-1zM6 2h1v1h-1zM8 2h1v1h-1zM12 2h1v1h-1zM14 2h1v1h-1zM0 3h1v1h-1zM3 3h1v1h-1zM5 3h1v1h-1zM9 3h1v1h-1zM11 3h1v1h-1zM14 3h1v1h-1zM0 4h1v1h-1zM4 4h1v1h-1zM10 4h1v1h-1zM14 4h1v1h-1zM0 5h1v1h-1zM14 5h1v1h-1zM0 6h1v1h-1zM14 6h1v1h-1zM0 7h1v1h-1zM14 7h1v1h-1zM0 8h15v1h-15zM0 9h1v1h-1zM14 9h1v1h-1zM0 10h1v1h-1zM14 10h1v1h-1zM1 11h13v1h-13z"/>
<path fill="#fff4a8" d="M1 1h1v1h-1zM7 1h1v1h-1zM13 1h1v1h-1zM1 4h1v1h-1zM1 5h1v1h-1z"/>
<path fill="#ffd91a" d="M1 2h1v1h-1zM7 2h1v1h-1zM1 3h2v1h-2zM6 3h3v1h-3zM12 3h1v1h-1zM2 4h2v1h-2zM5 4h5v1h-5zM11 4h2v1h-2zM2 5h11v1h-11zM1 6h1v1h-1zM3 6h4v1h-4zM8 6h4v1h-4zM1 7h11v1h-11zM1 9h1v1h-1zM3 9h1v1h-1zM5 9h1v1h-1zM7 9h1v1h-1zM9 9h1v1h-1zM11 9h1v1h-1z"/>
<path fill="#f08a24" d="M13 2h1v1h-1zM13 3h1v1h-1zM13 4h1v1h-1zM13 5h1v1h-1zM13 6h1v1h-1zM12 7h2v1h-2zM2 9h1v1h-1zM4 9h1v1h-1zM6 9h1v1h-1zM8 9h1v1h-1zM10 9h1v1h-1zM12 9h2v1h-2zM1 10h13v1h-13z"/>
<path fill="#e5372b" d="M2 6h1v1h-1zM7 6h1v1h-1zM12 6h1v1h-1z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

+6
View File
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" shape-rendering="crispEdges">
<path fill="#2b1b12" d="M2 0h9v1h-9zM0 1h3v1h-3zM10 1h3v1h-3zM0 2h1v1h-1zM2 2h1v1h-1zM10 2h1v1h-1zM12 2h1v1h-1zM0 3h1v1h-1zM2 3h1v1h-1zM10 3h1v1h-1zM12 3h1v1h-1zM0 4h3v1h-3zM10 4h3v1h-3zM2 5h1v1h-1zM10 5h1v1h-1zM3 6h1v1h-1zM9 6h1v1h-1zM4 7h1v1h-1zM8 7h1v1h-1zM5 8h1v1h-1zM7 8h1v1h-1zM5 9h1v1h-1zM7 9h1v1h-1zM4 10h1v1h-1zM8 10h1v1h-1zM3 11h1v1h-1zM9 11h1v1h-1zM3 12h7v1h-7z"/>
<path fill="#fff4a8" d="M3 1h1v1h-1zM3 2h1v1h-1zM3 3h1v1h-1zM3 4h1v1h-1z"/>
<path fill="#ffd91a" d="M4 1h5v1h-5zM4 2h5v1h-5zM4 3h5v1h-5zM4 4h5v1h-5zM3 5h6v1h-6zM4 6h4v1h-4zM5 7h2v1h-2zM6 8h1v1h-1zM5 10h3v1h-3zM4 11h4v1h-4z"/>
<path fill="#f08a24" d="M9 1h1v1h-1zM9 2h1v1h-1zM9 3h1v1h-1zM9 4h1v1h-1zM9 5h1v1h-1zM8 6h1v1h-1zM7 7h1v1h-1zM6 9h1v1h-1zM8 11h1v1h-1z"/>
</svg>

After

Width:  |  Height:  |  Size: 844 B

+3 -3
View File
@@ -3,7 +3,7 @@ import { NavLink } from "react-router";
import { PageBody, PageHero } from "../ui";
const ADMIN_SECTIONS = [
{ path: "matches", label: "내전 관리" },
{ path: "matches", label: "대회 관리" },
{ path: "tournament-codes", label: "토너먼트 코드" },
{ path: "legacy-import", label: "과거 기록 가져오기" },
{ path: "legacy-matches", label: "과거 기록 정리" },
@@ -46,7 +46,7 @@ export function AdminPage({
className={({ isActive }) =>
`flex min-h-10 items-center justify-center rounded-[10px] px-2 py-2 text-center text-xs font-bold transition-colors sm:px-4 sm:text-sm ${
isActive
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
? "bg-secondary text-secondary-content"
: "text-content-muted hover:bg-sunken hover:text-content"
}`
}
@@ -72,7 +72,7 @@ export function AdminNotice({
return (
<main className="mx-auto w-full max-w-3xl px-4 py-16 sm:px-6">
<div className="lts-panel px-6 py-10 text-center">
<h1 className="text-lg font-bold text-content">{title}</h1>
<h1 className="text-lg font-bold">{title}</h1>
{children && (
<div className="mt-2 text-sm text-content-muted">{children}</div>
)}
@@ -0,0 +1,52 @@
.lts-hall {
--lts-hall-slant: 10px;
/* Paint the muted band edge to edge without leaving the page-width column. */
background: var(--color-background-muted);
box-shadow: 0 0 0 100vmax var(--color-background-muted);
clip-path: inset(0 -100vmax);
}
.lts-hall-card {
border-radius: 1.25rem;
}
.lts-hall-player,
.lts-hall-portrait {
border-radius: 0.75rem;
}
.lts-hall-pixel {
image-rendering: pixelated;
}
.lts-hall-crown {
rotate: 14deg;
}
@media (prefers-reduced-motion: no-preference) {
.lts-hall[data-intro] .lts-hall-portrait img {
animation: lts-hall-reveal 110ms linear
calc(180ms + var(--lts-hall-order) * 48ms) backwards;
}
}
@keyframes lts-hall-reveal {
from {
clip-path: polygon(
0 0,
0 0,
calc(0px - var(--lts-hall-slant)) 100%,
0 100%
);
}
to {
clip-path: polygon(
0 0,
calc(100% + var(--lts-hall-slant)) 0,
100% 100%,
0 100%
);
}
}
+183
View File
@@ -0,0 +1,183 @@
import type { MatchPosition } from '@lolympus/contracts';
import { ChevronRight, UserRound } from 'lucide-react';
import { useEffect, useRef, useState, type CSSProperties } from 'react';
import { Link } from 'react-router';
import { useDdragonManifest } from '../api/hooks';
import captainCrown from '../assets/captain-crown.svg';
import pixelTrophy from '../assets/pixel-trophy.svg';
import { profileIconUrl } from '../lib/ddragon';
import { positionLabel } from '../lib/league';
import { pageWidthClass } from '../ui/layout';
import './HomeHallOfFame.css';
// The roster featured on the home page is curated independently of match results.
const FEATURED_TEAM = {
name: '똥칼라파워',
captainUserId: '69f090029bf765ff8e54faae',
members: [
{
userId: '6a36268cf3a6fd12921ca016',
position: 'TOP',
gameName: 'ALLM',
tagLine: 'ALL',
profileIconId: 6091,
},
{
userId: '69f090029bf765ff8e54faae',
position: 'JGL',
gameName: 'OPIS',
tagLine: '2283',
profileIconId: 7146,
},
{
userId: '69f090039bf765ff8e54facf',
position: 'MID',
gameName: '우 킨',
tagLine: '안우킨',
profileIconId: 6622,
},
{
userId: '6a37c488f3a6fd12921cf2b4',
position: 'ADC',
gameName: '말 안해도 알잖아',
tagLine: 'Ф x Ф',
profileIconId: 6379,
},
{
userId: '69f090069bf765ff8e54fb5a',
position: 'SUP',
gameName: '툭치면 크르릉',
tagLine: 'KR1',
profileIconId: 4020,
},
] satisfies Array<{
userId: string;
position: MatchPosition;
gameName: string;
tagLine: string;
profileIconId: number;
}>,
};
export default function HomeHallOfFame({
introReady,
}: {
introReady: boolean;
}) {
const { data: manifest } = useDdragonManifest();
const sectionRef = useRef<HTMLElement>(null);
const [playIntro, setPlayIntro] = useState(false);
useEffect(() => {
const section = sectionRef.current;
if (
!introReady ||
!section ||
typeof IntersectionObserver === 'undefined' ||
window.matchMedia('(prefers-reduced-motion: reduce)').matches
) {
return;
}
const observer = new IntersectionObserver(
([entry]) => {
if (entry?.isIntersecting) setPlayIntro(true);
},
{ threshold: 0.5 },
);
observer.observe(section);
return () => observer.disconnect();
}, [introReady]);
return (
// The second grid column is left empty on purpose: it reserves room for a
// small companion card beside the hall of fame.
<section
ref={sectionRef}
aria-labelledby="home-hall-of-fame"
className={`${pageWidthClass()} lts-hall grid gap-8 py-6 md:py-8 lg:grid-cols-[minmax(0,1fr)_20rem]`}
data-intro={playIntro ? '' : undefined}
>
<div className="lts-hall-card flex min-w-0 flex-col gap-4 bg-card p-5 sm:flex-row sm:gap-5">
<h2 className="min-w-0 sm:w-36 sm:shrink-0">
<span
id="home-hall-of-fame"
className="block text-sm font-semibold text-content-muted"
>
명예의 전당
</span>
<span className="mt-2 block text-2xl leading-tight font-extrabold tracking-tight [overflow-wrap:anywhere]">
{FEATURED_TEAM.name}
</span>
<span className="mt-1 flex items-center gap-1 text-xs font-semibold text-content-muted">
<img src={pixelTrophy} alt="" className="lts-hall-pixel size-4" />
직전 멸망전 우승
</span>
</h2>
<div className="h-px bg-line sm:h-auto sm:w-px" aria-hidden="true" />
<ul
className="grid min-w-0 flex-1 gap-1 sm:grid-cols-5 sm:content-center sm:items-start"
aria-label="우승팀 선수"
>
{FEATURED_TEAM.members.map(
({ userId, position, gameName, tagLine, profileIconId }, index) => {
const icon = profileIconUrl(manifest, profileIconId);
const isCaptain = userId === FEATURED_TEAM.captainUserId;
return (
<li key={userId} className="min-w-0">
<Link
to={`/users/${userId}/history?queueGroup=internal`}
className="lts-hall-player group flex h-full items-center gap-2.5 px-2 py-2 transition-colors hover:bg-sunken focus-visible:-outline-offset-2 sm:flex-col sm:gap-2 sm:py-3 sm:text-center"
>
<span className="relative shrink-0">
{isCaptain && (
<img
src={captainCrown}
alt="팀장"
className="lts-hall-crown lts-hall-pixel absolute -top-2.5 -right-2.5 z-10 w-6"
/>
)}
<span
className="lts-hall-portrait relative grid size-10 place-items-center overflow-hidden bg-sunken-strong text-content-muted sm:size-13"
style={{ '--lts-hall-order': index } as CSSProperties}
>
<UserRound className="size-5" aria-hidden="true" />
<img
key={icon}
src={icon}
alt=""
className="absolute inset-0 size-full object-cover"
onError={(event) => {
event.currentTarget.hidden = true;
}}
/>
</span>
</span>
<span className="min-w-0 flex-1 sm:w-full sm:flex-none">
<span className="block text-xs font-semibold text-content-muted">
{positionLabel[position]}
</span>
<span className="flex flex-wrap items-baseline gap-x-1.5 sm:flex-col sm:items-center">
<span className="text-sm font-bold [overflow-wrap:anywhere] group-hover:underline">
{gameName}
</span>
<span className="text-xs text-content-muted [overflow-wrap:anywhere]">
#{tagLine}
</span>
</span>
</span>
<ChevronRight
className="size-4 shrink-0 text-content-muted sm:hidden"
aria-hidden="true"
/>
</Link>
</li>
);
},
)}
</ul>
</div>
</section>
);
}
@@ -612,11 +612,11 @@ function SkillBuildPanel({
</div>
{skillEvents.length > 0 ? (
<div className="mt-3 overflow-x-auto">
<div className="min-w-[610px] space-y-1">
<div className="min-w-[400px] space-y-1">
{SKILL_ROWS.map((row) => (
<div
key={`skill-row-${row.slot}`}
className="grid grid-cols-[2rem_repeat(18,minmax(1.45rem,1fr))] gap-1"
className="grid grid-cols-[2rem_repeat(18,minmax(1.1rem,1fr))] gap-0.5"
>
<div
className={`flex h-7 items-center justify-center text-xs font-bold ${row.className}`}
+6 -6
View File
@@ -289,7 +289,7 @@ function SummonerSpellTooltipContent({
return (
<div className="space-y-2">
<div className="font-black text-[#f0d878]">
<div className="font-black text-item-highlight">
{spell?.name ?? `스펠 ${spellId}`}
</div>
{descriptionHtml ? (
@@ -320,7 +320,7 @@ function RuneTooltipContent({
return (
<div className="space-y-2">
<div className="font-black text-[#f0d878]">
<div className="font-black text-item-highlight">
{rune?.name ?? (runeId ? `룬 ${runeId}` : "룬")}
</div>
{rune?.shortDesc ? (
@@ -349,7 +349,7 @@ function RuneStyleTooltipContent({
return (
<div className="space-y-2">
<div className="font-black text-[#f0d878]">
<div className="font-black text-item-highlight">
{style?.name ?? (styleId ? `룬 ${styleId}` : "룬")}
</div>
<div className="text-white/55">룬 스타일</div>
@@ -371,7 +371,7 @@ function ItemTooltipContent({
return (
<div className="space-y-2">
<div className="font-black text-[#f0d878]">
<div className="font-black text-item-highlight">
{item?.name ?? `아이템 ${itemId}`}
</div>
{item?.plaintext ? (
@@ -390,8 +390,8 @@ function ItemTooltipContent({
{item?.gold.total ? (
<div className="border-t border-white/10 pt-2 font-bold text-white">
가격:
<span className="text-[#f0d878]">{item.gold.total}</span>{" "}
<span className="text-[#f0d878]">
<span className="text-item-highlight">{item.gold.total}</span>{" "}
<span className="text-item-highlight">
({item.gold.base || item.gold.total})
</span>
</div>
@@ -165,12 +165,13 @@ function RoundColumn({
{bracketRoundLabel(round.stage, round.roundNumber)}
</h3>
<div className="space-y-3">
{round.seriesIds.map((seriesId) => {
{round.seriesIds.map((seriesId, index) => {
const series = seriesById.get(seriesId);
return series ? (
<SeriesScoreCard
key={series.seriesId}
series={series}
displayLabel={`${index + 1}경기`}
teamById={teamById}
/>
) : null;
@@ -55,7 +55,7 @@ export function MatchDetailTabBar({
}
return (
<div className="lts-panel sticky top-(--app-header-height) z-40 p-1">
<div className="lts-panel sticky top-(--app-header-nav-height) z-40 p-1">
<div
className="no-scrollbar flex gap-1 overflow-x-auto"
role="tablist"
@@ -79,7 +79,7 @@ export function MatchDetailTabBar({
onKeyDown={(event) => handleKeyDown(event, tab.id)}
className={`h-10 flex-none whitespace-nowrap rounded-[10px] px-4 text-sm font-bold transition-colors sm:px-5 ${
selected
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
? "bg-secondary text-secondary-content"
: "text-content-muted hover:bg-sunken hover:text-content"
}`}
>
@@ -86,11 +86,6 @@ export function SeriesScoreCard({
<span className="block truncate text-[11px] font-bold leading-3 text-base-content/75">
{identity.label}
</span>
{identity.code && (
<span className="mt-0.5 block truncate font-mono text-[9px] leading-[10px] text-content-subtle">
{identity.code}
</span>
)}
</span>
<span
className={`inline-flex shrink-0 items-center gap-1 border px-1 py-0.5 text-[10px] font-bold leading-3 ${STATUS_TONE_CLASS[presentation.tone]}`}
@@ -58,9 +58,6 @@ export function TeamSeriesCard({
{displayLabel}
</h3>
<div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-content-muted">
{series.code && (
<code className="break-all font-mono">{series.code}</code>
)}
<span>{seriesRuleLabel(series)}</span>
</div>
</div>
@@ -198,7 +198,7 @@ export function TeamTournamentCodes({
aria-label={`${seriesLabel} 토너먼트 코드`}
>
<div className="px-4 pt-3 sm:px-5">
<h4 className="text-sm font-bold text-base-content">토너먼트 코드</h4>
<h4 className="text-sm font-bold">토너먼트 코드</h4>
</div>
<ol>
{renderAssignment(nextAssignment)}
+220 -81
View File
@@ -10,8 +10,6 @@
*/
@layer reset, theme, base, astryx-base, astryx-theme, lolympus, components, utilities;
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/preflight.css" layer(base);
@import "@astryxdesign/core/reset.css";
@@ -21,6 +19,14 @@
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
@font-face {
font-family: "SuitVariable";
src: url("https://cdn.jsdelivr.net/gh/Project-Noonnu/2611030106@font-variable-845/variable-845/SUIT-Variable.woff2") format("woff2");
font-style: normal;
font-weight: 100 900;
font-display: swap;
}
/* ── 원색 ──
실제 색상값은 이곳에서만 관리한다. 화면은 아래 역할 토큰을 쓴다. */
@theme static {
@@ -28,6 +34,58 @@
--color-brand-ink: #22252e;
--color-brand-gold: #f2b01e;
--color-brand-leaf: #2f9e58;
/* 기본 표면과 테두리 */
--color-palette-white: #ffffff;
--color-palette-black: #000000;
--color-palette-body-dark: #14161b;
--color-palette-card-dark: #1e2129;
--color-palette-popover-dark: #272b35;
--color-palette-muted-light: #eff0f5;
--color-palette-muted-dark: #262a33;
--color-palette-sunken-dark: #181b21;
--color-palette-sunken-strong-light: #e7eaf1;
--color-palette-sunken-strong-dark: #2b2f39;
--color-palette-line-light: #e2e4eb;
--color-palette-line-dark: #ffffff17;
--color-palette-line-strong-light: #d2d6e1;
--color-palette-line-strong-dark: #484d5a;
--color-palette-shadow-light: #26283808;
--color-palette-shadow-dark: #00000033;
/* 글자 */
--color-palette-title-light: #454757;
--color-palette-text-light: #3d3f4c;
--color-palette-text-strong-light: #262838;
--color-palette-text-dark: #f1f2f5;
--color-palette-text-secondary-dark: #b3b9c6;
--color-palette-text-subtle-light: #6d707f;
--color-palette-text-disabled-light: #9297a5;
--color-palette-text-disabled-dark: #6f7685;
--color-palette-coral-ink: #261b19;
--color-palette-gold-ink: #2a1f04;
--color-palette-item-highlight: #f0d878;
/* 경기 결과와 상태 */
--color-palette-win-text-light: #2456a2;
--color-palette-win-text-dark: #a2c4ff;
--color-palette-win-fill-light: #4279ca;
--color-palette-win-fill-dark: #6598e7;
--color-palette-win-tint-dark: #202b3d;
--color-palette-loss-text-light: #a92e42;
--color-palette-loss-text-dark: #ffabb3;
--color-palette-loss-fill-light: #d75464;
--color-palette-loss-fill-dark: #ea7583;
--color-palette-loss-tint-dark: #39272b;
--color-palette-gold-text-light: #805213;
--color-palette-gold-text-dark: #f1cd82;
--color-palette-gold-tint-light: #fbf2df;
--color-palette-gold-tint-dark: #3b3020;
--color-palette-leaf-text-light: #246a46;
--color-palette-leaf-text-dark: #9cd8b2;
--color-palette-leaf-fill-dark: #5cba82;
--color-palette-leaf-tint-light: #eaf4ed;
--color-palette-leaf-tint-dark: #23352a;
}
@layer lolympus {
@@ -35,78 +93,105 @@
[data-astryx-theme="neutral"] {
/* 글자 */
--font-family-body:
"Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
sans-serif;
"SuitVariable", -apple-system, BlinkMacSystemFont, system-ui,
"Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
--font-family-heading: var(--font-family-body);
/* 모서리: 카드는 넉넉하게, 조작 요소는 한 단계 작게 */
/* 카드, 조작 요소, 작은 이미지의 모서리 */
--radius-inner: 0.375rem;
--radius-element: 0.5rem;
--radius-container: 0.875rem;
--radius-page: 1.25rem;
--radius-container: 0.75rem;
--radius-page: 0.75rem;
/* 표면 */
--color-background-body: light-dark(#f1f2f6, #14161b);
--color-background-card: light-dark(#ffffff, #1e2129);
--color-background-surface: light-dark(#ffffff, #1e2129);
--color-background-popover: light-dark(#ffffff, #272b35);
--color-background-muted: light-dark(#f4f5f8, #262a33);
/* 조작 요소 높이: 칩(32) · 기본 버튼(36) · 강조 버튼과 탭(40) */
--size-element-sm: 2rem;
--size-element-md: 2.25rem;
--size-element-lg: 2.5rem;
/* 흰 기본 표면과 옅은 보조 표면 */
--color-background-body: light-dark(var(--color-palette-white), var(--color-palette-body-dark));
--color-background-card: light-dark(var(--color-palette-white), var(--color-palette-card-dark));
--color-background-surface: var(--color-background-card);
--color-background-popover: light-dark(var(--color-palette-white), var(--color-palette-popover-dark));
--color-background-muted: light-dark(var(--color-palette-muted-light), var(--color-palette-muted-dark));
/* 글자·선 */
--color-text-primary: light-dark(#1b1e26, #f1f2f5);
--color-text-secondary: light-dark(#5a6170, #a4abb8);
--color-text-disabled: light-dark(#a6acb8, #5d6471);
--color-text-primary: light-dark(var(--color-palette-text-light), var(--color-palette-text-dark));
--lts-text-title: light-dark(var(--color-palette-title-light), var(--color-palette-text-dark));
--lts-text-strong: light-dark(var(--color-palette-text-strong-light), var(--color-palette-text-dark));
--color-text-secondary: light-dark(
var(--color-palette-title-light),
var(--color-palette-text-secondary-dark)
);
/* 흰 표면의 보조 글자. 옅은 배경의 작은 글자는 secondary를 쓴다. */
--lts-text-subtle: light-dark(var(--color-palette-text-subtle-light), var(--color-palette-text-secondary-dark));
--color-text-disabled: light-dark(
var(--color-palette-text-disabled-light),
var(--color-palette-text-disabled-dark)
);
--color-icon-primary: var(--color-text-primary);
--color-icon-secondary: var(--color-text-secondary);
--color-border: light-dark(#1b1e2614, #ffffff17);
--color-border-emphasized: light-dark(#d3d7df, #414653);
--color-border: light-dark(var(--color-palette-line-light), var(--color-palette-line-dark));
--color-border-emphasized: light-dark(
var(--color-palette-line-strong-light),
var(--color-palette-line-strong-dark)
);
/* 주 액션: 브랜드 코랄 위에 짙은 글자 */
--color-accent: var(--color-brand-coral);
--color-on-accent: light-dark(#2a1704, #1f1203);
--color-on-accent: var(--color-palette-coral-ink);
--color-accent-muted: light-dark(
color-mix(in oklab, var(--color-brand-coral) 18%, white),
color-mix(in oklab, var(--color-brand-coral) 13%, var(--color-background-card)),
color-mix(in oklab, var(--color-brand-coral) 25%, var(--color-background-body))
);
--color-text-accent: light-dark(
color-mix(in oklab, var(--color-brand-coral) 75%, black),
color-mix(in oklab, var(--color-brand-coral) 78%, white)
color-mix(in oklab, var(--color-brand-coral) 70%, var(--color-palette-black)),
color-mix(in oklab, var(--color-brand-coral) 66%, var(--color-palette-white))
);
--color-icon-accent: var(--color-text-accent);
/* ── LOLYMPUS 전용 역할 ── */
/* 짙은 페이지 머리 띠와 다크 모드 상단 내비게이션. */
--lts-ink: light-dark(var(--color-brand-ink), #0e1014);
--lts-ink-raised: light-dark(#2e323d, #1a1d24);
--lts-ink-line: #ffffff1f;
--lts-on-ink: #f4f5f7;
--lts-on-ink-muted: #b3b9c6;
/* 선택된 필터와 탭 */
--lts-ink: light-dark(var(--color-brand-ink), var(--color-palette-text-dark));
--lts-on-ink: light-dark(var(--color-palette-white), var(--color-palette-text-strong-light));
/* 제목 영역은 본문과 같은 계열의 단색 표면을 쓴다. */
--lts-hero: var(--lts-sunken);
--lts-hero-raised: var(--color-background-card);
--lts-hero-line: var(--color-border);
--lts-on-hero: var(--color-text-primary);
--lts-on-hero-muted: var(--color-text-secondary);
/* 들어간 표면(표 머리, 통계 칸, 입력 배경) */
--lts-sunken: light-dark(#f6f7f9, #181b21);
--lts-sunken-strong: light-dark(#eceef2, #2b2f39);
--lts-text-tertiary: light-dark(#7d8493, #848b99);
--lts-sunken: light-dark(var(--color-palette-muted-light), var(--color-palette-sunken-dark));
--lts-sunken-strong: light-dark(
var(--color-palette-sunken-strong-light),
var(--color-palette-sunken-strong-dark)
);
/* 경기 결과와 진영 */
--lts-win: light-dark(#2c6be0, #7fabff);
--lts-win-fill: light-dark(#4d8bf5, #4d8bf5);
--lts-win-tint: light-dark(#eaf1ff, #1c2a47);
--lts-win-line: light-dark(#c9dbfb, #2f4470);
--lts-loss: light-dark(#d93a4d, #ff8c97);
--lts-loss-fill: light-dark(#ec5567, #ec5567);
--lts-loss-tint: light-dark(#ffeef0, #40212a);
--lts-loss-line: light-dark(#f8cfd5, #6a3140);
--lts-gold: light-dark(#a86a00, #f5c451);
--lts-win: light-dark(var(--color-palette-win-text-light), var(--color-palette-win-text-dark));
--lts-win-fill: light-dark(var(--color-palette-win-fill-light), var(--color-palette-win-fill-dark));
--lts-win-tint: light-dark(
color-mix(in srgb, var(--color-palette-win-fill-light) 5%, var(--color-palette-white)),
var(--color-palette-win-tint-dark)
);
--lts-win-line: color-mix(in srgb, var(--lts-win-fill) 25%, var(--color-background-card));
--lts-loss: light-dark(var(--color-palette-loss-text-light), var(--color-palette-loss-text-dark));
--lts-loss-fill: light-dark(var(--color-palette-loss-fill-light), var(--color-palette-loss-fill-dark));
--lts-loss-tint: light-dark(
color-mix(in srgb, var(--color-palette-loss-fill-light) 5%, var(--color-palette-white)),
var(--color-palette-loss-tint-dark)
);
--lts-loss-line: color-mix(in srgb, var(--lts-loss-fill) 25%, var(--color-background-card));
--lts-gold: light-dark(var(--color-palette-gold-text-light), var(--color-palette-gold-text-dark));
--lts-gold-fill: var(--color-brand-gold);
--lts-gold-tint: light-dark(#fff5d9, #3d3113);
--lts-leaf: light-dark(#23804a, #74d199);
--lts-leaf-fill: light-dark(var(--color-brand-leaf), #3bb56d);
--lts-leaf-tint: light-dark(#e6f6ec, #17352a);
--lts-gold-tint: light-dark(var(--color-palette-gold-tint-light), var(--color-palette-gold-tint-dark));
--lts-leaf: light-dark(var(--color-palette-leaf-text-light), var(--color-palette-leaf-text-dark));
--lts-leaf-fill: light-dark(var(--color-brand-leaf), var(--color-palette-leaf-fill-dark));
--lts-leaf-tint: light-dark(var(--color-palette-leaf-tint-light), var(--color-palette-leaf-tint-dark));
--lts-shadow-card:
0 1px 2px light-dark(#1b1e260a, #00000040),
0 2px 8px light-dark(#1b1e260a, #00000033);
--lts-shadow-card: 0 3px 10px
light-dark(var(--color-palette-shadow-light), var(--color-palette-shadow-dark));
}
}
@@ -122,7 +207,6 @@
font-family: var(--font-family-body);
font-size: 15px;
line-height: 1.55;
font-feature-settings: "ss06";
-webkit-font-smoothing: antialiased;
}
}
@@ -139,6 +223,10 @@
color: inherit;
}
:where(h1, h2, h3, h4, h5, h6) {
color: var(--lts-text-title);
}
/* 테두리를 두른 상자·칩의 기본 모서리. rounded-* 유틸리티가 항상 이긴다. */
:where(
div,
@@ -175,6 +263,15 @@
outline: 2px solid var(--color-text-accent);
outline-offset: 2px;
}
/* 버튼은 칩과 같은 알약 모양으로 통일한다. */
.astryx-button {
border-radius: 999px;
font-weight: 600;
}
.astryx-button:where([data-size="md"], [data-size="lg"]) {
padding-inline: 1rem;
}
}
/* ── Tailwind 유틸리티 ↔ 토큰 매핑 ──
@@ -196,15 +293,17 @@
--color-line-strong: var(--color-border-emphasized);
--color-content: var(--color-text-primary);
--text-color-content-strong: var(--lts-text-strong);
--color-content-muted: var(--color-text-secondary);
--color-content-subtle: var(--lts-text-tertiary);
--color-content-subtle: var(--lts-text-subtle);
--color-content-disabled: var(--color-text-disabled);
--color-ink: var(--lts-ink);
--color-ink-raised: var(--lts-ink-raised);
--color-ink-line: var(--lts-ink-line);
--color-on-ink: var(--lts-on-ink);
--color-on-ink-muted: var(--lts-on-ink-muted);
/* ink 유틸리티는 페이지 머리 띠 표면을 가리킨다. 짙은 채움은 secondary를 쓴다. */
--color-ink: var(--lts-hero);
--color-ink-raised: var(--lts-hero-raised);
--color-ink-line: var(--lts-hero-line);
--color-on-ink: var(--lts-on-hero);
--color-on-ink-muted: var(--lts-on-hero-muted);
/* primary: 채움은 브랜드 코랄, 글자·선은 테마에 맞춘 코랄 */
--color-primary: var(--color-accent);
@@ -219,7 +318,7 @@
--color-accent: var(--lts-gold-fill);
--text-color-accent: var(--lts-gold);
--color-accent-content: #2a1f04;
--color-accent-content: var(--color-palette-gold-ink);
--color-win: var(--lts-win-fill);
--text-color-win: var(--lts-win);
@@ -238,16 +337,18 @@
--color-info: var(--lts-win-fill);
--text-color-info: var(--lts-win);
--color-info-content: #ffffff;
--color-info-content: var(--color-palette-white);
--color-success: var(--lts-leaf-fill);
--text-color-success: var(--lts-leaf);
--color-success-content: #ffffff;
--color-success-content: var(--color-palette-white);
--color-warning: var(--lts-gold-fill);
--text-color-warning: var(--lts-gold);
--color-warning-content: #2a1f04;
--color-warning-content: var(--color-palette-gold-ink);
--color-error: var(--lts-loss-fill);
--text-color-error: var(--lts-loss);
--color-error-content: #ffffff;
--color-error-content: var(--color-palette-white);
--text-color-item-highlight: var(--color-palette-item-highlight);
--color-bracket-winner: var(--color-text-accent);
@@ -257,7 +358,7 @@
}
@layer utilities {
/* 낮은 알파의 본문색 글자는 대비가 무너진다. 3단 역할색으로 올려 붙인다.
/* 낮은 알파의 본문색 글자는 대비가 무너진다. 보조 글자색으로 올려 붙인다.
hover/focus 유틸이 specificity로 이길 수 있도록 !important를 쓰지 않는다. */
.text-base-content\/15,
.text-base-content\/20,
@@ -265,10 +366,7 @@
.text-base-content\/30,
.text-base-content\/35,
.text-base-content\/40,
.text-base-content\/45 {
color: var(--lts-text-tertiary);
}
.text-base-content\/45,
.text-base-content\/50,
.text-base-content\/55,
.text-base-content\/60,
@@ -292,13 +390,48 @@
@layer components {
.lts-app-shell {
--app-header-row-height: 3.5rem;
--app-header-nav-height: 0px;
--app-header-height: calc(var(--app-header-row-height) + var(--app-header-nav-height) + 1px);
--app-header-row-height: 3.25rem;
/* 페이지 내부 고정 탭의 위쪽 여백은 메뉴 줄 높이만 사용한다. */
--app-header-nav-height: 3rem;
--app-header-height: calc(var(--app-header-row-height) + var(--app-header-nav-height));
}
:root:not([data-theme="dark"]) .lts-app-shell:has(main.lts-overview) {
--color-background-body: #f9f9f9;
@media (width >= 48rem) {
.lts-app-shell {
--app-header-row-height: 3.5rem;
--app-header-nav-height: 4rem;
}
}
.lts-home-hero {
--hero-backdrop: var(--color-palette-body-dark);
background: var(--hero-backdrop);
color: var(--color-palette-white);
}
.lts-home-hero::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
background: linear-gradient(
90deg,
color-mix(in srgb, var(--hero-backdrop) 92%, transparent),
color-mix(in srgb, var(--hero-backdrop) 80%, transparent) 55%,
color-mix(in srgb, var(--hero-backdrop) 45%, transparent)
);
}
@media (width >= 48rem) {
.lts-home-hero::before {
background: linear-gradient(
90deg,
var(--hero-backdrop),
color-mix(in srgb, var(--hero-backdrop) 78%, transparent) 35%,
color-mix(in srgb, var(--hero-backdrop) 10%, transparent) 80%,
var(--hero-backdrop)
);
}
}
/* 흰 카드. 페이지의 기본 데이터 그릇이다. */
@@ -317,7 +450,7 @@
}
.lts-table thead th {
background: var(--lts-sunken);
color: var(--lts-text-tertiary);
color: var(--color-text-secondary);
font-size: 0.75rem;
font-weight: 600;
text-align: left;
@@ -352,12 +485,12 @@
}
.lts-input::placeholder,
.lts-textarea::placeholder {
color: var(--color-text-disabled);
color: var(--lts-text-subtle);
}
.lts-input:hover,
.lts-select:hover,
.lts-textarea:hover {
border-color: var(--lts-text-tertiary);
border-color: var(--lts-text-subtle);
}
.lts-input:focus-visible,
.lts-select:focus-visible,
@@ -373,13 +506,6 @@
color: var(--color-text-disabled);
cursor: not-allowed;
}
.lts-select {
appearance: none;
padding-right: 2rem;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8493' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.625rem center;
}
.lts-textarea {
min-height: 5rem;
resize: vertical;
@@ -429,7 +555,20 @@
.animate-outbid-shake {
animation: lts-outbid-shake 0.4s ease-in-out;
}
/* 홈 순위 카드: 넘긴 방향에서 새 순위가 밀려 들어온다. */
@keyframes lts-rank-slide-in {
from {
opacity: 0;
transform: translateX(var(--lts-rank-slide-from, 1.5rem));
}
}
.lts-rank-slide {
animation: lts-rank-slide-in 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
.lts-rank-slide,
.animate-bid-pop,
.animate-outbid-shake {
animation: none;
+7 -7
View File
@@ -3,18 +3,18 @@ import type { DdragonManifest } from '../api/types';
const FALLBACK_VERSION = '15.24.1';
const FALLBACK_CDN = 'https://ddragon.leagueoflegends.com/cdn';
const DDRAGON_DESCRIPTION_TAG_CLASSES: Record<string, string> = {
active: 'text-[#f0d878] font-semibold',
attention: 'text-[#f0d878] font-semibold',
active: 'text-item-highlight font-semibold',
attention: 'text-item-highlight font-semibold',
flavorText: 'text-white/45 italic',
healing: 'text-emerald-300 font-semibold',
keywordMajor: 'text-[#f0d878] font-semibold',
keywordName: 'text-[#f0d878] font-semibold',
keywordMajor: 'text-item-highlight font-semibold',
keywordName: 'text-item-highlight font-semibold',
keywordStealth: 'text-violet-300 font-semibold',
mainText: 'text-white/80',
ornnBonus: 'text-[#f0d878] font-semibold',
passive: 'text-[#f0d878] font-semibold',
ornnBonus: 'text-item-highlight font-semibold',
passive: 'text-item-highlight font-semibold',
rarityGeneric: 'text-white/55',
rarityLegendary: 'text-[#f0d878] font-semibold',
rarityLegendary: 'text-item-highlight font-semibold',
rarityMythic: 'text-violet-300 font-semibold',
rules: 'text-white/45',
shield: 'text-sky-300 font-semibold',
@@ -0,0 +1,116 @@
import type { ApiInternalMatchCard, ApiLeaderboardRow } from '../api/types';
export const LEADERBOARD_SORTS = [
{ value: 'games', label: '경기 수' },
{ value: 'winRate', label: '승률' },
{ value: 'kda', label: 'KDA' },
] as const;
export type LeaderboardSort = (typeof LEADERBOARD_SORTS)[number]['value'];
/** 이 판수에 못 미치는 선수는 승률·KDA 정렬에서 뒤로 보낸다. */
export const LEADERBOARD_MIN_GAMES = 5;
export function parseLeaderboardSort(value: string | null): LeaderboardSort {
return value === 'winRate' || value === 'kda' ? value : 'games';
}
/**
* 순위표 정렬. `games`는 서버가 준 순서를 그대로 쓴다. 승률·KDA는 표본이 적은
* 선수가 위로 올라오지 않도록 최소 판수를 채운 선수를 먼저 놓는다.
*/
export function sortLeaderboardRows<
T extends Pick<ApiLeaderboardRow, 'games' | 'winRate' | 'kda'>,
>(rows: readonly T[], sort: LeaderboardSort): T[] {
if (sort === 'games') return [...rows];
const qualifies = (row: T) => row.games >= LEADERBOARD_MIN_GAMES;
return [...rows].sort(
(a, b) =>
Number(qualifies(b)) - Number(qualifies(a)) ||
b[sort] - a[sort] ||
b.games - a.games,
);
}
/**
* 한 라인만의 순위표. 그 라인 기록이 있는 선수만 남기고 전적을 라인 전적으로
* 바꾼 뒤 승률 순으로 놓는다. 최소 판수도 그 라인 판수로 따진다.
*/
export function rankLeaderboardByLane<
T extends Pick<
ApiLeaderboardRow,
'games' | 'wins' | 'losses' | 'winRate' | 'kda' | 'byLane'
>,
>(rows: readonly T[], lane: keyof ApiLeaderboardRow['byLane']): T[] {
const laneRows = rows.flatMap((row) => {
const stats = row.byLane[lane];
if (!stats || stats.games <= 0) return [];
return [
{
...row,
games: stats.games,
wins: stats.wins,
losses: stats.games - stats.wins,
winRate: Math.round((stats.wins / stats.games) * 100),
kda: stats.kda,
},
];
});
return sortLeaderboardRows(laneRows, 'winRate');
}
/** 가장 많이 플레이한 라인. 기록이 없으면 undefined. */
export function getMainLane(byLane: ApiLeaderboardRow['byLane']) {
let main: { lane: string; games: number } | undefined;
for (const [lane, stats] of Object.entries(byLane)) {
if (stats && stats.games > 0 && (!main || stats.games > main.games)) {
main = { lane, games: stats.games };
}
}
return main?.lane;
}
type MatchOutcomeSource = Pick<
ApiInternalMatchCard,
'winnerTeamIndex' | 'seriesResults' | 'teams'
>;
type MatchTeam = ApiInternalMatchCard['teams'][number];
export type InternalMatchOutcome =
| {
type: 'score';
left: MatchTeam;
right: MatchTeam;
leftWins: number;
rightWins: number;
winner?: MatchTeam;
}
| { type: 'winner'; winner: MatchTeam };
/** 목록 행에서 바로 보여줄 결과. 두 팀 단일 시리즈는 스코어, 그 외는 우승팀. */
export function getInternalMatchOutcome(
match: MatchOutcomeSource,
): InternalMatchOutcome | undefined {
const team = (index: number | undefined) =>
match.teams.find(({ teamIndex }) => teamIndex === index);
const winner = team(match.winnerTeamIndex);
if (match.teams.length === 2 && match.seriesResults.length === 1) {
const [series] = match.seriesResults;
const left = team(series.teamAIndex);
const right = team(series.teamBIndex);
if (left && right) {
return {
type: 'score',
left,
right,
leftWins: series.teamAWins,
rightWins: series.teamBWins,
winner: winner ?? team(series.winnerTeamIndex),
};
}
}
return winner ? { type: 'winner', winner } : undefined;
}
+6
View File
@@ -0,0 +1,6 @@
import type { MatchEventType } from '@lolympus/contracts';
export const MATCH_EVENT_LABEL: Record<MatchEventType, string> = {
inhouse: '내전',
tournament: '멸망전',
};
+36
View File
@@ -0,0 +1,36 @@
const MULTI_KILL_LABELS: Record<number, string> = {
2: '더블킬',
3: '트리플킬',
4: '쿼드라킬',
5: '펜타킬',
};
/** 한 경기의 최대 연속 처치 수를 배지 문구로 바꾼다. 2 미만이면 배지가 없다. */
export function multiKillLabel(largestMultiKill: number | undefined) {
if (!largestMultiKill || largestMultiKill < 2) return;
return MULTI_KILL_LABELS[Math.min(5, Math.floor(largestMultiKill))];
}
/**
* 개발 화면 전용 목업. 최근 경기 응답에 `largestMultiKill`이 아직 없어서, 배지
* 디자인을 확인할 수 있도록 킬 수로 값을 지어낸다. 실제 기록이 아니므로
* 운영 빌드에서는 호출하지 않는다.
*/
export function mockLargestMultiKill(kills: number) {
if (kills >= 15) return 4;
if (kills >= 11) return 3;
if (kills >= 7) return 2;
return 0;
}
/** 요약의 포지션 비율을 높은 순으로 정리한다. */
export function rankPositionRates(
rates: Partial<Record<string, number>>,
limit = 2,
) {
return Object.entries(rates)
.filter((entry): entry is [string, number] => (entry[1] ?? 0) > 0)
.sort((a, b) => b[1] - a[1])
.slice(0, limit)
.map(([lane, rate]) => ({ lane, rate }));
}
+2 -2
View File
@@ -456,7 +456,7 @@ function AuctionTimerText({
return (
<span
className={`text-xl font-extrabold tabular-nums ${timer <= 5 ? "text-[#ff99a5]" : "text-on-ink"}`}
className={`text-xl font-extrabold tabular-nums ${timer <= 5 ? "text-loss" : "text-on-ink"}`}
>
{timer.toFixed(1)}s
</span>
@@ -2547,8 +2547,8 @@ export default function AuctionPage() {
</header>
{teamGrid}
</section>
{poolPanel}
{chatPanel}
{poolPanel}
</div>
) : chatPanel}
</div>
+196 -54
View File
@@ -21,6 +21,15 @@ import {
championIconUrl,
profileIconUrl,
} from '../lib/ddragon';
import {
getInternalMatchOutcome,
getMainLane,
LEADERBOARD_MIN_GAMES,
LEADERBOARD_SORTS,
parseLeaderboardSort,
sortLeaderboardRows,
} from '../lib/internal-stats-presentation';
import { LANE_LABELS } from '../lib/riot-history';
import {
internalMatchDetailPath,
internalMatchGamePath,
@@ -41,6 +50,7 @@ import {
LoadingNote,
Panel,
PanelHeader,
Pill,
PlainPage,
Skeleton,
} from '../ui';
@@ -115,12 +125,89 @@ function OfficialMatchResult({
}
}
/** 팀원 프로필을 겹쳐 보여주는 작은 묶음. */
function MemberStack({
members,
manifest,
}: {
members: ApiInternalMatchCard['teams'][number]['members'];
manifest: Manifest;
}) {
if (members.length === 0) return null;
return (
<span className="flex shrink-0 -space-x-1.5" aria-hidden="true">
{members.slice(0, 5).map((member) => (
<img
key={member.userId}
src={profileIconUrl(manifest, member.profileIconId)}
alt=""
title={member.summonerName}
className="size-6 rounded-full bg-sunken-strong object-cover ring-2 ring-card"
loading="lazy"
/>
))}
</span>
);
}
/** 펼치지 않아도 보이는 결과 요약. 목록 응답에 담긴 값만 쓴다. */
function MatchOutcomeSummary({
match,
recordedGameCount,
manifest,
}: {
match: ApiInternalMatchCard;
recordedGameCount: number;
manifest: Manifest;
}) {
const outcome = getInternalMatchOutcome(match);
if (!outcome) {
return (
<span className="flex items-center gap-2">
{match.status === 'in-progress' && (
<Pill tone="live" dot>
진행 중
</Pill>
)}
<span className="tabular">{recordedGameCount}세트 수집</span>
</span>
);
}
if (outcome.type === 'score') {
const { left, right, leftWins, rightWins, winner } = outcome;
const nameClass = (team: typeof left) =>
`min-w-0 truncate ${winner?.teamIndex === team.teamIndex ? 'font-bold text-content' : ''}`;
return (
<span className="flex min-w-0 items-center gap-2">
<span className={nameClass(left)}>{left.name}</span>
<strong className="tabular shrink-0 rounded-full bg-sunken-strong px-2.5 py-0.5 text-content-strong">
{leftWins} : {rightWins}
</strong>
<span className={nameClass(right)}>{right.name}</span>
</span>
);
}
return (
<span className="flex min-w-0 items-center gap-2">
<Pill tone="gold">우승</Pill>
<strong className="min-w-0 truncate font-bold text-content">
{outcome.winner.name}
</strong>
<MemberStack members={outcome.winner.members} manifest={manifest} />
</span>
);
}
function MatchCard({
match,
communityId,
manifest,
}: {
match: ApiInternalMatchCard;
communityId: string;
manifest: Manifest;
}) {
const [open, setOpen] = useState(false);
const competition = useCompetition(match.matchId, communityId, open);
@@ -130,6 +217,10 @@ function MatchCard({
({ winnerTeamIndex }) => winnerTeamIndex !== null,
);
const schedule = getHomeMatchSchedule(match.scheduledAt);
const playerCount = match.teams.reduce(
(count, team) => count + team.members.length,
0,
);
return (
<li>
@@ -137,25 +228,31 @@ function MatchCard({
className="group"
onToggle={(event) => setOpen(event.currentTarget.open)}
>
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,18rem)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
<span className="min-w-0">
<span className="tabular block text-xs text-content-muted">
<time dateTime={match.scheduledAt}>
{schedule?.compact ?? '일정 미정'}
</time>{' '}
· {match.teams.length}팀
{playerCount > 0 && ` · ${playerCount}명`}
{recordedGames.length > 0 && ` · ${recordedGames.length}세트`}
</span>
<strong className="mt-1 block break-words text-base font-semibold leading-snug">
{getHistoryMatchTitle(match.title, schedule)}
</strong>
</span>
<span className="col-start-1 row-start-2 text-sm text-content-muted sm:col-start-2 sm:row-start-1">
<span className="col-start-1 row-start-2 flex min-w-0 text-sm text-content-muted sm:col-start-2 sm:row-start-1 sm:justify-end">
{competition.data ? (
<strong className="font-semibold text-content">
<OfficialMatchResult competition={competition.data} />
</strong>
) : (
`${recordedGames.length}세트 수집`
<MatchOutcomeSummary
match={match}
recordedGameCount={recordedGames.length}
manifest={manifest}
/>
)}
</span>
<ChevronDown
@@ -235,7 +332,7 @@ function HighlightCell({
return (
<div className="min-w-0 px-4 py-3.5 sm:px-5">
<div className="text-xs font-semibold text-content-subtle">{title}</div>
<div className="tabular mt-1 text-[22px] font-extrabold leading-tight text-content">
<div className="tabular mt-1 text-[22px] font-extrabold leading-tight text-content-strong">
{highlight ? `${highlight.metric}${suffix}` : '—'}
</div>
{highlight ? (
@@ -281,7 +378,7 @@ function LeaderboardTable({
</div>
<div className="overflow-x-auto">
<table
className={showMetrics ? 'lts-table min-w-[760px]' : 'lts-table'}
className={showMetrics ? 'lts-table min-w-[820px]' : 'lts-table'}
>
<thead>
<tr>
@@ -289,13 +386,11 @@ function LeaderboardTable({
순위
</th>
<th scope="col">소환사</th>
<th scope="col" className="!text-right">
승률
<th scope="col" className="hidden sm:table-cell">
주 챔피언
</th>
<th scope="col">승률</th>
<th scope="col" className="!text-right">
전적
</th>
<th scope="col" className={`${metricClass} !text-right`}>
KDA
</th>
<th scope="col" className={`${metricClass} !text-right`}>
@@ -307,14 +402,12 @@ function LeaderboardTable({
<th scope="col" className={`${metricClass} !text-right`}>
분당 CS
</th>
<th scope="col" className={metricClass}>
주 챔피언
</th>
</tr>
</thead>
<tbody>
{rows.map((row) => {
const rank = ranks.get(row.userId) ?? 0;
const mainLane = getMainLane(row.byLane);
return (
<tr
key={row.userId}
@@ -326,7 +419,9 @@ function LeaderboardTable({
className={`inline-grid size-6 place-items-center rounded-full text-xs font-extrabold ${
rank === 1
? 'bg-gold text-accent-content'
: 'bg-sunken-strong text-content-muted'
: rank === 2
? 'bg-sunken-strong text-content'
: 'bg-gold-tint text-gold'
}`}
>
{rank}
@@ -338,39 +433,71 @@ function LeaderboardTable({
)}
</td>
<td>
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="group flex items-center gap-2.5"
>
<div className="flex items-center gap-2.5">
<img
src={profileIconUrl(manifest, row.profileIconId)}
alt=""
className="hidden size-8 shrink-0 rounded-full sm:block bg-sunken-strong object-cover"
className="hidden size-9 shrink-0 rounded-full bg-sunken-strong object-cover sm:block"
loading="lazy"
/>
<span className="break-words font-semibold text-content group-hover:text-primary">
{row.summonerName}
<div className="min-w-0">
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="break-words font-semibold text-content hover:text-primary"
>
{row.summonerName}
</Link>
<div className="flex flex-wrap items-center gap-x-1.5 text-xs text-content-muted">
{mainLane && (
<>
<span>{LANE_LABELS[mainLane] ?? mainLane}</span>
<span aria-hidden="true">·</span>
</>
)}
<button
type="button"
className="hover:text-content hover:underline"
onClick={() => onSelectPlayer(row.userId)}
>
참가 내전 보기
</button>
</div>
</div>
</div>
</td>
<td className="hidden sm:table-cell">
<div className="flex gap-1">
{row.topChampions.slice(0, 3).map((champion) => (
<ChampionChip
key={champion.championId}
championId={champion.championId}
manifest={manifest}
/>
))}
</div>
</td>
<td className="tabular w-36">
<div className="flex items-baseline justify-between gap-2">
<strong className={ratioClass(row.winRate)}>
{row.winRate}%
</strong>
<span className="whitespace-nowrap text-xs text-content-muted">
{row.wins}승 {row.losses}패
</span>
</Link>
<button
type="button"
className="mt-1 text-xs text-content-muted hover:underline"
onClick={() => onSelectPlayer(row.userId)}
</div>
<div
className="mt-1 h-1.5 overflow-hidden rounded-full bg-loss/25"
aria-hidden="true"
>
참가 내전
</button>
<div
className="h-full rounded-full bg-win"
style={{ width: `${row.winRate}%` }}
/>
</div>
</td>
<td
className={`tabular text-right font-bold ${ratioClass(row.winRate)}`}
>
{row.winRate}%
</td>
<td className="tabular whitespace-nowrap text-right text-[13px] text-content-muted">
{row.games}전 {row.wins}승 {row.losses}패
</td>
<td
className={`tabular text-right font-semibold ${metricClass} ${kdaClass(row.kda)}`}
className={`tabular text-right font-semibold ${kdaClass(row.kda)}`}
>
{row.kda}
</td>
@@ -389,17 +516,6 @@ function LeaderboardTable({
>
{row.avgCsPerMin}
</td>
<td className={metricClass}>
<div className="flex gap-1">
{row.topChampions.map((champion) => (
<ChampionChip
key={champion.championId}
championId={champion.championId}
manifest={manifest}
/>
))}
</div>
</td>
</tr>
);
})}
@@ -454,6 +570,7 @@ export default function CommunityInternalStatsPage() {
const keyword = query.trim().toLocaleLowerCase('ko-KR');
const format = searchParams.get('format');
const playerId = searchParams.get('player');
const sort = parseLeaderboardSort(searchParams.get('sort'));
const championId = Number(searchParams.get('championId'));
const filters = {
seasonId,
@@ -477,7 +594,10 @@ export default function CommunityInternalStatsPage() {
leaderboardQuery.data?.season ??
matchesQuery.data?.pages[0]?.season;
const insights = insightsQuery.data;
const leaderboardRows = leaderboardQuery.data?.rows ?? [];
const leaderboardRows = sortLeaderboardRows(
leaderboardQuery.data?.rows ?? [],
sort,
);
const player = leaderboardRows.find((row) => row.userId === playerId);
const visibleMatches = matches.filter((match) => {
const matchType = match.teams.length === 2 ? 'pair' : 'tournament';
@@ -537,7 +657,7 @@ export default function CommunityInternalStatsPage() {
</div>
<div className="flex flex-wrap items-center gap-3">
<Link
to="/?history=all"
to="/inhouse"
className="text-sm font-semibold text-content-muted hover:underline"
>
전체 일정 기록
@@ -586,7 +706,7 @@ export default function CommunityInternalStatsPage() {
placeholder={isRanking ? '선수 이름 검색' : '내전명 검색'}
value={query}
onChange={(event) => updateParam('q', event.target.value)}
className="min-w-0 flex-1 text-sm text-content focus-visible:outline-none"
className="min-w-0 flex-1 text-sm text-content placeholder:text-content-subtle focus-visible:outline-none"
/>
</label>
</div>
@@ -600,7 +720,23 @@ export default function CommunityInternalStatsPage() {
</span>
</h2>
{isRanking ? (
<span className="text-xs text-content-muted">승률 순</span>
<div
className="flex flex-wrap items-center gap-1.5"
role="group"
aria-label="순위 정렬"
>
{LEADERBOARD_SORTS.map(({ value, label }) => (
<Chip
key={value}
selected={sort === value}
onClick={() =>
updateParam('sort', value === 'games' ? '' : value)
}
>
{label}
</Chip>
))}
</div>
) : (
<div
className="flex flex-wrap gap-1.5"
@@ -641,6 +777,11 @@ export default function CommunityInternalStatsPage() {
</div>
)}
{isRanking && sort !== 'games' && (
<p className="border-b border-line px-4 py-2 text-xs text-content-muted sm:px-5">
{LEADERBOARD_MIN_GAMES}판 미만인 선수는 뒤에 표시합니다.
</p>
)}
{isRanking ? (
leaderboardQuery.isLoading ? (
<LoadingNote label="순위를 불러오는 중" />
@@ -716,6 +857,7 @@ export default function CommunityInternalStatsPage() {
key={match.matchId}
match={match}
communityId={communityId}
manifest={ddragon}
/>
))}
</ul>
@@ -781,7 +923,7 @@ export default function CommunityInternalStatsPage() {
</div>
</Panel>
{insights && (
<details className="lts-panel">
<details className="lts-panel" open>
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold">
시즌 기록
</summary>
+492 -146
View File
@@ -1,11 +1,23 @@
import { useState } from 'react';
import { useEffect, useState, type CSSProperties } from 'react';
import type {
MatchDetailResponse,
MatchEventType,
MatchSummaryResponse,
} from '@lolympus/contracts';
import { ChevronLeft, ChevronRight } from 'lucide-react';
import { Link, useSearchParams } from 'react-router';
import { useMatches, useMatchesPage } from '../api/hooks';
import {
useCommunityLeaderboard,
useDdragonManifest,
useMatches,
useMatchesPage,
} from '../api/hooks';
import nextMatchArtwork from '../assets/next-match-hero.webp';
import HomeHallOfFame from '../components/HomeHallOfFame';
import { championIconUrl, profileIconUrl } from '../lib/ddragon';
import { rankLeaderboardByLane } from '../lib/internal-stats-presentation';
import { MATCH_EVENT_LABEL } from '../lib/match-event-type';
import { LANE_LABELS } from '../lib/riot-history';
import { mapIdToLabel } from '../api/mappers';
import { DEFAULT_COMMUNITY_ID } from '../config';
import {
@@ -17,18 +29,34 @@ import {
Pill,
PlainPage,
Skeleton,
pageWidthClass,
} from '../ui';
import {
getHistoryMatchTitle,
getHomeMatchEnrollment,
getHomeMatchSchedule,
getNextMatchBanner,
HOME_MATCH_STATUS,
} from './home-match-presentation';
const UPCOMING_MATCH_LIST_LIMIT = 4;
const HISTORY_MATCH_PAGE_SIZE = 10;
const HOME_HISTORY_LIMIT = 5;
const HOME_HISTORY_LIMIT = 4;
const HOME_RANKING_LIMIT = 5;
const DEFAULT_MAP_ID = 11;
const RANKING_COLUMNS_CLASS =
'grid grid-cols-[1.5rem_minmax(0,1fr)_3rem] items-center gap-3 px-3';
/** 순위 카드의 슬라이드 순서. undefined는 종합 순위. */
const RANKING_SLIDES = [
undefined,
'TOP',
'JUNGLE',
'MIDDLE',
'BOTTOM',
'UTILITY',
] as const;
const RANKING_SLIDE_INTERVAL_MS = 5000;
const GENERIC_MATCH_NAME = /^(?:정기\s*)?내전$/u;
const DECISION_LABELS = {
walkover: '부전승',
@@ -37,70 +65,75 @@ const DECISION_LABELS = {
draw: '무승부',
} as const;
function NextMatch({ match }: { match?: MatchDetailResponse }) {
if (!match) {
return (
<h1 className="text-sm font-medium text-content-muted">
예정된 내전이 없습니다
</h1>
);
}
function NextMatch({ match }: { match: MatchDetailResponse }) {
const schedule = getHomeMatchSchedule(match.scheduledAt);
const enrollment = getHomeMatchEnrollment(match);
const href = `/match/${match._id}`;
const { title, status, capacity, canApply } = getNextMatchBanner(match);
return (
<header className="flex flex-col gap-3 rounded-xl border border-line bg-card p-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:p-5">
<div className="min-w-0">
<p className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-sm text-content-muted">
<span className="font-semibold">다음 내전</span>
{schedule && (
<time
dateTime={match.scheduledAt}
className="tabular font-semibold text-content"
>
{schedule.date} · {schedule.time}
</time>
)}
</p>
<h1 className="mt-1 break-words text-xl font-bold leading-snug sm:text-2xl">
{match.title}
</h1>
<p className="tabular mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-sm text-content-muted">
{match.status !== 'recruiting' && (
<span>{HOME_MATCH_STATUS[match.status]} ·</span>
)}
<span>{enrollment.capacity} ·</span>
<strong className="font-semibold text-content">
{enrollment.label}
</strong>
{match.mapId !== DEFAULT_MAP_ID && (
<span>· {mapIdToLabel(match.mapId)}</span>
)}
</p>
</div>
{enrollment.canApply ? (
<div className="shrink-0">
<Button label="참가 신청" variant="primary" size="md" href={href} />
<Link
to={`/match/${match._id}`}
aria-labelledby="next-match-label next-match-title"
aria-describedby="next-match-schedule next-match-status"
className="lts-home-hero group relative isolate block overflow-hidden focus-visible:-outline-offset-4 focus-visible:outline-primary"
>
<img
src={nextMatchArtwork}
alt=""
fetchPriority="high"
className="absolute inset-y-0 left-1/2 -z-20 h-full w-full max-w-[112rem] -translate-x-1/2 object-cover object-[75%_center] md:object-center"
/>
<div
className={`${pageWidthClass()} flex min-h-[16rem] items-center py-8 md:min-h-[clamp(22rem,29vw,30rem)] md:py-12`}
>
<div className="w-full max-w-xl">
<p
id="next-match-label"
className="text-sm font-semibold text-white/80 md:text-base"
>
다음 내전
</p>
<h1
id="next-match-title"
className="mt-3 text-[clamp(2rem,5vw,3.5rem)] font-extrabold leading-[1.15] tracking-tight text-white [overflow-wrap:anywhere] group-hover:underline group-hover:decoration-2 group-hover:underline-offset-8"
>
{title}
</h1>
<p
id="next-match-schedule"
className="tabular mt-4 text-base font-semibold text-white/90 md:mt-6 md:text-xl"
>
{schedule ? (
<time dateTime={match.scheduledAt}>
{schedule.date} {schedule.time}
</time>
) : '일정 미정'}
</p>
<p id="next-match-status" className="tabular mt-3 text-sm text-white/85 md:text-base">
<strong className={canApply ? 'font-semibold text-brand-coral' : 'font-semibold'}>
{status}
</strong>
{' · '}
{capacity}
{match.mapId !== DEFAULT_MAP_ID && (
<> · {mapIdToLabel(match.mapId)}</>
)}
</p>
</div>
) : (
<Link
to={href}
className="inline-flex min-h-10 w-fit shrink-0 items-center gap-1 text-sm font-semibold text-content hover:underline"
>
내전 보기
<ChevronRight className="size-4" aria-hidden="true" />
</Link>
)}
</header>
</div>
</Link>
);
}
function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
function UpcomingMatches({
matches,
title = '이어지는 내전',
}: {
matches: MatchDetailResponse[];
title?: string;
}) {
return (
<Panel>
<PanelHeader title="이어지는 내전" />
<PanelHeader title={title} />
<ul className="divide-y divide-line">
{matches.map((match) => {
const schedule = getHomeMatchSchedule(match.scheduledAt);
@@ -117,7 +150,7 @@ function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
>
{schedule?.compact ?? '일정 미정'}
</time>
<h3 className="col-start-1 mt-0.5 truncate text-[15px] font-semibold text-content group-hover:underline sm:col-start-2 sm:row-start-1 sm:mt-0">
<h3 className="col-start-1 mt-0.5 truncate text-[15px] font-semibold group-hover:underline sm:col-start-2 sm:row-start-1 sm:mt-0">
{match.title}
</h3>
<p className="tabular col-start-1 mt-1 text-[13px] text-content-muted sm:col-start-3 sm:row-start-1 sm:mt-0">
@@ -139,11 +172,29 @@ function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
);
}
function HistoryResult({ match }: { match: MatchSummaryResponse }) {
function HistoryResult({
match,
showTeamNames = false,
}: {
match: MatchSummaryResponse;
showTeamNames?: boolean;
}) {
const result = match.historyResult;
const teamLabelClass = `min-w-0 break-words text-content-muted${showTeamNames ? '' : ' md:truncate'}`;
if (match.status === 'finished' && result) {
switch (result.type) {
case 'score': {
if (showTeamNames && result.teamAName && result.teamBName) {
return (
<span className="break-words text-content">
{result.teamAName}{' '}
<strong className="tabular whitespace-nowrap font-bold">
{result.teamAWins}–{result.teamBWins}
</strong>{' '}
{result.teamBName}
</span>
);
}
const label = result.winnerTeamName
? `${result.winnerTeamName} 승`
: undefined;
@@ -154,7 +205,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
</strong>
{label && (
<span
className="min-w-0 break-words text-content-muted md:truncate"
className={teamLabelClass}
title={label}
>
{label}
@@ -171,7 +222,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
{result.teamNames.length > 1 ? '공동 1위' : '우승'}
</strong>
<span
className="min-w-0 break-words text-content-muted md:truncate"
className={teamLabelClass}
title={label}
>
{label}
@@ -187,7 +238,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
</strong>
{result.winnerTeamName && (
<span
className="min-w-0 break-words text-content-muted md:truncate"
className={teamLabelClass}
title={result.winnerTeamName}
>
{result.winnerTeamName}
@@ -227,8 +278,8 @@ function HistoryTableColumns() {
<thead>
<tr>
<th scope="col">일정</th>
<th scope="col">내전</th>
<th scope="col">결과</th>
<th scope="col">대회</th>
<th scope="col">상태·결과</th>
<th scope="col" className="!text-right">
참가
</th>
@@ -277,9 +328,15 @@ function HistoryRecordsSkeleton({ limit }: { limit: number }) {
);
}
function HistoryRecords({ matches }: { matches: MatchSummaryResponse[] }) {
function HistoryRecords({
matches,
eventLabel,
}: {
matches: MatchSummaryResponse[];
eventLabel: string;
}) {
if (matches.length === 0) {
return <EmptyNote size="sm" title="아직 내전 기록이 없습니다." />;
return <EmptyNote size="sm" title={`아직 ${eventLabel} 기록이 없습니다.`} />;
}
const rows = matches.map((match) => {
@@ -352,6 +409,261 @@ function HistoryRecords({ matches }: { matches: MatchSummaryResponse[] }) {
);
}
function RecentMatchResults({ matches }: { matches: MatchSummaryResponse[] }) {
if (matches.length === 0) {
return <EmptyNote size="sm" title="아직 종료된 내전이 없습니다." />;
}
return (
<ul className="divide-y divide-line border-y border-line">
{matches.map((match) => {
const schedule = getHomeMatchSchedule(match.scheduledAt);
const name = getHistoryMatchTitle(match.title, schedule);
// 이름이 "내전"뿐이면 행을 구분할 수 없으므로 일정을 제목으로 올린다.
const datedTitle = schedule && GENERIC_MATCH_NAME.test(name.trim());
const details = [
!datedTitle && (schedule?.compact ?? '일정 미정'),
match.teams.length > 2 && `${match.teams.length}팀`,
match.mapId !== DEFAULT_MAP_ID && mapIdToLabel(match.mapId),
].filter(Boolean);
return (
<li key={match._id}>
<Link
to={`/match/${match._id}`}
className="group grid gap-1 px-2 py-3.5 transition-colors hover:bg-sunken focus-visible:-outline-offset-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center md:gap-4"
>
<div className="min-w-0">
<p className="tabular break-words text-[15px] font-semibold leading-snug text-content group-hover:underline">
{datedTitle ? (
<>
<time dateTime={match.scheduledAt}>{schedule.compact}</time>{' '}
{name}
</>
) : (
name
)}
</p>
{details.length > 0 && (
<p className="tabular mt-0.5 text-xs text-content-muted">
{details.join(' · ')}
</p>
)}
</div>
{match.historyResult && (
<div className="min-w-0 text-[13px] md:text-right">
<HistoryResult match={match} showTeamNames />
</div>
)}
</Link>
</li>
);
})}
</ul>
);
}
function RecentMatchResultsSkeleton({ limit }: { limit: number }) {
return (
<div className="divide-y divide-line border-y border-line" aria-hidden="true">
{Array.from({ length: limit }, (_, index) => (
<div
key={index}
className="grid gap-2 px-2 py-3.5 md:grid-cols-2 md:items-center"
>
<div className="space-y-1">
<Skeleton width={130} height={16} index={index} />
<Skeleton width={96} height={12} index={index} />
</div>
<Skeleton width={120} height={14} index={index} className="md:justify-self-end" />
</div>
))}
</div>
);
}
const RANK_BADGE_CLASS = [
'bg-gold text-accent-content',
'bg-sunken-strong text-content',
'bg-gold-tint text-gold',
] as const;
/** 현재 시즌 순위표의 앞부분. 전적 화면과 같은 집계를 그대로 보여준다. */
function RankingPreview({ statsPath }: { statsPath: string }) {
const leaderboardQuery = useCommunityLeaderboard({ seasonId: 'current' });
const { data: manifest } = useDdragonManifest();
const [slide, setSlide] = useState(0);
const [direction, setDirection] = useState<1 | -1>(1);
const [paused, setPaused] = useState(false);
const [touchStartX, setTouchStartX] = useState<number>();
const lane = RANKING_SLIDES[slide];
const allRows = leaderboardQuery.data?.rows ?? [];
const rows = (lane ? rankLeaderboardByLane(allRows, lane) : allRows).slice(
0,
HOME_RANKING_LIMIT,
);
const label = lane ? LANE_LABELS[lane] : '종합';
const move = (step: 1 | -1) => {
setDirection(step);
setSlide(
(current) => (current + step + RANKING_SLIDES.length) % RANKING_SLIDES.length,
);
};
// key가 바뀌면 목록이 새로 붙으면서 넘긴 방향에서 들어오는 애니메이션이 다시 돈다.
const slideStyle = {
'--lts-rank-slide-from': `${direction * 1.5}rem`,
} as CSSProperties;
// 읽거나 누르려는 동안에는 멈추고, 직접 넘기면 그 슬라이드부터 다시 센다.
useEffect(() => {
if (paused || window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
return;
}
const timer = window.setTimeout(() => move(1), RANKING_SLIDE_INTERVAL_MS);
return () => window.clearTimeout(timer);
}, [paused, slide]);
return (
<aside
aria-busy={leaderboardQuery.isLoading}
onMouseEnter={() => setPaused(true)}
onMouseLeave={() => setPaused(false)}
onFocus={() => setPaused(true)}
onBlur={() => setPaused(false)}
onTouchStart={(event) => setTouchStartX(event.touches[0]?.clientX)}
onTouchEnd={(event) => {
const endX = event.changedTouches[0]?.clientX;
if (touchStartX === undefined || endX === undefined) return;
const distance = endX - touchStartX;
if (Math.abs(distance) > 48) move(distance < 0 ? 1 : -1);
setTouchStartX(undefined);
}}
>
<PanelHeader
title={`시즌 ${label} 순위`}
variant="section"
actions={
<Link
to={`${statsPath}?view=ranking`}
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
>
전체 보기
<ChevronRight className="size-4" aria-hidden="true" />
</Link>
}
/>
<div className="overflow-hidden rounded-2xl bg-sunken p-2">
{leaderboardQuery.isLoading ? (
<div className="space-y-3 p-3" aria-hidden="true">
{Array.from({ length: HOME_RANKING_LIMIT }, (_, index) => (
<Skeleton key={index} width="100%" height={36} index={index} />
))}
</div>
) : leaderboardQuery.isError ? (
<p className="p-3 text-sm text-content-muted">
순위를 불러오지 못했습니다.
</p>
) : rows.length === 0 ? (
<div
key={slide}
style={slideStyle}
className="lts-rank-slide grid min-h-[17.5rem] place-items-center"
>
<EmptyNote size="sm" title="아직 집계된 순위가 없습니다." />
</div>
) : (
<ol
key={slide}
style={slideStyle}
className="lts-rank-slide min-h-[17.5rem]"
>
{rows.map((row, index) => (
<li key={row.userId}>
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
className={`${RANKING_COLUMNS_CLASS} group rounded-xl py-2.5 transition-colors hover:bg-card focus-visible:-outline-offset-2`}
>
<span
className={`tabular grid size-6 place-items-center rounded-full text-xs font-bold ${
RANK_BADGE_CLASS[index] ?? 'text-content-muted'
}`}
>
{index + 1}
<span className="sr-only">위</span>
</span>
<span className="flex min-w-0 items-center gap-2">
<img
src={profileIconUrl(manifest, row.profileIconId)}
alt=""
className="size-9 shrink-0 rounded-full bg-sunken-strong object-cover"
loading="lazy"
/>
<span className="min-w-0 flex-1">
<span className="block truncate text-sm font-semibold text-content group-hover:text-primary">
{row.summonerName}
</span>
<span className="tabular block text-xs text-content-muted">
{row.games}전 {row.wins}승 {row.losses}패
</span>
</span>
<span className="hidden shrink-0 items-center gap-0.5 min-[420px]:flex lg:hidden">
{row.topChampions.slice(0, 3).map((champion) => {
const icon = championIconUrl(manifest, champion.championId);
return icon ? (
<img
key={champion.championId}
src={icon}
alt=""
className="size-6 rounded-full object-cover"
loading="lazy"
/>
) : null;
})}
</span>
</span>
<strong
className={`tabular text-right text-sm ${
row.winRate >= 50 ? 'text-win' : 'text-content-muted'
}`}
>
<span className="sr-only">승률 </span>
{row.winRate}%
</strong>
</Link>
</li>
))}
</ol>
)}
<div className="flex items-center justify-center gap-1 pt-1">
<button
type="button"
aria-label="이전 순위"
className="grid size-8 place-items-center rounded-full text-content-muted transition-colors hover:bg-card hover:text-content"
onClick={() => move(-1)}
>
<ChevronLeft className="size-4" aria-hidden="true" />
</button>
<p
className="tabular min-w-12 text-center text-[13px] text-content-muted"
aria-live={paused ? 'polite' : 'off'}
>
<span className="sr-only">{label} 순위, </span>
<strong className="font-bold text-content">{slide + 1}</strong> /{' '}
{RANKING_SLIDES.length}
</p>
<button
type="button"
aria-label="다음 순위"
className="grid size-8 place-items-center rounded-full text-content-muted transition-colors hover:bg-card hover:text-content"
onClick={() => move(1)}
>
<ChevronRight className="size-4" aria-hidden="true" />
</button>
</div>
</div>
</aside>
);
}
interface HistoryPaginationProps {
page: number;
pageCount: number;
@@ -396,10 +708,12 @@ function HistoryPagination({
);
}
export default function HomePage() {
export default function HomePage({ eventType }: { eventType?: MatchEventType }) {
const showArchive = eventType !== undefined;
const selectedEventType = eventType ?? 'inhouse';
const eventLabel = MATCH_EVENT_LABEL[selectedEventType];
const [timelineNow] = useState(() => new Date().toISOString());
const [searchParams, setSearchParams] = useSearchParams();
const showArchive = searchParams.get('history') === 'all';
const requestedPage = Number(searchParams.get('page'));
const historyPage =
showArchive && Number.isSafeInteger(requestedPage) && requestedPage > 0
@@ -415,14 +729,17 @@ export default function HomePage() {
setSearchParams(params, { preventScrollReset: true });
}
const upcomingMatchesQuery = useMatches({
eventType: selectedEventType,
limit: UPCOMING_MATCH_LIST_LIMIT,
scheduledFrom: timelineNow,
sort: 'asc',
});
const historyMatchesQuery = useMatchesPage({
eventType: selectedEventType,
limit: historyLimit,
page: historyPage,
scheduledTo: timelineNow,
status: showArchive ? undefined : 'finished',
scheduledTo: showArchive ? timelineNow : undefined,
sort: 'desc',
includeResults: true,
});
@@ -438,7 +755,10 @@ export default function HomePage() {
);
}
const [nextMatch, ...upcomingMatches] = upcomingMatchesQuery.data ?? [];
const allUpcomingMatches = upcomingMatchesQuery.data ?? [];
const [nextMatch, ...upcomingMatches] = allUpcomingMatches;
const bannerMatch = showArchive ? undefined : nextMatch;
const visibleUpcomingMatches = showArchive ? allUpcomingMatches : upcomingMatches;
const historyTotal = historyMatchesQuery.data?.total ?? 0;
const historyPageCount = Math.max(
1,
@@ -450,25 +770,27 @@ export default function HomePage() {
const hasHistoryError =
Boolean(historyMatchesQuery.error) && !historyMatchesQuery.data;
const statsPath = `/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`;
const HistorySection = showArchive ? Panel : 'section';
const UpcomingStatusHeading = showArchive ? 'p' : 'h1';
const contentSpacing = showArchive ? 'space-y-5 pb-16' : 'space-y-8 pb-10 md:pb-16';
const contentTopPadding = bannerMatch ? 'pt-10 md:pt-16' : 'pt-5 sm:pt-6';
return (
<PlainPage className="lts-overview space-y-5 pt-5 pb-16 sm:pt-6">
{showArchive ? (
<div className="flex flex-wrap items-center justify-between gap-3">
<h1 className="text-2xl font-bold">전체 내전 일정</h1>
<Link to="/" className="text-sm font-semibold hover:underline">
내전 홈
</Link>
</div>
) : upcomingMatchesQuery.isLoading ? (
<h1 className="text-sm text-content-muted" aria-busy="true">
내전 일정을 불러오는 중
</h1>
const content = (
<div className={`${pageWidthClass()} ${contentSpacing} ${contentTopPadding}`}>
{showArchive && (
<header>
<h1 className="text-2xl font-bold">{eventLabel} 일정</h1>
</header>
)}
{upcomingMatchesQuery.isLoading ? (
<UpcomingStatusHeading className="text-sm text-content-muted" aria-busy="true">
{eventLabel} 일정을 불러오는 중
</UpcomingStatusHeading>
) : upcomingMatchesQuery.isError && !upcomingMatchesQuery.data ? (
<div className="flex flex-wrap items-center gap-3">
<h1 className="text-sm text-content-muted">
내전 일정을 불러오지 못했습니다
</h1>
<UpcomingStatusHeading className="text-sm text-content-muted">
{eventLabel} 일정을 불러오지 못했습니다
</UpcomingStatusHeading>
<button
type="button"
className="min-h-8 text-sm font-semibold underline"
@@ -477,67 +799,91 @@ export default function HomePage() {
다시 시도
</button>
</div>
) : (
<NextMatch match={nextMatch} />
)}
) : !nextMatch ? (
<UpcomingStatusHeading className="text-sm text-content-muted">
예정된 {eventLabel}이 없습니다
</UpcomingStatusHeading>
) : null}
{!showArchive && upcomingMatches.length > 0 && (
<UpcomingMatches matches={upcomingMatches} />
)}
<Panel aria-busy={isHistoryPageLoading} aria-live="polite">
<PanelHeader
title={showArchive ? '지난 일정 전체' : '최근 내전 일정'}
actions={
<Link
to={statsPath}
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
>
전적 검색
<ChevronRight className="size-4" aria-hidden="true" />
</Link>
}
{visibleUpcomingMatches.length > 0 && (
<UpcomingMatches
matches={visibleUpcomingMatches}
title={showArchive ? '다가오는 일정' : undefined}
/>
{isHistoryPageLoading ? (
<HistoryRecordsSkeleton limit={historyLimit} />
) : hasHistoryError ? (
<div className="p-4">
<ErrorNote
title="지난 내전 기록을 불러오지 못했습니다"
action={
<Button
label="다시 시도"
size="sm"
variant="secondary"
onClick={() => void historyMatchesQuery.refetch()}
/>
}
/>
</div>
) : (
<HistoryRecords matches={historyMatchesQuery.data?.matches ?? []} />
)}
{showArchive && !hasHistoryError && historyTotal > 0 && (
<HistoryPagination
page={historyPage}
pageCount={historyPageCount}
total={historyTotal}
isFetching={historyMatchesQuery.isFetching}
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
onNext={() => setHistoryPage(historyPage + 1)}
)}
<div
className={
showArchive
? undefined
: 'grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_20rem]'
}
>
<HistorySection aria-busy={isHistoryPageLoading} aria-live="polite">
<PanelHeader
title={showArchive ? '지난 일정과 결과' : '최근 내전 결과'}
variant={showArchive ? 'panel' : 'section'}
actions={
<Link
to={showArchive ? statsPath : '/inhouse'}
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
>
{showArchive ? '전적 검색' : '전체 내전 기록'}
<ChevronRight className="size-4" aria-hidden="true" />
</Link>
}
/>
)}
{!showArchive && historyTotal > HOME_HISTORY_LIMIT && (
<div className="border-t border-line px-4 py-2.5 text-right sm:px-5">
<Link
to="/?history=all"
className="text-sm text-content-muted hover:underline"
>
전체 일정 기록
</Link>
</div>
)}
</Panel>
</PlainPage>
{isHistoryPageLoading ? (
showArchive ? (
<HistoryRecordsSkeleton limit={historyLimit} />
) : (
<RecentMatchResultsSkeleton limit={historyLimit} />
)
) : hasHistoryError ? (
<div className="p-4">
<ErrorNote
title={`지난 ${eventLabel} 기록을 불러오지 못했습니다`}
action={
<Button
label="다시 시도"
size="sm"
variant="secondary"
onClick={() => void historyMatchesQuery.refetch()}
/>
}
/>
</div>
) : showArchive ? (
<HistoryRecords
matches={historyMatchesQuery.data?.matches ?? []}
eventLabel={eventLabel}
/>
) : (
<RecentMatchResults matches={historyMatchesQuery.data?.matches ?? []} />
)}
{showArchive && !hasHistoryError && historyTotal > 0 && (
<HistoryPagination
page={historyPage}
pageCount={historyPageCount}
total={historyTotal}
isFetching={historyMatchesQuery.isFetching}
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
onNext={() => setHistoryPage(historyPage + 1)}
/>
)}
</HistorySection>
{!showArchive && <RankingPreview statsPath={statsPath} />}
</div>
</div>
);
return (
<main>
{bannerMatch && <NextMatch match={bannerMatch} />}
{content}
{!showArchive && (
<HomeHallOfFame introReady={!upcomingMatchesQuery.isPending} />
)}
</main>
);
}
@@ -117,7 +117,7 @@ function GamePanel({
<section className="lts-panel overflow-hidden">
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5">
<div>
<h3 className="text-sm font-black text-base-content">
<h3 className="text-sm font-black">
{ordinal === undefined ? `전체 ${game.gameNumber}세트` : `${ordinal}세트`}
{ordinal !== undefined && ordinal !== game.gameNumber && (
<span className="ml-2 text-xs font-medium text-content-muted">전체 {game.gameNumber}</span>
@@ -145,7 +145,7 @@ function GamePanel({
? team.side === "blue"
? "bg-win-tint text-win"
: "bg-loss-tint text-loss"
: "bg-sunken text-content-subtle"
: "bg-sunken text-content-muted"
}`}
>
{teamIndexLabel(team.teamIndex)} ({sideLabel(team.side)}){" "}
+1 -1
View File
@@ -41,7 +41,7 @@ export default function LoginPage() {
<span className="grid size-11 place-items-center rounded-full bg-primary-tint text-primary">
<KeyRound className="size-5" aria-hidden="true" />
</span>
<h1 className="mt-4 text-xl font-extrabold text-content">로그인</h1>
<h1 className="mt-4 text-xl font-extrabold">로그인</h1>
<p className="mt-1.5 text-sm leading-relaxed text-content-muted">
내전 참가 신청, 팀장 경매, 운영 기능은 로그인 후 사용할 수 있습니다.
전적과 대진은 로그인 없이 볼 수 있습니다.
+27 -1
View File
@@ -1835,7 +1835,7 @@ export default function MatchDetailPage() {
title="내전을 찾을 수 없습니다"
description="주소가 바뀌었거나 삭제된 내전일 수 있습니다."
action={
<Btn to="/" variant="secondary">
<Btn to="/inhouse" variant="secondary">
내전 목록으로
</Btn>
}
@@ -2546,6 +2546,32 @@ export default function MatchDetailPage() {
등록된 팀이 없습니다.
</div>
)}
{!usesTabbedLayout && match.teams.length === 0 && (
<div className="lts-panel">
<EmptyNote
title={
showAuctionLink
? "경매로 팀을 구성하고 있습니다"
: "팀이 아직 확정되지 않았습니다"
}
description={
showAuctionLink
? "경매가 끝나면 팀 구성과 대진표가 이 화면에 표시됩니다."
: "팀 구성이 끝나면 팀과 대진표가 이 화면에 표시됩니다."
}
action={
showAuctionLink ? (
<Btn
to={`/match/${match.id}/auction`}
variant="secondary"
>
경매 진행 상황 보기
</Btn>
) : undefined
}
/>
</div>
)}
{match.teams.map((team) => (
<TeamCard key={team.teamIndex} team={team} />
))}
+29 -31
View File
@@ -334,7 +334,7 @@ function ItemStrip({
itemId={itemId}
manifest={manifest}
trinket={index === 6}
className="h-8 w-8"
className="h-7 w-7"
imageClassName=""
/>
))}
@@ -716,7 +716,7 @@ function PostgameBreakdown({
return (
<section className="mt-5 overflow-hidden border border-base-content/10 bg-base-100">
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-base-content/8 px-4 py-3">
<h2 className="text-sm font-black text-base-content">경기 요약</h2>
<h2 className="text-sm font-black">경기 요약</h2>
<div className="flex flex-wrap items-center gap-2 text-xs font-bold text-base-content/35">
{version ? <span>Ver. {version}</span> : null}
<span>{formatDuration(selectedGame.gameDuration)}</span>
@@ -1147,7 +1147,7 @@ function TimelineGraph({
<section className="mt-5 overflow-hidden border border-base-content/10 bg-base-100">
<div className="flex flex-col gap-3 border-b border-base-content/8 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
<div>
<h2 className="text-sm font-black text-base-content">경기 흐름</h2>
<h2 className="text-sm font-black">경기 흐름</h2>
<div className="mt-1 text-xs font-bold text-base-content/35">
{finalPoint
? `${finalLeader} ${formatSignedCompactNumber(finalPoint.value)}`
@@ -1241,7 +1241,7 @@ function TimelineGraph({
type="monotone"
dataKey="positive"
stroke="none"
fill="#3b82f6"
fill="var(--lts-win-fill)"
fillOpacity={0.16}
isAnimationActive={false}
/>
@@ -1249,7 +1249,7 @@ function TimelineGraph({
type="monotone"
dataKey="negative"
stroke="none"
fill="#ef4444"
fill="var(--lts-loss-fill)"
fillOpacity={0.16}
isAnimationActive={false}
/>
@@ -1282,9 +1282,9 @@ function TimelineGraph({
r={selected ? 5.5 : markerRadius}
fill={
event.side === "blue"
? "#3b82f6"
? "var(--lts-win-fill)"
: event.side === "red"
? "#ef4444"
? "var(--lts-loss-fill)"
: "currentColor"
}
stroke="currentColor"
@@ -1321,7 +1321,7 @@ function TimelineGraph({
{timelineEvents.length > 0 ? (
<div className="border-t border-base-content/8 px-4 py-3">
<div className="flex flex-wrap items-baseline justify-between gap-2">
<h3 className="text-xs font-black text-base-content">주요 사건</h3>
<h3 className="text-xs font-black">주요 사건</h3>
<p className="text-[11px] font-bold text-base-content/30">
항목을 선택하면 그래프의 해당 시점을 강조합니다
</p>
@@ -1348,7 +1348,7 @@ function TimelineGraph({
))}
</div>
<ul
className="m-0 mt-3 grid max-h-64 list-none gap-1.5 overflow-y-auto p-0 sm:grid-cols-2 lg:grid-cols-3"
className="m-0 mt-3 max-h-80 list-none divide-y divide-line overflow-y-auto rounded-field border border-line p-0"
aria-label="시간순 주요 사건"
>
{visibleEventEntries.map(({ event, key }) => {
@@ -1370,10 +1370,8 @@ function TimelineGraph({
type="button"
aria-pressed={selected}
onClick={() => setSelectedEventKey(selected ? null : key)}
className={`grid h-full w-full grid-cols-[3.25rem_3.25rem_minmax(0,1fr)] items-start gap-2 border px-2.5 py-2 text-left text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${
selected
? "border-primary bg-primary/8"
: "border-base-content/8 hover:bg-base-content/[0.03]"
className={`grid w-full grid-cols-[3rem_3rem_minmax(0,1fr)] items-baseline gap-2 !rounded-none px-3 py-1.5 text-left text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary ${
selected ? "bg-primary-tint" : "hover:bg-sunken"
}`}
>
<span className="font-mono font-black tabular-nums text-base-content/55">
@@ -1390,8 +1388,8 @@ function TimelineGraph({
>
{event.side ? sideLabel(event.side) : "-"}
</span>
<span className="min-w-0">
<span className="block truncate font-bold text-base-content/75">
<span className="min-w-0 sm:flex sm:items-baseline sm:gap-3">
<span className="block truncate font-bold text-base-content/75 sm:w-32 sm:shrink-0">
{teamName ? (
<span className="sr-only">{teamName} </span>
) : null}
@@ -1399,7 +1397,7 @@ function TimelineGraph({
</span>
{actorLabel ? (
<span
className="mt-0.5 block truncate text-[10px] font-bold text-base-content/35"
className="mt-0.5 block min-w-0 truncate text-[11px] text-content-muted sm:mt-0 sm:flex-1"
title={actorLabel}
>
{actorLabel}
@@ -1447,16 +1445,16 @@ function TeamTable({
))}
</div>
<div className="hidden overflow-x-auto lg:block">
<table className="w-full min-w-[1040px] table-fixed text-left">
<table className="w-full min-w-[920px] table-fixed text-left">
<thead>
<tr className="bg-base-content/[0.02] text-xs uppercase tracking-wider text-base-content/35">
<th className="w-[276px] px-3 py-2.5">선수</th>
<th className="w-[108px] px-3 py-2.5 text-center">KDA</th>
<th className="w-[120px] px-3 py-2.5 text-center">가한 피해량</th>
<th className="w-[120px] px-3 py-2.5 text-center">받은 피해량</th>
<th className="w-[80px] px-3 py-2.5 text-center">시야</th>
<th className="w-[96px] px-3 py-2.5 text-center">CS · 경제</th>
<th className="w-[260px] px-3 py-2.5">아이템</th>
<th className="w-[228px] px-3 py-2.5">선수</th>
<th className="w-[100px] px-3 py-2.5 text-center">KDA</th>
<th className="w-[104px] px-3 py-2.5 text-center">가한 피해량</th>
<th className="w-[104px] px-3 py-2.5 text-center">받은 피해량</th>
<th className="w-[72px] px-3 py-2.5 text-center">시야</th>
<th className="w-[92px] px-3 py-2.5 text-center">CS · 경제</th>
<th className="w-[232px] px-3 py-2.5">아이템</th>
</tr>
</thead>
<tbody>
@@ -1537,10 +1535,10 @@ function GameTabs({
return (
<nav
className="lts-panel sticky top-(--app-header-height) z-30 p-1"
className="lts-panel sticky top-(--app-header-nav-height) z-30 p-1 sm:flex sm:items-center sm:gap-1"
aria-label="세트 선택"
>
<label className="flex min-w-0 items-center gap-2 border-b border-line px-2 py-1.5 text-xs font-semibold text-content-muted">
<label className="flex min-w-0 items-center gap-2 border-b border-line px-2 py-1.5 text-xs font-semibold text-content-muted sm:w-72 sm:shrink-0 sm:border-b-0 sm:border-r sm:py-0 sm:pr-3">
<span className="shrink-0">대진</span>
<select
className="lts-select min-w-0"
@@ -1555,7 +1553,7 @@ function GameTabs({
))}
</select>
</label>
<div className="flex items-center gap-1">
<div className="flex min-w-0 items-center gap-1 sm:flex-1">
<Link
to={previousGame ? pathFor(previousGame.gameNumber) : "#"}
state={navigationState}
@@ -1577,9 +1575,9 @@ function GameTabs({
to={pathFor(game.gameNumber)}
state={navigationState}
aria-current={active ? "page" : undefined}
className={`flex h-10 shrink-0 items-center gap-2 rounded-[10px] px-3.5 text-sm transition-colors ${
className={`group flex h-10 shrink-0 items-center gap-2 rounded-[10px] px-3.5 text-sm transition-colors ${
active
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
? "bg-secondary text-secondary-content"
: "text-content-muted hover:bg-sunken hover:text-content"
}`}
>
@@ -1590,7 +1588,7 @@ function GameTabs({
<span className="text-xs opacity-80">전체 {game.gameNumber}</span>
)}
<span
className={`max-w-28 truncate text-xs ${active ? "opacity-80" : "text-content-subtle"}`}
className={`max-w-28 truncate text-xs ${active ? "opacity-80" : "text-content-subtle group-hover:text-content-muted"}`}
>
{winnerTeam
? `${getTeamName(detail, winnerTeam.teamIndex)} 승`
@@ -1638,7 +1636,7 @@ function MatchScoreHero({
const showSeriesScore = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries) && leftScore !== undefined && rightScore !== undefined;
const decision = selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
const sideTone = (side: TeamSide) =>
side === "blue" ? "text-[#8fb6ff]" : "text-[#ff99a5]";
side === "blue" ? "text-win" : "text-loss";
return (
<PageHero
+2 -2
View File
@@ -191,7 +191,7 @@ export default function MatchTeamProgressPage() {
actions={
<Link
to={`/match/${id}/team?select=1`}
className="inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-field bg-white/10 px-4 text-sm font-bold text-on-ink transition-colors hover:bg-white/20"
className="inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-field bg-on-ink/10 px-4 text-sm font-bold text-on-ink transition-colors hover:bg-on-ink/20"
>
<UsersRound className="h-4 w-4" aria-hidden="true" />
팀 변경
@@ -335,7 +335,7 @@ function SectionHeading({
}) {
return (
<div className="mb-3 border-b border-base-content/10 pb-2">
<h2 id={id} className="text-base font-black text-base-content">
<h2 id={id} className="text-base font-black">
{title}
</h2>
<p className="mt-0.5 text-xs text-content-muted">{description}</p>
+279 -122
View File
@@ -1,6 +1,6 @@
import { lazy, Suspense, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { ChevronDown, ChevronUp, RefreshCw, X } from "lucide-react";
import { ArrowDown, ChevronDown, ChevronUp, RefreshCw, X } from "lucide-react";
import { useLocation, useParams, useSearchParams } from "react-router";
import {
Chip,
@@ -51,6 +51,11 @@ import {
QUEUE_GROUP_TABS,
RANK_FILTER_TABS,
} from "../lib/riot-history";
import {
mockLargestMultiKill,
multiKillLabel,
rankPositionRates,
} from "../lib/multi-kill";
import { ResponsiveTierLabel } from "../components/RankBadge";
import {
InternalGameAnalysisPanel,
@@ -73,13 +78,6 @@ type HistoryLocationState = {
backTo?: unknown;
};
const SORT_LABELS: Record<ChampionSortKey, string> = {
games: "게임 수",
winRate: "승률",
kda: "KDA",
avgCsPerMin: "분당 CS",
};
function resolveBackTo(state: unknown) {
if (!state || typeof state !== "object") return "/";
const backTo = (state as HistoryLocationState).backTo;
@@ -168,7 +166,7 @@ function QueueTab({
onClick={onClick}
className={`h-10 flex-none whitespace-nowrap rounded-[10px] px-4 text-sm font-bold transition-colors ${
active
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
? "bg-secondary text-secondary-content"
: "text-content-muted hover:bg-sunken hover:text-content"
}`}
>
@@ -220,7 +218,7 @@ function SummaryCard({
label,
value,
sub,
valueClassName = "text-content",
valueClassName = "text-content-strong",
}: {
label: string;
value: React.ReactNode;
@@ -240,42 +238,80 @@ function SummaryCard({
);
}
function SortableHeader({
sortKey,
activeKey,
onSort,
children,
}: {
sortKey: ChampionSortKey;
activeKey: ChampionSortKey;
onSort: (key: ChampionSortKey) => void;
children: React.ReactNode;
}) {
const active = sortKey === activeKey;
return (
<th scope="col" aria-sort={active ? "descending" : "none"} className="!text-center">
<button
type="button"
onClick={() => onSort(sortKey)}
className={`inline-flex items-center gap-0.5 rounded-field px-1 py-0.5 hover:text-content ${active ? "text-content" : ""}`}
>
{children}
<ArrowDown
className={`size-3 ${active ? "opacity-100" : "opacity-0"}`}
aria-hidden="true"
/>
</button>
</th>
);
}
function ChampionStatsTable({
rows,
manifest,
selectedChampionId,
onChampionSelect,
sortKey,
onSort,
}: {
rows: ApiChampionStatsRow[];
manifest: DdragonManifest | null | undefined;
selectedChampionId?: number;
onChampionSelect: (championId: number | null) => void;
sortKey: ChampionSortKey;
onSort: (key: ChampionSortKey) => void;
}) {
if (rows.length === 0) {
return (
<div className="border border-base-content/10 bg-base-100 px-4 py-10 text-center text-sm text-base-content/35">
<div className="lts-panel px-4 py-10 text-center text-sm text-content-subtle">
조건에 맞는 챔피언 통계가 아직 없습니다.
</div>
);
}
return (
<div className="border border-base-content/10 bg-base-100 overflow-hidden">
<div className="lts-panel overflow-hidden">
<div className="overflow-x-auto">
<table className="w-full text-left min-w-[860px]">
<table className="lts-table min-w-[820px]">
<thead>
<tr className="bg-base-200/50 border-b border-base-content/10 text-xs text-base-content/35 uppercase tracking-wider">
<th className="px-3 py-3">챔피언</th>
<th className="px-3 py-3 text-center">승률</th>
<th className="px-3 py-3 text-center">게임</th>
<th className="px-3 py-3 text-center">승/패</th>
<th className="px-3 py-3 text-center">KDA</th>
<th className="px-3 py-3 text-center">킬</th>
<th className="px-3 py-3 text-center">데스</th>
<th className="px-3 py-3 text-center">어시스트</th>
<th className="px-3 py-3 text-center">멀티킬</th>
<th className="px-3 py-3 text-center">CS</th>
<th className="px-3 py-3 text-center">필터</th>
<tr>
<th scope="col">챔피언</th>
<SortableHeader sortKey="winRate" activeKey={sortKey} onSort={onSort}>
승률
</SortableHeader>
<SortableHeader sortKey="games" activeKey={sortKey} onSort={onSort}>
게임
</SortableHeader>
<SortableHeader sortKey="kda" activeKey={sortKey} onSort={onSort}>
KDA
</SortableHeader>
<th scope="col" className="!text-center">평균 K / D / A</th>
<th scope="col" className="!text-center">멀티킬</th>
<SortableHeader sortKey="avgCsPerMin" activeKey={sortKey} onSort={onSort}>
CS
</SortableHeader>
<th scope="col" className="!text-right">매치</th>
</tr>
</thead>
<tbody>
@@ -284,69 +320,83 @@ function ChampionStatsTable({
championDisplayName(manifest, row.championId) ??
String(row.championId);
const selected = selectedChampionId === row.championId;
const multiKills = [
["더블", row.doubleKills],
["트리플", row.tripleKills],
["쿼드라", row.quadraKills],
["펜타", row.pentaKills],
].filter(([, count]) => Number(count) > 0);
return (
<tr
key={row.championId}
className="border-b border-base-content/5 last:border-b-0 hover:bg-base-content/[0.02]"
className={`transition-colors hover:bg-sunken ${selected ? "bg-primary-tint/40" : ""}`}
>
<td className="px-3 py-3">
<td>
<div className="flex items-center gap-2">
<ChampionIcon
championId={row.championId}
manifest={manifest}
className="rounded-full"
/>
<span className="text-sm font-bold text-base-content">
<span className="font-bold text-content">
{displayName}
</span>
</div>
</td>
<td
className={`px-3 py-3 text-center text-sm font-bold ${ratioClass(row.winRate)}`}
>
{row.winRate}%
<td className="tabular w-36">
<div className="flex items-baseline justify-between gap-2">
<strong className={ratioClass(row.winRate)}>
{row.winRate}%
</strong>
<span className="whitespace-nowrap text-xs text-content-muted">
{row.wins}승 {row.losses}패
</span>
</div>
<div
className="mt-1 h-1.5 overflow-hidden rounded-full bg-loss/25"
aria-hidden="true"
>
<div
className="h-full rounded-full bg-win"
style={{ width: `${row.winRate}%` }}
/>
</div>
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
<td className="tabular text-center text-[13px]">
{row.games}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums text-base-content/55">
<span className="text-win">{row.wins}</span> /{" "}
<span className="text-loss">{row.losses}</span>
</td>
<td
className={`px-3 py-3 text-center text-sm font-bold tabular-nums ${kdaClass(row.kda)}`}
className={`tabular text-center font-bold ${kdaClass(row.kda)}`}
>
{row.kda}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.totalKills}
<td className="tabular whitespace-nowrap text-center text-[13px] text-content-muted">
{row.avgKills} /{" "}
<span className="text-loss">{row.avgDeaths}</span> /{" "}
{row.avgAssists}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.totalDeaths}
<td className="tabular text-center text-xs text-content-muted">
{multiKills.length > 0
? multiKills
.map(([label, count]) => `${label} ${count}`)
.join(" · ")
: "—"}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.totalAssists}
<td className="tabular whitespace-nowrap text-center text-[13px]">
{row.avgCs}{" "}
<span className="text-content-muted">
({row.avgCsPerMin}/분)
</span>
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums text-base-content/55">
{row.doubleKills}/{row.tripleKills}/{row.quadraKills}/
{row.pentaKills}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.avgCs} · {row.avgCsPerMin}/m
</td>
<td className="px-3 py-3 text-center">
<button
type="button"
className={`text-xs px-2 py-1 border ${
selected
? "border-primary/40 bg-primary/10 text-primary"
: "border-base-content/10 text-base-content/40 hover:text-base-content"
}`}
<td className="text-right">
<Chip
selected={selected}
onClick={() =>
onChampionSelect(selected ? null : row.championId)
}
>
{selected ? "해제" : "보기"}
</button>
</Chip>
</td>
</tr>
);
@@ -817,6 +867,43 @@ function MatchDetailTabs({
);
}
/** 접힌 행에서 양 팀 10명을 챔피언과 이름으로 훑어보게 한다. */
function MatchRoster({
teams,
manifest,
ownerParticipantId,
}: {
teams: ApiRecentMatchTeam[];
manifest: DdragonManifest | null | undefined;
ownerParticipantId: string;
}) {
if (teams.length === 0) return null;
return (
<div className="hidden w-44 shrink-0 grid-cols-2 gap-x-2 text-[11px] leading-4 lg:grid xl:w-52">
{teams.map((team) => (
<ul key={team.side} className="min-w-0 space-y-0.5">
{team.participants.map((participant) => (
<li key={participant.puuid} className="flex min-w-0 items-center gap-1">
<ChampionIcon championId={participant.championId} manifest={manifest} size="xs" className="rounded-sm" />
<span
className={`truncate ${
participant.puuid === ownerParticipantId
? "font-bold text-content"
: "text-content-muted"
}`}
title={participant.gameName}
>
{participant.gameName}
</span>
</li>
))}
</ul>
))}
</div>
);
}
function RecentMatchCard({
match,
manifest,
@@ -827,13 +914,21 @@ function RecentMatchCard({
ownerParticipantId: string;
}) {
const [expanded, setExpanded] = useState(false);
// 응답에 값이 없을 때 개발 화면에서만 목업으로 배지 모양을 확인한다.
const isMockMultiKill =
match.largestMultiKill === undefined && import.meta.env.DEV;
const multiKill = multiKillLabel(
isMockMultiKill
? mockLargestMultiKill(match.kills)
: match.largestMultiKill,
);
const championName =
championDisplayName(manifest, match.championId) ?? String(match.championId);
const outcome = match.remake ? "remake" : match.win ? "win" : "loss";
const surface = {
win: "border-win-line bg-win-tint",
loss: "border-loss-line bg-loss-tint",
remake: "border-line bg-card",
win: "bg-win-tint",
loss: "bg-loss-tint",
remake: "bg-card",
}[outcome];
const bar = { win: "bg-win", loss: "bg-loss", remake: "bg-content-disabled" }[outcome];
const resultClass = {
@@ -843,15 +938,17 @@ function RecentMatchCard({
}[outcome];
return (
<article className={`relative overflow-hidden rounded-box border ${surface}`}>
<article className={`relative overflow-hidden rounded-box border border-line ${surface}`}>
<span aria-hidden="true" className={`absolute inset-y-0 left-0 w-1 ${bar}`} />
<div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 py-3 pl-4 pr-2 sm:grid-cols-[minmax(0,1fr)_auto_auto] sm:gap-x-5 sm:px-5">
<div className="col-span-2 flex flex-wrap items-baseline gap-x-2 text-xs text-content-muted sm:col-span-3">
<strong className={`text-sm ${resultClass}`}>{match.remake ? "다시하기" : match.win ? "승리" : "패배"}</strong>
<span>{formatDate(match.gameCreation)} · {match.queueLabel}</span>
<div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2.5 py-3 pl-4 pr-2 sm:pl-5 sm:pr-3 xl:gap-x-5">
<div className="w-full shrink-0 text-xs text-content-muted sm:w-[5.5rem]">
<strong className={`block text-sm ${resultClass}`}>{match.remake ? "다시하기" : match.win ? "승리" : "패배"}</strong>
<span className="tabular sm:block">{match.queueLabel} · {formatDuration(match.gameDuration)}</span>
<span className="ml-1.5 sm:ml-0 sm:block">{formatDate(match.gameCreation)}</span>
</div>
<div className="flex min-w-0 items-center gap-2">
<ChampionIcon championId={match.championId} manifest={manifest} />
<div className="flex min-w-0 flex-1 items-center gap-2 sm:w-40 sm:flex-none xl:w-44">
<ChampionIcon championId={match.championId} manifest={manifest} size="lg" className="rounded-xl" />
<LoadoutIcons summonerSpells={match.summonerSpells} perks={match.perks} manifest={manifest} />
<div className="min-w-0">
<div className="truncate font-bold text-content" title={championName}>{championName}</div>
<div className="text-xs text-content-muted">
@@ -859,29 +956,46 @@ function RecentMatchCard({
</div>
</div>
</div>
<div className="tabular whitespace-nowrap text-right">
<strong className="text-sm sm:text-base">{match.kills} / {match.deaths} / {match.assists}</strong>
<div className="text-xs text-content-muted">{match.deaths === 0 ? "Perfect" : `${match.kda} KDA`}</div>
<div className="tabular w-24 shrink-0 whitespace-nowrap text-right sm:text-center">
<strong className="text-sm text-content-strong sm:text-base">
{match.kills} / <span className="text-loss">{match.deaths}</span> / {match.assists}
</strong>
<div className={`text-xs font-semibold ${kdaClass(match.kda)}`}>{match.deaths === 0 ? "Perfect" : `${match.kda} KDA`}</div>
{multiKill && (
<span
className="mt-1 inline-flex h-5 items-center rounded-full border border-leaf px-2 text-[11px] font-semibold text-leaf"
title={isMockMultiKill ? "목업 데이터 (API 미지원)" : undefined}
>
{multiKill}
</span>
)}
</div>
<dl className="tabular hidden w-28 shrink-0 text-xs text-content-muted md:block">
<div>킬 관여 <span className="font-semibold text-content">{match.killParticipation}%</span></div>
<div>CS {match.totalCs} ({match.csPerMin}/분)</div>
<div>시야 {match.visionScore}</div>
</dl>
<div className="shrink-0">
<ItemGrid items={match.items} trinket={match.trinket} manifest={manifest} itemKey={match.matchId} />
</div>
<MatchRoster teams={match.teams} manifest={manifest} ownerParticipantId={ownerParticipantId} />
<button
type="button"
onClick={() => setExpanded((current) => !current)}
className="col-span-2 flex min-h-9 items-center justify-end gap-1 rounded-field px-2 text-xs font-semibold text-content-muted hover:text-content focus-visible:-outline-offset-2 sm:col-span-1"
className="ml-auto flex min-h-9 shrink-0 items-center gap-1 rounded-field px-2 text-xs font-semibold text-content-muted hover:text-content focus-visible:-outline-offset-2"
aria-expanded={expanded}
aria-label={expanded ? "상세 전적 접기" : "상세 전적 펼치기"}
>
{expanded ? "상세 접기" : "상세 보기"}
<span className="lg:sr-only">{expanded ? "상세 접기" : "상세 보기"}</span>
{expanded ? <ChevronUp className="size-4" aria-hidden="true" /> : <ChevronDown className="size-4" aria-hidden="true" />}
</button>
</div>
{expanded && (
<div className="border-t border-line bg-card">
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-line px-4 py-3 text-xs text-content-muted">
<LoadoutIcons summonerSpells={match.summonerSpells} perks={match.perks} manifest={manifest} />
<span>Lv.{match.championLevel} · {formatDuration(match.gameDuration)}</span>
<span>킬 관여 {match.killParticipation}%</span>
<span>CS {match.totalCs} ({match.csPerMin}/분)</span>
<span>시야 {match.visionScore} · 제어와드 {match.controlWardsBought}</span>
<span>Lv.{match.championLevel}</span>
<span>제어와드 {match.controlWardsBought}</span>
<span>와드 설치 {match.wardsPlaced} · 제거 {match.wardsKilled}</span>
<span>챔피언 피해량 {match.damageDealtToChampions.toLocaleString()}</span>
</div>
<MatchDetailTabs match={match} manifest={manifest} ownerParticipantId={ownerParticipantId} />
@@ -1044,6 +1158,8 @@ export default function UserHistoryPage() {
? (championDisplayName(ddragon, championId) ?? String(championId))
: null;
const positionRates = rankPositionRates(summary?.positionRates ?? {});
const visibleChampionRows = (() => {
const rows = isInternalQueue
? (internalFirstPage?.championStats.champions ?? [])
@@ -1175,7 +1291,7 @@ export default function UserHistoryPage() {
title="소환사를 찾을 수 없습니다"
description="계정 연결이 해제됐거나 잘못된 주소일 수 있습니다."
action={
<Btn to="/" variant="secondary">
<Btn to="/inhouse" variant="secondary">
내전 목록으로
</Btn>
}
@@ -1198,9 +1314,9 @@ export default function UserHistoryPage() {
<img
src={profileIconUrl(ddragon, profile.profileIconId)}
alt=""
className="size-[72px] rounded-2xl bg-ink-raised object-cover ring-2 ring-white/15 sm:size-[88px]"
className="size-[72px] rounded-2xl bg-ink-raised object-cover ring-2 ring-ink-line sm:size-[88px]"
/>
<span className="tabular absolute -bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-ink-raised px-2 py-0.5 text-[11px] font-bold text-on-ink ring-1 ring-white/20">
<span className="tabular absolute -bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-ink-raised px-2 py-0.5 text-[11px] font-bold text-on-ink ring-1 ring-ink-line">
{profile.summonerLevel}
</span>
</div>
@@ -1252,7 +1368,7 @@ export default function UserHistoryPage() {
</div>
))}
<div className="lts-panel sticky top-(--app-header-height) z-30 p-1">
<div className="lts-panel sticky top-(--app-header-nav-height) z-30 p-1">
<div
className="no-scrollbar flex gap-1 overflow-x-auto"
role="tablist"
@@ -1338,7 +1454,7 @@ export default function UserHistoryPage() {
: undefined
}
/>
<div className="grid grid-cols-2 divide-line max-lg:[&>*:nth-child(n+3)]:border-t max-lg:[&>*:nth-child(even)]:border-l lg:grid-cols-[repeat(4,minmax(0,1fr))_minmax(0,1.5fr)] lg:divide-x">
<div className="grid grid-cols-2 divide-line max-lg:[&>*:nth-child(n+3)]:border-t max-lg:[&>*:nth-child(even)]:border-l lg:grid-cols-5 lg:divide-x">
<SummaryCard
label="승률"
value={summary ? `${summary.winRate}%` : "—"}
@@ -1353,7 +1469,13 @@ export default function UserHistoryPage() {
/>
<SummaryCard
label="최고 평점"
value={summary?.bestRating?.rating ?? "—"}
value={
summary?.bestRating
? summary.bestRating.rating === "Perfect"
? "노데스"
: summary.bestRating.rating
: "—"
}
sub={
summary?.bestRating
? `${summary.bestRating.kills}/${summary.bestRating.deaths}/${summary.bestRating.assists}`
@@ -1376,33 +1498,79 @@ export default function UserHistoryPage() {
}
sub="가장 최근 경기 기준"
/>
<div className="col-span-2 px-4 py-3.5 sm:px-5 lg:col-span-1">
<div className="px-4 py-3.5 max-lg:col-span-2 sm:px-5">
<div className="text-xs font-semibold text-content-subtle">
선호 포지션
</div>
{positionRates.length > 0 ? (
<ul className="mt-2 space-y-1.5">
{positionRates.map(({ lane, rate }) => (
<li key={lane} className="tabular text-xs">
<div className="flex justify-between gap-2">
<span className="font-semibold text-content">
{LANE_LABELS[lane] ?? lane}
</span>
<span className="text-content-muted">{rate}%</span>
</div>
<div
className="mt-0.5 h-1.5 overflow-hidden rounded-full bg-sunken-strong"
aria-hidden="true"
>
<div
className="h-full rounded-full bg-primary"
style={{ width: `${Math.min(100, rate)}%` }}
/>
</div>
</li>
))}
</ul>
) : (
<div className="mt-2 text-xs text-content-subtle">기록 없음</div>
)}
</div>
<div className="col-span-2 border-t border-line px-4 py-3.5 max-lg:!border-l-0 sm:px-5 lg:col-span-5 lg:!border-l-0">
<div className="text-xs font-semibold text-content-subtle">
자주 플레이한 챔피언
</div>
<div className="mt-2 flex items-center gap-4">
{(summary?.topChampions ?? []).map((champion) => (
<button
type="button"
key={champion.championId}
className="group flex items-center gap-2 text-left"
aria-label={`${championDisplayName(ddragon, champion.championId) ?? champion.championId} 경기만 보기`}
onClick={() =>
updateSearch({ championId: champion.championId })
}
>
<ChampionIcon
championId={champion.championId}
manifest={ddragon}
className="rounded-full ring-2 ring-transparent transition-shadow group-hover:ring-primary"
/>
<span
className={`tabular text-sm font-bold ${ratioClass(champion.winRate)}`}
<div className="mt-2 flex flex-wrap items-center gap-x-8 gap-y-3">
{(summary?.topChampions ?? []).map((champion) => {
const wins = Math.round(
(champion.games * champion.winRate) / 100,
);
return (
<button
type="button"
key={champion.championId}
className="group flex items-center gap-2.5 text-left"
aria-label={`${championDisplayName(ddragon, champion.championId) ?? champion.championId} 경기만 보기`}
onClick={() =>
updateSearch({ championId: champion.championId })
}
>
{champion.winRate}%
</span>
</button>
))}
<ChampionIcon
championId={champion.championId}
manifest={ddragon}
size="lg"
className="rounded-full ring-2 ring-transparent transition-shadow group-hover:ring-primary"
/>
<span className="tabular">
<span
className={`block text-sm font-bold ${ratioClass(champion.winRate)}`}
>
{champion.winRate}%
<span className="ml-1.5 text-xs font-medium text-content-muted">
{wins}승 {champion.games - wins}패
</span>
</span>
<span className="block text-xs text-content-muted">
{championDisplayName(ddragon, champion.championId) ??
champion.championId}{" "}
· 평점 {champion.avgRating}
</span>
</span>
</button>
);
})}
{(summary?.topChampions ?? []).length === 0 && (
<span className="text-xs text-content-subtle">기록 없음</span>
)}
@@ -1463,19 +1631,6 @@ export default function UserHistoryPage() {
placeholder="챔피언 검색"
className="lts-input"
/>
<select
value={sortKey}
onChange={(event) =>
setSortKey(event.target.value as ChampionSortKey)
}
className="lts-select"
>
{(Object.keys(SORT_LABELS) as ChampionSortKey[]).map((key) => (
<option key={key} value={key}>
{SORT_LABELS[key]}순
</option>
))}
</select>
</div>
</div>
<ChampionStatsTable
@@ -1485,6 +1640,8 @@ export default function UserHistoryPage() {
onChampionSelect={(nextChampionId) =>
updateSearch({ championId: nextChampionId })
}
sortKey={sortKey}
onSort={setSortKey}
/>
</section>
+37 -14
View File
@@ -3,6 +3,7 @@ import { useQueryClient } from '@tanstack/react-query';
import type {
GrandFinalGameCount,
MatchDetailResponse,
MatchEventType,
MatchGameMode,
MatchLifecycleStatus,
MatchScheduleItemView,
@@ -17,11 +18,13 @@ import {
} from '../../api/hooks';
import type { MatchMutationRequest } from '../../api/types';
import { DEFAULT_COMMUNITY_ID } from '../../config';
import { MATCH_EVENT_LABEL } from '../../lib/match-event-type';
import { Btn, Chip, ErrorNote, LoadingNote, Pill, type PillTone } from '../../ui';
import { AdminNotice, AdminPage } from '../../components/AdminPage';
const DEFAULT_FORM: MatchMutationRequest = {
title: '',
eventType: 'inhouse',
description: '',
mapId: 11,
scheduledAt: toInputValue(new Date(Date.now() + 24 * 60 * 60 * 1000)),
@@ -147,6 +150,7 @@ function makeForm(match?: MatchDetailResponse): MatchMutationRequest & {
return {
title: match.title,
eventType: match.eventType ?? 'inhouse',
description: match.description,
mapId: match.mapId,
scheduledAt: toInputValue(match.scheduledAt),
@@ -204,6 +208,7 @@ export default function MatchAdminPage() {
async function invalidate() {
await Promise.all([
queryClient.invalidateQueries({ queryKey: ['matches', communityId] }),
queryClient.invalidateQueries({ queryKey: ['matches-page', communityId] }),
queryClient.invalidateQueries({ queryKey: ['match', communityId] }),
]);
}
@@ -225,6 +230,7 @@ export default function MatchAdminPage() {
function buildPayload(): MatchMutationRequest {
const details: MatchMutationRequest = {
title: form.title.trim(),
eventType: form.eventType,
description: form.description?.trim() ?? '',
mapId: Number(form.mapId ?? 11),
scheduledAt: toIsoFromInput(form.scheduledAt),
@@ -275,7 +281,7 @@ export default function MatchAdminPage() {
await invalidate();
setShowForm(false);
setEditing(null);
setMessage(editing ? '내전을 수정했습니다.' : '내전을 만들었습니다.');
setMessage(editing ? '대회를 수정했습니다.' : '대회를 만들었습니다.');
},
onError: (error: Error) => setMessage(error.message),
};
@@ -296,7 +302,7 @@ export default function MatchAdminPage() {
variant="destructive"
disabled={deleteMutation.isPending}
onClick={() => {
if (!window.confirm('이 내전을 삭제할까요?')) return;
if (!window.confirm('이 대회를 삭제할까요?')) return;
deleteMutation.mutate(match._id, {
onSuccess: invalidate,
onError: (error) => setMessage(error instanceof Error ? error.message : '삭제 실패'),
@@ -318,7 +324,7 @@ export default function MatchAdminPage() {
return (
<AdminNotice title="권한이 필요합니다">
<p className="mt-2 text-sm text-base-content/40">
내전 관리는 owner/admin만 사용할 수 있습니다.
대회 관리는 owner/admin만 사용할 수 있습니다.
</p>
</AdminNotice>
);
@@ -327,11 +333,11 @@ export default function MatchAdminPage() {
return (
<AdminPage
communityId={communityId}
title="내전 관리"
description="내전 생성, 모집 정원, 게임 모드와 공지 내용을 관리합니다."
title="대회 관리"
description="내전과 멸망전의 일정, 참가 설정과 공지를 관리합니다."
>
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
<div className="flex flex-wrap gap-2" role="group" aria-label="내전 상태 필터">
<div className="flex flex-wrap gap-2" role="group" aria-label="대회 상태 필터">
<Chip selected={!statusFilter} onClick={() => setStatusFilter(undefined)}>전체</Chip>
{matchStatusFilters.map((status) => (
<Chip key={status} selected={statusFilter === status} onClick={() => setStatusFilter(status)}>
@@ -340,7 +346,7 @@ export default function MatchAdminPage() {
))}
</div>
<Btn variant="primary" onClick={openCreate}>
새 내전 만들기
새 대회 만들기
</Btn>
</div>
@@ -354,7 +360,7 @@ export default function MatchAdminPage() {
<section className="mb-6 border border-base-content/10 bg-base-100 p-4">
<div className="mb-4 flex items-center justify-between gap-3">
<h2 ref={formHeading} tabIndex={-1} className="scroll-mt-28 text-sm font-bold">
{editing ? '내전 수정' : '새 내전'}
{editing ? '대회 수정' : '새 대회'}
</h2>
<button
type="button"
@@ -397,6 +403,21 @@ export default function MatchAdminPage() {
className="lts-input mt-1 w-full"
/>
</label>
<label className="text-xs text-base-content/45">
대회 유형
<select
value={form.eventType}
onChange={(event) => {
const eventType = event.target.value as MatchEventType;
setForm((current) => ({ ...current, eventType }));
}}
className="lts-select mt-1 w-full"
>
{Object.entries(MATCH_EVENT_LABEL).map(([value, label]) => (
<option key={value} value={value}>{label}</option>
))}
</select>
</label>
<label className="text-xs text-base-content/45">
정원
<select
@@ -585,15 +606,15 @@ export default function MatchAdminPage() {
)}
{matchesQuery.isLoading ? (
<LoadingNote label="내전 목록을 불러오는 중" />
<LoadingNote label="대회 목록을 불러오는 중" />
) : matchesQuery.isError ? (
<ErrorNote title="내전 목록을 불러오지 못했습니다" action={<Btn onClick={() => void matchesQuery.refetch()}>다시 시도</Btn>} />
<ErrorNote title="대회 목록을 불러오지 못했습니다" action={<Btn onClick={() => void matchesQuery.refetch()}>다시 시도</Btn>} />
) : matches.length === 0 ? (
<p role="status" className="lts-panel p-6 text-center text-sm text-content-muted">
{statusFilter ? '이 상태의 내전이 없습니다.' : '등록된 내전이 없습니다.'}
{statusFilter ? '이 상태의 대회가 없습니다.' : '등록된 대회가 없습니다.'}
</p>
) : (
<section className="lts-panel overflow-hidden" aria-label="내전 목록">
<section className="lts-panel overflow-hidden" aria-label="대회 목록">
<ul className="divide-y divide-line lg:hidden">
{matches.map((match) => (
<li key={match._id} className="space-y-2 px-4 py-3">
@@ -604,7 +625,7 @@ export default function MatchAdminPage() {
<Pill tone={MATCH_STATES[match.status].tone}>{MATCH_STATES[match.status].label}</Pill>
</div>
<p className="text-xs text-content-muted">
{formatDate(match.scheduledAt)} · {match.participants.length}/{match.maxParticipants}명
{MATCH_EVENT_LABEL[match.eventType ?? 'inhouse']} · {formatDate(match.scheduledAt)} · {match.participants.length}/{match.maxParticipants}명
</p>
<details className="text-sm">
<summary className="cursor-pointer py-2 font-semibold">상세·관리</summary>
@@ -623,7 +644,8 @@ export default function MatchAdminPage() {
<thead>
<tr className="bg-base-200/40 border-b border-base-content/10 text-xs uppercase tracking-wider text-base-content/35">
<th className="px-3 py-2">시간</th>
<th className="px-3 py-2">내전</th>
<th className="px-3 py-2">대회</th>
<th className="px-3 py-2">유형</th>
<th className="px-3 py-2">상태</th>
<th className="px-3 py-2">정원</th>
<th className="px-3 py-2">모드</th>
@@ -644,6 +666,7 @@ export default function MatchAdminPage() {
{match.description || '-'}
</div>
</td>
<td className="px-3 py-2 text-xs">{MATCH_EVENT_LABEL[match.eventType ?? 'inhouse']}</td>
<td className="px-3 py-2 text-xs"><Pill tone={MATCH_STATES[match.status].tone}>{MATCH_STATES[match.status].label}</Pill></td>
<td className="px-3 py-2 text-xs tabular-nums">
{match.participants.length}/{match.maxParticipants}
-1
View File
@@ -21,7 +21,6 @@
--lts-content-disabled: var(--color-text-disabled);
color: var(--color-text-primary);
font-family: Figtree, "Asta Sans", system-ui, sans-serif;
font-size: var(--text-body-size);
line-height: var(--text-body-leading);
}
+23 -6
View File
@@ -17,6 +17,11 @@ export const HOME_MATCH_STATUS = {
finished: '종료',
} as const;
type HomeMatchEnrollment = Pick<
MatchDetailResponse,
'status' | 'joined' | 'participants' | 'maxParticipants'
>;
export function getHomeMatchSchedule(scheduledAt: string) {
const value = new Date(scheduledAt);
if (Number.isNaN(value.getTime())) return;
@@ -61,12 +66,7 @@ export function getHistoryMatchTitle(
: title;
}
export function getHomeMatchEnrollment(
match: Pick<
MatchDetailResponse,
'status' | 'joined' | 'participants' | 'maxParticipants'
>,
) {
export function getHomeMatchEnrollment(match: HomeMatchEnrollment) {
const current = match.participants.length;
const remaining = match.maxParticipants - current;
const isRecruiting = match.status === 'recruiting';
@@ -84,3 +84,20 @@ export function getHomeMatchEnrollment(
return { canApply, capacity, label };
}
export function getNextMatchBanner(
match: HomeMatchEnrollment & Pick<MatchDetailResponse, 'title'>,
) {
const { canApply, capacity } = getHomeMatchEnrollment(match);
const regularTitle = /^(?:[월화수목금토일]요일\s*(?:정기\s*)?|정기\s*)내전$/u;
const title = regularTitle.test(match.title.trim()) ? '정기 내전' : match.title;
let status: string = HOME_MATCH_STATUS[match.status];
if (match.status === 'team-built') status = '팀 편성';
if (match.status === 'recruiting') {
if (match.joined) status = '신청 완료';
else if (!canApply) status = match.maxParticipants > 0 ? '정원 마감' : '모집 마감';
}
return { title, status, capacity, canApply };
}
@@ -278,7 +278,7 @@ export default function InternalStatsPreview() {
}
return (
<div className="min-h-[calc(100vh-var(--app-header-height))] bg-[#f9f9f9] dark:bg-body">
<div className="min-h-[calc(100vh-var(--app-header-height))] bg-body">
<main className={`${pageWidthClass()} pb-12 pt-6 sm:pt-8`}>
<header className="flex flex-wrap items-end justify-between gap-4">
<div>
+1 -1
View File
@@ -4,7 +4,7 @@
.match-flows-panel {
border-radius: 12px;
box-shadow: 0 3px 10px rgb(0 0 0 / 3%);
box-shadow: 0 3px 10px color-mix(in srgb, var(--color-palette-black) 3%, transparent);
}
.match-flows-link[aria-current="page"] {
+9 -7
View File
@@ -9,9 +9,7 @@ export interface Crumb {
}
/**
* 페이지 머리 띠. 상단 내비게이션과 같은 잉크색으로 이어지고, 본문 시트가
* 아래에서 겹쳐 올라온다. "지금 어디에 있고 무엇을 할 수 있는지"를 이 한
* 곳에서 읽게 한다.
* 제목과 맥락을 보조 배경 위에 모은다. 본문 시트가 아래에서 겹쳐 올라온다.
*/
export function PageHero({
crumbs,
@@ -40,7 +38,7 @@ export function PageHero({
children?: ReactNode;
}) {
return (
<header className="bg-ink text-on-ink">
<header className="border-b border-ink-line bg-ink text-on-ink">
<div className={`${pageWidthClass(width)} pt-5 ${flush ? "pb-6" : "pb-14"}`}>
{crumbs && crumbs.length > 0 && (
<nav
@@ -68,7 +66,7 @@ export function PageHero({
{media}
<div className="min-w-0">
{eyebrow && (
<p className="mb-1 text-xs font-semibold text-brand-coral">
<p className="mb-1 text-xs font-semibold text-primary">
{eyebrow}
</p>
)}
@@ -160,20 +158,24 @@ export function PanelHeader({
description,
count,
actions,
variant = "panel",
className = "",
}: {
title: ReactNode;
description?: ReactNode;
count?: ReactNode;
actions?: ReactNode;
variant?: "panel" | "section";
className?: string;
}) {
const spacing = variant === "section" ? "pb-3" : "border-b border-line px-4 py-3 sm:px-5";
return (
<div
className={`flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-b border-line px-4 py-3 sm:px-5 ${className}`}
className={`flex flex-wrap items-center justify-between gap-x-4 gap-y-2 ${spacing} ${className}`}
>
<div className="min-w-0">
<h2 className="flex items-baseline gap-2 text-[15px] font-bold text-content">
<h2 className="flex items-baseline gap-2 text-[17px] font-bold">
{title}
{count !== undefined && (
<span className="tabular text-sm font-semibold text-content-subtle">
+3 -3
View File
@@ -7,7 +7,7 @@ const TONES = {
win: "bg-win-tint text-win",
loss: "bg-loss-tint text-loss",
gold: "bg-gold-tint text-gold",
ink: "bg-white/10 text-on-ink",
ink: "bg-on-ink/10 text-on-ink",
solid: "bg-primary text-primary-content",
} as const;
@@ -59,8 +59,8 @@ export function Chip({
aria-pressed={selected}
className={`inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-3 text-[13px] font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${
selected
? "border-transparent bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
: "border-line-strong bg-card text-content-muted hover:border-content-subtle hover:text-content"
? "border-transparent bg-secondary text-secondary-content"
: "border-line-strong bg-card text-content-subtle hover:border-content-subtle hover:text-content"
} ${className}`}
{...rest}
>
+12 -8
View File
@@ -14,18 +14,22 @@ const BRAND_COLORS = {
leaf: "#2f9e58",
} as const;
test("defines each brand color once as a primitive token", () => {
test("keeps literal colors in the primitive palette", () => {
const palette = stylesheet.match(/@theme static\s*\{[^}]*\}/)?.[0];
assert.ok(palette, "the primitive palette must be in @theme static");
for (const [name, value] of Object.entries(BRAND_COLORS)) {
assert.match(
stylesheet,
palette,
new RegExp(`--color-brand-${name}: ${escapeRegExp(value)};`),
);
assert.equal(
stylesheet.split(value).length - 1,
1,
`${name} should have one literal source`,
);
assert.equal(palette.split(`${value};`).length - 1, 1);
}
assert.doesNotMatch(
stylesheet.replace(palette, ""),
/#[\da-f]{3,8}\b|\b(?:rgba?|hsla?|oklch|oklab)\(/i,
);
});
test("keeps the layer order that lets LOLYMPUS tokens override Astryx", () => {
@@ -43,7 +47,7 @@ test("derives Astryx action colors from the brand coral", () => {
);
assert.match(
stylesheet,
/--color-text-accent: light-dark\(\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, black\),\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, white\)\s*\);/,
/--color-text-accent: light-dark\(\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, var\(--color-palette-black\)\),\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, var\(--color-palette-white\)\)\s*\);/,
);
});
@@ -1,9 +1,11 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import type { MatchParticipantView } from '@lolympus/contracts';
import {
getHistoryMatchTitle,
getHomeMatchEnrollment,
getHomeMatchSchedule,
getNextMatchBanner,
} from '../src/pages/home-match-presentation.ts';
test('uses the Korean schedule and only removes a matching generic title prefix', () => {
@@ -48,3 +50,34 @@ test('promotes application only for an open match with available places', () =>
'참가 완료',
);
});
test('uses neutral titles and distinguishes registration states on the next match banner', () => {
const match = {
title: '토요일 내전',
status: 'recruiting' as const,
joined: false,
maxParticipants: 1,
participants: [],
};
const participant: MatchParticipantView = {
userId: 'player-1' as MatchParticipantView['userId'],
joinedAt: '2026-11-10T09:00:00.000Z',
preferredPositions: [],
excluded: false,
};
assert.deepEqual(getNextMatchBanner(match), {
title: '정기 내전',
status: '모집 중',
capacity: '0/1명',
canApply: true,
});
const fullMatch = { ...match, participants: [participant] };
assert.equal(getNextMatchBanner(fullMatch).status, '정원 마감');
assert.equal(getNextMatchBanner({ ...fullMatch, joined: true }).status, '신청 완료');
assert.equal(getNextMatchBanner({ ...match, maxParticipants: 0 }).status, '모집 마감');
assert.deepEqual(
getNextMatchBanner({ ...fullMatch, title: '토요일 시즌 결승 내전', status: 'team-built' }),
{ title: '토요일 시즌 결승 내전', status: '팀 편성', capacity: '1/1명', canApply: false },
);
});
+1 -1
View File
@@ -15,7 +15,7 @@ test("shares the four history columns between records and the loading state", ()
assert.equal(columns.match(/<col(?:\s|\/|>)/g)?.length, 4);
assert.deepEqual(
Array.from(columns.matchAll(/<th\b[^>]*>\s*([^<]+?)\s*<\/th>/g), (match) => match[1]),
["일정", "내전", "결과", "참가"],
["일정", "대회", "상태·결과", "참가"],
);
assert.match(skeleton, /<HistoryTableColumns\s*\/>/);
assert.match(records, /<HistoryTableColumns\s*\/>/);
@@ -0,0 +1,105 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {
getInternalMatchOutcome,
getMainLane,
parseLeaderboardSort,
rankLeaderboardByLane,
sortLeaderboardRows,
} from '../src/lib/internal-stats-presentation.ts';
const rows = [
{ id: 'many', games: 90, winRate: 46, kda: 2.1 },
{ id: 'steady', games: 40, winRate: 55, kda: 3.4 },
{ id: 'lucky', games: 2, winRate: 100, kda: 9 },
{ id: 'sharp', games: 12, winRate: 55, kda: 4.2 },
];
const ids = (list: typeof rows) => list.map(({ id }) => id);
test('keeps the server order for the default sort and ignores unknown values', () => {
assert.equal(parseLeaderboardSort(null), 'games');
assert.equal(parseLeaderboardSort('nope'), 'games');
assert.equal(parseLeaderboardSort('kda'), 'kda');
assert.deepEqual(ids(sortLeaderboardRows(rows, 'games')), ids(rows));
});
test('ranks small samples after players with enough games', () => {
assert.deepEqual(ids(sortLeaderboardRows(rows, 'winRate')), [
'steady',
'sharp',
'many',
'lucky',
]);
assert.deepEqual(ids(sortLeaderboardRows(rows, 'kda')), [
'sharp',
'steady',
'many',
'lucky',
]);
});
test('ranks one lane by its own win rate and sample size', () => {
const player = (
id: string,
byLane: Parameters<typeof rankLeaderboardByLane>[0][number]['byLane'],
) => ({ id, games: 50, wins: 25, losses: 25, winRate: 50, kda: 3, byLane });
const ranked = rankLeaderboardByLane(
[
player('offlane', { MIDDLE: { games: 20, wins: 18, kda: 5 } }),
player('lucky', { TOP: { games: 2, wins: 2, kda: 9 } }),
player('steady', { TOP: { games: 10, wins: 6, kda: 3 } }),
player('sharp', { TOP: { games: 6, wins: 4, kda: 4 } }),
],
'TOP',
);
assert.deepEqual(
ranked.map(({ id }) => id),
['sharp', 'steady', 'lucky'],
);
assert.deepEqual(
{ games: ranked[0].games, wins: ranked[0].wins, losses: ranked[0].losses, winRate: ranked[0].winRate },
{ games: 6, wins: 4, losses: 2, winRate: 67 },
);
});
test('picks the most played lane', () => {
assert.equal(
getMainLane({
TOP: { games: 3, wins: 1, kda: 2 },
BOTTOM: { games: 8, wins: 4, kda: 3 },
}),
'BOTTOM',
);
assert.equal(getMainLane({}), undefined);
});
test('shows a score for a single two-team series and a winner otherwise', () => {
const team = (teamIndex: number) => ({
teamIndex,
name: `${teamIndex + 1}팀`,
members: [],
});
const pair = getInternalMatchOutcome({
winnerTeamIndex: 1,
teams: [team(0), team(1)],
seriesResults: [
{ teamAIndex: 0, teamBIndex: 1, teamAWins: 1, teamBWins: 2 },
],
});
assert.equal(pair?.type, 'score');
assert.equal(pair?.type === 'score' && pair.rightWins, 2);
assert.equal(pair?.winner?.name, '2팀');
const tournament = getInternalMatchOutcome({
winnerTeamIndex: 2,
teams: [team(0), team(1), team(2), team(3)],
seriesResults: [],
});
assert.deepEqual(tournament, { type: 'winner', winner: team(2) });
assert.equal(
getInternalMatchOutcome({ teams: [team(0), team(1)], seriesResults: [] }),
undefined,
);
});
+22
View File
@@ -0,0 +1,22 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { multiKillLabel, rankPositionRates } from '../src/lib/multi-kill.ts';
test('labels only real multi kills and caps at a penta kill', () => {
assert.equal(multiKillLabel(undefined), undefined);
assert.equal(multiKillLabel(1), undefined);
assert.equal(multiKillLabel(2), '더블킬');
assert.equal(multiKillLabel(4), '쿼드라킬');
assert.equal(multiKillLabel(6), '펜타킬');
});
test('orders played positions by rate and drops empty ones', () => {
assert.deepEqual(
rankPositionRates({ TOP: 32, MIDDLE: 58, JUNGLE: 0, BOTTOM: 10 }),
[
{ lane: 'MIDDLE', rate: 58 },
{ lane: 'TOP', rate: 32 },
],
);
assert.deepEqual(rankPositionRates({}), []);
});