Skip to content

Commit

Permalink
Merge branch 'develop' into alex/414-bug-bash-add-alert-when-pick-is-…
Browse files Browse the repository at this point in the history
…upda
  • Loading branch information
alexappleget committed Jul 19, 2024
2 parents 1236a94 + 49148fe commit 1f26a02
Show file tree
Hide file tree
Showing 48 changed files with 122 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/apiFunctions.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { IEntry } from '@/app/league/[leagueId]/entry/Entries.interface';
import { IEntry } from '@/app/(main)/league/[leagueId]/entry/Entries.interface';

export interface IAccountData {
email: string;
Expand Down
2 changes: 1 addition & 1 deletion api/apiFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Query } from 'appwrite';
import {
IEntry,
IEntryProps,
} from '@/app/league/[leagueId]/entry/Entries.interface';
} from '@/app/(main)/league/[leagueId]/entry/Entries.interface';

/**
* Register a new account
Expand Down
14 changes: 14 additions & 0 deletions app/(admin)/admin/leagues/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { JSX } from 'react';

/**
* Renders the admin page.
* @returns {JSX.Element} - The rendered login page.
*/
const AdminLeagues = (): JSX.Element => {
return <div>Admin Leagues</div>;
};

export default AdminLeagues;
14 changes: 14 additions & 0 deletions app/(admin)/admin/notifications/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { JSX } from 'react';

/**
* Renders the admin page.
* @returns {JSX.Element} - The rendered login page.
*/
const AdminNotifications = (): JSX.Element => {
return <div>Admin Notifications</div>;
};

export default AdminNotifications;
14 changes: 14 additions & 0 deletions app/(admin)/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { JSX } from 'react';

/**
* Renders the admin page.
* @returns {JSX.Element} - The rendered login page.
*/
const AdminHome = (): JSX.Element => {
return <div>Admin Home</div>;
};

export default AdminHome;
14 changes: 14 additions & 0 deletions app/(admin)/admin/players/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { JSX } from 'react';

/**
* Renders the admin page.
* @returns {JSX.Element} - The rendered login page.
*/
const AdminPlayers = (): JSX.Element => {
return <div>Admin Players</div>;
};

export default AdminPlayers;
46 changes: 46 additions & 0 deletions app/(admin)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import React, { JSX } from 'react';
import { GeistSans } from 'geist/font/sans';
import '../globals.css';
import { AuthContextProvider } from '@/context/AuthContextProvider';
import ErrorBoundary from '../error';
import { Toaster } from 'react-hot-toast';

const defaultUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: 'http://localhost:3000';

export const metadata = {
metadataBase: new URL(defaultUrl),
title: 'GridIron Survivor',
description: 'Fantasy Football Survivor Pool',
};

/**
* The root layout for the application.
* @param props - The props
* @param props.children - The children
* @returns The rendered root layout.
*/
const RootLayout = ({
children,
}: {
children: React.ReactNode;
}): JSX.Element => {
return (
<html lang="en" className={GeistSans.className}>
<body className="dark:dark bg-background pb-8 px-4 text-foreground xl:pb-0">
<ErrorBoundary>
<AuthContextProvider>
<main>{children}</main>
<Toaster />
</AuthContextProvider>
</ErrorBoundary>
</body>
</html>
);
};

export default RootLayout;
4 changes: 2 additions & 2 deletions app/layout.tsx → app/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import React, { JSX } from 'react';
import { GeistSans } from 'geist/font/sans';
import './globals.css';
import '../globals.css';
import Nav from '@/components/Nav/Nav';
import { AuthContextProvider } from '@/context/AuthContextProvider';
import ErrorBoundary from './error';
import ErrorBoundary from '../error';
import { Toaster } from 'react-hot-toast';

const defaultUrl = process.env.VERCEL_URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => {
}

try {
const scheduleData = await import(`@/app/schedule/2024/week${week}.json`);
const scheduleData = await import(
`@/app/(main)/schedule/2024/week${week}.json`
);
setSchedule(scheduleData.events);
} catch (error) {
console.error('Could not load week data:', error);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/login/page.test.tsx → app/(main)/login/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jest.mock('next/navigation', () => ({
},
}));

jest.mock('../../context/AuthContextProvider', () => ({
jest.mock('../../../context/AuthContextProvider', () => ({
useAuthContext() {
return {
...mockUseAuthContext,
Expand Down
2 changes: 1 addition & 1 deletion app/login/page.tsx → app/(main)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
FormField,
FormItem,
FormMessage,
} from '../../components/Form/Form';
} from '../../../components/Form/Form';

const LoginUserSchema = z.object({
email: z
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { toast } from 'react-hot-toast';
const mockLogin = jest.fn();
const mockPush = jest.fn();

jest.mock('../../api/apiFunctions', () => ({
jest.mock('../../../api/apiFunctions', () => ({
registerAccount: jest.fn(),
}));

Expand Down Expand Up @@ -37,7 +37,7 @@ jest.mock('next/navigation', () => ({
},
}));

jest.mock('../../context/AuthContextProvider', () => ({
jest.mock('../../../context/AuthContextProvider', () => ({
useAuthContext() {
return mockUseAuthContext;
},
Expand Down
2 changes: 1 addition & 1 deletion app/register/page.tsx → app/(main)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
FormField,
FormItem,
FormMessage,
} from '../../components/Form/Form';
} from '../../../components/Form/Form';
import { toast } from 'react-hot-toast';
import Alert from '@/components/AlertNotification/AlertNotification';
import { AlertVariants } from '@/components/AlertNotification/Alerts.enum';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ const alertVariants = cva(
const Alert = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
>(({ variant, children }) => (
>(({ variant, children }, ref) => (
<div
role="alert"
className={alertVariants({ variant })}
ref={ref}
>{children}</div>
));
Alert.displayName = 'Alert';
Expand Down
3 changes: 2 additions & 1 deletion components/LeagueCard/LeagueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ const LeagueCard = React.forwardRef<HTMLAnchorElement, ILeagueCardProps>(
survivors,
title,
totalPlayers,
}) => (
}, ref) => (
<Link
data-testid="LeagueCard"
href={href}
className={cn(
'LeagueCard flex max-h-32 place-items-center gap-6 rounded-lg border bg-card p-4 text-card-foreground shadow-sm dark:border-zinc-800 hover:bg-zinc-800 transition',
)}
ref={ref}
>
<Image
alt="League Logo"
Expand Down
2 changes: 1 addition & 1 deletion components/Nav/Nav.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import Nav from './Nav';
import Login from '@/app/login/page';
import Login from '@/app/(main)/login/page';

const mockPush = jest.fn();
const mockUsePathname = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion utils/utils.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
IUser,
IWeeklyPicks,
} from '@/api/apiFunctions.interface';
import { IEntry } from '@/app/league/[leagueId]/entry/Entries.interface';
import { IEntry } from '@/app/(main)/league/[leagueId]/entry/Entries.interface';

export interface IGetGameData {
userId: IUser['id'];
Expand Down
4 changes: 2 additions & 2 deletions utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
IGetUserPick,
} from './utils.interface';
import { ILeague } from '@/api/apiFunctions.interface';
import { IEntry } from '@/app/league/[leagueId]/entry/Entries.interface';
import { IEntry } from '@/app/(main)/league/[leagueId]/entry/Entries.interface';

/**
* Combine class names
Expand Down Expand Up @@ -143,4 +143,4 @@ export const getUserLeagues = async (
*/
export const getUserEntries = async (userId: IUser['id'], leagueId: ILeague['leagueId']): Promise<IEntry[]> => {
return await getCurrentUserEntries(userId, leagueId);
}
}

0 comments on commit 1f26a02

Please sign in to comment.