Skip to content

Commit

Permalink
add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
gautvm committed May 1, 2023
1 parent 572d1b5 commit 8290c5b
Show file tree
Hide file tree
Showing 39 changed files with 115 additions and 83 deletions.
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.next
node_modules
yarn.lock
yarn-error.log
next-env.d.ts
2 changes: 1 addition & 1 deletion README copy.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# COMING SOON
# COMING SOON
4 changes: 3 additions & 1 deletion components/EventData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const EventList = (props: any) => {
}`}
>
{props.search_array(newText, props.match.comp_level)}{" "}
{props.match.comp_level !== "qm" ? `${props.match.set_number} (Match ${props.match.match_number})` : props.match.match_number}
{props.match.comp_level !== "qm"
? `${props.match.set_number} (Match ${props.match.match_number})`
: props.match.match_number}
</span>{" "}
</a>
</Link>
Expand Down
4 changes: 3 additions & 1 deletion components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export const Header = (props: any) => {
>
{props.title}{" "}
<span
className={`text-lightGray ${isValidElement(props.title) && "ml-4"}`}
className={`text-lightGray ${
isValidElement(props.title) && "ml-4"
}`}
>
/ Scout Machine
</span>
Expand Down
37 changes: 23 additions & 14 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { API_URL, CURR_YEAR } from "@/lib/constants";
import Link from "next/link";
import Image from 'next/image'
import Image from "next/image";
import React, { useEffect, useState } from "react";
import { AiOutlineMenu } from "react-icons/ai";
import { RiRadarFill } from "react-icons/ri";
Expand Down Expand Up @@ -70,7 +70,7 @@ async function fetchTeamsData() {
return newTeamData;
}

export const Navbar = (props: { active?: string, dontScroll?: boolean }) => {
export const Navbar = (props: { active?: string; dontScroll?: boolean }) => {
const [teams, setTeams] = useState<any>();
const [searchTerm, setSearchTerm] = useState<string>("");
const [showLinks, setShowLinks] = useState(false);
Expand Down Expand Up @@ -118,7 +118,9 @@ export const Navbar = (props: { active?: string, dontScroll?: boolean }) => {
<>
<div
className={`${
isScrolled && !props.dontScroll ? "fixed top-0 left-0 right-0 z-50" : ""
isScrolled && !props.dontScroll
? "fixed top-0 left-0 right-0 z-50"
: ""
} pl-8 pr-8`}
>
{" "}
Expand Down Expand Up @@ -257,17 +259,24 @@ export const Navbar = (props: { active?: string, dontScroll?: boolean }) => {
)}
</div>
</div>
{session ? <div className="relative">
<Image
src={session?.user?.image!}
className="h-10 w-10 rounded-full"
width={50}
height={50}
alt="pfp"
/>
</div> : <button onClick={() => signIn("google")} className="text-sm flex border dark:border-[#2A2A2A] dark:bg-card py-1 px-4 text-lightGray font-medium rounded-lg ml-[-10px]">
<BsFillPersonFill className="text-lg mr-1" /> Sign Up
</button>}
{session ? (
<div className="relative">
<Image
src={session?.user?.image!}
className="h-10 w-10 rounded-full"
width={50}
height={50}
alt="pfp"
/>
</div>
) : (
<button
onClick={() => signIn("google")}
className="text-sm flex border dark:border-[#2A2A2A] dark:bg-card py-1 px-4 text-lightGray font-medium rounded-lg ml-[-10px]"
>
<BsFillPersonFill className="text-lg mr-1" /> Sign Up
</button>
)}
</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions components/Social.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const Social = (props: any) => {
return (
<p className={`flex ${props.className} hover:text-primary`}>
<props.icon className="text-2xl mr-1" /> {props.name}
</p>
);
};
return (
<p className={`flex ${props.className} hover:text-primary`}>
<props.icon className="text-2xl mr-1" /> {props.name}
</p>
);
};
4 changes: 3 additions & 1 deletion components/TwitchEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ interface Props {
export const TwitchEmbed = (props: Props) => {
return (
<iframe
src={`https://player.twitch.tv/?channel=${props.channel}&parent=${dev ? 'localhost' : 'machine.frc6070.ca'}&muted=true`}
src={`https://player.twitch.tv/?channel=${props.channel}&parent=${
dev ? "localhost" : "machine.frc6070.ca"
}&muted=true`}
className="rounded-lg border dark:border-[#2A2A2A] dark:bg-card hover:border-gray-600 px-2 py-3 max-w-full h-64 max-h-[500px]"
></iframe>
);
Expand Down
5 changes: 1 addition & 4 deletions components/headers/EventHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ export const EventHeader = (props: any) => {
</span>
<br />{" "}
{props.event.location_name && (
<a
href={props.event.gmaps_url}
target="_blank"
>
<a href={props.event.gmaps_url} target="_blank">
{props.event.location_name},
</a>
)}{" "}
Expand Down
3 changes: 1 addition & 2 deletions components/headers/TeamScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export const TeamScreen = (props: any) => {
href={`https://frc-events.firstinspires.org/team/${props.team.team_number}`}
target="_blank"
>

FIRST Inspires
FIRST Inspires
</a>
</p>
</div>
Expand Down
4 changes: 1 addition & 3 deletions components/tabs/event/Alliances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ export const AlliancesScreen = (props: any) => {
href={`/teams/${alliance.picks[3].slice(3)}`}
legacyBehavior
>
<a>
{alliance.picks[3].slice(3)}
</a>
<a>{alliance.picks[3].slice(3)}</a>
</Link>
) : (
<ImCross className="text-gray-500" />
Expand Down
5 changes: 4 additions & 1 deletion components/tabs/team/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export const AboutTab = (props: any) => {
<Card title="Event Wins:" desc={eventsWon} />
<Card title="Awards Won:" desc={props.team.teamAwards.length} />
<Card title="Avg Awards per Season:" desc={avgAwards} />
<Card title="Trips to FIRST Championship:" desc={firstChampionship.length} />
<Card
title="Trips to FIRST Championship:"
desc={firstChampionship.length}
/>
</div>
);
};
2 changes: 1 addition & 1 deletion lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ declare const global: Prisma;

export const db = global.prisma || new PrismaClient();

if (process.env.NODE_ENV === "development") global.prisma = db;
if (process.env.NODE_ENV === "development") global.prisma = db;
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ const nextConfig = {
},
],
},
}
};

module.exports = nextConfig
module.exports = nextConfig;
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint": "next lint && prettier --write .",
"generate": "prisma generate",
"push": "prisma db push",
"studio": "prisma studio"
Expand Down Expand Up @@ -35,5 +35,8 @@
"tailwindcss": "3.3.1",
"typescript": "5.0.4",
"use-debounce": "^9.0.4"
},
"devDependencies": {
"prettier": "^2.8.8"
}
}
2 changes: 1 addition & 1 deletion pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Navbar } from "@/components/Navbar";
import Link from "next/link";
import Head from 'next/head'
import Head from "next/head";

export default function Page404() {
return (
Expand Down
9 changes: 6 additions & 3 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import "@/styles/globals.css";
import "tailwindcss/tailwind.css";
import type { AppProps } from "next/app";
import { SessionProvider } from 'next-auth/react'
import { SessionProvider } from "next-auth/react";

export default function App({ Component, pageProps: { session, ...pageProps }, }: AppProps) {
export default function App({
Component,
pageProps: { session, ...pageProps },
}: AppProps) {
return (
<SessionProvider session={session}>
<Component {...pageProps} />
</SessionProvider>
)
);
}
4 changes: 2 additions & 2 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Html, Head, Main, NextScript } from 'next/document'
import { Html, Head, Main, NextScript } from "next/document";

export default function Document() {
return (
Expand All @@ -9,5 +9,5 @@ export default function Document() {
<NextScript />
</body>
</Html>
)
);
}
2 changes: 1 addition & 1 deletion pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export const authOptions = {
},
};

export default NextAuth(authOptions);
export default NextAuth(authOptions);
2 changes: 1 addition & 1 deletion pages/api/events/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
res: NextApiResponse
) {
return await fetchData(res, `events/${CURR_YEAR}`);
}
}
2 changes: 1 addition & 1 deletion pages/api/events/alliances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { event } = req.query;
return await fetchData(res, `event/${event}/alliances`);
}
}
2 changes: 1 addition & 1 deletion pages/api/events/matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team, year, event } = req.query;
return await fetchData(res, `team/frc${team}/event/${year}${event}/matches`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/awards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team } = req.query;
return await fetchData(res, `team/frc${team}/awards`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/districts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team } = req.query;
return await fetchData(res, `team/frc${team}/districts`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team, year } = req.query;
return await fetchData(res, `team/frc${team}/events/${year}`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team } = req.query;
return await fetchData(res, `team/frc${team}`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/socials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team } = req.query;
return await fetchData(res, `team/frc${team}/social_media`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default async function getTeams(
) {
const { team } = req.query;
return await fetchData(res, `team/frc${team}/events/${CURR_YEAR}/statuses`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { page } = req.query;
return await fetchData(res, `teams/${page}`);
}
}
2 changes: 1 addition & 1 deletion pages/api/team/years.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default async function getTeams(
) {
const { team } = req.query;
return await fetchData(res, `team/frc${team}/years_participated`);
}
}
11 changes: 5 additions & 6 deletions pages/events/[event]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { API_URL } from "@/lib/constants";
import { GetServerSideProps } from "next";
import { useRouter } from "next/router";
import { useState } from "react";
import Head from 'next/head'
import Head from "next/head";

export default function EventsPage({
matches,
Expand Down Expand Up @@ -95,9 +95,7 @@ export default function EventsPage({
<AlliancesScreen alliances={eventAlliances} />
)}

{activeTab === 5 && (
<TeamsScreen teams={eventTeams} />
)}
{activeTab === 5 && <TeamsScreen teams={eventTeams} />}
</div>
</div>
</div>
Expand Down Expand Up @@ -133,8 +131,9 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
.then((res) => res.json())
.catch(() => null);

const eventAwards = await fetch(`${API_URL}/api/events/awards?event=${event}`)
.then((res) => res.json())
const eventAwards = await fetch(
`${API_URL}/api/events/awards?event=${event}`
).then((res) => res.json());

return {
props: {
Expand Down
9 changes: 6 additions & 3 deletions pages/events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { getStorage, setStorage } from "@/util/localStorage";
import { formatTime } from "@/util/time";
import { log } from "@/util/log";
import { useState, useEffect } from "react";
import Head from 'next/head'
import Head from "next/head";

async function fetchEventsData() {
const eventsData = getStorage(`events_${CURR_YEAR}`);

if (eventsData) {
return eventsData;
}
Expand All @@ -22,7 +22,10 @@ async function fetchEventsData() {
next: { revalidate: 60 },
});

log("warning", `Fetching [/events/all] took ${formatTime(performance.now() - start)}`);
log(
"warning",
`Fetching [/events/all] took ${formatTime(performance.now() - start)}`
);

if (!res.ok) {
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion pages/fame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HOFTeams } from "@/lib/constants";
import Image from "next/image";
import Link from "next/link";
import { FaMedal } from "react-icons/fa";
import Head from 'next/head'
import Head from "next/head";

export default function HOFPage() {
return (
Expand Down
Loading

1 comment on commit 8290c5b

@vercel
Copy link

@vercel vercel bot commented on 8290c5b May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

machine – ./

machine-git-main-6070.vercel.app
scoutmachine.vercel.app
machine.frc6070.ca
machine-6070.vercel.app

Please sign in to comment.