Repository: HavenDV/VolleyballRating
Pull request #11: Footer with additional menu items
Author: login: emartiros
Created: 2025-03-12T23:40:54Z | Merged: 2025-03-13T00:18:19Z

This pull request introduces several new components and updates to the existing codebase to enhance functionality and improve the user interface. The most important changes include the addition of new components, updates to the `supabase-queries` library, and modifications to the main page layout.

### New Components:
* [`src/app/components/footer.tsx`](diffhunk://#diff-b79568334031db301e7f3a723697582a7a94b2389c7453aebd237ca77c563ff8R1-R49): Added a new `Footer` component that includes navigation icons and admin-specific functionality.
* [`src/app/components/history.tsx`](diffhunk://#diff-d4e116dd26f184ce604ffdbf5a81a221e82de6cbfcbfc93319d6f9067c98b1e5R1-R11): Added a new `History` component.
* [`src/app/components/leaderboard.tsx`](diffhunk://#diff-2ec21ac1aea6b129ca6ca7df26ce1f232f011abcd8dc37c9d3ab2f44516625f0R1-R21): Added a new `Leaderboard` component that displays a greeting, voting options, and a rating table.
* [`src/app/components/start.tsx`](diffhunk://#diff-43b2e61837f6c6682a1e26b1d7323bc9665bfb24940b7dcf8128a4c10a114c18R1-R51): Added a new `Start` component to manage the creation and reshuffling of games.

### Updates to `supabase-queries` Library:
* [`src/app/lib/supabase-queries.ts`](diffhunk://#diff-1397141340184aa7943019369a0d9e2d6ffba1b8f174a1b60bc305a60da2854fR32-R48): Exported the `supabase` client, added new types (`Game`, `GameState`), and implemented new functions (`isAdmin`, `getActiveGame`, `createActiveGame`). (F921fd4aR1, [[1]](diffhunk://#diff-1397141340184aa7943019369a0d9e2d6ffba1b8f174a1b60bc305a60da2854fR32-R48) [[2]](diffhunk://#diff-1397141340184aa7943019369a0d9e2d6ffba1b8f174a1b60bc305a60da2854fR96-R132)

### Main Page Layout:
* [`src/app/page.tsx`](diffhunk://#diff-73d7a23e5015801b9bcc9db601d6ec9594d3eb34e5bb23154e0ae4b0c30f1a3bL3-R27): Refactored the main page to include the new `Footer`, `History`, `Leaderboard`, and `Start` components. Added state management for active screen navigation.

### Other Changes:
* [`src/app/components/rating.tsx`](diffhunk://#diff-150527b82ff8c35308d1de88dee028f0656cf13936909fb8f8c0b0014c5ea8aaL3-R6): Updated the import paths and removed the creation of a local `supabase` client instance, using the exported one instead. [[1]](diffhunk://#diff-150527b82ff8c35308d1de88dee028f0656cf13936909fb8f8c0b0014c5ea8aaL3-R6) [[2]](diffhunk://#diff-150527b82ff8c35308d1de88dee028f0656cf13936909fb8f8c0b0014c5ea8aaL26) [[3]](diffhunk://#diff-150527b82ff8c35308d1de88dee028f0656cf13936909fb8f8c0b0014c5ea8aaL41-R40)
* [`src/app/layout.tsx`](diffhunk://#diff-29d0a55f5ca1a9951042587f8b891bb4cd8b204f5bc855dc2468ed44cde2f5b3L4-R4): Updated the import path for `TelegramProvider` and adjusted the body class to ensure proper layout styling. [[1]](diffhunk://#diff-29d0a55f5ca1a9951042587f8b891bb4cd8b204f5bc855dc2468ed44cde2f5b3L4-R4) [[2]](diffhunk://#diff-29d0a55f5ca1a9951042587f8b891bb4cd8b204f5bc855dc2468ed44cde2f5b3L37-R37)
* [`src/app/components/vote.tsx`](diffhunk://#diff-d8e994b8e51ffd3c295f290c05de3b1e5165a22ba547256751c262a476dfa28cL4-R8): Updated import paths for `supabase-queries` and `telegram-context`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a footer navigation bar that allows quick access to Leaderboard, History, and Game Start screens, with options tailored by user roles.
  - Launched new screens offering enhanced experiences for viewing game history, checking scores, and initiating or reshuffling game sessions.
  - Added a new `History` component for displaying game history.
  - Introduced `Leaderboard` and `Start` components for enhanced game interaction.

- **Enhancements**
  - Updated overall layout and styling for a more responsive and visually appealing interface.
  - Improved game session management and administrative functionalities to streamline user interactions.
  - Implemented new path mappings for better organization and clarity in module resolution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/public/history.svg b/public/history.svg
new file mode 100644
index 0000000..4278123
--- /dev/null
+++ b/public/history.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none">
+
+<g fill="#ffffff">
+
+<path d="M1.5 1.25a.75.75 0 011.5 0v1.851A7 7 0 111 8a.75.75 0 011.5 0 5.5 5.5 0 101.725-4H5.75a.75.75 0 010 1.5h-3.5a.75.75 0 01-.75-.75v-3.5z"/>
+
+<path d="M8.25 4a.75.75 0 01.75.75v3.763l1.805.802a.75.75 0 01-.61 1.37l-2.25-1A.75.75 0 017.5 9V4.75A.75.75 0 018.25 4z"/>
+
+</g>
+
+</svg>
\ No newline at end of file
diff --git a/public/leaderboard.svg b/public/leaderboard.svg
new file mode 100644
index 0000000..d99f248
--- /dev/null
+++ b/public/leaderboard.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M15 21H9V12.6C9 12.2686 9.26863 12 9.6 12H14.4C14.7314 12 15 12.2686 15 12.6V21Z" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M20.4 21H15V18.1C15 17.7686 15.2686 17.5 15.6 17.5H20.4C20.7314 17.5 21 17.7686 21 18.1V20.4C21 20.7314 20.7314 21 20.4 21Z" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M9 21V16.1C9 15.7686 8.73137 15.5 8.4 15.5H3.6C3.26863 15.5 3 15.7686 3 16.1V20.4C3 20.7314 3.26863 21 3.6 21H9Z" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M10.8056 5.11325L11.7147 3.1856C11.8314 2.93813 12.1686 2.93813 12.2853 3.1856L13.1944 5.11325L15.2275 5.42427C15.4884 5.46418 15.5923 5.79977 15.4035 5.99229L13.9326 7.4917L14.2797 9.60999C14.3243 9.88202 14.0515 10.0895 13.8181 9.96099L12 8.96031L10.1819 9.96099C9.94851 10.0895 9.67568 9.88202 9.72026 9.60999L10.0674 7.4917L8.59651 5.99229C8.40766 5.79977 8.51163 5.46418 8.77248 5.42427L10.8056 5.11325Z" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
\ No newline at end of file
diff --git a/public/volleyball.svg b/public/volleyball.svg
new file mode 100644
index 0000000..3b5f3c7
--- /dev/null
+++ b/public/volleyball.svg
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
+<svg height="800px" width="800px" version="1.1" id="_x32_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
+	 viewBox="0 0 512 512"  xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#ffffff;}
+</style>
+<g>
+	<path class="st0" d="M440.982,179.047c31.455-10.869,50.788-74.986,34.14-101.954c0.619,17.314-30.526,30.426-41.388,11.813
+		C426.709,58.742,485.047,29.438,512,25.616c-12.803-19.271-83.179-27.726-108.67,7.11c-17.166,23.448-11.928,38.796-34.704,30.109
+		c-24.91-9.531-3.18-43.817,16.756-50.045c-78.584-14.536-58.477,66.012-87.976,58.268c-29.505-7.736-1.88-32.708,1.331-35.919
+		c-52.97-8.456-40.336,46.618-81.246,57.224c-24.252,9.09-38.34,10.877-51.399,13.144C95.967,117.715,34.612,167.009,10.413,239.249
+		c-35.106,104.878,21.437,218.336,126.3,253.458c104.87,35.107,218.344-21.421,253.466-126.3
+		c4.657-13.909,7.682-27.966,9.198-41.976c1.122-10.39,5.678-22.876,9.639-32.113c12.199-28.531,46.795-38.727,55.212-52.095
+		c18.83-29.931,3.598-48.738,3.598-48.738s-7.002,17.746-26.883,19.642C421.046,213.031,409.534,189.916,440.982,179.047z
+		 M319.788,175.039c12.355,11.488,23.24,25.034,32.168,40.46c6.142,10.645,11.055,21.715,14.722,32.94
+		c-2.313,4.58-4.75,9.082-7.326,13.538c-29.149,50.385-72,90.675-124.065,116.63c-4,1.98-7.983,3.86-12.084,5.624
+		c-7.821-21.824-11.875-45.001-11.875-68.349c0-1.478,0-2.986,0.039-4.495c23.92-13.074,45.194-30.364,62.817-50.927
+		c4.758-5.547,9.26-11.302,13.422-17.321c2.066-2.862,3.991-5.802,5.887-8.796C304.974,216.18,313.893,196.244,319.788,175.039z
+		 M113.528,151.622c27.556-15.89,57.487-23.386,87.109-23.386c30.148-0.046,59.916,7.821,86.166,22.628
+		c4.881,2.731,9.639,5.756,14.257,8.997c-5.083,22.636-14.057,43.794-26.071,62.802c-1.423,2.259-2.893,4.495-4.456,6.73h-0.046
+		c-4.665-3.489-9.462-6.862-14.343-10.103c-49.117-32.554-105.854-50.633-164.655-52.567
+		C98.342,161.207,105.66,156.171,113.528,151.622z M48.885,216.768c5.6-9.918,12.192-19.302,19.726-28.051
+		c4.124-0.201,8.286-0.302,12.409-0.302c58.199,0,114.572,16.996,163.016,49.124c4.456,2.955,8.827,6.018,13.082,9.221
+		c-16.114,18.66-35.671,34.38-57.626,46.185c-23.348-14.567-49.125-24.616-75.908-29.784c-7.186-1.393-14.42-2.452-21.707-3.071
+		c-6.932-0.673-13.872-1.014-20.857-1.014c-16.872,0-33.853,1.895-50.587,5.848C34.163,248.107,40.383,231.861,48.885,216.768z
+		 M114.796,454.685c-26.241-14.854-48.962-36.631-65.153-64.636c-15.89-27.556-23.387-57.487-23.434-87.108
+		c0-4.882,0.225-9.701,0.642-14.544c17.84-4.998,36.089-7.458,54.168-7.458c5.934,0,11.86,0.248,17.738,0.82
+		c-0.495,4.874-0.92,9.755-1.206,14.621c-0.418,6.56-0.626,13.151-0.626,19.766c0,51.484,12.525,101.986,36.623,147.675
+		C127.12,461.16,120.846,458.127,114.796,454.685z M200.969,477.313c-12.339,0-24.562-1.3-36.546-3.868h-0.046
+		c-2.105-3.28-4.132-6.607-6.058-9.972c-25.993-45.086-39.532-95.634-39.532-147.327c0-6.119,0.208-12.262,0.588-18.404
+		c0.256-4.348,0.627-8.649,1.099-12.865c24.392,4.789,47.856,14.126,69.022,27.602c-0.039,1.153-0.039,2.298-0.039,3.404
+		c0,26.171,4.588,52.033,13.422,76.472c2.467,6.854,5.292,13.584,8.486,20.191c2.166,4.673,4.579,9.252,7.094,13.739
+		c8.881,15.697,19.696,30.38,32.345,43.702C234.405,474.923,217.679,477.313,200.969,477.313z M352.713,388.773
+		c-14.861,26.249-36.6,48.962-64.643,65.162c-4.843,2.824-9.794,5.338-14.814,7.651c-14.305-13.724-26.241-29.235-35.749-46.053
+		c-2.058-3.667-3.977-7.372-5.794-11.148c4.494-1.934,8.904-4.038,13.33-6.235c53.371-26.527,97.784-67.227,128.867-117.953
+		c0.959,7.434,1.424,14.915,1.47,22.412C375.38,332.756,367.52,362.532,352.713,388.773z"/>
+</g>
+</svg>
\ No newline at end of file
diff --git a/src/app/components/footer.tsx b/src/app/components/footer.tsx
new file mode 100644
index 0000000..10c04e1
--- /dev/null
+++ b/src/app/components/footer.tsx
@@ -0,0 +1,49 @@
+'use client';
+
+import Image from "next/image";
+import { useTelegram } from "@context/telegram-context";
+import { ScreenName } from "../page";
+import { useCallback, useEffect, useState } from "react";
+import { isAdmin } from "@lib/supabase-queries";
+
+type FooterProps = {
+  setActiveScreen: (screen: ScreenName) => void;
+};
+
+export default function Footer({setActiveScreen} : FooterProps) {
+  const { launchParams, theme } = useTelegram();
+  const [admin, setAdmin] = useState<boolean>(false)
+
+  const initIsAdmin = useCallback(async () => {
+    setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? Number(process.env.NEXT_PUBLIC_TELEGRAM_TEST_ID) ))
+  }, [launchParams])
+
+  useEffect(() => {
+    initIsAdmin()
+  }, [initIsAdmin])
+
+  const footerElement = useCallback((icon: string, activeScreenName: ScreenName) => {
+    return (
+      <div className="pb-2" onClick={() => setActiveScreen(activeScreenName)}>
+          <Image src={icon} alt={activeScreenName} width={30} height={30}/>
+      </div>
+    )
+  }, [setActiveScreen])
+
+  const leaderboard = footerElement('/leaderboard.svg', 'leaderboard')
+  const history = footerElement('/history.svg', 'history')
+  const start = footerElement('/volleyball.svg', 'start')
+
+  return (
+    <>
+      <div className={`min-h-12 ${theme.bg}`}/>
+      <div className={`fixed bottom-0 h-12 p-2 w-full  ${theme.bg}`}>
+        <div className={`flex flex-auto flex-row justify-around`}>
+          {leaderboard}
+          {admin && start}
+          {history}
+        </div>
+      </div>
+    </>
+  )
+}
\ No newline at end of file
diff --git a/src/app/components/history.tsx b/src/app/components/history.tsx
new file mode 100644
index 0000000..96dddc6
--- /dev/null
+++ b/src/app/components/history.tsx
@@ -0,0 +1,11 @@
+'use client';
+
+export default function History() {
+
+  return (
+    <div>
+      
+    </div>
+  )
+
+}
\ No newline at end of file
diff --git a/src/app/components/leaderboard.tsx b/src/app/components/leaderboard.tsx
new file mode 100644
index 0000000..40149ec
--- /dev/null
+++ b/src/app/components/leaderboard.tsx
@@ -0,0 +1,21 @@
+'use client';
+
+import Hello from '@components/hello';
+import RatingTable from '@components/rating';
+import Vote from '@components/vote';
+import { useTelegram } from '@context/telegram-context';
+
+export default function Leaderboard() {
+  const { theme } = useTelegram();
+
+  return (
+    <div 
+      className={`w-full mx-auto p-2 sm:p-4 flex flex-col gap-2 items-center ${theme.bg} min-h-screen overflow-hidden`}
+      style={theme.bgStyle}
+    >
+      <Hello />
+      <Vote />
+      <RatingTable />
+    </div>
+  )
+}
\ No newline at end of file
diff --git a/src/app/components/rating.tsx b/src/app/components/rating.tsx
index f201a47..58d9475 100644
--- a/src/app/components/rating.tsx
+++ b/src/app/components/rating.tsx
@@ -1,9 +1,9 @@
 "use client";
 
-import { useEffect, useState, useRef } from "react";
+import { useEffect, useState } from "react";
 import Image from "next/image";
-import { createClient } from "@/app/utils/supabase/client";
-import { useTelegram } from "../context/telegram-context";
+import { useTelegram } from "@context/telegram-context";
+import { supabase } from "@lib/supabase-queries";
 
 // Type for a player's rating info returned by the stored procedure
 export type PlayerRating = {
@@ -23,7 +23,6 @@ export default function RatingTable() {
   const { theme } = useTelegram();
   
   // Create Supabase client instance
-  const supabase = useRef(createClient());
 
   // Fetch ratings from Supabase by calling the stored procedure
   useEffect(() => {
@@ -38,7 +37,7 @@ export default function RatingTable() {
   async function fetchRatings() {
     setLoading(true);
     setError(null);
-    const { data, error } = await supabase.current.rpc("calculate_player_ratings");
+    const { data, error } = await supabase.rpc("calculate_player_ratings");
     if (error) {
       console.error("Error fetching ratings:", error);
       setError(error.message);
diff --git a/src/app/components/start.tsx b/src/app/components/start.tsx
new file mode 100644
index 0000000..c9670c4
--- /dev/null
+++ b/src/app/components/start.tsx
@@ -0,0 +1,51 @@
+'use client';
+
+import { useCallback, useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
+
+  const {theme} = useTelegram()
+
+  const [currentGame, setCurrentGame] = useState<Game | null>(null)
+
+  const initCurrentGame = useCallback(async () => {
+    setCurrentGame(await getActiveGame())
+  }, [setCurrentGame])
+
+  useEffect(() => {
+    initCurrentGame()
+  }, [initCurrentGame])
+
+  const gameCreator = (
+    <div>
+
+    </div>
+  )
+
+  const gameViewer = () => (
+    <div>
+
+    </div>
+  )
+
+  const createGame = () => {
+
+  }
+
+  const reshuffle = () => {
+
+  }
+
+  return (
+    <div className={`flex flex-auto flex-col ${theme.bg} items-center`}>
+      <div className={`${theme.cardBg} p-4 rounded-sm m-4`} onClick={currentGame ? reshuffle: createGame}>
+        <h3>{currentGame ? 'Reshuffle': 'Start a game!'}</h3>
+      </div>
+      {currentGame
+      ? gameViewer()
+      : gameCreator}
+    </div>
+  )
+}
\ No newline at end of file
diff --git a/src/app/components/vote.tsx b/src/app/components/vote.tsx
index 1f0e855..99a11eb 100644
--- a/src/app/components/vote.tsx
+++ b/src/app/components/vote.tsx
@@ -1,11 +1,11 @@
 "use client";
 
 import { useCallback, useEffect, useState } from "react";
-import { getRandomVotePair, submitVote, VotePair, User } from "@/app/lib/supabase-queries";
+import { getRandomVotePair, submitVote, VotePair, User } from "@lib/supabase-queries";
 import Image from "next/image";
 import { PostgrestError } from "@supabase/supabase-js";
-import { useTelegram } from "../context/telegram-context";
-import { TelegramTheme } from "../utils/telegram-theme";
+import { useTelegram } from "@context/telegram-context";
+import { TelegramTheme } from "@utils/telegram-theme";
 
 // Player card skeleton component
 function PlayerCardSkeleton({ theme }: { theme: TelegramTheme }) {
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index c755dd5..65ef44c 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,7 +1,7 @@
 import type { Metadata, Viewport } from "next";
 import { Geist, Geist_Mono } from "next/font/google";
 import "./globals.css";
-import { TelegramProvider } from "./context/telegram-context";
+import { TelegramProvider } from "@context/telegram-context";
 
 const geistSans = Geist({
   variable: "--font-geist-sans",
@@ -34,7 +34,7 @@ export default function RootLayout({
   return (
     <html lang="en" className="overflow-x-hidden">
       <body
-        className={`${geistSans.variable} ${geistMono.variable} antialiased overflow-x-hidden`}
+        className={`${geistSans.variable} ${geistMono.variable} antialiased overflow-x-hidden flex min-h-screen`}
       >
         <TelegramProvider>
           {children}
diff --git a/src/app/lib/supabase-queries.ts b/src/app/lib/supabase-queries.ts
index 77659d0..921fd4a 100644
--- a/src/app/lib/supabase-queries.ts
+++ b/src/app/lib/supabase-queries.ts
@@ -1,6 +1,6 @@
 import { createClient } from '@/app/utils/supabase/client';
 
-const supabase = createClient();
+export const supabase = createClient();
 
 export type User = {
   id: number;
@@ -8,6 +8,7 @@ export type User = {
   lastName?: string;
   username?: string;
   photoUrl?: string;
+  admin: boolean;
 };
 
 export type DB_RandomVotePair = {
@@ -28,6 +29,23 @@ export type VotePair = {
   playerB: User;
 };
 
+export type Game = {
+  id: string,
+  team_a: string[],
+  team_b: string[],
+  team_a_score: number,
+  team_b_score: number,
+  state: GameState,
+  creator: number,
+  finisher: number
+}
+
+export enum GameState {
+  ACTIVE = 'ACTIVE',
+  FINISHED = 'FINISHED',
+  CANCELLED = 'CANCELLED'
+}
+
 export async function getRandomVotePair(voterId: number): Promise<VotePair[]> {
   const { data, error } = await supabase
     .rpc("get_random_vote_pair", { voter_id_param: voterId });
@@ -74,4 +92,41 @@ export async function upsertUser(id: number, first_name: string, last_name: stri
   if (error) {
     console.error('Error updating user in Supabase:', error);
   }
+}
+
+export async function isAdmin(id: number) {
+  const result = await supabase.from('users').select('admin').eq('id', id).limit(1)
+
+  if (result.error) {
+    console.error('Error selecting admin status', result.error);
+    throw result.error;
+  }
+  if (result.data.length != 1) {
+    console.error('Error selecting admin status, user not found', result.error);
+    throw new Error('User not found')
+  }
+  return result.data[0].admin
+}
+
+export async function getActiveGame(): Promise<Game | null> {
+  const result = await supabase.from('games').select().eq('state', 'ACTIVE').limit(1)
+
+  if (result.error) {
+    console.error('Error getting active game', result.error);
+    throw result.error;
+  }
+
+  return result.data.length == 0
+    ? null
+    : result.data[0] as Game
+}
+
+export async function createActiveGame(game: Game) {
+  const result = await supabase.from('games').insert([game])
+
+  if (result.error) {
+    console.error('Error creating active game', result.error);
+    throw result.error;
+  }
+
 }
\ No newline at end of file
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 3605c49..ce62582 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,21 +1,29 @@
 'use client';
 
-import Hello from './components/hello';
-import RatingTable from './components/rating';
-import Vote from './components/vote';
-import { useTelegram } from './context/telegram-context';
+import History from '@components/history';
+import Leaderboard from '@components/leaderboard';
+import { JSX, useState } from 'react';
+import { useTelegram } from '@context/telegram-context';
+import Start from '@components/start';
+
+export type ScreenName = 'leaderboard' | 'history' | 'start';
 
 export default function Home() {
-  const { theme } = useTelegram();
+
+  const {theme} = useTelegram()
+
+  const [activeScreen] = useState<ScreenName>('leaderboard')
+
+  const screens: Record<ScreenName, JSX.Element> = {
+    leaderboard: <Leaderboard />,
+    history: <History />,
+    start: <Start/>
+  }
 
   return (
-    <div 
-      className={`w-full mx-auto p-2 sm:p-4 flex flex-col gap-2 items-center ${theme.bg} min-h-screen overflow-hidden`}
-      style={theme.bgStyle}
-    >
-      <Hello />
-      <Vote />
-      <RatingTable />
+    <div className={`${theme.bg} flex flex-auto flex-col`}>
+      {screens[activeScreen]}
+      {/* <Footer setActiveScreen={setActiveScreen}/> */}
     </div>
   )
 }
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index c133409..5467152 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -19,7 +19,11 @@
       }
     ],
     "paths": {
-      "@/*": ["./src/*"]
+      "@/*": ["./src/*"],
+      "@components/*": ["./src/app/components/*"],
+      "@context/*": ["./src/app/context/*"],
+      "@utils/*": ["./src/app/utils/*"],
+      "@lib/*": ["./src/app/lib/*"],
     }
   },
   "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],


Reviews:
user: login: emartiros
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T23:41:24Z
user: login: emartiros
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T23:42:11Z
user: login: HavenDV
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-12T23:43:09Z
user: login: emartiros
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T23:43:21Z
user: login: copilot-pull-request-reviewer[bot]
body: ## Pull Request Overview

This pull request introduces a new Footer component with additional menu items and new screen components (Start, Leaderboard, History) to support navigating between different application views. Key changes include:
- A new Footer component with conditional rendering for admin users.
- New components for Start, Leaderboard, and History screens.
- Updates to module import paths and refactored Supabase query exports.

### Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

<details>
<summary>Show a summary per file</summary>

| File                                  | Description                                                                                   |
| ------------------------------------- | --------------------------------------------------------------------------------------------- |
| src/app/components/footer.tsx         | New Footer component with conditional rendering and navigation callback.                     |
| src/app/components/start.tsx            | New Start component for game management with asynchronous data fetching.                     |
| src/app/components/leaderboard.tsx      | New Leaderboard component for displaying player ratings.                                      |
| src/app/components/history.tsx          | New History component with a placeholder view.                                               |
| src/app/page.tsx                        | Updated integration of the screen components with adjusted import paths.                      |
| src/app/lib/supabase-queries.ts         | Refactored Supabase queries and added new functions for admin checks and game management.      |
| src/app/layout.tsx                      | Adjusted provider import paths and layout styling changes.                                    |
| src/app/components/rating.tsx           | Updated imports and removed redundant client instance creation for Supabase.                   |
| src/app/components/vote.tsx             | Updated import paths and minor refactoring in vote functionality.                              |
</details>



<details>
<summary>Comments suppressed due to low confidence (2)</summary>

**src/app/components/footer.tsx:21**
* Consider adding a dependency array (e.g. []) to the useEffect hook to ensure that initIsAdmin is only executed once on mount.
```
useEffect(() => { initIsAdmin() })
```
**src/app/components/start.tsx:13**
* Include a dependency array (e.g. []) in the useEffect hook to ensure initCurrentGame runs only once on mount and avoids unnecessary re-executions.
```
useEffect(() => { initCurrentGame() })
```
</details>


state: COMMENTED
author_association: NONE
submitted_at: 2025-03-12T23:50:03Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 9**

<details>
<summary>🔭 Outside diff range comments (1)</summary><blockquote>

<details>
<summary>src/app/lib/supabase-queries.ts (1)</summary><blockquote>

`58-74`: _⚠️ Potential issue_

**Fix type safety issue in getRandomVotePair function.**

The function is mapping DB_RandomVotePair objects to VotePair objects, but it's not including the admin property that was added to the User type.


```diff
return data?.map((pair: DB_RandomVotePair) => ({
  playerA: {
    id: pair.player_a_id,
    firstName: pair.player_a_first_name,
    lastName: pair.player_a_last_name,
    photoUrl: pair.player_a_photo_url,
    username: pair.player_a_username,
+   admin: false, // Default value or query this separately if needed
  },
  playerB: {
    id: pair.player_b_id,
    firstName: pair.player_b_first_name,
    lastName: pair.player_b_last_name,
    photoUrl: pair.player_b_photo_url,
    username: pair.player_b_username,
+   admin: false, // Default value or query this separately if needed
  }
})) ?? [];
```

</blockquote></details>

</blockquote></details>

<details>
<summary>♻️ Duplicate comments (2)</summary><blockquote>

<details>
<summary>src/app/components/start.tsx (1)</summary><blockquote>

`7-51`: _⚠️ Potential issue_

**Missing admin access control**

According to comments, this component should only be available to admins, but there's no access control implementation.


Add admin verification using the `isAdmin` function mentioned in the PR objectives:

```diff
import { useEffect, useState } from "react";
import { useTelegram } from "@context/telegram-context";
-import { Game, getActiveGame } from "@lib/supabase-queries";
+import { Game, getActiveGame, isAdmin } from "@lib/supabase-queries";

export default function Start() {

  const {theme, user} = useTelegram()
+  const [isUserAdmin, setIsUserAdmin] = useState(false);
  const [currentGame, setCurrentGame] = useState<Game | null>(null)

  useEffect(() => {
    initCurrentGame()
+    checkAdminStatus()
  }, [])

+  const checkAdminStatus = async () => {
+    if (user) {
+      const adminStatus = await isAdmin(user.id);
+      setIsUserAdmin(adminStatus);
+    }
+  }

  // rest of the component...

  return (
    <div className={`flex flex-auto flex-col ${theme.bg} items-center`}>
+     {!isUserAdmin ? (
+       <div className={`${theme.cardBg} p-4 rounded-sm m-4`}>
+         <h3>You don't have permission to access this page</h3>
+       </div>
+     ) : (
        <div className={`${theme.cardBg} p-4 rounded-sm m-4`} onClick={currentGame ? reshuffle: createGame}>
          <h3>{currentGame ? 'Reshuffle': 'Start a game!'}</h3>
        </div>
+     )}
      {currentGame
      ? gameViewer()
      : gameCreator}
    </div>
  )
}
```

</blockquote></details>
<details>
<summary>src/app/page.tsx (1)</summary><blockquote>

`26-26`: _⚠️ Potential issue_

**Uncomment Footer component to enable screen navigation**

The Footer component is commented out, which prevents users from navigating between screens. Since you've implemented the screen state management and created the Footer component, it should be uncommented to enable the intended functionality.


```diff
- {/* <Footer setActiveScreen={setActiveScreen}/> */}
+ <Footer setActiveScreen={setActiveScreen}/>
```

</blockquote></details>

</blockquote></details>

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>src/app/components/footer.tsx (1)</summary><blockquote>

`40-40`: **Remove extra whitespace in className string**

There are unnecessary extra spaces in the className string.


```diff
- <div className={`fixed bottom-0 h-12 p-2 w-full  ${theme.bg}`}>
+ <div className={`fixed bottom-0 h-12 p-2 w-full ${theme.bg}`}>
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 7df4d5bfd95011763164c1c1856748f9e3c9c07e and 677fecad0689d70beb1c609076d194b32e178e28.

</details>

<details>
<summary>⛔ Files ignored due to path filters (3)</summary>

* `public/history.svg` is excluded by `!**/*.svg`
* `public/leaderboard.svg` is excluded by `!**/*.svg`
* `public/volleyball.svg` is excluded by `!**/*.svg`

</details>

<details>
<summary>📒 Files selected for processing (10)</summary>

* `src/app/components/footer.tsx` (1 hunks)
* `src/app/components/history.tsx` (1 hunks)
* `src/app/components/leaderboard.tsx` (1 hunks)
* `src/app/components/rating.tsx` (2 hunks)
* `src/app/components/start.tsx` (1 hunks)
* `src/app/components/vote.tsx` (1 hunks)
* `src/app/layout.tsx` (2 hunks)
* `src/app/lib/supabase-queries.ts` (3 hunks)
* `src/app/page.tsx` (1 hunks)
* `tsconfig.json` (1 hunks)

</details>

<details>
<summary>🔇 Additional comments (14)</summary><blockquote>

<details>
<summary>src/app/components/leaderboard.tsx (1)</summary>

`8-21`: **LGTM: Well-structured component with appropriate theme handling**

This component nicely consolidates the Hello, Vote, and RatingTable components with proper theming from the Telegram context. The layout is responsive and properly styled based on the theme.

</details>
<details>
<summary>tsconfig.json (1)</summary>

`22-26`: **LGTM: Good path alias configuration**

The path mappings properly define aliases for components, context, utils, and lib directories, making imports more readable and maintainable across the codebase. These changes align well with the absolute imports used in the new components.

</details>
<details>
<summary>src/app/components/rating.tsx (2)</summary>

`3-6`: **Good improvement to import structure!**

The refactoring to use an imported Supabase client from a central location rather than creating a new client with useRef is a cleaner approach. This promotes consistency and makes the code more maintainable.

---

`40-40`: **Simplified Supabase client usage**

Accessing the imported Supabase client directly instead of through a ref simplifies the code and maintains the same functionality.

</details>
<details>
<summary>src/app/components/footer.tsx (1)</summary>

`27-27`: **Improve footer element positioning**

The footer elements aren't properly centered vertically. Consider adding alignment classes to improve the layout.


```diff
- <div className="pb-2" onClick={() => setActiveScreen(activeScreenName)}>
+ <div className="pb-2 flex items-center justify-center" onClick={() => setActiveScreen(activeScreenName)}>
```

</details>
<details>
<summary>src/app/page.tsx (1)</summary>

`17-21`: **Implementation looks good for screen management**

The screen management approach using a Record to map screen names to components is clean and maintainable.

</details>
<details>
<summary>src/app/layout.tsx (2)</summary>

`4-4`: **Good improvement to import structure**

Changing from relative to absolute import paths makes the code more maintainable and less prone to errors when files are moved.

---

`37-37`: **Enhanced layout styling**

Adding the 'flex min-h-screen' classes to the body element improves the layout structure, ensuring the content fills the screen height properly.

</details>
<details>
<summary>src/app/components/vote.tsx (1)</summary>

`4-4`: **Improved code organization with absolute imports.**

The migration from relative paths to absolute path imports (using the @ prefix) is a good practice that improves code organization and maintainability. This change aligns with modern React project standards and makes import statements more consistent across the codebase.



Also applies to: 7-8

</details>
<details>
<summary>src/app/lib/supabase-queries.ts (5)</summary>

`3-3`: **Good change: Centralizing the Supabase client.**

Exporting the Supabase client allows for consistent reuse across components, eliminating the need for multiple client instances throughout the application.

---

`11-11`: **User type extension with admin property.**

Adding the admin property to the User type is appropriate for implementing the role-based functionality mentioned in the PR objectives.

---

`32-47`: **Well-structured game management types.**

The Game type and GameState enum are well-defined and provide clear structure for game management. The enum approach for game states is particularly good as it provides type safety and prevents invalid states.

---

`97-109`: **Good implementation of admin check with proper error handling.**

The isAdmin function properly handles database errors and the case where a user is not found. The explicit error messages will be helpful for debugging.

---

`111-122`: **Clear implementation of active game retrieval.**

The getActiveGame function has proper error handling and correctly returns null when no active game exists, making it easy for consumers to handle the absence of an active game.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-03-13T00:01:15Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (3)</summary><blockquote>

<details>
<summary>src/app/components/footer.tsx (3)</summary><blockquote>

`27-29`: **Enhance clickable feedback for footer elements.**

The div elements lack visual feedback indicating they are clickable. Consider adding hover effects or cursor styling for better user experience.

```diff
-      <div className="pb-2" onClick={() => setActiveScreen(activeScreenName)}>
+      <div className="pb-2 cursor-pointer hover:opacity-80 transition-opacity" onClick={() => setActiveScreen(activeScreenName)}>
           <Image src={icon} alt={activeScreenName} width={30} height={30}/>
       </div>
```

---

`33-35`: **Consider memoizing the footer elements.**

These constants are recreated on every render. Using `useMemo` would prevent unnecessary recreations of these elements when the component re-renders for other reasons.

```diff
-  const leaderboard = footerElement('/leaderboard.svg', 'leaderboard')
-  const history = footerElement('/history.svg', 'history')
-  const start = footerElement('/volleyball.svg', 'start')
+  const leaderboard = useMemo(() => footerElement('/leaderboard.svg', 'leaderboard'), [footerElement])
+  const history = useMemo(() => footerElement('/history.svg', 'history'), [footerElement])
+  const start = useMemo(() => footerElement('/volleyball.svg', 'start'), [footerElement])
```

---

`40-40`: **Fix inconsistent spacing in className.**

There are two spaces between `w-full` and the template literal, which is inconsistent with the spacing in other className strings.

```diff
-      <div className={`fixed bottom-0 h-12 p-2 w-full  ${theme.bg}`}>
+      <div className={`fixed bottom-0 h-12 p-2 w-full ${theme.bg}`}>
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 677fecad0689d70beb1c609076d194b32e178e28 and 06b70bd1ce2334d7829cda4e7d2c695f62773c1c.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `src/app/components/footer.tsx` (1 hunks)
* `src/app/components/start.tsx` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* src/app/components/start.tsx

</details>

<details>
<summary>🔇 Additional comments (2)</summary><blockquote>

<details>
<summary>src/app/components/footer.tsx (2)</summary>

`18-18`: **LGTM: Environment variable usage for test ID.**

Good job using an environment variable instead of a hardcoded user ID. This improves security and makes the code more maintainable.

---

`21-23`: **LGTM: Proper dependency array in useEffect.**

The useEffect hook correctly includes initIsAdmin in its dependency array, preventing potential infinite re-renders.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-03-13T00:10:48Z
user: login: copilot-pull-request-reviewer[bot]
body: ## Pull Request Overview

This PR adds several new UI components (Footer, History, Leaderboard, and Start) to enhance the user interface and game interaction while updating the supabase queries library and main page layout for improved modularity and performance.
- Added new components for game management and navigation.
- Updated the supabase-queries library with new types and functions.
- Adjusted the main page and layout to integrate the new components.

### Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

<details>
<summary>Show a summary per file</summary>

| File                         | Description                                                    |
| ---------------------------- | -------------------------------------------------------------- |
| src/app/components/start.tsx | New component for game creation/rescheduling with placeholder functions. |
| src/app/components/footer.tsx | Footer navigation displaying icons with admin-specific elements. |
| src/app/components/leaderboard.tsx | New component integrating greeting, voting, and rating display. |
| src/app/components/history.tsx | New (currently empty) component for displaying game history.    |
| src/app/page.tsx               | Main page updated to include new components and navigation state management. |
| src/app/lib/supabase-queries.ts | Exports supabase client and adds game-related types and query functions. |
| src/app/layout.tsx             | Layout and import path adjustments for improved styling and consistency. |
| src/app/components/rating.tsx  | Refactored to use the exported supabase client with enhanced error handling. |
| src/app/components/vote.tsx    | Updated import paths and UI adjustments for voting functionality. |
</details>





state: COMMENTED
author_association: NONE
submitted_at: 2025-03-13T00:16:32Z

Review comments:
diff_hunk: @@ -1,21 +1,30 @@
 'use client';
 
-import Hello from './components/hello';
-import RatingTable from './components/rating';
-import Vote from './components/vote';
-import { useTelegram } from './context/telegram-context';
+import Footer from '@components/footer';
+import History from '@components/history';
+import Leaderboard from '@components/leaderboard';
+import { JSX, useState } from 'react';
+import { useTelegram } from '@context/telegram-context';
+import Start from '@components/start';
+
+export type ScreenName = 'leaderboard' | 'history' | 'start';
 
 export default function Home() {
-  const { theme } = useTelegram();
+
+  const {theme} = useTelegram()
+
+  const [activeScreen, setActiveScreen] = useState<ScreenName>('leaderboard')
+
+  const screens: Record<ScreenName, JSX.Element> = {
+    leaderboard: <Leaderboard />,
+    history: <History />,
+    start: <Start/>
+  }
 
   return (
-    <div 
-      className={`w-full mx-auto p-2 sm:p-4 flex flex-col gap-2 items-center ${theme.bg} min-h-screen overflow-hidden`}
-      style={theme.bgStyle}
-    >
-      <Hello />
-      <Vote />
-      <RatingTable />
+    <div className={`${theme.bg} flex flex-auto flex-col`}>
+      {screens[activeScreen]}
+      {/* <Footer setActiveScreen={setActiveScreen}/> */}
path: src/app/page.tsx
user: login: emartiros
body: footer is commented
created_at: 2025-03-12T23:41:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,13 +1,14 @@
 import { createClient } from '@/app/utils/supabase/client';
 
-const supabase = createClient();
+export const supabase = createClient();
 
 export type User = {
   id: number;
   firstName: string;
   lastName?: string;
   username?: string;
   photoUrl?: string;
+  admin: boolean;
path: src/app/lib/supabase-queries.ts
user: login: emartiros
body: user can now be `admin`, which will allow creating teams and submitting the match results
created_at: 2025-03-12T23:42:10Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,51 @@
+'use client';
+
+import { useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
path: src/app/components/start.tsx
user: login: emartiros
body: a screen to create an active game / reshuffle teams
available only for admin
created_at: 2025-03-12T23:43:21Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,49 @@
+'use client';
+
+import Image from "next/image";
+import { useTelegram } from "@context/telegram-context";
+import { ScreenName } from "../page";
+import { useEffect, useState } from "react";
+import { isAdmin } from "@lib/supabase-queries";
+
+type FooterProps = {
+  setActiveScreen: (screen: ScreenName) => void;
+};
+
+export default function Footer({setActiveScreen} : FooterProps) {
+  const { launchParams, theme } = useTelegram();
+  const [admin, setAdmin] = useState<boolean>(false)
+
+  const initIsAdmin = async () => {
+    setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? 832467215))
+  }
+
+  useEffect(() => {
+    initIsAdmin()
+  })
+
+  const footerElement = (icon: string, activeScreenName: ScreenName) => {
+    return (
+      <div className="pb-2 flex-col align-center justify-items-center" onClick={() => setActiveScreen(activeScreenName)}>
path: src/app/components/footer.tsx
user: login: Copilot
body: The Tailwind CSS class 'align-center' is not valid; replace it with 'items-center' to properly center the content.
```suggestion
      <div className="pb-2 flex-col items-center justify-items-center" onClick={() => setActiveScreen(activeScreenName)}>
```
created_at: 2025-03-12T23:50:03Z
author_association: NONE
diff_hunk: @@ -0,0 +1,11 @@
+'use client';
+
+export default function History() {
+
+  return (
+    <div>
+      
+    </div>
+  )
+
+}
path: src/app/components/history.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Empty component needs implementation**

This component is intended to display historical data according to the PR objectives, but it's completely empty. As it stands, this component doesn't serve any purpose in the application.


Consider implementing the historical data display functionality or removing this component if it's not needed for the current iteration. If it's a placeholder for future work, add a TODO comment explaining its intended purpose.

```diff
export default function History() {

  return (
    <div>
-      
+      {/* TODO: Implement history display functionality */}
+      <p>Coming soon: Game history will be displayed here</p>
    </div>
  )

}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
export default function History() {

  return (
    <div>
      {/* TODO: Implement history display functionality */}
      <p>Coming soon: Game history will be displayed here</p>
    </div>
  )

}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:13Z
author_association: NONE
diff_hunk: @@ -0,0 +1,51 @@
+'use client';
+
+import { useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
+
+  const {theme} = useTelegram()
+
+  const [currentGame, setCurrentGame] = useState<Game | null>(null)
+
+  useEffect(() => {
+    initCurrentGame()
+  }, [])
path: src/app/components/start.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Missing dependencies in useEffect hook**

The useEffect hook is initialized with an empty dependency array, which means it will only run once when the component mounts. If any variables from the component scope are used inside the effect, they should be included in the dependency array.


For now, this is fine since you're only calling `initCurrentGame` which doesn't depend on any other variables, but be cautious if you update this effect in the future.

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Fixed in commit 06b70bd
created_at: 2025-03-13T00:01:13Z
author_association: NONE
diff_hunk: @@ -0,0 +1,51 @@
+'use client';
+
+import { useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
+
+  const {theme} = useTelegram()
+
+  const [currentGame, setCurrentGame] = useState<Game | null>(null)
+
+  useEffect(() => {
+    initCurrentGame()
+  }, [])
+
+  const initCurrentGame = async () => {
+    setCurrentGame(await getActiveGame())
+  }
+
+  const gameCreator = (
+    <div>
+
+    </div>
+  )
+
+  const gameViewer = () => (
+    <div>
+
+    </div>
+  )
+
+  const createGame = () => {
+
+  }
+
+  const reshuffle = () => {
+
+  }
+
+  return (
+    <div className={`flex flex-auto flex-col ${theme.bg} items-center`}>
+      <div className={`${theme.cardBg} p-4 rounded-sm m-4`} onClick={currentGame ? reshuffle: createGame}>
+        <h3>{currentGame ? 'Reshuffle': 'Start a game!'}</h3>
+      </div>
+      {currentGame
+      ? gameViewer()
+      : gameCreator}
path: src/app/components/start.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Inconsistent component invocation**

There's an inconsistency in how the conditional rendering is implemented - `gameViewer` is called as a function but `gameCreator` is referenced directly as a JSX element.


Fix this by making both consistent:

```diff
{currentGame
-? gameViewer()
-: gameCreator}
+? gameViewer()
+: gameCreator()}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
      {currentGame
      ? gameViewer()
      : gameCreator()}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:13Z
author_association: NONE
diff_hunk: @@ -0,0 +1,51 @@
+'use client';
+
+import { useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
+
+  const {theme} = useTelegram()
+
+  const [currentGame, setCurrentGame] = useState<Game | null>(null)
+
+  useEffect(() => {
+    initCurrentGame()
+  }, [])
+
+  const initCurrentGame = async () => {
+    setCurrentGame(await getActiveGame())
+  }
+
+  const gameCreator = (
+    <div>
+
+    </div>
+  )
+
+  const gameViewer = () => (
+    <div>
+
+    </div>
+  )
path: src/app/components/start.tsx
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Empty component definitions with inconsistent patterns**

Both `gameCreator` and `gameViewer` are empty but use inconsistent patterns - one is a JSX element and the other is a function returning JSX. This makes the code harder to maintain.


I recommend using consistent patterns and implementing the actual content:

```diff
- const gameCreator = (
-   <div>
-
-   </div>
- )
+ const gameCreator = () => (
+   <div className={`${theme.cardBg} p-4 rounded-sm w-full max-w-md`}>
+     <h3 className="text-center mb-4">Create a new game</h3>
+     {/* Add form elements for creating a game */}
+   </div>
+ )

const gameViewer = () => (
  <div>
-
+   <h3 className="text-center mb-4">Current Game</h3>
+   {/* Add game details display */}
+   <pre className="mt-2 p-2 bg-gray-100 rounded">{JSON.stringify(currentGame, null, 2)}</pre>
  </div>
)
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const gameCreator = () => (
    <div className={`${theme.cardBg} p-4 rounded-sm w-full max-w-md`}>
      <h3 className="text-center mb-4">Create a new game</h3>
      {/* Add form elements for creating a game */}
    </div>
  )

  const gameViewer = () => (
    <div>
      <h3 className="text-center mb-4">Current Game</h3>
      {/* Add game details display */}
      <pre className="mt-2 p-2 bg-gray-100 rounded">{JSON.stringify(currentGame, null, 2)}</pre>
    </div>
  )
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:13Z
author_association: NONE
diff_hunk: @@ -0,0 +1,51 @@
+'use client';
+
+import { useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
+
+  const {theme} = useTelegram()
+
+  const [currentGame, setCurrentGame] = useState<Game | null>(null)
+
+  useEffect(() => {
+    initCurrentGame()
+  }, [])
+
+  const initCurrentGame = async () => {
+    setCurrentGame(await getActiveGame())
+  }
+
+  const gameCreator = (
+    <div>
+
+    </div>
+  )
+
+  const gameViewer = () => (
+    <div>
+
+    </div>
+  )
+
+  const createGame = () => {
+
+  }
+
+  const reshuffle = () => {
+
+  }
path: src/app/components/start.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Empty function implementations**

The `createGame` and `reshuffle` functions are defined but empty, yet they're used in the onClick handler. This will result in clicks that do nothing.


Implement these functions to fulfill their intended purpose as mentioned in the PR description:

```diff
const createGame = () => {
-
+  // Import and use createActiveGame from supabase-queries
+  import { createActiveGame } from "@lib/supabase-queries";
+  
+  const handleCreateGame = async () => {
+    try {
+      await createActiveGame();
+      // Refresh current game after creation
+      initCurrentGame();
+    } catch (error) {
+      console.error("Failed to create game:", error);
+      // Add error handling UI
+    }
+  }
}

const reshuffle = () => {
-
+  // Implement team reshuffling logic
+  if (!currentGame) return;
+  
+  // Add code to reshuffle teams
+  console.log("Reshuffling teams for game:", currentGame.id);
+  // Then refresh current game data
+  initCurrentGame();
}
```


> Committable suggestion skipped: line range outside the PR's diff.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:14Z
author_association: NONE
diff_hunk: @@ -0,0 +1,49 @@
+'use client';
+
+import Image from "next/image";
+import { useTelegram } from "@context/telegram-context";
+import { ScreenName } from "../page";
+import { useEffect, useState } from "react";
+import { isAdmin } from "@lib/supabase-queries";
+
+type FooterProps = {
+  setActiveScreen: (screen: ScreenName) => void;
+};
+
+export default function Footer({setActiveScreen} : FooterProps) {
+  const { launchParams, theme } = useTelegram();
+  const [admin, setAdmin] = useState<boolean>(false)
+
+  const initIsAdmin = async () => {
+    setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? 832467215))
+  }
path: src/app/components/footer.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Replace hardcoded user ID with environment variable**

The code contains a hardcoded user ID (832467215) as a fallback, which is not a secure or maintainable practice. Hardcoded IDs can lead to security issues and make the code harder to maintain.


```diff
- setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? 832467215))
+ setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? process.env.NEXT_PUBLIC_ADMIN_ID))
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const initIsAdmin = async () => {
-    setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? 832467215))
+    setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? process.env.NEXT_PUBLIC_ADMIN_ID))
  }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:14Z
author_association: NONE
diff_hunk: @@ -0,0 +1,49 @@
+'use client';
+
+import Image from "next/image";
+import { useTelegram } from "@context/telegram-context";
+import { ScreenName } from "../page";
+import { useEffect, useState } from "react";
+import { isAdmin } from "@lib/supabase-queries";
+
+type FooterProps = {
+  setActiveScreen: (screen: ScreenName) => void;
+};
+
+export default function Footer({setActiveScreen} : FooterProps) {
+  const { launchParams, theme } = useTelegram();
+  const [admin, setAdmin] = useState<boolean>(false)
+
+  const initIsAdmin = async () => {
+    setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? 832467215))
+  }
+
+  useEffect(() => {
+    initIsAdmin()
+  })
path: src/app/components/footer.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Fix infinite re-renders by adding dependency array to useEffect**

Without a dependency array, this useEffect hook will run after every render, potentially causing infinite re-renders and excessive API calls. Add an empty dependency array to ensure it only runs once during component mount.


```diff
useEffect(() => {
  initIsAdmin()
-})
+}, [])
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  useEffect(() => {
    initIsAdmin()
  }, [])
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Fixed in commit 06b70bd
created_at: 2025-03-13T00:01:14Z
author_association: NONE
diff_hunk: @@ -1,21 +1,29 @@
 'use client';
 
-import Hello from './components/hello';
-import RatingTable from './components/rating';
-import Vote from './components/vote';
-import { useTelegram } from './context/telegram-context';
+import History from '@components/history';
+import Leaderboard from '@components/leaderboard';
+import { JSX, useState } from 'react';
+import { useTelegram } from '@context/telegram-context';
+import Start from '@components/start';
+
+export type ScreenName = 'leaderboard' | 'history' | 'start';
 
 export default function Home() {
-  const { theme } = useTelegram();
+
+  const {theme} = useTelegram()
+
+  const [activeScreen] = useState<ScreenName>('leaderboard')
path: src/app/page.tsx
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Add state setter function to enable screen navigation**

The useState hook is destructured to only include the state value but not the setter function. This means the active screen cannot be changed programmatically, which will prevent the Footer component from working correctly when uncommented.


```diff
- const [activeScreen] = useState<ScreenName>('leaderboard')
+ const [activeScreen, setActiveScreen] = useState<ScreenName>('leaderboard')
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const [activeScreen, setActiveScreen] = useState<ScreenName>('leaderboard')
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:14Z
author_association: NONE
diff_hunk: @@ -74,4 +92,41 @@ export async function upsertUser(id: number, first_name: string, last_name: stri
   if (error) {
     console.error('Error updating user in Supabase:', error);
   }
+}
+
+export async function isAdmin(id: number) {
+  const result = await supabase.from('users').select('admin').eq('id', id).limit(1)
+
+  if (result.error) {
+    console.error('Error selecting admin status', result.error);
+    throw result.error;
+  }
+  if (result.data.length != 1) {
+    console.error('Error selecting admin status, user not found', result.error);
+    throw new Error('User not found')
+  }
+  return result.data[0].admin
+}
+
+export async function getActiveGame(): Promise<Game | null> {
+  const result = await supabase.from('games').select().eq('state', 'ACTIVE').limit(1)
+
+  if (result.error) {
+    console.error('Error getting active game', result.error);
+    throw result.error;
+  }
+
+  return result.data.length == 0
+    ? null
+    : result.data[0] as Game
+}
+
+export async function createActiveGame(game: Game) {
+  const result = await supabase.from('games').insert([game])
+
+  if (result.error) {
+    console.error('Error creating active game', result.error);
+    throw result.error;
+  }
+
 }
path: src/app/lib/supabase-queries.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Add a return value for consistency in error handling.**

Unlike other similar functions that return data or a success indicator, createActiveGame doesn't return anything on success. This could lead to confusion in error handling patterns.


```diff
export async function createActiveGame(game: Game) {
  const result = await supabase.from('games').insert([game])

  if (result.error) {
    console.error('Error creating active game', result.error);
    throw result.error;
  }
+  
+  return true; // or return result.data if needed
}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
export async function createActiveGame(game: Game) {
  const result = await supabase.from('games').insert([game])

  if (result.error) {
    console.error('Error creating active game', result.error);
    throw result.error;
  }
  
  return true; // or return result.data if needed
}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-13T00:01:14Z
author_association: NONE
diff_hunk: @@ -0,0 +1,51 @@
+'use client';
+
+import { useCallback, useEffect, useState } from "react";
+import { useTelegram } from "@context/telegram-context";
+import { Game, getActiveGame } from "@lib/supabase-queries";
+
+export default function Start() {
+
+  const {theme} = useTelegram()
+
+  const [currentGame, setCurrentGame] = useState<Game | null>(null)
+
+  const initCurrentGame = useCallback(async () => {
+    setCurrentGame(await getActiveGame())
+  }, [setCurrentGame])
+
+  useEffect(() => {
+    initCurrentGame()
+  }, [initCurrentGame])
+
+  const gameCreator = (
+    <div>
+
+    </div>
+  )
+
+  const gameViewer = () => (
+    <div>
+
+    </div>
+  )
+
+  const createGame = () => {
+
path: src/app/components/start.tsx
user: login: Copilot
body: [nitpick] The createGame function is currently empty; consider adding a TODO comment or a brief note that the implementation is pending for clarity.
```suggestion
    // TODO: Implement the createGame function
```
created_at: 2025-03-13T00:16:31Z
author_association: NONE
diff_hunk: @@ -1,21 +1,29 @@
 'use client';
 
-import Hello from './components/hello';
-import RatingTable from './components/rating';
-import Vote from './components/vote';
-import { useTelegram } from './context/telegram-context';
+import History from '@components/history';
+import Leaderboard from '@components/leaderboard';
+import { JSX, useState } from 'react';
+import { useTelegram } from '@context/telegram-context';
+import Start from '@components/start';
+
+export type ScreenName = 'leaderboard' | 'history' | 'start';
 
 export default function Home() {
-  const { theme } = useTelegram();
+
+  const {theme} = useTelegram()
+
+  const [activeScreen] = useState<ScreenName>('leaderboard')
+
path: src/app/page.tsx
user: login: Copilot
body: The activeScreen state is initialized without its updater function and the Footer is commented out, which leaves screen navigation non-interactive; consider including the state updater and uncommenting or providing a placeholder for future navigation support.
```suggestion
  const [activeScreen, setActiveScreen] = useState<ScreenName>('leaderboard')
```
created_at: 2025-03-13T00:16:31Z
author_association: NONE

PR comments:
user: login: vercel[bot]
created_at: 2025-03-12T23:40:57Z
body: Someone is attempting to deploy a commit to the **Konstantin S's projects** Team on [Vercel](https://vercel.com).

A member of the Team first needs to [authorize it](https://vercel.com/git/authorize?team=Konstantin%20S's%20projects&type=github&job=%7B%22headInfo%22%3A%7B%22sha%22%3A%2292f6cf00f646d314845637e2b3bcdec20eae16cf%22%7D%2C%22id%22%3A%22QmfVtf1NSHDCswMQtqj2HGSU97V6ABYC4e1bEb3wyasiQT%22%2C%22org%22%3A%22HavenDV%22%2C%22prId%22%3A11%2C%22repo%22%3A%22VolleyballRating%22%7D).


author_association: NONE
user: login: vercel[bot]
created_at: 2025-03-12T23:48:46Z
body: [vc]: #cGEwTzkhtMtBb2KURKCKB3Al/PtSvkFnpJf6VjpnFAY=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ2b2xsZXliYWxsLXJhdGluZyIsInJvb3REaXJlY3RvcnkiOm51bGwsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9rb25zdGFudGluLXNzLXByb2plY3RzL3ZvbGxleWJhbGwtcmF0aW5nL0FIVmlqRGpnZEdtcldaaDZQRDFGY1haTWFHM1oiLCJwcmV2aWV3VXJsIjoidm9sbGV5YmFsbC1yYXRpbmctZ2l0LWZvcmstZW1hcnRpLTMwOGRmYS1rb25zdGFudGluLXNzLXByb2plY3RzLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoidm9sbGV5YmFsbC1yYXRpbmctZ2l0LWZvcmstZW1hcnRpLTMwOGRmYS1rb25zdGFudGluLXNzLXByb2plY3RzLnZlcmNlbC5hcHAifX1dfQ==
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **volleyball-rating** | ✅ Ready ([Inspect](https://vercel.com/konstantin-ss-projects/volleyball-rating/AHVijDjgdGmrWZh6PD1FcXZMaG3Z)) | [Visit Preview](https://volleyball-rating-git-fork-emarti-308dfa-konstantin-ss-projects.vercel.app) | 💬 [**Add feedback**](https://vercel.live/open-feedback/volleyball-rating-git-fork-emarti-308dfa-konstantin-ss-projects.vercel.app?via=pr-comment-feedback-link) | Mar 13, 2025 0:15am |


author_association: NONE
user: login: HavenDV
created_at: 2025-03-12T23:53:15Z
body: @coderabbit
author_association: COLLABORATOR
user: login: coderabbitai[bot]
created_at: 2025-03-12T23:54:06Z
body: <!-- This is an auto-generated reply by CodeRabbit -->
> [!TIP]
> For best results, initiate chat on the files or code changes.

<details>
<summary>🧩 Analysis chain</summary>

🏁 Script executed:
```
#!/bin/bash
# Fetch PR details
gh pr view 11 --json title,body,baseRefName,headRefName,state,additions,deletions

# List files changed in the PR
gh pr view 11 --json files --jq '.files[].path'

# Use git to show the diff of all changed files
git diff $(git merge-base HEAD origin/main) HEAD
```

Length of output: 659

---

🏁 Script executed:
```
#!/bin/bash
# Examine the footer component which appears most relevant to the PR
cat src/app/components/footer.tsx

# Check the newly added SVG files
cat public/history.svg
cat public/leaderboard.svg
cat public/volleyball.svg

# Let's also examine the layout file to understand how the footer is integrated
cat src/app/layout.tsx

# Look at the new components mentioned in the files
cat src/app/components/history.tsx
cat src/app/components/leaderboard.tsx
```

Length of output: 8972

---

🏁 Script executed:
```
#!/bin/bash
# Check the main page to understand the app structure
cat src/app/page.tsx

# Examine the rating component referenced in the leaderboard
cat src/app/components/rating.tsx

# Look at the vote component referenced in the leaderboard
cat src/app/components/vote.tsx

# Check the start component mentioned in the footer
cat src/app/components/start.tsx

# Look at the hello component used in leaderboard
cat src/app/components/hello.tsx
```

Length of output: 22601

---



</details>

@HavenDV I notice you've pinged me to review PR #11 "Footer with additional menu items". Based on my analysis of the code, this PR:

1. Adds a footer navigation component with three menu items:
   - Leaderboard (rating table + voting)
   - Start game (admin-only feature)
   - History (currently empty)

2. Includes new SVG icons for these menu items

3. Implements screen switching functionality, but I notice the Footer component is currently commented out in page.tsx

Would you like me to review the implementation in detail, suggest improvements, or help with something specific about this PR?
author_association: NONE
user: login: HavenDV
created_at: 2025-03-12T23:54:48Z
body: @CodeRabbit yes please, устрой ему ЖЕСТКОЕ ревью
author_association: COLLABORATOR
user: login: coderabbitai[bot]
created_at: 2025-03-12T23:55:57Z
body: <!-- This is an auto-generated reply by CodeRabbit -->
<details>
<summary>🧩 Analysis chain</summary>

🏁 Script executed:
```
#!/bin/bash
# Get a detailed diff of all the changes in the PR
git diff $(git merge-base HEAD origin/main) HEAD > pr_diff.txt

# List all changed files
git diff --name-only $(git merge-base HEAD origin/main) HEAD

# Examine key files that were modified

# Check for code quality issues in footer.tsx
cat src/app/components/footer.tsx

# Check page.tsx to see why Footer might be commented out
cat src/app/page.tsx

# Examine supabase queries to check for efficiency and security concerns
cat src/app/lib/supabase-queries.ts

# Check for unused imports across components
grep -r "import" --include="*.tsx" --include="*.ts" src/app/components/
```

Length of output: 7930

---

🏁 Script executed:
```
#!/bin/bash
# Examine other key components
cat src/app/components/history.tsx
cat src/app/components/start.tsx

# Check the body of the PR to understand its purpose better
git show -s --format=%B HEAD

# Check if there are any ESLint or TypeScript configuration files
ls -la | grep -E "eslint|tsconfig"

# Look for style inconsistencies
find src -name "*.tsx" -o -name "*.ts" | xargs grep -l "useState" | xargs grep -l "useEffect" | xargs cat
```

Length of output: 25612

---



</details>

@HavenDV Провожу жесткое ревью для PR #11:

## Критические проблемы:

### 1. Бесконечные рендеры и излишние API вызовы:
```typescript
// footer.tsx
useEffect(() => {
  initIsAdmin()
}) // ОШИБКА: отсутствует массив зависимостей []
```

```typescript
// start.tsx
useEffect(() => {
  initCurrentGame()
}) // ОШИБКА: тот же самый антипаттерн
```

### 2. Захардкоженные значения:
```typescript
setAdmin(await isAdmin(launchParams?.tgWebAppData?.user?.id ?? 832467215))
// Недопустимо использовать хардкод ID 832467215
```

### 3. Пустые компоненты и неиспользуемый код:
```typescript
// History.tsx - полностью пустой компонент
export default function History() {
  return (<div></div>)
}
```

```typescript
// page.tsx - закомментированный основной компонент PR
{/* <Footer setActiveScreen={setActiveScreen}/> */}
```

### 4. Нарушения типизации:
```typescript
const gameViewer = (game) => ( // Отсутствует тип параметра
  <div></div>
)
```

### 5. Пустые реализации функций:
```typescript
const createGame = () => {}
const reshuffle = () => {}
```

### 6. Несогласованная обработка ошибок в API функциях:
```typescript
export async function createActiveGame(game: Game) {
  // Функция ничего не возвращает в случае успеха
}
```

### 7. Стилистические проблемы:
```typescript
<div className={`fixed bottom-0 h-12 p-2 w-full  ${theme.bg}`}>
// Лишний пробел перед ${theme.bg}
```

## Рекомендации:
1. Добавить правильные массивы зависимостей во все useEffect
2. Заменить захардкоженные ID на переменные окружения
3. Реализовать пустые компоненты или удалить их
4. Раскомментировать Footer и завершить его интеграцию
5. Добавить типизацию для всех параметров функций
6. Стандартизировать обработку ошибок
7. Исправить стилистические проблемы

PR требует серьезной доработки перед слиянием.

<details>
<summary>:white_check_mark: Actions performed</summary>

Review triggered.

> Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

</details>
author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-03-12T23:56:00Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough
The pull request introduces several new React components, including `Footer`, `History`, `Leaderboard`, and `Start`. The `Footer` component features clickable elements controlled by an admin state, while `Start` manages game state initialization. Additionally, import paths have been updated from relative to absolute, and the Supabase queries have been enhanced with new types and functions for game management. The layout styling has been adjusted, state-driven screen rendering has been implemented in the page component, and new TypeScript path mappings have been added for better organization.

## Changes

| File(s) | Change Summary |
|---------|----------------|
| `src/app/components/footer.tsx`<br>`src/app/components/history.tsx`<br>`src/app/components/leaderboard.tsx`<br>`src/app/components/start.tsx` | Added new React components. `Footer` includes clickable icons with admin-check logic; `History` is a basic client component; `Leaderboard` applies themed styling and embeds child components; `Start` manages game state with conditional rendering. |
| `src/app/components/rating.tsx`<br>`src/app/components/vote.tsx` | Updated component logic and imports. `Rating` now uses a directly imported Supabase client (removing `useRef`), and `Vote`’s import paths have been changed to absolute paths. |
| `src/app/layout.tsx` | Updated the import for `TelegramProvider` and enhanced the `<body>` styling by adding flex display and minimum height classes. |
| `src/app/lib/supabase-queries.ts` | Exported the Supabase client and introduced a new `Game` type, `GameState` enum, and functions (`isAdmin`, `getActiveGame`, `createActiveGame`) to manage game states and user administration. |
| `src/app/page.tsx` | Restructured the page to use state-based screen rendering with a new `ScreenName` type, replacing previous component imports. |
| `tsconfig.json` | Added new path mappings for module aliasing: `"@components/*"`, `"@context/*"`, `"@utils/*"`, and `"@lib/*"`. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant U as User
    participant H as Home (page.tsx)
    participant S as Screen Component
    U->>H: Select screen (leaderboard, history, start)
    H->>H: setState(activeScreen)
    H->>S: Render selected screen
```

```mermaid
sequenceDiagram
    participant S as Start Component
    participant Q as Supabase Queries
    S->>S: initCurrentGame()
    S->>Q: getActiveGame()
    Q-->>S: Return active game data (or null)
    alt Active game exists
        S->>S: Render game viewer
    else
        S->>S: Render game creator interface
    end
```

## Poem
> I'm a little rabbit with a hop and a spin,  
> Coding new features with a wide, cheeky grin.  
> Components added and imports now refined,  
> State flows smooth, every detail aligned.  
> With lines of code and a carrot so sweet,  
> I celebrate these changes—happy paws and beat! 🐰✨

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>⚡🧪 Multi-step agentic review comment chat (experimental)</summary>
> 
> - We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
> 						- To enable this feature, set early_access to true under in the settings.
> 
> </details>

<!-- announcements_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpADK2VmgqyjcEj2wAbb5AokAI7Y0riQ4rjedJAARABi+Pg0fADu6rDotLTq8PgYaH5sGNgoNMyIMZAAFLaQZgCM9QCUkHKQ2IiUkCTMLuIU+MjwGLgDtNgM0pCdUlR+ZLCYk0W4yAThsJ4Aavi+JLICBd421MNECkqHnRqQANL7jIsYpEMYDN7YShueaFk5efwAGaQcgpBTMbh5diIAA07W4tGoU3WuE2kAABohsNwVGhOmBgpR4NJ0ZBvPABFRXHDMPRmIp4ID4AxTnk1vhvpBesMeGhSGS0LJ8HgNEYAHIkMFMCFQkbIX5KeguEgcAxQdEJJKUdFcACCILQEngRFZWGlkPII0ggJI1GwFDOKCYGHlGCVtGYPMB2De4jyBRy0lF6oAEkgCK4dZB9ebZWFhjQ3dF1tlENxvILIAhEBHmQVIIjcGhgxiADK2pQUAT4Fy0KMxlgW9gbagoN4fJTyyBEAIk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oabYnvB2MRolim0qwSZMaA0BCA/Gn3dhtWM4Zns8yl7Rse4GbGNi72ImLARgCZDVlkZeQUvk+kUY9iWKPwP4KNkJi4R4OvQLtPRXaBZx4I5oFohQGShjhBYGgexqSE6C7o0OaWVshjhso7hfAslR0MzO4CszvebIu3OiGFYdFpYMQLgAAG0Yg5LJhkmTbRqyAAuraOVkydKWKxNWZrO1kwV0asnKlobONnA1g2FsyAFrJ1mw0nZMQI2UrIBag1nZrs62eGP1meyZWHgDeF8JYRHBZKAIxyNMHQ4WptGJnUUsFzOH2Vu4ZABcHX0tj5tY2PwckG1BLKXFLgbULRlZFwAiIq2mAKVOeB2gYNM2uvMKidJhH28p2Xbe0oiPnZ4NbpnvVKlAD4yrRZZPOUhq7hVl6y/ZVs3WUNXtke54ZeQEmUjJRm2i+5GQAeTtiHkYgVZZsoOZbLdkiM2OU83wjPOJmIyyZamO3EvNXYszV5ioYefMQ9nbyA5V1D2UbOnlEy55J8xefZQvlyyr5vpE2VszHk7z8xQc5+QfNfnHyF5sMwwAYAzTbxxoHAvNBjKLSZSS0aAMtPH0rSMpq0KgWtFoHrRppoFPqcEKUyErV5EAElHcpKDoBCVMaqaKBTAtSQrIVkWKX4AAAZUkAADgACctAFZCwqsgCB6gDAVJCws4UsKVkqSWgPUE4VkIBAp8XOCQHqArJ2FJAXOOwtoUEKIAkANhQIF4UCBJFkwXOKfFPhkIeF7C3OJwoYCIgyEJAFZLQFzhCLOF2iQEKklziMLT4DAQReoo0VQAXo6gEhbQDIUgpKFtAISn6n0BAA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=HavenDV/VolleyballRating&utm_content=11):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE