Skip to content

Commit 93e8b6e

Browse files
Merge pull request #345 from Decatur-Robotics/main
Updating CS IA
2 parents e35505d + f742ac6 commit 93e8b6e

13 files changed

Lines changed: 667 additions & 229 deletions

File tree

.github/workflows/cd.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ name: CD
22

33
on:
44
workflow_call:
5-
secrets:
6-
SSL_KEY:
7-
required: true
8-
SSL_CERT:
9-
required: true
10-
ENV_FILE:
11-
required: true
125
workflow_dispatch: # Allows manual triggering of the workflow
136

147
permissions:
@@ -27,15 +20,6 @@ jobs:
2720

2821
- name: Create certs directory
2922
run: mkdir certs
30-
31-
- name: Write SSL key
32-
run: echo "${{ secrets.SSL_KEY }}" > certs/ssl.key
33-
34-
- name: Write SSL cert
35-
run: echo "${{ secrets.SSL_CERT }}" > certs/ssl.cert
36-
37-
- name: Write ENV file
38-
run: echo "${{ secrets.ENV_FILE }}" > .env
3923

4024
- name: Build and export
4125
uses: docker/build-push-action@v6

.github/workflows/onpush.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,4 @@ jobs:
1313
cd:
1414
needs:
1515
- ci
16-
uses: ./.github/workflows/cd.yml
17-
secrets:
18-
SSL_KEY: ${{ secrets.SSL_KEY }}
19-
SSL_CERT: ${{ secrets.SSL_CERT }}
20-
ENV_FILE: ${{ secrets.ENV_FILE }}
16+
uses: ./.github/workflows/cd.yml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Features full feature parity with SJ2, whilst remaining simpler, faster and cool
5353
1. Run `npm run test`
5454

5555
## Contributing
56-
You've made it past set up and are ready to contibure to the future scouting - here's how.
56+
You've made it past set up and are ready to contibure to the future of scouting - here's how.
5757

5858
We recommend you start with issues labelled `good first issue` to get a feel for the codebase. Fork the repo (unless you're part of Decatur Robotics, in which case make a new branch) and then make a pull request to the main branch. We'll review it and, if it looks good, merge it.
5959

components/competition/CompetitionIndex.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import CompHeaderCard from "./CompHeaderCard";
4646
import InsightsAndSettingsCard from "./InsightsAndSettingsCard";
4747
import MatchScheduleCard from "./MatchScheduleCard";
4848
import PitScoutingCard from "./PitScoutingCard";
49+
import toast from "react-hot-toast";
4950

5051
const api = new ClientApi();
5152

@@ -386,7 +387,7 @@ export default function CompetitionIndex(props: {
386387
}
387388

388389
if ((res.result as string).toLowerCase() !== "success") {
389-
alert(res.result);
390+
toast.error(res.result);
390391
}
391392

392393
setAssigningMatches(false);
@@ -395,11 +396,11 @@ export default function CompetitionIndex(props: {
395396
const reloadCompetition = async () => {
396397
const num = Math.floor(Math.random() * 1000000);
397398
if(prompt(`Are you sure you want to reload the competition? This will overwrite ALL your data. We CANNOT recover your data. If you are sure, type '${num}'`) !== String(num)) {
398-
alert("Cancelled");
399+
toast("Cancelled");
399400
return;
400401
}
401402

402-
alert("Reloading competition...");
403+
toast("Reloading competition...");
403404

404405
setUpdatingComp("Checking for Updates...");
405406
const res = await api.reloadCompetition(comp?._id!);

components/stats/Picklist.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function TeamCard(props: { cardData: CardData, draggable: boolean, picklist?: Pi
6969
return (
7070
<div
7171
className={`w-${props.width ?? "[150px]"} h-${props.height ?? "[100px]"} bg-base-100 rounded-lg p-1 flex items-center justify-center border-2 border-base-100 hover:border-primary`}
72-
ref={dragRef}
72+
ref={dragRef as unknown as () => void}
7373
>
7474
<h1>
7575
{props.rank !== undefined ? `${props.rank + 1}. ` : ""}<span className="max-sm:hidden">Team</span> <span className="text-accent">#{teamNumber}</span>
@@ -115,7 +115,7 @@ function PicklistCard(props: { picklist: Picklist, picklists: Picklist[] }) {
115115
return (
116116
<div
117117
className="bg-base-200 min-h-[30rem] h-fit rounded-lg w-1/3 sm:w-1/6 min-h-32 flex flex-col items-center space-y-2 p-2 sm:p-4"
118-
ref={dropRef}
118+
ref={dropRef as unknown as () => void}
119119
>
120120
<input defaultValue={picklist.name} className="w-[95%] input input-sm max-sm:hidden" onChange={changeName} />
121121
<h1 className="w-[95%] input input-sm input-disabled sm:hidden">{picklist.name}</h1>
@@ -148,7 +148,7 @@ export function TeamList(props: { teams: CardData[], picklists: Picklist[], expe
148148
});
149149

150150
return (
151-
<div ref={dropRef} className="w-full h-fit flex flex-row bg-base-300 space-x-2 p-2 overflow-x-scroll">
151+
<div ref={dropRef as unknown as () => void} className="w-full h-fit flex flex-row bg-base-300 space-x-2 p-2 overflow-x-scroll">
152152
{
153153
props.teams.sort((a, b) => a.number - b.number).map((team) => (
154154
<TeamCard

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const httpsOptions = {
2424

2525
console.log("HTTPS options set");
2626

27-
startSlackApp();
27+
// startSlackApp();
2828

2929
console.log("App preparing...");
3030
app.prepare().then(() => {

lib/Auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Analytics } from '@/lib/client/Analytics';
1111
import Email from "next-auth/providers/email";
1212
import ResendUtils from "./ResendUtils";
1313
import CollectionId from "./client/CollectionId";
14+
import { AdapterUser } from "next-auth/adapters";
1415

1516
var db = getDatabase();
1617

@@ -137,7 +138,7 @@ export const AuthenticationOptions: AuthOptions = {
137138
debug: false,
138139
adapter: {
139140
...adapter,
140-
createUser: async (user) => {
141+
createUser: async (user: Omit<AdapterUser, "id">) => {
141142
const createdUser = await adapter.createUser!(user);
142143

143144
Analytics.newSignUp(user.name ?? "Unknown User");

lib/api/AccessLevels.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ namespace AccessLevels {
6868
return { authorized: false, authData: undefined };
6969
}
7070

71-
console.log(team.owners, user._id?.toString());
72-
7371
return { authorized: team.owners.includes(user._id?.toString()!), authData: { team, comp } };
7472
}
7573

@@ -241,8 +239,6 @@ namespace AccessLevels {
241239
}
242240

243241
export async function IfOnTeamThatOwnsPicklist(req: NextApiRequest, res: ApiLib.ApiResponse<any>, { userPromise, db }: UserAndDb, picklistId: string) {
244-
console.log("IfOnTeamThatOwnsPicklist", picklistId);
245-
246242
const user = await userPromise;
247243
if (!user) {
248244
return { authorized: false, authData: undefined };
@@ -258,7 +254,6 @@ namespace AccessLevels {
258254
return { authorized: false, authData: undefined };
259255
}
260256

261-
console.log(team.users, user._id?.toString());
262257
return { authorized: team.users.includes(user._id?.toString()!), authData: { team, picklist } };
263258
}
264259
}

lib/api/ApiLib.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NextApiRequest, NextApiResponse } from "next";
22
import { OmitCallSignature } from "@/lib/Types";
3+
import toast from "react-hot-toast";
34

45
/**
56
* @tested_by tests/lib/api/ApiLib.test.ts
@@ -108,7 +109,7 @@ namespace ApiLib {
108109

109110
if (res?.error) {
110111
if (res.error === "Unauthorized") {
111-
alert(`Unauthorized API request: ${subUrl}. If this is an error, please contact the developers.`);
112+
toast.error(`Unauthorized API request: ${subUrl}. If this is an error, please contact the developers.`);
112113
}
113114
throw new Error(`${subUrl}: ${res.error}`);
114115
}

0 commit comments

Comments
 (0)