From 9dcc420643eabc81f90c91b3b19f474820f4e375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Tue, 15 Sep 2026 17:39:26 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8F=86=20pixel-art=20profile=20wi?= =?UTF-8?q?th=20badge=20ladders=20-=20profile=20hero=20gets=20a=20pixel-gr?= =?UTF-8?q?id=20brand=20cover=20with=20the=20avatar=20overlapping=20it=20-?= =?UTF-8?q?=20stat=20tiles=20carry=20pixelarticons=20(MIT)=20glyphs=20and?= =?UTF-8?q?=20follow=20the=20owner's=20role:=20=20=20focus/homework/exams?= =?UTF-8?q?=20for=20students,=20lessons/marks/answers=20for=20staff=20-=20?= =?UTF-8?q?badges=20regroup=20into=20one=20ladder=20card=20per=20counter?= =?UTF-8?q?=20with=20bronze/silver/gold=20=20=20rungs,=20a=20level=20title?= =?UTF-8?q?=20from=20the=20earned=20share,=20and=20a=20"next=20badge"=20st?= =?UTF-8?q?rip;=20=20=20folded=20to=20one=20row,=20"show=20all"=20expands?= =?UTF-8?q?=20the=20rest=20-=20account=20menu=20gains=20an=20explicit=20"P?= =?UTF-8?q?rofilim"=20entry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bun.lock | 13 +- package.json | 1 + src/components/layout/sidebar-account.tsx | 8 +- src/components/ui/icons.tsx | 5 + src/components/ui/pixel-icon.tsx | 55 +++ src/components/users/badge-grid.tsx | 417 +++++++++++++--------- src/i18n/messages.ts | 81 +++++ src/index.css | 10 + src/lib/badges.ts | 42 +++ src/pages/profile-page.tsx | 74 ++-- 10 files changed, 512 insertions(+), 194 deletions(-) create mode 100644 src/components/ui/pixel-icon.tsx diff --git a/bun.lock b/bun.lock index 31ab881..e53d1e8 100644 --- a/bun.lock +++ b/bun.lock @@ -12,6 +12,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "pdfjs-dist": "^6.1.200", + "pixelarticons": "^2.4.1", "solid-js": "^1.9.14", "tailwind-merge": "^3.6.0", }, @@ -356,7 +357,7 @@ "@tanstack/history": ["@tanstack/history@1.162.0", "", {}, "sha512-79pf/RkhteYZTRgcR4F9kbk84P2N8rugQJswxfIqovlbRiT3yI7eBE+5QorIrZaOKktsgzRlXh1l/du/xpl4iA=="], - "@tanstack/router-core": ["@tanstack/router-core@1.171.14", "", { "dependencies": { "@tanstack/history": "1.162.0", "cookie-es": "^3.0.0", "seroval": "^1.5.4", "seroval-plugins": "^1.5.4" } }, "sha512-Mo3hwx0qB0cJsVYGDjG0+Ouf7VV74h/vsoDMGztdlyzDanp4gBA2s7IVvm6hFrmQM6GpD9F0Z7SqD7OldfLE7g=="], + "@tanstack/router-core": ["@tanstack/router-core@1.171.15", "", { "dependencies": { "@tanstack/history": "1.162.0", "cookie-es": "^3.0.0", "seroval": "^1.5.4", "seroval-plugins": "^1.5.4" } }, "sha512-IILCDcLaItMZQ2jEmCABHY1Nhjjn5XUvwpQp3e4Nmu+vfg0BgYFuu/QASz2SwE2ZNbVMrvt8X/wxa+Gg5aErxA=="], "@tanstack/router-devtools-core": ["@tanstack/router-devtools-core@1.168.0", "", { "dependencies": { "clsx": "^2.1.1", "goober": "^2.1.16" }, "peerDependencies": { "@tanstack/router-core": "^1.170.0", "csstype": "^3.0.10" } }, "sha512-wQoQhlBK7nlZgqzaqdYXKWNTpdHdsaREdaPhFZVH0/Ador+F+eM3/NF2i3f2LPeS0GgKraZUQXe1Q/1+KHyEYg=="], @@ -528,7 +529,7 @@ "isbot": ["isbot@5.2.0", "", {}, "sha512-gbZiGCb4B5xaoxg9mS7koAyRdvJnArk10VLSHOgz6rtBG93/pi1xOFaVvXMKZ7JXgyZ8zAbNRK5uIBdIUTFSqw=="], - "jiti": ["jiti@1.21.7", "", { "bin": "bin/jiti.js" }, "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A=="], + "jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], @@ -590,6 +591,8 @@ "picomatch": ["picomatch@4.0.5", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="], + "pixelarticons": ["pixelarticons@2.4.1", "", { "peerDependencies": { "react": ">=16" }, "bin": { "pixelarticons": "bin/upgrade.js" } }, "sha512-NIiwuEmBrFT6YG5PdMnOPRsGm0rbz4TiH0P5sgftjrQugxgdF+xtZPgGrgAOL76KUMJ04kk5Bq2lVLnmBg7IPw=="], + "playwright": ["playwright@1.62.1", "", { "dependencies": { "playwright-core": "1.62.1" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-0M+L3LAD8/nm554LOla9Ayx0j0tmFZ0FBcoQ7F1VuVHpM/XpiC8RcDzBQB8W5+hA8L22THxELzeF+2WcUzvcLg=="], "playwright-core": ["playwright-core@1.62.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-wPYSwEBJY9GHraISXqyqtx0na0LpO3XEX7jNDhntbex7tzUS7kLnZsOlFruFJB4Hi/rhDMjXGqHewDZ68nYZVw=="], @@ -602,6 +605,8 @@ "pure-rand": ["pure-rand@8.4.2", "", {}, "sha512-vvuOGgcuPJAirlHvuQw1TrOiw7ptaIXXmIbNuiNOY6lNGJJH49PQ1Kj4nd783nPdQhQdicgOjVI2yI/9BD6/Ng=="], + "react": ["react@19.3.0", "", {}, "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog=="], + "react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="], "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], @@ -696,8 +701,6 @@ "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - "@tailwindcss/node/jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], - "@tailwindcss/node/lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="], "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" }, "bundled": true }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], @@ -712,8 +715,6 @@ "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@tanstack/solid-router/@tanstack/router-core": ["@tanstack/router-core@1.171.15", "", { "dependencies": { "@tanstack/history": "1.162.0", "cookie-es": "^3.0.0", "seroval": "^1.5.4", "seroval-plugins": "^1.5.4" } }, "sha512-IILCDcLaItMZQ2jEmCABHY1Nhjjn5XUvwpQp3e4Nmu+vfg0BgYFuu/QASz2SwE2ZNbVMrvt8X/wxa+Gg5aErxA=="], - "babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/helper-module-imports@7.18.6", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="], "babel-plugin-jsx-dom-expressions/parse5": ["parse5@7.3.0", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="], diff --git a/package.json b/package.json index fe3c338..f19f901 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "pdfjs-dist": "^6.1.200", + "pixelarticons": "^2.4.1", "solid-js": "^1.9.14", "tailwind-merge": "^3.6.0" }, diff --git a/src/components/layout/sidebar-account.tsx b/src/components/layout/sidebar-account.tsx index 408cf6e..354c3e4 100644 --- a/src/components/layout/sidebar-account.tsx +++ b/src/components/layout/sidebar-account.tsx @@ -12,7 +12,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { IconChevronRight, IconGlobe, IconGuide, IconLogout, IconSettings } from "@/components/ui/icons"; +import { IconChevronRight, IconGlobe, IconGuide, IconLogout, IconSettings, IconUserCircle } from "@/components/ui/icons"; import { ThemeModeControl } from "@/components/layout/theme-mode-control"; import { UserAvatar } from "@/components/users/user-avatar"; import { useAuth } from "@/stores/auth-context"; @@ -86,11 +86,15 @@ export function SidebarAccount(props: { collapsed?: boolean; onLogout: () => voi {name()} - {t("profile.myProfile")} + @{u().username}
+ void navigate({ to: "/profile/me" })}> + + {t("profile.myProfile")} + setProfileOpen(true)}> {t("nav.settings")} diff --git a/src/components/ui/icons.tsx b/src/components/ui/icons.tsx index 5648a7f..c864a97 100644 --- a/src/components/ui/icons.tsx +++ b/src/components/ui/icons.tsx @@ -24,6 +24,7 @@ import eyeUrl from "@phosphor-icons/core/regular/eye.svg?url"; import fileTextUrl from "@phosphor-icons/core/regular/file-text.svg?url"; import funnelUrl from "@phosphor-icons/core/regular/funnel.svg?url"; import gearUrl from "@phosphor-icons/core/regular/gear.svg?url"; +import userCircleUrl from "@phosphor-icons/core/regular/user-circle.svg?url"; import graduationCapUrl from "@phosphor-icons/core/regular/graduation-cap.svg?url"; import houseUrl from "@phosphor-icons/core/regular/house.svg?url"; import listUrl from "@phosphor-icons/core/regular/list.svg?url"; @@ -511,6 +512,10 @@ export function IconReportAnalytics(props: IconProps) { return ; } +export function IconUserCircle(props: IconProps) { + return ; +} + export function IconSettings(props: IconProps) { return ; } diff --git a/src/components/ui/pixel-icon.tsx b/src/components/ui/pixel-icon.tsx new file mode 100644 index 0000000..a726543 --- /dev/null +++ b/src/components/ui/pixel-icon.tsx @@ -0,0 +1,55 @@ +import chevronDown from "pixelarticons/svg/chevron-down.svg?raw"; +import chevronUp from "pixelarticons/svg/chevron-up.svg?raw"; +import checkDouble from "pixelarticons/svg/check-double.svg?raw"; +import checkboxOn from "pixelarticons/svg/checkbox-on.svg?raw"; +import bookOpen from "pixelarticons/svg/book-open.svg?raw"; +import calendarWeeks from "pixelarticons/svg/calendar-weeks.svg?raw"; +import crown from "pixelarticons/svg/crown.svg?raw"; +import fire from "pixelarticons/svg/fire.svg?raw"; +import hourglass from "pixelarticons/svg/hourglass.svg?raw"; +import lock from "pixelarticons/svg/lock.svg?raw"; +import messageText from "pixelarticons/svg/message-text.svg?raw"; +import notes from "pixelarticons/svg/notes.svg?raw"; +import penSquare from "pixelarticons/svg/pen-square.svg?raw"; +import pencil from "pixelarticons/svg/pencil.svg?raw"; +import sparkles from "pixelarticons/svg/sparkles.svg?raw"; +import star from "pixelarticons/svg/star.svg?raw"; +import trophy from "pixelarticons/svg/trophy.svg?raw"; +import users from "pixelarticons/svg/users.svg?raw"; +import zap from "pixelarticons/svg/zap.svg?raw"; +import { cn } from "@/lib/cn"; + +// Pixel-art glyphs from pixelarticons (MIT, https://pixelarticons.com). Only +// the handful the profile uses are imported, so the rest never reach a bundle. +const ICONS = { + "book-open": bookOpen, + "calendar-weeks": calendarWeeks, + "check-double": checkDouble, + "chevron-down": chevronDown, + "chevron-up": chevronUp, + "checkbox-on": checkboxOn, + crown, + fire, + hourglass, + lock, + "message-text": messageText, + notes, + "pen-square": penSquare, + pencil, + sparkles, + star, + trophy, + users, + zap, +} as const; + +export type PixelIconName = keyof typeof ICONS; + +const sized = (svg: string) => + svg + .replace(/\s(?:width|height)="[^"]*"/g, "") + .replace("