diff --git a/chess-frontend/actions/friend.ts b/chess-frontend/actions/friend.ts new file mode 100644 index 0000000000000000000000000000000000000000..02a4b5ebdef95c0cfa46f2c3fc4998141f7ff339 --- /dev/null +++ b/chess-frontend/actions/friend.ts @@ -0,0 +1,20 @@ +"use server"; + +import { safeFetch } from "@/lib/constants/safe-fetch"; +import { GetFriend, SearchFriend } from "@/types/friends"; + +export async function getFriends(): Promise { + const friends = await safeFetch("/friends?limit=50"); + + if (!friends?.length) return null; + + return friends; +} + +export async function searchUsers(query: string) { + const result = await safeFetch(`/friends/search?q=${query}`); + + if (!result?.length) return null; + + return result; +} diff --git a/chess-frontend/app/(protected)/community/_components/blocked-tab.tsx b/chess-frontend/app/(protected)/community/_components/blocked-tab.tsx new file mode 100644 index 0000000000000000000000000000000000000000..7e3976bcd517477e2554355fb342f73e7c976be2 --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/blocked-tab.tsx @@ -0,0 +1,48 @@ +import { Slash } from "lucide-react"; +import { STUB_BLOCKED } from "./community-types"; +import { PlayerCard } from "./community-shared"; + +export function BlockedTab() { + return ( +
+ {STUB_BLOCKED.length === 0 ? ( + // +
+ ) : ( + <> +

+ {STUB_BLOCKED.length} block +

+
+ {STUB_BLOCKED.map((b) => ( + + Unblock + + } + /> + ))} +
+ + )} +
+ ); +} diff --git a/chess-frontend/app/(protected)/community/_components/community-client.tsx b/chess-frontend/app/(protected)/community/_components/community-client.tsx new file mode 100644 index 0000000000000000000000000000000000000000..2eb9d594c6e1d93dc9d235e0d537313cff1ab354 --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/community-client.tsx @@ -0,0 +1,129 @@ +"use client"; + +import { Users, Search, Bell, UserX } from "lucide-react"; +import { motion } from "framer-motion"; + +import { STUB_FRIENDS, STUB_REQUESTS, STUB_BLOCKED } from "./community-types"; +import { FriendsTab } from "./friends-tab"; +import { FindPlayersTab } from "./find-players-tab"; +import { RequestsTab } from "./requests-tab"; +import { BlockedTab } from "./blocked-tab"; +import { cn } from "@/lib/utils"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; + +const TABS = [ + { + id: "friends", + label: "Friends", + icon: Users, + badge: STUB_FRIENDS.length, + content: FriendsTab, + }, + { + id: "find", + label: "Find Players", + icon: Search, + badge: null, + content: FindPlayersTab, + }, + { + id: "requests", + label: "Requests", + icon: Bell, + badge: STUB_REQUESTS.length, + content: RequestsTab, + }, + { + id: "blocked", + label: "Blocked", + icon: UserX, + badge: STUB_BLOCKED.length > 0 ? STUB_BLOCKED.length : null, + content: BlockedTab, + }, +] as const; + +export function CommunityNav({ active }: { active: string }) { + const router = useRouter(); + const pathname = usePathname(); + const searchParams = useSearchParams(); + + const handleTabChange = (id: string) => { + const params = new URLSearchParams(searchParams); + params.set("tab", id); + router.replace(`${pathname}?${params.toString()}`); + }; + return ( + <> +
+

+ Community +

+

+ Manage your connections, discover players, handle requests. +

+
+
+ {TABS.map(({ id, label, icon: Icon, badge }) => { + const isActive = active === id; + return ( + + ); + })} +
+ + ); +} diff --git a/chess-frontend/app/(protected)/community/_components/community-shared.tsx b/chess-frontend/app/(protected)/community/_components/community-shared.tsx new file mode 100644 index 0000000000000000000000000000000000000000..3accbdccaf7b6523b5aa58ae1ec9d29e5297f942 --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/community-shared.tsx @@ -0,0 +1,277 @@ +import { Check, Search, Swords, Trophy, UserPlus, UserX } from "lucide-react"; +import { getInitials } from "@/lib/constants/get-initials"; +import { GetFriend, SearchFriend } from "@/types/friends"; + +export function getAvatarHue(name: string) { + return [...name].reduce((a, c) => a + c.charCodeAt(0), 0) % 360; +} + +export function winRate(w: number, l: number, d: number) { + const t = w + l + d; + return t === 0 ? 0 : Math.round((w / t) * 100); +} + +export function Avatar({ + player, + size = 40, +}: { + player: { + name: string; + image: string | null; + }; + size?: number; +}) { + const hue = getAvatarHue(player.name); + return ( +
+
+ {player.image ? ( + {player.name} + ) : ( + getInitials(player.name) + )} +
+ {/* {player.online !== undefined && ( + + )} */} +
+ ); +} + +export function StatBar({ + wins, + losses, + draws, +}: { + wins: number; + losses: number; + draws: number; +}) { + const t = wins + losses + draws || 1; + return ( +
+
+
+
+
+ ); +} + +export function FriendCard({ + player, + actions, +}: { + player: GetFriend; + actions: React.ReactNode; +}) { + return ( +
+ + +
+
+ + {player.name} + + + @{player.username} + +
+
+
+ + + {player.rating} + +
+ · + + {winRate(player.wins, player.losses, player.draws)}% WR + +
+ +
+ +
{actions}
+
+ ); +} +export function PlayerCard({ player }: { player: SearchFriend }) { + return ( +
+ + +
+
+ + {player.name} + + + @{player.username} + +
+
+
+ + + {player.rating} + +
+ · +
+
+ +
+ + + +
+
+ ); +} + +export function IconBtn({ + icon: Icon, + label, + variant = "default", +}: { + icon: React.ElementType; + label: string; + onClick?: () => void; + variant?: "default" | "green" | "red" | "amber"; +}) { + const colors = { + default: { + bg: "rgba(255,255,255,0.07)", + hover: "rgba(255,255,255,0.13)", + color: "#a1a1aa", + }, + green: { + bg: "rgba(34,197,94,0.12)", + hover: "rgba(34,197,94,0.22)", + color: "#4ade80", + }, + red: { + bg: "rgba(239,68,68,0.1)", + hover: "rgba(239,68,68,0.2)", + color: "#f87171", + }, + amber: { + bg: "rgba(234,179,8,0.1)", + hover: "rgba(234,179,8,0.2)", + color: "#fbbf24", + }, + }[variant]; + + return ( + + ); +} + +export function EmptyState({ + icon: Icon, + title, + sub, +}: { + icon: React.ElementType; + title: string; + sub: string; +}) { + return ( +
+
+ +
+

+ {title} +

+

{sub}

+
+ ); +} diff --git a/chess-frontend/app/(protected)/community/_components/community-types.ts b/chess-frontend/app/(protected)/community/_components/community-types.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8fade581756420efc95b5303fdc6aeabb8eba75 --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/community-types.ts @@ -0,0 +1,87 @@ +import { GetFriend } from "@/types/friends"; + +export const STUB_FRIENDS: GetFriend[] = [ + { + id: "1", + name: "Arjun Mehta", + username: "arjunm99", + rating: 1420, + wins: 88, + losses: 44, + draws: 12, + image: null, + createdAt: new Date(), + }, + { + id: "2", + name: "Priya Singh", + username: "priyaS", + rating: 1105, + wins: 34, + losses: 21, + draws: 5, + image: null, + createdAt: new Date(), + }, + { + id: "3", + name: "Rohit Tomar", + username: "tomarrohit3240", + rating: 979, + wins: 10, + losses: 28, + draws: 6, + image: null, + createdAt: new Date(), + }, + { + id: "4", + name: "Sneha Verma", + username: "sneha_v", + rating: 1680, + wins: 201, + losses: 77, + draws: 33, + image: null, + createdAt: new Date(), + }, +]; + +export const STUB_REQUESTS: GetFriend[] = [ + { + id: "5", + name: "Karan Nair", + username: "knair_chess", + rating: 1250, + wins: 55, + losses: 40, + draws: 8, + image: null, + createdAt: new Date(), + }, + { + id: "6", + name: "Divya Patel", + username: "div_patel", + rating: 870, + wins: 12, + losses: 18, + draws: 2, + image: null, + createdAt: new Date(), + }, +]; + +export const STUB_BLOCKED: GetFriend[] = [ + { + id: "7", + name: "Toxic GM", + username: "toxicgm123", + rating: 2100, + wins: 500, + losses: 10, + draws: 5, + image: null, + createdAt: new Date(), + }, +]; diff --git a/chess-frontend/app/(protected)/community/_components/find-players-tab.tsx b/chess-frontend/app/(protected)/community/_components/find-players-tab.tsx new file mode 100644 index 0000000000000000000000000000000000000000..ac59a165e6c380da988d4ee22b7009e8e30bb61f --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/find-players-tab.tsx @@ -0,0 +1,31 @@ +import { EmptyState, PlayerCard } from "./community-shared"; +import { searchUsers } from "@/actions/friend"; +import { SearchUsersForm } from "./search-users-form"; +import { Search } from "lucide-react"; + +export async function FindPlayersTab({ query }: { query: string }) { + const results = query ? await searchUsers(query) : null; + + return ( +
+ + {!query ? ( +
+ Type a name or username to search all players. +
+ ) : !results ? ( + + ) : ( +
+ {results.map((p) => ( + + ))} +
+ )} +
+ ); +} diff --git a/chess-frontend/app/(protected)/community/_components/friends-tab.tsx b/chess-frontend/app/(protected)/community/_components/friends-tab.tsx new file mode 100644 index 0000000000000000000000000000000000000000..bccdcbf8aff7bb65368e472fd10b836fc12858b0 --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/friends-tab.tsx @@ -0,0 +1,47 @@ +import { Swords, MessageSquare, UserMinus, Users } from "lucide-react"; +import { + PlayerCard, + IconBtn, + EmptyState, + FriendCard, +} from "./community-shared"; +import { getFriends } from "@/actions/friend"; +import { SearchUsersForm } from "./search-users-form"; + +export async function FriendsTab({ query }: { query: string }) { + const friends = await getFriends(); + + return ( +
+ + {!friends ? ( + + ) : ( +
+ {friends.map((f) => ( + + + + removeFriend(f.id)} + /> + + } + /> + ))} +
+ )} +
+ ); +} diff --git a/chess-frontend/app/(protected)/community/_components/requests-tab.tsx b/chess-frontend/app/(protected)/community/_components/requests-tab.tsx new file mode 100644 index 0000000000000000000000000000000000000000..1ae7ca1d07b276f74cf9f90b36387d47a284bc4e --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/requests-tab.tsx @@ -0,0 +1,61 @@ +"use client"; + +import * as React from "react"; +import { Bell, Check, X } from "lucide-react"; +import { STUB_REQUESTS } from "./community-types"; +import { EmptyState, PlayerCard, IconBtn } from "./community-shared"; + +export function RequestsTab() { + const [requests, setRequests] = React.useState(STUB_REQUESTS); + + const accept = (id: string) => + setRequests((p) => p.filter((r) => r.id !== id)); + const decline = (id: string) => + setRequests((p) => p.filter((r) => r.id !== id)); + + return ( +
+ {requests.length === 0 ? ( + // +
+ ) : ( + <> +

+ {requests.length} pending +

+
+ {/* {requests.map((r) => ( + + accept(r.id)} + /> + decline(r.id)} + /> + + } + /> + ))} */} +
+ + )} +
+ ); +} diff --git a/chess-frontend/app/(protected)/community/_components/search-users-form.tsx b/chess-frontend/app/(protected)/community/_components/search-users-form.tsx new file mode 100644 index 0000000000000000000000000000000000000000..088d5295cd5b7162bbbf74b1f3bd3050e1d5ef6c --- /dev/null +++ b/chess-frontend/app/(protected)/community/_components/search-users-form.tsx @@ -0,0 +1,51 @@ +"use client"; + +import { Search } from "lucide-react"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { useState } from "react"; + +export function SearchUsersForm({ + placeholder, + query, +}: { + placeholder: string; + query: string; +}) { + const router = useRouter(); + const pathname = usePathname(); + const searchParams = useSearchParams(); + + const [text, setText] = useState(query); + + const handleSubmit = (e: React.SubmitEvent) => { + e.preventDefault(); + const params = new URLSearchParams(searchParams); + if (text) { + params.set("q", text); + } else { + params.delete("q"); + } + + router.replace(`${pathname}?${params.toString()}`, { scroll: false }); + }; + + return ( +
+ + setText(e.target.value)} + value={text} + style={{ + background: "rgba(255,255,255,0.05)", + border: "1px solid rgba(255,255,255,0.08)", + fontFamily: "'DM Sans', sans-serif", + }} + /> + + ); +} diff --git a/chess-frontend/app/(protected)/community/page.tsx b/chess-frontend/app/(protected)/community/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..10fb3370b82d6af7b66b94609b8cff0abe7b212a --- /dev/null +++ b/chess-frontend/app/(protected)/community/page.tsx @@ -0,0 +1,36 @@ +import { getFriends } from "@/actions/friend"; +import { BlockedTab } from "./_components/blocked-tab"; +import { CommunityNav } from "./_components/community-client"; +import { FindPlayersTab } from "./_components/find-players-tab"; +import { FriendsTab } from "./_components/friends-tab"; +import { RequestsTab } from "./_components/requests-tab"; + +export default async function CommunityPage({ + searchParams, +}: { + searchParams: Promise<{ tab?: string; q: string }>; +}) { + const { tab, q } = await searchParams; + const active = tab || "friends"; + const query = q || ""; + + return ( +
+
+
+ + + {active === "friends" && } + {active === "find" && } + {active === "requests" && } + {active === "blocked" && } +
+
+ ); +} diff --git a/chess-frontend/app/(protected)/game/[id]/_components/active-board.tsx b/chess-frontend/app/(protected)/game/[id]/_components/active-board.tsx index a5a7ab5e60522431f44deecf5a3dcbe5ec56eafb..4e3d745030283e56f037314762d01e1dad67721f 100644 --- a/chess-frontend/app/(protected)/game/[id]/_components/active-board.tsx +++ b/chess-frontend/app/(protected)/game/[id]/_components/active-board.tsx @@ -65,16 +65,18 @@ export function ActiveBoard({ {promotionMove && ( <>
setPromotionMove(null)} onContextMenu={(e) => { e.preventDefault(); setPromotionMove(null); }} + style={{ backgroundColor: "rgba(0, 0, 0, 0.2)" }} />
+
{lastMoveRejectedReason}
)} diff --git a/chess-frontend/app/(protected)/game/[id]/_components/game-chat.tsx b/chess-frontend/app/(protected)/game/[id]/_components/game-chat.tsx new file mode 100644 index 0000000000000000000000000000000000000000..c86851a70e72922eff9dff0125614d5793813471 --- /dev/null +++ b/chess-frontend/app/(protected)/game/[id]/_components/game-chat.tsx @@ -0,0 +1,98 @@ +"use client"; + +import { useState, useRef, useEffect } from "react"; +import { useGameStore } from "@/store/use-game-store"; +import { useSocket } from "@/store/socket-provider"; +import { cn, scrollClass } from "@/lib/utils"; + +interface GameChatProps { + gameId: string; + isPlayer: boolean; +} + +export function GameChat({ gameId, isPlayer }: GameChatProps) { + const [input, setInput] = useState(""); + const chatMessages = useGameStore((s) => s.chatMessages); + const { sendChatMessage, joinGameChat } = useSocket(); + const scrollRef = useRef(null); + + useEffect(() => { + if (scrollRef.current) { + scrollRef.current.scrollTop = scrollRef.current.scrollHeight; + } + }, [chatMessages]); + + useEffect(() => { + if (!joinGameChat) return; + joinGameChat(gameId); + }, [gameId]); + + const handleSend = (e: React.SubmitEvent) => { + e.preventDefault(); + if (!input.trim() || !isPlayer) return; + sendChatMessage(gameId, input.trim()); + setInput(""); + }; + + return ( +
+
+ {chatMessages.length === 0 ? ( +

+ No messages yet. Be the first to say hi! +

+ ) : ( + chatMessages.map((msg, idx) => { + return ( +
+ {msg.sender.image ? ( + {msg.sender.username} + ) : ( +
+ {msg.sender.username.charAt(0).toUpperCase()} +
+ )} +
+ + {msg.sender.username} + + + {msg.content} + +
+
+ ); + }) + )} +
+
+ setInput(e.target.value)} + placeholder={ + isPlayer ? "Send a message..." : "Chat is for players only" + } + disabled={!isPlayer} + className="flex-1 bg-zinc-900 border border-zinc-800 text-sm text-white px-3 py-1.5 rounded focus:outline-none focus:ring-1 focus:ring-zinc-600 transition-shadow disabled:opacity-60 disabled:cursor-not-allowed" + /> +
+
+ ); +} diff --git a/chess-frontend/app/(protected)/game/[id]/_components/game-over-overlay.tsx b/chess-frontend/app/(protected)/game/[id]/_components/game-over-overlay.tsx index 2d379f18645c460e36e320ddbfcbf1e7d3f2d33a..bdf06f1d93969933f71c20762a3bcb5eaae72c4b 100644 --- a/chess-frontend/app/(protected)/game/[id]/_components/game-over-overlay.tsx +++ b/chess-frontend/app/(protected)/game/[id]/_components/game-over-overlay.tsx @@ -35,7 +35,7 @@ export function GameOverOverlay({ let headline = "Draw"; let headlineColor = "text-zinc-400"; - if (isAbandoned) { + if (isAbandoned && !gameOver.winnerId) { headline = "Aborted"; headlineColor = "text-zinc-500"; } else if (winnerColor) { @@ -48,8 +48,12 @@ export function GameOverOverlay({ : isDraw ? "Game drawn" : `${winnerColor} won`; - if (gameOver.reason && !isAbandoned) + + if (gameOver.reason && !isAbandoned) { subtitle += ` by ${gameOver.reason.toLowerCase()}`; + } else if (isAbandoned && winnerColor) { + subtitle = `${winnerColor} won (abandoned)`; + } return (
diff --git a/chess-frontend/app/(protected)/game/[id]/_components/game-sidebar.tsx b/chess-frontend/app/(protected)/game/[id]/_components/game-sidebar.tsx index 5cabd1ea5bc0411750d83bfc47e55a51a0615779..3612e033e59d11e7d62cb64c898c55537f0936d9 100644 --- a/chess-frontend/app/(protected)/game/[id]/_components/game-sidebar.tsx +++ b/chess-frontend/app/(protected)/game/[id]/_components/game-sidebar.tsx @@ -8,6 +8,7 @@ import { IncomingDrawOffer } from "./incoming-draw-offer"; import { ActiveGameControls } from "./active-game-controls"; import { RematchControls } from "./rematch-controls"; import { FlipButton } from "./flip-button"; +import { GameChat } from "./game-chat"; interface GameSidebarProps { activeGame: ActiveGame; @@ -61,6 +62,8 @@ export function GameSidebar({
)}
+ +
); } diff --git a/chess-frontend/app/(protected)/game/[id]/_components/move-list.tsx b/chess-frontend/app/(protected)/game/[id]/_components/move-list.tsx index 0366e445decf2da29452397e92dfc7a189804076..6936d4c173541b3a44aa3aa5319220e2a4255df1 100644 --- a/chess-frontend/app/(protected)/game/[id]/_components/move-list.tsx +++ b/chess-frontend/app/(protected)/game/[id]/_components/move-list.tsx @@ -31,8 +31,8 @@ interface MoveButtonProps { function SanText({ san, color }: { san: string; color: "w" | "b" }) { const pieceIcons = { - w: { K: "♔", Q: "♕", R: "♖", B: "♗", N: "♘" }, - b: { K: "♚", Q: "♛", R: "♜", B: "♝", N: "♞" }, + w: { K: "♚", Q: "♛", R: "♜", B: "♝", N: "♞" }, + b: { K: "♔", Q: "♕", R: "♖", B: "♗", N: "♘" }, }; const pieceMatch = san.match(/^([KQRBN])(.*)$/); @@ -168,7 +168,6 @@ export function MoveList({ }: MoveListProps) { const scrollContainerRef = useRef(null); const pairs = parsePgnWithTimes(pgn, timeControl); - console.log({ pairs }); useEffect(() => { if (!scrollContainerRef.current) return; diff --git a/chess-frontend/app/(protected)/game/[id]/_components/player-card.tsx b/chess-frontend/app/(protected)/game/[id]/_components/player-card.tsx index 3bd1e8516a6175137a4ca8097401a65372536407..17a2f52f70c82bb87475b5cbb0688c0cd1f07f77 100644 --- a/chess-frontend/app/(protected)/game/[id]/_components/player-card.tsx +++ b/chess-frontend/app/(protected)/game/[id]/_components/player-card.tsx @@ -4,6 +4,7 @@ import { GameStateUser, PLAYER_COLOR } from "@/types/chess"; import { Clock } from "./clock"; import { cn } from "@/lib/utils"; import Link from "next/link"; +import { getInitials } from "@/lib/constants/get-initials"; interface PlayerCardProps { player: GameStateUser; @@ -44,7 +45,7 @@ export function PlayerCard({ isWhite ? "bg-zinc-800 text-zinc-400" : "bg-zinc-800 text-zinc-400", )} > - {player.username.charAt(0).toUpperCase()} + {getInitials(player.username)}
)} diff --git a/chess-frontend/app/(protected)/history/_components/game-history-with-board.tsx b/chess-frontend/app/(protected)/history/_components/game-history-with-board.tsx index 05a1d1b2aa884698211cbfdc6560215d86a7edd6..8b299226ed8a2048b36baa077039f82f6cbc1e9d 100644 --- a/chess-frontend/app/(protected)/history/_components/game-history-with-board.tsx +++ b/chess-frontend/app/(protected)/history/_components/game-history-with-board.tsx @@ -4,28 +4,7 @@ import { GameboardSnapshot } from "./gameboard-snapshot"; import { redirect } from "next/dist/client/components/navigation"; import { getUserFromSession } from "@/actions/session"; import { cn, scrollClass } from "@/lib/utils"; - -export type Player = { - id: string; - username: string; - currentRating: number; - matchRating: number; - diff: number; -}; - -export type GameRecord = { - id: string; - status: GameStatus; - timeControl: string; - createdAt: string; - winnerId: string | null; - result: string; - finalFen: string; - pgn: string; - moveTimes: number[]; - white: Player; - black: Player; -}; +import { GameRecord } from "@/types/history"; const PIECE_VALUES: Record = { p: 1, n: 3, b: 3, r: 5, q: 9 }; const PIECE_GLYPHS: Record = { diff --git a/chess-frontend/app/(protected)/history/page.tsx b/chess-frontend/app/(protected)/history/page.tsx index 718c2fedd9acd666a3ffc329ae44be812bd435b1..cb1b177bb8520ca19a0744a93ae80938686455d3 100644 --- a/chess-frontend/app/(protected)/history/page.tsx +++ b/chess-frontend/app/(protected)/history/page.tsx @@ -1,10 +1,29 @@ import { api } from "@/lib/clients/server"; import { GameBoardWithHistory } from "./_components/game-history-with-board"; +import { ApiResponse } from "@/types"; +import { GameRecord } from "@/types/history"; + +async function getHistory() { + try { + const res = await api("/games/history?limit=50"); + + if (!res.ok) return null; + + const { data }: ApiResponse = await res.json(); + + if (!data?.length) return null; + + return data; + } catch (error) { + console.error("Fetch failed:", error); + return null; + } +} const HistoryPage = async () => { - const res = await api("/games/history?limit=50"); - const json = await res.json(); - const games = json.success ? json.data : null; + const games = await getHistory(); + if (!games) return null; + return ; }; diff --git a/chess-frontend/app/globals.css b/chess-frontend/app/globals.css index 27c5e42932bb7285837db077cfacb2eb5bbefd03..3273f8f7f720a81aba79ecb57277fc33db810de8 100644 --- a/chess-frontend/app/globals.css +++ b/chess-frontend/app/globals.css @@ -7,7 +7,7 @@ @theme inline { --color-background: var(--background); --color-foreground: var(--foreground); - --font-sans: var(--font-geist-sans); + --font-sans: var(--font-sans); --font-mono: var(--font-mono); --color-sidebar-ring: var(--sidebar-ring); --color-sidebar-border: var(--sidebar-border); @@ -45,11 +45,10 @@ --radius-2xl: calc(var(--radius) * 1.8); --radius-3xl: calc(var(--radius) * 2.2); --radius-4xl: calc(var(--radius) * 2.6); + --font-heading: var(--font-sans); } :root { - --background: oklch(1 0 0); - --foreground: oklch(0.145 0 0); --card: oklch(1 0 0); --card-foreground: oklch(0.145 0 0); --popover: oklch(1 0 0); @@ -66,11 +65,11 @@ --border: oklch(0.922 0 0); --input: oklch(0.922 0 0); --ring: oklch(0.708 0 0); - --chart-1: oklch(0.809 0.105 251.813); - --chart-2: oklch(0.623 0.214 259.815); - --chart-3: oklch(0.546 0.245 262.881); - --chart-4: oklch(0.488 0.243 264.376); - --chart-5: oklch(0.424 0.199 265.638); + --chart-1: oklch(0.87 0 0); + --chart-2: oklch(0.556 0 0); + --chart-3: oklch(0.439 0 0); + --chart-4: oklch(0.371 0 0); + --chart-5: oklch(0.269 0 0); --radius: 0.625rem; --sidebar: oklch(0.985 0 0); --sidebar-foreground: oklch(0.145 0 0); @@ -80,6 +79,8 @@ --sidebar-accent-foreground: oklch(0.205 0 0); --sidebar-border: oklch(0.922 0 0); --sidebar-ring: oklch(0.708 0 0); + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); } .dark { @@ -101,11 +102,11 @@ --border: oklch(1 0 0 / 10%); --input: oklch(1 0 0 / 15%); --ring: oklch(0.556 0 0); - --chart-1: oklch(0.809 0.105 251.813); - --chart-2: oklch(0.623 0.214 259.815); - --chart-3: oklch(0.546 0.245 262.881); - --chart-4: oklch(0.488 0.243 264.376); - --chart-5: oklch(0.424 0.199 265.638); + --chart-1: oklch(0.87 0 0); + --chart-2: oklch(0.556 0 0); + --chart-3: oklch(0.439 0 0); + --chart-4: oklch(0.371 0 0); + --chart-5: oklch(0.269 0 0); --sidebar: oklch(0.205 0 0); --sidebar-foreground: oklch(0.985 0 0); --sidebar-primary: oklch(0.488 0.243 264.376); @@ -124,6 +125,6 @@ @apply bg-background text-foreground; } html { - @apply font-mono; + @apply font-sans; } -} +} \ No newline at end of file diff --git a/chess-frontend/app/layout.tsx b/chess-frontend/app/layout.tsx index 0b8ff99c0b2d4ec1cb2967c8bacc612227849e1e..3e9b720fd4e363641d6814ed35b4dd022aef376e 100644 --- a/chess-frontend/app/layout.tsx +++ b/chess-frontend/app/layout.tsx @@ -1,12 +1,12 @@ import type { Metadata } from "next"; -import { Raleway } from "next/font/google"; +import { Raleway, Geist } from "next/font/google"; import { cn, scrollClass } from "@/lib/utils"; import "./globals.css"; import { Toaster } from "@/components/ui/sonner"; import Navbar from "@/components/navbar/navbar"; -const raleway = Raleway({ subsets: ["latin"], variable: "--font-sans" }); +const geist = Geist({subsets:['latin'],variable:'--font-sans'}); export const metadata: Metadata = { title: "Chess", @@ -19,11 +19,11 @@ export default async function RootLayout({ children: React.ReactNode; }) { return ( - + diff --git a/chess-frontend/bun.lock b/chess-frontend/bun.lock index 74ddb95328742cf2742de98a2ce8eee9ab57ca82..4f5f726e475c1081dbb38135a4a489e6ab1a2f19 100644 --- a/chess-frontend/bun.lock +++ b/chess-frontend/bun.lock @@ -9,14 +9,16 @@ "chess.js": "^1.4.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", - "lucide-react": "^0.577.0", + "cmdk": "^1.1.1", + "framer-motion": "^12.38.0", + "lucide-react": "^1.7.0", "next": "16.1.6", "next-themes": "^0.4.6", "radix-ui": "^1.4.3", "react": "19.2.3", "react-chessboard": "^5.10.0", "react-dom": "19.2.3", - "shadcn": "^4.0.5", + "shadcn": "^4.1.2", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tw-animate-css": "^1.4.0", @@ -38,8 +40,6 @@ "packages": { "@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="], - "@antfu/ni": ["@antfu/ni@25.0.0", "", { "dependencies": { "ansis": "^4.0.0", "fzf": "^0.5.2", "package-manager-detector": "^1.3.0", "tinyexec": "^1.0.1" }, "bin": { "na": "bin/na.mjs", "ni": "bin/ni.mjs", "nr": "bin/nr.mjs", "nci": "bin/nci.mjs", "nlx": "bin/nlx.mjs", "nun": "bin/nun.mjs", "nup": "bin/nup.mjs" } }, "sha512-9q/yCljni37pkMr4sPrI3G4jqdIk074+iukc5aFJl7kmDCCsiJrbZ6zKxnES1Gwg+i9RcDZwvktl23puGslmvA=="], - "@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], "@babel/compat-data": ["@babel/compat-data@7.29.0", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="], @@ -520,8 +520,6 @@ "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "ansis": ["ansis@4.2.0", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="], - "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "aria-hidden": ["aria-hidden@1.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="], @@ -600,6 +598,8 @@ "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], + "cmdk": ["cmdk@1.1.1", "", { "dependencies": { "@radix-ui/react-compose-refs": "^1.1.1", "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-id": "^1.1.0", "@radix-ui/react-primitive": "^2.0.2" }, "peerDependencies": { "react": "^18 || ^19 || ^19.0.0-rc", "react-dom": "^18 || ^19 || ^19.0.0-rc" } }, "sha512-Vsv7kFaXm+ptHDMZ7izaRsP70GgrW9NBNGswt9OZaVBLlE0SNpDq8eu/VGXyF9r7M0azK3Wy7OlYXsuyYLFzHg=="], + "code-block-writer": ["code-block-writer@13.0.3", "", {}, "sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg=="], "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], @@ -792,6 +792,8 @@ "forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="], + "framer-motion": ["framer-motion@12.38.0", "", { "dependencies": { "motion-dom": "^12.38.0", "motion-utils": "^12.36.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g=="], + "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="], "fs-extra": ["fs-extra@11.3.4", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA=="], @@ -804,8 +806,6 @@ "fuzzysort": ["fuzzysort@3.1.0", "", {}, "sha512-sR9BNCjBg6LNgwvxlBd0sBABvQitkLzoVY9MYYROQVX/FvfJ4Mai9LsGhDgd8qYdds0bY77VzYd5iuB+v5rwQQ=="], - "fzf": ["fzf@0.5.2", "", {}, "sha512-Tt4kuxLXFKHy8KT40zwsUPUkg1CrsgY25FxA2U/j/0WgEDCk3ddc/zLTCCcbSHX9FcKtLuVaDGtGE/STWC+j3Q=="], - "generator-function": ["generator-function@2.0.1", "", {}, "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g=="], "gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="], @@ -1042,7 +1042,7 @@ "lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - "lucide-react": ["lucide-react@0.577.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-4LjoFv2eEPwYDPg/CUdBJQSDfPyzXCRrVW1X7jrx/trgxnxkHFjnVZINbzvzxjN70dxychOfg+FTYwBiS3pQ5A=="], + "lucide-react": ["lucide-react@1.7.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-yI7BeItCLZJTXikmK4KNUGCKoGzSvbKlfCvw44bU4fXAL6v3gYS4uHD1jzsLkfwODYwI6Drw5Tu9Z5ulDe0TSg=="], "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], @@ -1070,6 +1070,10 @@ "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], + "motion-dom": ["motion-dom@12.38.0", "", { "dependencies": { "motion-utils": "^12.36.0" } }, "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA=="], + + "motion-utils": ["motion-utils@12.36.0", "", {}, "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg=="], + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], "msw": ["msw@2.12.10", "", { "dependencies": { "@inquirer/confirm": "^5.0.0", "@mswjs/interceptors": "^0.41.2", "@open-draft/deferred-promise": "^2.2.0", "@types/statuses": "^2.0.6", "cookie": "^1.0.2", "graphql": "^16.12.0", "headers-polyfill": "^4.0.2", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "path-to-regexp": "^6.3.0", "picocolors": "^1.1.1", "rettime": "^0.10.1", "statuses": "^2.0.2", "strict-event-emitter": "^0.5.1", "tough-cookie": "^6.0.0", "type-fest": "^5.2.0", "until-async": "^3.0.2", "yargs": "^17.7.2" }, "peerDependencies": { "typescript": ">= 4.8.x" }, "optionalPeers": ["typescript"], "bin": { "msw": "cli/index.js" } }, "sha512-G3VUymSE0/iegFnuipujpwyTM2GuZAKXNeerUSrG2+Eg391wW63xFs5ixWsK9MWzr1AGoSkYGmyAzNgbR3+urw=="], @@ -1136,8 +1140,6 @@ "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], - "package-manager-detector": ["package-manager-detector@1.6.0", "", {}, "sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA=="], - "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], "parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="], @@ -1258,7 +1260,7 @@ "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="], - "shadcn": ["shadcn@4.0.5", "", { "dependencies": { "@antfu/ni": "^25.0.0", "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-z0SOHEU1+ADam1UJHrgxJhUsOb0/jBoYc+u9mhWs071KrnORq48X7uCwG3mD2ysQEBtOfeK/MxMGsmzL5Jt+Jg=="], + "shadcn": ["shadcn@4.1.2", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-qNQcCavkbYsgBj+X09tF2bTcwRd8abR880bsFkDU2kMqceMCLAm5c+cLg7kWDhfh1H9g08knpQ5ZEf6y/co16g=="], "sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="], @@ -1334,8 +1336,6 @@ "tiny-invariant": ["tiny-invariant@1.3.3", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="], - "tinyexec": ["tinyexec@1.0.2", "", {}, "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg=="], - "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="], "tldts": ["tldts@7.0.25", "", { "dependencies": { "tldts-core": "^7.0.25" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-keinCnPbwXEUG3ilrWQZU+CqcTTzHq9m2HhoUP2l7Xmi8l1LuijAXLpAJ5zRW+ifKTNscs4NdCkfkDCBYm352w=="], diff --git a/chess-frontend/components.json b/chess-frontend/components.json index af9ecb00361a6ee033dd9b6aed987d335af4c910..02e61e07044c3cdfad1b3e89161cd6717e602abe 100644 --- a/chess-frontend/components.json +++ b/chess-frontend/components.json @@ -1,6 +1,6 @@ { "$schema": "https://ui.shadcn.com/schema.json", - "style": "radix-lyra", + "style": "radix-nova", "rsc": true, "tsx": true, "tailwind": { @@ -10,7 +10,7 @@ "cssVariables": true, "prefix": "" }, - "iconLibrary": "phosphor", + "iconLibrary": "lucide", "rtl": false, "aliases": { "components": "@/components", diff --git a/chess-frontend/components/navbar/navlinks.tsx b/chess-frontend/components/navbar/navlinks.tsx index c9eff9b834fa467438172cfd78338d899807d104..bf152b70a294be5468563afffddb1bf693c34494 100644 --- a/chess-frontend/components/navbar/navlinks.tsx +++ b/chess-frontend/components/navbar/navlinks.tsx @@ -4,7 +4,7 @@ const links = [ { name: "Play", href: "/" }, { name: "Leaderboard", href: "/leaderboard" }, { name: "History", href: "/history" }, - { name: "Friends", href: "/friends" }, + { name: "Community", href: "/community" }, ]; export function NavLinks() { diff --git a/chess-frontend/components/navbar/user-dropdown.tsx b/chess-frontend/components/navbar/user-dropdown.tsx index dab7e12612c03156da164ed9420dc58372c0f717..6dcc0e3d768180e0a1339d5e7e8c53de50702c70 100644 --- a/chess-frontend/components/navbar/user-dropdown.tsx +++ b/chess-frontend/components/navbar/user-dropdown.tsx @@ -9,6 +9,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { ChevronDown, User, Settings, LogOut } from "lucide-react"; +import { getInitials } from "@/lib/constants/get-initials"; type UserDropdownProps = { user: { @@ -58,11 +59,7 @@ export function UserDropdown({ user, onSignOut }: UserDropdownProps) { className="object-cover" /> - {user.name - ?.split(" ") - .map((n) => n[0]) - .join("") - .toUpperCase()} + {getInitials(user.name)} diff --git a/chess-frontend/components/ui/avatar.tsx b/chess-frontend/components/ui/avatar.tsx index f6b1d4b845cb042966b32b115b8cd86d926b16ca..47ff2e2f444ae5dd3288e213e77f7b55bdf7281c 100644 --- a/chess-frontend/components/ui/avatar.tsx +++ b/chess-frontend/components/ui/avatar.tsx @@ -94,7 +94,7 @@ function AvatarGroupCount({
svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", + "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className )} {...props} diff --git a/chess-frontend/components/ui/badge.tsx b/chess-frontend/components/ui/badge.tsx index fe670e932d4bd3907d8a2513757b8475f266176a..cacff11dce8d09f7882da68c971b3a7e5be3e78a 100644 --- a/chess-frontend/components/ui/badge.tsx +++ b/chess-frontend/components/ui/badge.tsx @@ -5,7 +5,7 @@ import { Slot } from "radix-ui" import { cn } from "@/lib/utils" const badgeVariants = cva( - "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", + "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", { variants: { variant: { diff --git a/chess-frontend/components/ui/button.tsx b/chess-frontend/components/ui/button.tsx index 04f0be5ba3dcd6ce1e4cc88b32532c63cf6e9ef5..6138844d902c70e782c413d4dac7b46f4e93715d 100644 --- a/chess-frontend/components/ui/button.tsx +++ b/chess-frontend/components/ui/button.tsx @@ -5,7 +5,7 @@ import { Slot } from "radix-ui" import { cn } from "@/lib/utils" const buttonVariants = cva( - "group/button inline-flex shrink-0 items-center justify-center rounded-none border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { @@ -23,12 +23,14 @@ const buttonVariants = cva( size: { default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", - xs: "h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", - sm: "h-7 gap-1 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", - lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3", + xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", + sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", + lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", icon: "size-8", - "icon-xs": "size-6 rounded-none [&_svg:not([class*='size-'])]:size-3", - "icon-sm": "size-7 rounded-none", + "icon-xs": + "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3", + "icon-sm": + "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg", "icon-lg": "size-9", }, }, diff --git a/chess-frontend/components/ui/command.tsx b/chess-frontend/components/ui/command.tsx new file mode 100644 index 0000000000000000000000000000000000000000..5cea6edff58bfcb01dfd9cd5d13d583762b5eea6 --- /dev/null +++ b/chess-frontend/components/ui/command.tsx @@ -0,0 +1,192 @@ +"use client"; + +import * as React from "react"; +import { Command as CommandPrimitive } from "cmdk"; + +import { cn } from "@/lib/utils"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { InputGroup, InputGroupAddon } from "@/components/ui/input-group"; +import { SearchIcon, CheckIcon } from "lucide-react"; + +function Command({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function CommandDialog({ + title = "Command Palette", + description = "Search for a command to run...", + children, + className, + showCloseButton = false, + ...props +}: React.ComponentProps & { + title?: string; + description?: string; + className?: string; + showCloseButton?: boolean; +}) { + return ( + + + {title} + {description} + + + {children} + + + ); +} + +function CommandInput({ + className, + ...props +}: React.ComponentProps) { + return ( +
+ + + + + + +
+ ); +} + +function CommandList({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function CommandEmpty({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function CommandGroup({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function CommandSeparator({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function CommandItem({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + {children} + + + ); +} + +function CommandShortcut({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + + ); +} + +export { + Command, + CommandDialog, + CommandInput, + CommandList, + CommandEmpty, + CommandGroup, + CommandItem, + CommandShortcut, + CommandSeparator, +}; diff --git a/chess-frontend/components/ui/dialog.tsx b/chess-frontend/components/ui/dialog.tsx new file mode 100644 index 0000000000000000000000000000000000000000..d9aecca5035ec8c564ac14d8d475d888efda93e6 --- /dev/null +++ b/chess-frontend/components/ui/dialog.tsx @@ -0,0 +1,168 @@ +"use client" + +import * as React from "react" +import { Dialog as DialogPrimitive } from "radix-ui" + +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { XIcon } from "lucide-react" + +function Dialog({ + ...props +}: React.ComponentProps) { + return +} + +function DialogTrigger({ + ...props +}: React.ComponentProps) { + return +} + +function DialogPortal({ + ...props +}: React.ComponentProps) { + return +} + +function DialogClose({ + ...props +}: React.ComponentProps) { + return +} + +function DialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function DialogContent({ + className, + children, + showCloseButton = true, + ...props +}: React.ComponentProps & { + showCloseButton?: boolean +}) { + return ( + + + + {children} + {showCloseButton && ( + + + + )} + + + ) +} + +function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function DialogFooter({ + className, + showCloseButton = false, + children, + ...props +}: React.ComponentProps<"div"> & { + showCloseButton?: boolean +}) { + return ( +
+ {children} + {showCloseButton && ( + + + + )} +
+ ) +} + +function DialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function DialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, +} diff --git a/chess-frontend/components/ui/dropdown-menu.tsx b/chess-frontend/components/ui/dropdown-menu.tsx index a8223c48dc3b972269acc9eaed03028abf0bf7ad..c263ad57ea58d9c9949891fc869993cf6928a3fd 100644 --- a/chess-frontend/components/ui/dropdown-menu.tsx +++ b/chess-frontend/components/ui/dropdown-menu.tsx @@ -4,7 +4,7 @@ import * as React from "react" import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui" import { cn } from "@/lib/utils" -import { CheckIcon, CaretRightIcon } from "@phosphor-icons/react" +import { CheckIcon, ChevronRightIcon } from "lucide-react" function DropdownMenu({ ...props @@ -43,7 +43,7 @@ function DropdownMenuContent({ data-slot="dropdown-menu-content" sideOffset={sideOffset} align={align} - className={cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-none bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} + className={cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} {...props} /> @@ -73,7 +73,7 @@ function DropdownMenuItem({ data-inset={inset} data-variant={variant} className={cn( - "group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", + "group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className )} {...props} @@ -95,7 +95,7 @@ function DropdownMenuCheckboxItem({ data-slot="dropdown-menu-checkbox-item" data-inset={inset} className={cn( - "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} checked={checked} @@ -139,7 +139,7 @@ function DropdownMenuRadioItem({ data-slot="dropdown-menu-radio-item" data-inset={inset} className={cn( - "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} {...props} @@ -170,7 +170,7 @@ function DropdownMenuLabel({ data-slot="dropdown-menu-label" data-inset={inset} className={cn( - "px-2 py-2 text-xs text-muted-foreground data-inset:pl-7", + "px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", className )} {...props} @@ -185,7 +185,7 @@ function DropdownMenuSeparator({ return ( ) @@ -226,13 +226,13 @@ function DropdownMenuSubTrigger({ data-slot="dropdown-menu-sub-trigger" data-inset={inset} className={cn( - "flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + "flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className )} {...props} > {children} - + ) } @@ -244,7 +244,7 @@ function DropdownMenuSubContent({ return ( ) diff --git a/chess-frontend/components/ui/field.tsx b/chess-frontend/components/ui/field.tsx index 8c842e8316113d03b96172271be9ef4356ea2138..b4c0ca6f1d0f19af5e060624ac45943a56856544 100644 --- a/chess-frontend/components/ui/field.tsx +++ b/chess-frontend/components/ui/field.tsx @@ -30,7 +30,7 @@ function FieldLegend({ data-slot="field-legend" data-variant={variant} className={cn( - "mb-2.5 font-medium data-[variant=label]:text-xs data-[variant=legend]:text-sm", + "mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className )} {...props} @@ -106,7 +106,7 @@ function FieldLabel({