From c541cc09b40e606b002af4bb6215b187c95c0556 Mon Sep 17 00:00:00 2001 From: pavel444-byte Date: Thu, 15 Oct 2026 17:30:10 +0500 Subject: [PATCH] Add public profiles and cosmetic shop --- app/cosmetics/page.tsx | 43 ++ app/dashboard/page.tsx | 8 + app/layout.tsx | 1 + app/players/[id]/page.tsx | 76 ++++ app/profile-cosmetics.css | 409 ++++++++++++++++++ app/settings/page.tsx | 1 + components/AccountSettings.tsx | 36 +- components/CosmeticsShop.tsx | 152 +++++++ components/Leaderboard.tsx | 16 +- components/MultiplayerGame.tsx | 1 + components/MultiplayerRoom.tsx | 2 + components/PixelArt.tsx | 66 +-- lib/account-api.ts | 5 +- lib/api.ts | 3 + lib/catalog.ts | 4 +- lib/cosmetics-api.ts | 52 +++ lib/leaderboard.ts | 2 +- lib/multiplayer-appearance.ts | 2 +- lib/profile-cosmetics.ts | 15 + lib/profile.ts | 2 +- lib/public-profile.ts | 41 ++ shared/account.ts | 15 +- shared/database.ts | 18 + shared/locales/ru.json | 49 +++ shared/profile-appearance.ts | 3 +- shared/profile-cosmetic-ids.ts | 8 + shared/profile-cosmetics.ts | 41 ++ ...5121852_profile_cosmetics_and_currency.sql | 333 ++++++++++++++ 28 files changed, 1359 insertions(+), 45 deletions(-) create mode 100644 app/cosmetics/page.tsx create mode 100644 app/players/[id]/page.tsx create mode 100644 app/profile-cosmetics.css create mode 100644 components/CosmeticsShop.tsx create mode 100644 lib/cosmetics-api.ts create mode 100644 lib/profile-cosmetics.ts create mode 100644 lib/public-profile.ts create mode 100644 shared/profile-cosmetic-ids.ts create mode 100644 shared/profile-cosmetics.ts create mode 100644 supabase/migrations/20261015121852_profile_cosmetics_and_currency.sql diff --git a/app/cosmetics/page.tsx b/app/cosmetics/page.tsx new file mode 100644 index 0000000..5839856 --- /dev/null +++ b/app/cosmetics/page.tsx @@ -0,0 +1,43 @@ +import Link from "next/link"; +import { redirect } from "next/navigation"; +import { ArrowLeft } from "lucide-react"; +import { CosmeticsShop } from "@/components/CosmeticsShop"; +import { Footer, Header } from "@/components/Shell"; +import { getI18n } from "@/lib/i18n"; +import { accountProfile } from "@/lib/profile"; +import { profileCosmeticsState } from "@/lib/profile-cosmetics"; +import { user } from "@/lib/supabase"; + +export const dynamic = "force-dynamic"; + +export async function generateMetadata() { + const { t } = await getI18n(); + return { title: t("Profile cosmetics") }; +} + +export default async function CosmeticsPage() { + const account = await user(); + if (!account) redirect("/log-in?next=%2Fcosmetics"); + const [profile, shop] = await Promise.all([ + accountProfile(account), + profileCosmeticsState(account.id), + ]); + const { t } = await getI18n(); + + return ( + <> +
+
+ +
+