diff --git a/.github/workflows/github-lint-push.yml b/.github/workflows/github-lint-push.yml index e69de29..fc26294 100644 --- a/.github/workflows/github-lint-push.yml +++ b/.github/workflows/github-lint-push.yml @@ -0,0 +1,25 @@ +name: Lint Code + +on: + push: + branches: + - '**' # This triggers the action on any branch + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install dependencies + run: npm install + + - name: Run ESLint + run: npx eslint . --ext .js,.jsx,.ts,.tsx # Adjust extensions as needed diff --git a/app/(homepage)/page.js b/app/(homepage)/page.js deleted file mode 100644 index 1586724..0000000 --- a/app/(homepage)/page.js +++ /dev/null @@ -1,56 +0,0 @@ -// app/(homepage)/page.js (Home Component) -'use client' -import React from 'react' -// import Link from 'next/link' -import Dashboard from '../components/Dashboard.js' -// import styles from '../styles/Home.module.css' -// import { useAuth } from '../components/AuthWrapper' // Import useAuth - -const Home = () => { - // const { authUser, userProfile, handleSignOut } = useAuth() // Use useAuth hook to get the user and sign-out function - - return ( - /* -
-
-
-

BSA | Tennis Consulting

-
-
- {authUser ? ( - - ) : ( - - )} -
-
-
-

Match Viewer

- - {/* Search Dropdown */ /* } -
- -
- - {/* Other Links */ /* } -
-

Or get started by:

-
    -
  • - Uploading a match -
  • -
  • - Adding a Team -
  • -
  • - Tagging a match -
  • -
-
-
-
*/ - - ) -} - -export default Home diff --git a/app/(interactive)/dashboard/sampleData.js b/app/(interactive)/dashboard/sampleData.js deleted file mode 100644 index f4b2e5f..0000000 --- a/app/(interactive)/dashboard/sampleData.js +++ /dev/null @@ -1,1733 +0,0 @@ -const matchData = [ - { - // Vs. LMU - clientTeam: 'UCLA (M)', - clientPlayer: 'Giacomo Revelli', - opponentTeam: 'Loyola Marymount (M)', - opponentPlayer: 'Togan Tokac', - date: '1/17/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 7, - opponentGames: 6, - clientTiebreak: 7, - opponentTiebreak: 5 - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Jerry Shi', - opponentTeam: 'Loyola Marymount (M)', - opponentPlayer: 'Rafael Nadal ', - date: '1/17/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Carlos Alcaraz', - opponentTeam: 'Loyola Marymount (M)', - opponentPlayer: 'Frances Tiafoe ', - date: '1/17/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Ben Shelton', - opponentTeam: 'Loyola Marymount (M)', - opponentPlayer: 'Jannik Sinner ', - date: '1/17/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Texas - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Leo Cardozo', - opponentTeam: 'Texas (M)', - opponentPlayer: 'Carlos Alcaraz', - date: '5/15/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 3, - opponentGames: 6, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: { - clientGames: 7, - opponentGames: 6, - clientTiebreak: 9, - opponentTiebreak: 7 - } - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Leo Cardozo', - opponentTeam: 'Texas (M)', - opponentPlayer: 'Carlos Alcaraz', - date: '5/15/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 3, - opponentGames: 6, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: { - clientGames: 7, - opponentGames: 6, - clientTiebreak: 9, - opponentTiebreak: 7 - } - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Leo Cardozo', - opponentTeam: 'Texas (M)', - opponentPlayer: 'Carlos Alcaraz', - date: '5/15/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 3, - opponentGames: 6, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: { - clientGames: 7, - opponentGames: 6, - clientTiebreak: 9, - opponentTiebreak: 7 - } - } - }, - // Vs. Washington - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Hance/Wagle', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington (M)', - opponentPlayer: 'Roger Federer', - date: '8/12/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Oklahoma State - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Oklahoma State (M)', - opponentPlayer: 'Andy Murray ', - date: '4/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Oklahoma State (M)', - opponentPlayer: 'Andy Murray', - date: '4/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Oklahoma State (M)', - opponentPlayer: 'Andy Murray', - date: '4/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Oklahoma State (M)', - opponentPlayer: 'Andy Murray', - date: '4/2/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Oklahoma State (M)', - opponentPlayer: 'Andy Murray', - date: '4/2/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Oklahoma State (M)', - opponentPlayer: 'Andy Murray', - date: '4/2/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Ohio State - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ohio State (M)', - opponentPlayer: 'Andy Murray', - date: '2/6/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ohio State (M)', - opponentPlayer: 'Andy Murray', - date: '2/6/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ohio State (M)', - opponentPlayer: 'Andy Murray', - date: '2/6/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ohio State (M)', - opponentPlayer: 'Andy Murray', - date: '2/6/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ohio State (M)', - opponentPlayer: 'Andy Murray', - date: '2/6/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ohio State (M)', - opponentPlayer: 'Andy Murray', - date: '2/6/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. USC - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'USC (M)', - opponentPlayer: 'Andy Murray', - date: '1/25/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'USC (M)', - opponentPlayer: 'Andy Murray', - date: '1/25/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'USC (M)', - opponentPlayer: 'Andy Murray', - date: '1/25/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'USC (M)', - opponentPlayer: 'Andy Murray', - date: '1/25/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'USC (M)', - opponentPlayer: 'Andy Murray', - date: '1/25/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'USC (M)', - opponentPlayer: 'Andy Murray', - date: '1/25/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. UC Irvine - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'UCI (M)', - opponentPlayer: 'Andy Murray', - date: '1/19/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'UCI (M)', - opponentPlayer: 'Andy Murray', - date: '1/19/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'UCI (M)', - opponentPlayer: 'Andy Murray', - date: '1/19/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'UCI (M)', - opponentPlayer: 'Andy Murray', - date: '1/19/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'UCI (M)', - opponentPlayer: 'Andy Murray', - date: '1/19/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'UCI (M)', - opponentPlayer: 'Andy Murray', - date: '1/19/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. TCU - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'TCU (M)', - opponentPlayer: 'Andy Murray', - date: '1/11/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'TCU (M)', - opponentPlayer: 'Andy Murray', - date: '1/11/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'TCU (M)', - opponentPlayer: 'Andy Murray', - date: '1/11/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'TCU (M)', - opponentPlayer: 'Andy Murray', - date: '1/11/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'TCU (M)', - opponentPlayer: 'Andy Murray', - date: '1/11/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'TCU (M)', - opponentPlayer: 'Andy Murray', - date: '1/11/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Arizona - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Hance/Wagle', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Arizona (M)', - opponentPlayer: 'Roger Federer', - date: '1/5/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Duke - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: true, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'Hance/Wagle', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Singles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Duke (M)', - opponentPlayer: 'Roger Federer', - date: '1/2/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Ole Miss - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Ole Miss (M)', - opponentPlayer: 'Roger Federer', - date: '1/3/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Washington State - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington State (M)', - opponentPlayer: 'Roger Federer', - date: '1/1/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Washington State - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Washington State (M)', - opponentPlayer: 'Roger Federer', - date: '1/1/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - }, - // Vs. Rice - { - clientTeam: 'UCLA (M)', - clientPlayer: 'CJ Gimena', - opponentTeam: 'Rice (M)', - opponentPlayer: 'Roger Federer', - date: '1/4/24', - isTagged: false, - singlesDoubles: 'Doubles', - videoID: 'Z6F1Amn51528fzmVlHlV', - matchScore: { - set1: { - clientGames: 6, - opponentGames: 4, - clientTiebreak: null, - opponentTiebreak: null - }, - set2: { - clientGames: 6, - opponentGames: 3, - clientTiebreak: null, - opponentTiebreak: null - }, - set3: null - } - } -] - -export default matchData diff --git a/app/(interactive)/layout.js b/app/(interactive)/layout.js deleted file mode 100644 index 524c5dd..0000000 --- a/app/(interactive)/layout.js +++ /dev/null @@ -1,23 +0,0 @@ -// import { Inter } from "next/font/google"; -import Toolbar from '../components/Toolbar' -// import Footer from "../components/Footer" - -// const inter = Inter({ subsets: ["latin"] }); - -export const metadata = { - title: 'Tennis Video Viewer', - description: 'Next13 App Router for UCLA D1 Tennis' -} - -export default function RootLayout({ children }) { - return ( - /* - DON'T RETURN ADDITIONAL // tags in Next layout: - https://github.com/vercel/next.js/discussions/25049#discussioncomment-7225671 - */ - <> - - {children} - - ) -} diff --git a/app/components/AuthWrapper.js b/app/AuthWrapper.js similarity index 89% rename from app/components/AuthWrapper.js rename to app/AuthWrapper.js index a9e9106..5089b1e 100644 --- a/app/components/AuthWrapper.js +++ b/app/AuthWrapper.js @@ -7,9 +7,10 @@ import React, { useMemo } from 'react' import { onAuthStateChanged, signOut } from 'firebase/auth' -import { auth } from '../services/initializeFirebase' -import { getUserProfile } from '../services/userInfo' -import LandingPage from './LandingPage' + +import { auth } from '@/app/services/initializeFirebase' +import { getUserProfile } from '@/app/services/userInfo' +import LandingPage from '@/app/components/LandingPage' const AuthContext = createContext() diff --git a/app/components/DataProvider.js b/app/DataProvider.js similarity index 78% rename from app/components/DataProvider.js rename to app/DataProvider.js index f08e08f..1b2be2b 100644 --- a/app/components/DataProvider.js +++ b/app/DataProvider.js @@ -7,9 +7,11 @@ import React, { useContext } from 'react' import { collection, getDocs, doc, updateDoc, addDoc } from 'firebase/firestore' -import { db } from '../services/initializeFirebase.js' -import { useAuth } from './AuthWrapper.js' -import getTeams from '../services/getTeams.js' +import { ref, uploadBytes, getDownloadURL } from 'firebase/storage' + +import { db, storage } from '@/app/services/initializeFirebase.js' +import { useAuth } from '@/app/AuthWrapper.js' +import getTeams from '@/app/services/getTeams.js' const DataContext = createContext() @@ -91,6 +93,23 @@ export const DataProvider = ({ children }) => { const createMatch = useCallback(async (collectionName, newMatchData) => { try { + let pdfUrl = null + if (newMatchData.pdfFile) { + const pdfRef = ref(storage, `match-pdfs/${newMatchData.pdfFile.name}`) + const metadata = { + contentType: 'application/pdf' + } + + const snapshot = await uploadBytes( + pdfRef, + newMatchData.pdfFile.blob, + metadata + ) + pdfUrl = await getDownloadURL(snapshot.ref) + } + console.log(pdfUrl) + newMatchData.pdfFile = pdfUrl + const newMatch = { id: 'temp-id', collection: collectionName, @@ -109,11 +128,19 @@ export const DataProvider = ({ children }) => { }, []) const fetchLogos = useCallback(async () => { + // Cache expiry time, currently 24 hours + const CACHE_EXPIRY_MS = 24 * 60 * 60 * 1000 const storedLogos = localStorage.getItem('teamLogos') - if (storedLogos) { - setLogos(JSON.parse(storedLogos)) - setLogosLoading(false) - return + const storedTimeStamp = localStorage.getItem('teamLogosTimestamp') + + if (storedLogos && storedTimeStamp) { + // check if cache expired + const cacheAge = Date.now() - parseInt(storedTimeStamp, 10) + if (cacheAge < CACHE_EXPIRY_MS) { + setLogos(JSON.parse(storedLogos)) + setLogosLoading(false) + return + } } setLogosLoading(true) @@ -128,6 +155,7 @@ export const DataProvider = ({ children }) => { setLogos(logosMap) localStorage.setItem('teamLogos', JSON.stringify(logosMap)) + localStorage.setItem('teamLogosTimestamp', Date.now().toString()) } catch (err) { setLogosError(err) console.error('Error fetching team logos:', err) diff --git a/app/components/DashTileContainer.js b/app/components/DashTileContainer.js index b1e14c3..1c55f9d 100644 --- a/app/components/DashTileContainer.js +++ b/app/components/DashTileContainer.js @@ -1,8 +1,9 @@ import React from 'react' -import DashboardTile from './DashboardTile' -import styles from '../styles/Dashboard.module.css' +import DashboardTile from '@/app/components/DashboardTile' +import styles from '@/app/styles/Dashboard.module.css' -const DashTileContainer = ({ matches, matchType, onTileClick }) => { +const DashTileContainer = ({ matches, matchType, onTileClick, cols = 3 }) => { + const columnClass = `matchTileContainer--${cols}` return ( <> {matches.length > 0 && ( @@ -10,7 +11,9 @@ const DashTileContainer = ({ matches, matchType, onTileClick }) => {

{matchType}

-
+
{matches.map((match, idx) => (
{ set ? set.opponentTiebreak : null )} isUnfinished={false} - isTagged={match.isTagged} + isTagged={match.published} />
))} diff --git a/app/components/Dashboard.js b/app/components/Dashboard.js index 2d4f82f..e8fe404 100644 --- a/app/components/Dashboard.js +++ b/app/components/Dashboard.js @@ -2,18 +2,18 @@ import React, { useState, useMemo } from 'react' import { useRouter } from 'next/navigation' -import { useData } from './DataProvider' -import styles from '../styles/Dashboard.module.css' -import DashTileContainer from './DashTileContainer' -// import getTeams from '@/app/services/getTeams.js' -// import RosterList from './RosterList.js' import Fuse from 'fuse.js' + +import { useData } from '@/app/DataProvider' +import styles from '@/app/styles/Dashboard.module.css' + +import DashTileContainer from '@/app/components/DashTileContainer' +// import getTeams from '@/app/services/getTeams.js' +import RosterList from '@/app/components/RosterList.js' + import { searchableProperties } from '@/app/services/searchableProperties.js' import SearchIcon from '@/public/search' -// for log out -import { useAuth } from './AuthWrapper' - const formatMatches = (matches) => { return matches .filter((match) => match.version === 'v1') // Filter for version 'v1' @@ -25,19 +25,9 @@ const Dashboard = () => { const { matches, logos } = useData() const [searchTerm, setSearchTerm] = useState('') const [selectedMatchSets, setSelectedMatchSets] = useState([]) - + console.log(matches) const formattedMatches = formatMatches(matches) - - // for log out - const { handleSignOut } = useAuth() - - // default show latest match: TODO BUG causes infinite re-rendering - // useEffect(() => { - // if (formattedMatches.length > 0) { - // const latestMatchKey = `${formattedMatches[0].matchDate}#${formattedMatches[0].teams.opponentTeam}` - // setSelectedMatchSets([latestMatchKey]) - // } - // }, [formattedMatches]) + console.log(formattedMatches) // Fuzzy search const fuse = useMemo(() => { @@ -77,17 +67,28 @@ const Dashboard = () => { ) } - const displayMatchSets = searchTerm ? filteredMatchSets : selectedMatchSets + // A: Search Results + // B: Carousel Results + // Default: All + const displayMatchSets = useMemo(() => { + if (searchTerm) return filteredMatchSets + if (selectedMatchSets.length > 0) return selectedMatchSets + + // fetch all, arr(set(matches)) + return [ + ...new Set( + formattedMatches.map((match) => + match.matchDetails.duel + ? `${match.matchDate}#${match.teams.opponentTeam}` + : `_#${match.matchDetails.event}` + ) + ) + ] + }, [searchTerm, filteredMatchSets, selectedMatchSets, formattedMatches]) return (
-
-

BSA | Tennis Consulting

-
- -
-

Dashboard

@@ -119,7 +120,11 @@ const Dashboard = () => {
{formattedMatches.map((match, index) => { - const matchKey = `${match.matchDate}#${match.teams.opponentTeam}` + let matchKey = `${match.matchDate}#${match.teams.opponentTeam}` + if (!match.matchDetails.duel) { + console.log('EVENT') + matchKey = `_#${match.matchDetails.event}` + } return (
{ const singlesMatches = formattedMatches.filter( (match) => match.singles && - matchKey === `${match.matchDate}#${match.teams.opponentTeam}` + ((match.matchDetails.duel && + matchKey === + `${match.matchDate}#${match.teams.opponentTeam}`) || + (!match.matchDetails.duel && + matchKey === `_#${match.matchDetails.event}`)) ) const doublesMatches = formattedMatches.filter( (match) => !match.singles && - matchKey === `${match.matchDate}#${match.teams.opponentTeam}` + ((match.matchDetails.duel && + matchKey === + `${match.matchDate}#${match.teams.opponentTeam}`) || + (!match.matchDetails.duel && + matchKey === `_#${match.matchDetails.event}`)) ) + console.log(matchKey) const [matchDate, matchName] = matchKey.split('#') return (
-

{`v ${matchName}`}

+

{matchName}

{matchDate}
{
- {/* */} -

Roster being fixed ...

+ {} + {/*

Roster being fixed ...

*/}
diff --git a/app/components/DashboardMatch.js b/app/components/DashboardMatch.js index 5f508c5..3d6a7b8 100644 --- a/app/components/DashboardMatch.js +++ b/app/components/DashboardMatch.js @@ -1,7 +1,8 @@ import React from 'react' -import MatchTiles from './MatchTiles' + +import MatchTiles from '@/app/components/MatchTiles' import extractSetScores from '@/app/services/extractSetScores' -import styles from '../styles/DashboardMatch.module.css' // Import the CSS module +import styles from '@/app/styles/DashboardMatch.module.css' // Import the CSS module const calculateMatchDate = (matchInfo) => { if (matchInfo && matchInfo.length > 0 && matchInfo[0].matchDate) { diff --git a/app/components/DashboardTile.js b/app/components/DashboardTile.js index 8a6b970..0bd741a 100644 --- a/app/components/DashboardTile.js +++ b/app/components/DashboardTile.js @@ -1,6 +1,21 @@ -import React, { useEffect, useState } from 'react'; -import styles from '../styles/DashboardTile.module.css'; -import { useData } from './DataProvider'; +import React, { useEffect, useState } from 'react' + +import styles from '@/app/styles/DashboardTile.module.css' + +import { useData } from '@/app/DataProvider' + +// Calculate winner of match +const calculateWinner = (player1, player2) => { + const player1Total = player1.reduce( + (total, current) => (!isNaN(current.score) ? total + current.score : total), + 0 + ) + const player2Total = player2.reduce( + (total, current) => (!isNaN(current.score) ? total + current.score : total), + 0 + ) + return player1Total > player2Total +} const DashboardTile = ({ clientTeam, diff --git a/app/components/ExtendedList.js b/app/components/ExtendedList.js index 84b6b6d..9e0d775 100644 --- a/app/components/ExtendedList.js +++ b/app/components/ExtendedList.js @@ -1,10 +1,12 @@ import React, { useEffect, useState } from 'react' -import styles from '../styles/ExtendedList.module.css' + +import styles from '@/app/styles/ExtendedList.module.css' import getTeams from '@/app/services/getTeams.js' -import Winner from '../../public/Winner.js' -import Error from '../../public/Error.js' -import DoubleFault from '../../public/DoubleFault' -import PlayButton from '../../public/PlayButton' + +import Winner from '@/public/Winner.js' +import Error from '@/public/Error.js' +import DoubleFault from '@/public/DoubleFault' +import PlayButton from '@/public/PlayButton' const ExtendedList = ({ pointsData, diff --git a/app/components/FilterList.js b/app/components/FilterList.js index ed215dc..e7100e8 100644 --- a/app/components/FilterList.js +++ b/app/components/FilterList.js @@ -1,9 +1,8 @@ -// components/FilterList.js - import React, { useEffect, useState } from 'react' -import styles from '../styles/FilterList.module.css' -// This file renammes columns to more human-readable names -import nameMap from '../services/nameMap.js' + +import styles from '@/app/styles/FilterList.module.css' +// This file renames columns to more human-readable names +import nameMap from '@/app/services/nameMap.js' const exclusiveGroups = { player1ReturnFhBh: ['Forehand', 'Backhand'], diff --git a/app/components/Footer.js b/app/components/Footer.js index 9f0933d..6e9781b 100644 --- a/app/components/Footer.js +++ b/app/components/Footer.js @@ -1,5 +1,5 @@ -import styles from '../styles/Footer.module.css' -import '../styles/global.css' +import styles from '@/app/styles/Footer.module.css' +import '@/app/styles/globals.css' const Footer = () => { return ( diff --git a/app/components/LandingPage.js b/app/components/LandingPage.js index 4380db9..091cf3d 100644 --- a/app/components/LandingPage.js +++ b/app/components/LandingPage.js @@ -1,86 +1,91 @@ import Image from 'next/image' import { useState } from 'react' -import { useAuth } from '../components/AuthWrapper' +import styles from '@/app/styles/LandingPage.module.css' +import navStyles from '@/app/styles/Navbar.module.css' import SignIn from './SignIn' -import styles from '../styles/LandingPage.module.css' -export default function LandingPage() { - const [showSignIn, setShowSignIn] = useState(false) - const { authUser } = useAuth() +const Land = () => { + return ( +
+
+

BRUIN

+

SPORTS

+

ANALYTICS

+
+
+

Empowering Tennis Excellence

+

through Data-Driven Insights

+ +
+
+ Image 1 + Image 2 + Image 3 + Image 4 +
+
+
+ UCLA Logo +
+
+ ) +} - const handleSignIn = () => { - setShowSignIn(true) // Show SignIn component when Sign In button is clicked - } +const LandingPage = () => { + const [showSignIn, setShowSignIn] = useState(false) return (
- {!showSignIn ? ( - <> -
-
-

BSA | Tennis Consulting

-
-
- {!authUser && ( - // Show Sign In button + {/* STATIC NAVBAR: FOR SIGNIN */} +
+
+
+

BSA | Tennis Consulting

+
+ {!showSignIn ? ( + + ) : ( + )}
-
-

BRUIN

-

SPORTS

-

ANALYTICS

-
-
-

Empowering Tennis Excellence

-

through Data-Driven Insights

- -
-
- Image 1 - Image 2 - Image 3 - Image 4 -
-
-
- UCLA Logo -
- - ) : ( - - )} +
+
+ {/* show LandingPage or SignIn Page */} + {!showSignIn ? : }
) } + +export default LandingPage diff --git a/app/components/MatchTiles.js b/app/components/MatchTiles.js index 0d6b7fe..d2340f2 100644 --- a/app/components/MatchTiles.js +++ b/app/components/MatchTiles.js @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react' -import styles from '../styles/MatchTiles.module.css' + +import styles from '@/app/styles/MatchTiles.module.css' import getTeams from '@/app/services/getTeams.js' // Calculate winner of match @@ -16,7 +17,7 @@ const calculateWinner = (player1, player2) => { } const MatchTiles = ({ - matchName, + // matchName, clientTeam, opponentTeam, matchDetails, diff --git a/app/components/Navbar.js b/app/components/Navbar.js new file mode 100644 index 0000000..c7c4c64 --- /dev/null +++ b/app/components/Navbar.js @@ -0,0 +1,29 @@ +'use client' +import Link from 'next/link' + +import { useAuth } from '@/app/AuthWrapper' +import styles from '@/app/styles/Navbar.module.css' + +// Navbar is wrapped by Auth: show this when signed in +const Navbar = () => { + const { handleSignOut } = useAuth() + + return ( +
+
+
+

+ + BSA | Tennis Consulting + +

+
+ +
+
+
+
+ ) +} + +export default Navbar diff --git a/app/components/PlayerProfileHeader.js b/app/components/PlayerProfileHeader.js new file mode 100644 index 0000000..7d61ce8 --- /dev/null +++ b/app/components/PlayerProfileHeader.js @@ -0,0 +1,59 @@ +import React from 'react' +import Image from 'next/image' + +import styles from '@/app/styles/PlayerProfileHeader.module.css' // Assuming you have CSS module for styling +import govinImage from '@/public/images/govin.png' +import StatBox from '@/app/components/StatBox' + +const PlayerProfileHeader = ({ playerData }) => { + return ( +
+ {/* Player Basic Information */} +
+
+

{playerData.name.toUpperCase()}

+

+ Class : {playerData.class}  |  Height :{' '} + {playerData.height} +  | Age : {playerData.age} +

+ + {/* Player Bio */} +
+

{playerData.bio}

+
+
+
+ {/* Win Counters */} +
+

Filter

+ Icon +
+
+ + + +
+
+
+ + {/* Profile Picture */} +
+ {`${playerData.name}'s +
+
+ ) +} + +export default PlayerProfileHeader diff --git a/app/components/PointsList.js b/app/components/PointsList.js index b79e77f..179d45c 100644 --- a/app/components/PointsList.js +++ b/app/components/PointsList.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import styles from '../styles/PointsList.module.css' +import styles from '@/app/styles/PointsList.module.css' import getTeams from '@/app/services/getTeams.js' const PointsList = ({ diff --git a/app/components/RosterList.js b/app/components/RosterList.js index 540ccb9..005e933 100644 --- a/app/components/RosterList.js +++ b/app/components/RosterList.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react' -import RosterTile from './RosterTile' -import { db } from '../services/initializeFirebase.js' // Ensure storage is exported from initializeFirebase.js +import RosterTile from '@/app/components/RosterTile' +import { db } from '@/app/services/initializeFirebase.js' // Ensure storage is exported from initializeFirebase.js import { collection, getDocs } from 'firebase/firestore' const RosterList = () => { @@ -25,7 +25,7 @@ const RosterList = () => { } fetchTeams() - }, [mensRoster]) + }, []) return ( // entire container diff --git a/app/components/RosterTile.js b/app/components/RosterTile.js index 43e2378..9deb935 100644 --- a/app/components/RosterTile.js +++ b/app/components/RosterTile.js @@ -1,6 +1,6 @@ import React, { useState } from 'react' -import styles from '../styles/Roster.module.css' +import styles from '@/app/styles/Roster.module.css' const RosterTile = ({ firstName, lastName, playerPhoto }) => { const [playerClicked, setPlayerClicked] = useState(false) diff --git a/app/components/ScoreBoard.js b/app/components/ScoreBoard.js index 3cebd19..f31ece2 100644 --- a/app/components/ScoreBoard.js +++ b/app/components/ScoreBoard.js @@ -24,11 +24,11 @@ const ScoreBoard = ({ const [localPlayData, setLocalPlayData] = useState(playData); - useEffect(() => { //smooth transition effect when scores change + useEffect(() => { if (playData) { const timeout = setTimeout(() => { setLocalPlayData(playData); - }, 100); + }, 500); return () => clearTimeout(timeout); } }, [playData]); @@ -55,7 +55,7 @@ const ScoreBoard = ({ key={index} style={{ position: 'relative', - opacity: score.score > player2FinalScores[index]?.score ? '100%' : '40%' + opacity: score.score > player2FinalScores[index].score ? 1 : 0.4 }} > {player1TieScores[index] ? ( @@ -80,9 +80,7 @@ const ScoreBoard = ({ ) : null )} - {player1GameScore} + {player1GameScore} {pointScore ? player1PointScore : player1TiebreakScore} @@ -97,7 +95,7 @@ const ScoreBoard = ({ key={index} style={{ position: 'relative', - opacity: score.score > player2FinalScores[index]?.score ? '100%' : '40%' + opacity: score.score > player1FinalScores[index].score ? 1 : 0.4 }} > {player2TieScores[index] ? ( @@ -121,9 +119,7 @@ const ScoreBoard = ({ ) : null )} - {player2GameScore} + {player2GameScore} {pointScore ? player2PointScore : player2TiebreakScore} diff --git a/app/components/SignIn.js b/app/components/SignIn.js index 2f1a33b..30573c7 100644 --- a/app/components/SignIn.js +++ b/app/components/SignIn.js @@ -1,16 +1,12 @@ -// components/SignIn.js import React, { useState } from 'react' import { getAuth, signInWithEmailAndPassword } from 'firebase/auth' -import styles from '../styles/SignIn.module.css' -import { useAuth } from './AuthWrapper' +import styles from '@/app/styles/SignIn.module.css' -const SignInPage = () => { +const SignIn = () => { const [credentials, setCredentials] = useState({ username: '', password: '' }) const [error, setError] = useState(null) - const { authUser, userProfile, handleSignOut } = useAuth() // Use useAuth hook to get the user and sign-out function console.log(error) - console.log(userProfile) const handleSignIn = async (e) => { e.preventDefault() @@ -32,18 +28,6 @@ const SignInPage = () => { return (
-
-
-

BSA | Tennis Consulting

-
-
- {authUser ? ( - - ) : ( - - )} -
-
@@ -101,4 +85,4 @@ const SignInPage = () => { ) } -export default SignInPage +export default SignIn diff --git a/app/components/StatBox.js b/app/components/StatBox.js new file mode 100644 index 0000000..909898b --- /dev/null +++ b/app/components/StatBox.js @@ -0,0 +1,14 @@ +import styles from '@/app/styles/StatBox.module.css' + +const StatBox = ({ stat, statNum }) => { + return ( +
+
+

{stat}

+

{statNum}

+
+
+ ) +} + +export default StatBox diff --git a/app/components/TileList.js b/app/components/TileList.js deleted file mode 100644 index 9bba7dc..0000000 --- a/app/components/TileList.js +++ /dev/null @@ -1,68 +0,0 @@ -'use client' - -import { useEffect, useState } from 'react' -import DashboardMatch from './DashboardMatch.js' -import { db } from '../services/initializeFirebase.js' -import transformData from '../services/transformData.js' -// import MatchTiles from './MatchTiles.js' -// import extractSetScores from '../services/extractSetScores.js' -import { getDocs, collection } from 'firebase/firestore' - -const groupByDate = (matches) => { - const grouped = {} - // Group matches into arrays by date - matches.forEach((match) => { - const date = match.matchDate || 'unknown' - if (!grouped[date]) { - grouped[date] = [] - } - grouped[date].push(match) - }) - // Convert the object into an array of arrays and sort by date descending - return Object.entries(grouped) - .sort((a, b) => { - // Convert date strings to Date objects for comparison - // 'unknown' dates are treated as the earliest possible date - const dateA = a[0] === 'unknown' ? new Date(0) : new Date(a[0]) - const dateB = b[0] === 'unknown' ? new Date(0) : new Date(b[0]) - return dateB - dateA // Sort descending - }) - .map((entry) => entry[1]) // Extract only the arrays of matches -} - -const TileList = () => { - const [matchList, setMatchList] = useState([]) - - useEffect(() => { - const fetchMatches = async () => { - try { - const querySnapshot = await getDocs(collection(db, 'UCLA (W)')) - // Iterate over each document, transform the data, and collect the results - const transformedMatches = querySnapshot.docs.map((doc) => { - const data = doc.data() // Get the data of each document - return transformData(data) // Assuming transformData is a function you have that processes each document's data - }) - const sortedDate = groupByDate(transformedMatches) - setMatchList(sortedDate) // Update your state with the transformed matches - } catch (error) { - console.error('Error fetching data:', error) - } - } - - fetchMatches() - }, []) - - return ( -
- {matchList && - matchList.map( - (matches, index) => - matches.length > 0 && ( - - ) - )} -
- ) -} - -export default TileList diff --git a/app/components/Toolbar.js b/app/components/Toolbar.js deleted file mode 100644 index fc34652..0000000 --- a/app/components/Toolbar.js +++ /dev/null @@ -1,22 +0,0 @@ -'use client' -import React from 'react' -import Link from 'next/link' - -import styles from '../styles/Toolbar.module.css' -import '../styles/global.css' - -const Toolbar = () => { - // const [user, setUser] = useState(null) - return ( -
- {/* Toolbar content goes here */} - - Match Viewer - - {/* Matches */} - {/* Add more links or content as needed */} -
- ) -} - -export default Toolbar diff --git a/app/layout.js b/app/layout.js index ee96bc7..5c21c1f 100644 --- a/app/layout.js +++ b/app/layout.js @@ -1,10 +1,17 @@ -// import { Inter } from "next/font/google"; -// import Toolbar from "./components/Toolbar" -import Footer from './components/Footer' -import { AuthProvider } from './components/AuthWrapper' -import { DataProvider } from './components/DataProvider' +import Navbar from '@/app/components/Navbar' +import Footer from '@/app/components/Footer' +import { AuthProvider } from '@/app/AuthWrapper' +import { DataProvider } from '@/app/DataProvider' -// const inter = Inter({ subsets: ["latin"] }); +import '@/app/styles/globals.css' +// eslint-disable-next-line camelcase +import { DM_Sans } from 'next/font/google' + +const dmSans = DM_Sans({ + subsets: ['latin'], // Only include the Latin subset (can be expanded) + weights: ['400', '500', '700'], // Include desired font weights + display: 'swap' // Ensure the text remains visible during font loading +}) export const metadata = { title: 'Tennis Video Viewer', @@ -19,9 +26,9 @@ export default function RootLayout({ children }) { - {/* */} -
+
+ {children}
diff --git a/app/(interactive)/match-list/page.js b/app/match-list/page.js similarity index 96% rename from app/(interactive)/match-list/page.js rename to app/match-list/page.js index dea8fc7..88a0857 100644 --- a/app/(interactive)/match-list/page.js +++ b/app/match-list/page.js @@ -2,7 +2,7 @@ import React from 'react' import Link from 'next/link' -import { useData } from '../../components/DataProvider' // Assuming the hook is located in the context folder +import { useData } from '@/app/DataProvider' const formatMatches = (matches) => { return matches diff --git a/app/(interactive)/matches/[slug]/page.js b/app/matches/[slug]/page.js similarity index 94% rename from app/(interactive)/matches/[slug]/page.js rename to app/matches/[slug]/page.js index 5265756..d50751a 100644 --- a/app/(interactive)/matches/[slug]/page.js +++ b/app/matches/[slug]/page.js @@ -3,17 +3,20 @@ import React, { useState, useEffect, useRef } from 'react' import { usePathname } from 'next/navigation' -import filterListStyles from '../../../styles/FilterList.module.css' -import styles from '../../../styles/Match.module.css' -import VideoPlayer from '../../../components/VideoPlayer' -import FilterList from '../../../components/FilterList' -import PointsList from '../../../components/PointsList' -import ScoreBoard from '../../../components/ScoreBoard' -import MatchTiles from '@/app/components/MatchTiles' -import { useData } from '@/app/components/DataProvider' -import ExtendedList from '../../../components/ExtendedList' +import { useData } from '@/app/DataProvider' + import nameMap from '@/app/services/nameMap' +import filterListStyles from '@/app/styles/FilterList.module.css' +import styles from '@/app/styles/Match.module.css' + +import VideoPlayer from '@/app/components/VideoPlayer' +import FilterList from '@/app/components/FilterList' +import PointsList from '@/app/components/PointsList' +import ScoreBoard from '@/app/components/ScoreBoard' +import MatchTiles from '@/app/components/MatchTiles' +import ExtendedList from '@/app/components/ExtendedList' + const MatchPage = () => { const [matchData, setMatchData] = useState() const [filterList, setFilterList] = useState([]) @@ -58,11 +61,11 @@ const MatchPage = () => { return p }) - setMatchData((prev) => ({ ...prev, points: updatedPoints })) + setMatchData((prev) => ({ ...prev, pointsJson: updatedPoints })) setBookmarks(updatedPoints.filter((p) => p.bookmarked)) try { - await updateMatch(docId, { points: updatedPoints }) + await updateMatch(docId, { pointsJson: updatedPoints }) } catch (error) { console.error('Error updating bookmarks:', error) } @@ -212,7 +215,7 @@ const MatchPage = () => { player2TieScores={matchData.pointsJson.map( (point) => point.player2TiebreakScore )} - isUnfinished={matchData.matchDetails.status === 'unfinished'} + isUnfinished={matchData.matchDetails.unfinished} displaySections={{ score: true, info: true, matchup: true }} />
@@ -396,7 +399,7 @@ const MatchPage = () => { player2TieScores={matchData.pointsJson.map( (point) => point.player2TiebreakScore )} - isUnfinished={matchData.matchDetails.status === 'unfinished'} + isUnfinished={matchData.matchDetails.unfinished} displaySections={{ score: true, info: true, matchup: true }} />
@@ -426,7 +429,7 @@ const MatchPage = () => { {showPDF ? (