Skip to content

Commit

Permalink
cs: fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
nehalist committed Apr 15, 2024
1 parent 1187152 commit ff07858
Show file tree
Hide file tree
Showing 24 changed files with 197 additions and 152 deletions.
6 changes: 3 additions & 3 deletions src/app/[locale]/(home)/login.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";

import { LoginProviderIcon } from "@/components/login-provider-icon";
import { Card, CardBody } from "@nextui-org/card";
import { getProviders, signIn } from "next-auth/react";
import { useState } from "react";
import { Button, Input } from "@nextui-org/react";
import { LoginProviderIcon } from "@/components/login-provider-icon";
import { getProviders, signIn } from "next-auth/react";
import { useSearchParams } from "next/navigation";
import { useState } from "react";

interface LoginProps {
providers: Awaited<ReturnType<typeof getProviders>>;
Expand Down
2 changes: 1 addition & 1 deletion src/app/[locale]/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LandingPage } from "@/app/[locale]/(home)/landing-page";
import { Home } from "@/app/[locale]/(home)/home";
import { LandingPage } from "@/app/[locale]/(home)/landing-page";
import { getCurrentUser } from "@/lib/session";
import { getProviders } from "next-auth/react";

Expand Down
8 changes: 3 additions & 5 deletions src/app/[locale]/(home)/teams/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { getLeagueTeams, getSelectedUserLeague } from "@/db/model/league";
import { TeamsTable } from "@/app/[locale]/(home)/teams-table";
import { getLeagueTeams, getSelectedUserLeague } from "@/db/model/league";

export default async function Teams() {
const currentLeague = await getSelectedUserLeague();

if (! currentLeague) {
if (!currentLeague) {
return null;
}

const teams = await getLeagueTeams(currentLeague.id);

return (
<TeamsTable teams={teams} />
);
return <TeamsTable teams={teams} />;
}
4 changes: 2 additions & 2 deletions src/app/[locale]/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode } from "react";
import { Link } from "@/lib/navigation";
import { Container } from "@/components/container";
import { Link } from "@/lib/navigation";
import { ReactNode } from "react";

const nav = [
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/[locale]/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getCurrentUser } from "@/lib/session";
import { redirect } from "@/lib/navigation";
import { Card, CardBody, CardHeader } from "@nextui-org/card";
import { db } from "@/db";
import { leagues, matches, memberships, teams, users } from "@/db/schema";
import { redirect } from "@/lib/navigation";
import { getCurrentUser } from "@/lib/session";
import { Card, CardBody, CardHeader } from "@nextui-org/card";
import { eq, sql } from "drizzle-orm";

async function getStats() {
Expand Down
6 changes: 3 additions & 3 deletions src/app/[locale]/invite/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { InviteForm } from "@/app/[locale]/invite/form";
import { Container } from "@/components/container";
import { getLeagueByInviteCode, userIsInLeague } from "@/db/model/league";
import { notFound } from "next/navigation";
import { InviteForm } from "@/app/[locale]/invite/form";
import { getCurrentUser } from "@/lib/session";
import { redirect } from "@/lib/navigation";
import { getCurrentUser } from "@/lib/session";
import { notFound } from "next/navigation";

export default async function Invite({
searchParams,
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/my/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode } from "react";
import { Link } from "@/lib/navigation";
import { Container } from "@/components/container";
import { Link } from "@/lib/navigation";
import { ReactNode } from "react";

export default function MyLayout({ children }: { children: ReactNode }) {
const nav = [
Expand Down
6 changes: 3 additions & 3 deletions src/app/[locale]/my/leagues/[id]/content.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";

import { MembershipsTable } from "@/app/[locale]/my/leagues/[id]/memberships-table";
import { InviteCode } from "@/app/[locale]/my/leagues/[id]/invite-code";
import { LeagueSettings } from "@/app/[locale]/my/leagues/[id]/settings";
import { LeagueStatus } from "@/app/[locale]/my/leagues/[id]/league-status";
import { User } from "@/db/schema";
import { MembershipsTable } from "@/app/[locale]/my/leagues/[id]/memberships-table";
import { LeagueSettings } from "@/app/[locale]/my/leagues/[id]/settings";
import { getLeagueWithMemberships } from "@/db/model/league";
import { User } from "@/db/schema";

export function LeagueManagementContent({
league,
Expand Down
2 changes: 1 addition & 1 deletion src/app/[locale]/my/leagues/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CreateLeagueForm } from "@/app/[locale]/my/leagues/create/form";
import { getTranslations } from "next-intl/server";
import { MyHeader } from "@/app/[locale]/my/my-header";
import { getTranslations } from "next-intl/server";

export default async function CreateLeague() {
const t = await getTranslations("my.leagues.create");
Expand Down
2 changes: 1 addition & 1 deletion src/app/[locale]/my/leagues/league-header-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { Button } from "@nextui-org/react";
import { Link } from "@/lib/navigation";
import { Button } from "@nextui-org/react";
import { useTranslations } from "next-intl";

export function LeagueHeaderActions() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/my/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MyHeader } from "@/app/[locale]/my/my-header";
import { SettingsForm } from "@/app/[locale]/my/settings/form";
import { redirect } from "next/navigation";
import { getCurrentUser } from "@/lib/session";
import { Card, CardBody, CardHeader } from "@nextui-org/card";
import { Divider } from "@nextui-org/react";
import { MyHeader } from "@/app/[locale]/my/my-header";
import { getTranslations } from "next-intl/server";
import { redirect } from "next/navigation";

export default async function Settings() {
const user = await getCurrentUser();
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";

import { ReactNode } from "react";
import { NextUIProvider } from "@nextui-org/react";
import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes";
import { SessionProvider } from "next-auth/react";
import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes";
import { ReactNode } from "react";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

Expand Down
2 changes: 1 addition & 1 deletion src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NextAuth from "next-auth";
import { authOptions } from "@/lib/auth";
import NextAuth from "next-auth";

const handler = NextAuth(authOptions);

Expand Down
23 changes: 16 additions & 7 deletions src/components/achievement-list.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import { Achievement, League } from "@/db/schema";
import { AchievementCard } from "@/components/achievement-card";
import { Achievement, League } from "@/db/schema";

interface AchievementListProps {
achievements: Achievement[];
league: League;
}

export function AchievementList({ achievements, league }: AchievementListProps) {
return <ul className="flex flex-col gap-3">
{achievements.map(achievement => (
<AchievementCard achievement={achievement} league={league} key={achievement.id} />
))}
</ul>
export function AchievementList({
achievements,
league,
}: AchievementListProps) {
return (
<ul className="flex flex-col gap-3">
{achievements.map(achievement => (
<AchievementCard
achievement={achievement}
league={league}
key={achievement.id}
/>
))}
</ul>
);
}
2 changes: 1 addition & 1 deletion src/components/game-chip.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { GameIcon } from "@/components/game-icon";
import { Game, games } from "@/lib/games";
import { Chip } from "@nextui-org/react";
import { GameIcon } from "@/components/game-icon";

export function GameChip({ game }: { game: Game["id"] }) {
const gameData = games.find(g => g.id === game);
Expand Down
2 changes: 1 addition & 1 deletion src/components/game-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { Game, games } from "@/lib/games";
import { ReactNode } from "react";
import { GiChessPawn, GiShuttlecock, GiSoccerField } from "react-icons/gi";
import { FaTrophy } from "react-icons/fa";
import { GiChessPawn, GiShuttlecock, GiSoccerField } from "react-icons/gi";

export function GameIcon({ game: game }: { game: Game["id"] }) {
const gameData = games.find(g => g.id === game);
Expand Down
2 changes: 1 addition & 1 deletion src/components/league-status-chip.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { Chip } from "@nextui-org/react";
import { leagueStatusEnum } from "@/db/schema";
import { Chip } from "@nextui-org/react";

export function LeagueStatusChip({
status,
Expand Down
4 changes: 2 additions & 2 deletions src/components/locale-switcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useLocale, useTranslations } from "next-intl";
import { locales } from "@/i18n";
import { usePathname, useRouter } from "@/lib/navigation";
import {
Button,
Expand All @@ -9,7 +9,7 @@ import {
DropdownMenu,
DropdownTrigger,
} from "@nextui-org/react";
import { locales } from "@/i18n";
import { useLocale, useTranslations } from "next-intl";

export function LocaleSwitcher() {
const locale = useLocale();
Expand Down
2 changes: 1 addition & 1 deletion src/components/theme-switcher.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useTheme } from "next-themes";
import { Button } from "@nextui-org/react";
import { useTheme } from "next-themes";
import { MdDarkMode, MdLightMode } from "react-icons/md";

export function ThemeSwitcher() {
Expand Down
3 changes: 1 addition & 2 deletions src/components/time-distance.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use client";

import { useEffect, useState } from "react";
import { differenceInHours, format, formatDistance } from "date-fns";
import { useLocale } from "next-intl";
import { useEffect, useState } from "react";

const threshold = 24;

Expand Down
2 changes: 1 addition & 1 deletion src/db/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { client, db } from "@/db";
import "dotenv/config";
import { migrate } from "drizzle-orm/postgres-js/migrator";
import { client, db } from "@/db";

(async () => {
await migrate(db, { migrationsFolder: "./drizzle" });
Expand Down
2 changes: 1 addition & 1 deletion src/db/model/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { User, users } from "@/db/schema";
import { db } from "@/db";
import { User, users } from "@/db/schema";
import { eq } from "drizzle-orm";

export async function getUserById(id: string) {
Expand Down
Loading

0 comments on commit ff07858

Please sign in to comment.