feat(web): refresh the app with Astryx and coral branding
This commit is contained in:
1 parent
f649490cd2
commit
da7b502936
140 files changed
+4531
-2368
No files matched your search
+162
-58
@@ -1,10 +1,10 @@
|
||||
import { BrowserRouter, Link, Route, Routes } from "react-router";
|
||||
import { BrowserRouter, Link, NavLink, Route, Routes } from "react-router";
|
||||
import type { ReactNode } from "react";
|
||||
import { useMsal } from "@azure/msal-react";
|
||||
import { Moon, Sun } from "lucide-react";
|
||||
import { LogOut, Moon, Sun } from "lucide-react";
|
||||
import DevAuthSwitcher from "./components/DevAuthSwitcher";
|
||||
import { DEFAULT_COMMUNITY_ID, setTheme, useTheme } from "./config";
|
||||
import { useCommunity } from "./api/hooks";
|
||||
import { useCommunity, useMe } from "./api/hooks";
|
||||
import { isMsalConfigured } from "./lib/auth/msal.config";
|
||||
import AuthCallbackPage from "./pages/AuthCallback";
|
||||
import HomePage from "./pages/HomePage";
|
||||
@@ -20,6 +20,24 @@ import LegacyImportPage from "./pages/admin/LegacyImportPage";
|
||||
import LegacyMatchesPage from "./pages/admin/LegacyMatchesPage";
|
||||
import MatchAdminPage from "./pages/admin/MatchAdminPage";
|
||||
import TournamentCodesPage from "./pages/admin/TournamentCodesPage";
|
||||
import { PlainPage, Tooltip, pageWidthClass } from "./ui";
|
||||
|
||||
const NAV_ICON_BUTTON_CLASS =
|
||||
"grid size-9 place-items-center rounded-field text-on-ink-muted transition-colors hover:bg-white/10 hover:text-on-ink";
|
||||
|
||||
function BrandMark() {
|
||||
return (
|
||||
<svg viewBox="0 0 28 28" className="size-7 shrink-0" aria-hidden="true">
|
||||
<rect width="28" height="28" rx="8" fill="var(--color-brand-coral)" />
|
||||
<path
|
||||
d="M5.5 20.5 11 10l3.4 5.6L16.6 12l5.9 8.5Z"
|
||||
fill="#2a1704"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<circle cx="19.2" cy="8.4" r="1.9" fill="#2a1704" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function MsalHeaderActions() {
|
||||
const { accounts, instance } = useMsal();
|
||||
@@ -28,7 +46,7 @@ function MsalHeaderActions() {
|
||||
if (!account) {
|
||||
return (
|
||||
<Link
|
||||
className="btn btn-ghost btn-sm px-2 text-base-content/60 hover:text-base-content"
|
||||
className="inline-flex h-9 items-center rounded-field bg-white/10 px-3.5 text-[13px] font-semibold text-on-ink transition-colors hover:bg-white/20"
|
||||
to="/login"
|
||||
>
|
||||
로그인
|
||||
@@ -36,15 +54,24 @@ function MsalHeaderActions() {
|
||||
);
|
||||
}
|
||||
|
||||
const name = account.name ?? account.username;
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-sm px-3 max-w-[45vw] sm:max-w-none"
|
||||
onClick={() => void instance.logoutRedirect()}
|
||||
>
|
||||
<span className="truncate">{account.name ?? account.username}</span>
|
||||
<span className="hidden shrink-0 sm:inline">로그아웃</span>
|
||||
</button>
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<span className="hidden max-w-40 truncate text-[13px] font-medium text-on-ink-muted sm:block">
|
||||
{name}
|
||||
</span>
|
||||
<Tooltip content="로그아웃" placement="below">
|
||||
<button
|
||||
type="button"
|
||||
className={NAV_ICON_BUTTON_CLASS}
|
||||
aria-label={`${name} 로그아웃`}
|
||||
onClick={() => void instance.logoutRedirect()}
|
||||
>
|
||||
<LogOut className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,32 +83,117 @@ function ThemeToggle() {
|
||||
const Icon = nextTheme === "dark" ? Moon : Sun;
|
||||
|
||||
return (
|
||||
<span className="tooltip tooltip-bottom" data-tip={label}>
|
||||
<Tooltip content={label} placement="below">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-sm btn-square text-base-content/60 hover:text-base-content"
|
||||
className={NAV_ICON_BUTTON_CLASS}
|
||||
aria-label={label}
|
||||
onClick={() => setTheme(nextTheme)}
|
||||
>
|
||||
<Icon className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
function PrimaryNavLink({
|
||||
to,
|
||||
end,
|
||||
children,
|
||||
}: {
|
||||
to: string;
|
||||
end?: boolean;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<NavLink
|
||||
to={to}
|
||||
end={end}
|
||||
className={({ isActive }) =>
|
||||
`relative inline-flex h-14 items-center px-3 text-sm font-semibold transition-colors ${
|
||||
isActive
|
||||
? "text-on-ink after:absolute after:inset-x-3 after:bottom-0 after:h-[3px] after:rounded-t-full after:bg-brand-coral"
|
||||
: "text-on-ink-muted hover:text-on-ink"
|
||||
}`
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</NavLink>
|
||||
);
|
||||
}
|
||||
|
||||
function AppHeader() {
|
||||
const communityQuery = useCommunity(DEFAULT_COMMUNITY_ID);
|
||||
const meQuery = useMe();
|
||||
const communityLabel = communityQuery.data?.name ?? "LOLYMPUS";
|
||||
const role = meQuery.data?.memberships.find(
|
||||
(membership) => membership.community?._id === DEFAULT_COMMUNITY_ID,
|
||||
)?.user?.role;
|
||||
const canManage = role === "owner" || role === "admin";
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 border-b border-ink-line bg-ink">
|
||||
<div
|
||||
className={`${pageWidthClass("xl")} flex h-14 items-center justify-between gap-3`}
|
||||
>
|
||||
<div className="flex min-w-0 items-center gap-2 sm:gap-5">
|
||||
<Link
|
||||
className="flex shrink-0 items-center gap-2.5 text-on-ink"
|
||||
to="/"
|
||||
aria-label={`${communityLabel} 홈`}
|
||||
>
|
||||
<BrandMark />
|
||||
<span className="hidden text-[17px] font-extrabold tracking-[-0.02em] sm:block">
|
||||
{communityLabel}
|
||||
</span>
|
||||
</Link>
|
||||
{DEFAULT_COMMUNITY_ID && (
|
||||
<nav aria-label="주 메뉴" className="flex items-center">
|
||||
<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>
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
<ThemeToggle />
|
||||
{isMsalConfigured && <MsalHeaderActions />}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function AppFooter() {
|
||||
return (
|
||||
<footer className="border-t border-base-content/10 bg-base-100">
|
||||
<div className="max-w-5xl mx-auto px-4 sm:px-6 py-8 text-xs text-base-content/35">
|
||||
<nav className="flex items-center gap-4 mb-4 font-semibold text-base-content/45">
|
||||
<Link to="/terms" className="hover:text-base-content">
|
||||
<footer className="border-t border-line">
|
||||
<div
|
||||
className={`${pageWidthClass("xl")} flex flex-col gap-3 py-8 text-xs text-content-subtle`}
|
||||
>
|
||||
<nav
|
||||
aria-label="정책"
|
||||
className="flex items-center gap-4 font-semibold text-content-muted"
|
||||
>
|
||||
<Link to="/terms" className="hover:text-content">
|
||||
서비스 이용약관
|
||||
</Link>
|
||||
<Link to="/privacy" className="hover:text-base-content">
|
||||
<Link to="/privacy" className="hover:text-content">
|
||||
개인정보처리방침
|
||||
</Link>
|
||||
</nav>
|
||||
<p className="leading-relaxed max-w-4xl">
|
||||
<p className="max-w-4xl leading-relaxed">
|
||||
© 2026 LOLYMPUS. LOLYMPUS is not endorsed by Riot Games and does not
|
||||
reflect the views or opinions of Riot Games or anyone officially
|
||||
involved in producing or managing League of Legends. League of Legends
|
||||
@@ -101,51 +213,42 @@ function LegalPage({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<main className="max-w-3xl mx-auto px-4 sm:px-6 py-12">
|
||||
<Link
|
||||
to="/"
|
||||
className="inline-flex text-xs text-base-content/40 hover:text-base-content mb-5"
|
||||
>
|
||||
← 홈으로
|
||||
</Link>
|
||||
<h1 className="text-2xl font-black text-base-content">{title}</h1>
|
||||
<div className="mt-6 space-y-4 text-sm leading-7 text-base-content/60">
|
||||
<PlainPage width="md" className="py-12">
|
||||
<h1 className="text-2xl font-extrabold text-content">{title}</h1>
|
||||
<div className="lts-panel mt-6 space-y-4 p-6 text-sm leading-7 text-content-muted">
|
||||
{children}
|
||||
</div>
|
||||
</main>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
|
||||
function NotFoundPage() {
|
||||
return (
|
||||
<PlainPage width="md" className="py-24 text-center">
|
||||
<p className="tabular text-5xl font-extrabold text-content-disabled">
|
||||
404
|
||||
</p>
|
||||
<h1 className="mt-4 text-xl font-bold text-content">
|
||||
페이지를 찾을 수 없습니다
|
||||
</h1>
|
||||
<p className="mt-2 text-sm text-content-muted">
|
||||
주소가 바뀌었거나 삭제된 내전일 수 있습니다.
|
||||
</p>
|
||||
<Link
|
||||
to="/"
|
||||
className="mt-6 inline-flex h-10 items-center rounded-field bg-primary px-5 text-sm font-bold text-primary-content"
|
||||
>
|
||||
내전 목록으로
|
||||
</Link>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
|
||||
function App() {
|
||||
const communityQuery = useCommunity(DEFAULT_COMMUNITY_ID);
|
||||
const communityLabel = communityQuery.data?.name ?? "LOLYMPUS";
|
||||
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<div className="min-h-screen bg-base-100 flex flex-col">
|
||||
<nav className="bg-base-100 border-b border-base-content/10 sticky top-0 z-50">
|
||||
<div className="max-w-5xl mx-auto px-4 sm:px-6 flex items-center justify-between h-12">
|
||||
<Link
|
||||
className="text-base font-bold tracking-tight text-base-content"
|
||||
to="/"
|
||||
>
|
||||
{communityLabel}
|
||||
</Link>
|
||||
<div className="flex items-center gap-3">
|
||||
{/* {DEFAULT_COMMUNITY_ID ? (
|
||||
<span className="text-xs uppercase tracking-wider text-base-content/25">
|
||||
API Live
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-xs uppercase tracking-wider text-amber-500/70">
|
||||
Set `VITE_DEFAULT_COMMUNITY_ID`
|
||||
</span>
|
||||
)} */}
|
||||
<ThemeToggle />
|
||||
{isMsalConfigured && <MsalHeaderActions />}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div className="flex min-h-screen flex-col bg-body">
|
||||
<AppHeader />
|
||||
|
||||
<div className="flex-1">
|
||||
<Routes>
|
||||
@@ -226,6 +329,7 @@ function App() {
|
||||
</LegalPage>
|
||||
}
|
||||
/>
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Routes>
|
||||
</div>
|
||||
<AppFooter />
|
||||
|
||||
Reference in new issue
Block a user