Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a8b1b3a
Add .prettierignore to exclude package-lock.json and node_modules
renatodellosso Dec 5, 2024
d1af03b
Autoformat all files
renatodellosso Dec 5, 2024
2de640a
Merge branch 'main' into autoformatter
renatodellosso Dec 5, 2024
f0ea1a8
Autoformatted ClientApi.ts
renatodellosso Dec 5, 2024
0dcf30d
Refactor countdown component styles to use object syntax for value as…
renatodellosso Dec 5, 2024
571c469
Add TypeScript ESLint plugin to configuration
renatodellosso Dec 5, 2024
b30d199
Remove TypeScript ESLint plugin from configuration
renatodellosso Dec 5, 2024
d1bc2fe
Merge branch 'main' into autoformatter
renatodellosso Dec 10, 2024
1935663
Merge branch 'main' into autoformatter
renatodellosso Dec 10, 2024
67f0737
Fix formatting
renatodellosso Dec 10, 2024
e11e7e0
Merge branch 'main' into autoformatter
renatodellosso Dec 10, 2024
ba465f3
Merge pull request #357 from Decatur-Robotics/autoformatter
renatodellosso Dec 10, 2024
30a305d
[npm]: Bump next from 15.0.3 to 15.1.0
dependabot[bot] Dec 10, 2024
ff4ddd1
Merge pull request #367 from Decatur-Robotics/dependabot/npm_and_yarn…
BanEvading Dec 10, 2024
08ff53c
Add alt tags to images
renatodellosso Dec 10, 2024
010672d
Add eslintignore
renatodellosso Dec 10, 2024
b331f88
Add ignores for node_modules and coverage in ESLint configuration
renatodellosso Dec 10, 2024
d15211e
Remove .eslintignore
renatodellosso Dec 10, 2024
4d60355
Fix remaining linter warnings
renatodellosso Dec 10, 2024
6553d0b
Configured lint command to ignore coverage directory
renatodellosso Dec 10, 2024
e4efb3e
Merge branch 'main' into fix-eslint-warnings
renatodellosso Dec 10, 2024
422513f
Fixed formatting issues
renatodellosso Dec 10, 2024
7c09846
Merge pull request #369 from Decatur-Robotics/fix-eslint-warnings
Tr01ler Dec 10, 2024
b4352e1
Require lint for cd
renatodellosso Dec 10, 2024
c1f26ab
Move the lint action into ci
renatodellosso Dec 10, 2024
e490b80
Pause CD action
renatodellosso Dec 10, 2024
599d77f
Remove Slack and SW from index
renatodellosso Dec 12, 2024
28ebf11
Refactor PitScoutingCard link generation, enhance ESLint config, and …
renatodellosso Dec 14, 2024
b202c3d
Refactor pit report variable naming and update test parameters for cl…
renatodellosso Dec 14, 2024
7a8b11d
Refactor PitScoutingCard to use Button for navigation and implement u…
renatodellosso Dec 14, 2024
145218a
Refactor PitScoutingCard to replace Button with anchor tags for navig…
renatodellosso Dec 14, 2024
78f4923
[npm]: Bump react-icons from 5.3.0 to 5.4.0
dependabot[bot] Dec 16, 2024
a3a873e
[npm]: Bump daisyui from 4.12.14 to 4.12.22
dependabot[bot] Dec 16, 2024
bd255d3
Merge pull request #376 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 17, 2024
4ccfb75
Merge branch 'main' into dependabot/npm_and_yarn/react-icons-5.4.0
renatodellosso Dec 17, 2024
86af4ca
[npm]: Bump @eslint/js from 9.16.0 to 9.17.0
dependabot[bot] Dec 17, 2024
2b2d9e7
Merge pull request #375 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 17, 2024
a0ebef9
Merge branch 'main' into dependabot/npm_and_yarn/eslint/js-9.17.0
renatodellosso Dec 17, 2024
f499a8b
[npm]: Bump @slack/web-api from 7.7.0 to 7.8.0
dependabot[bot] Dec 17, 2024
858a113
Merge pull request #374 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 17, 2024
96b5a7f
Merge branch 'main' into dependabot/npm_and_yarn/slack/web-api-7.8.0
renatodellosso Dec 17, 2024
d86e06d
[npm]: Bump @yudiel/react-qr-scanner from 2.0.8 to 2.1.0
dependabot[bot] Dec 17, 2024
6d2296a
Merge pull request #373 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 17, 2024
4c69c10
Merge branch 'main' into dependabot/npm_and_yarn/yudiel/react-qr-scan…
renatodellosso Dec 17, 2024
5b2ec2e
Merge pull request #372 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export
uses: docker/build-push-action@v6
with:
Expand All @@ -23,14 +23,31 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
node-version: "20"

- name: Install dependencies
run: npm install

- name: Unit tests
run: npm run test
run: npm run test

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Lint
run: npm run lint
3 changes: 1 addition & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
node-version: "20"

- name: Install dependencies
run: npm install

- name: Check formatting
run: npm run prettier-check

27 changes: 0 additions & 27 deletions .github/workflows/lint.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/onpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
ci:
uses: ./.github/workflows/ci.yml

cd:
needs:
- ci
uses: ./.github/workflows/cd.yml
# cd:
# needs:
# - ci
# uses: ./.github/workflows/cd.yml
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package-lock.json
/node_modules
22 changes: 11 additions & 11 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"recommendations": [
"ms-azuretools.vscode-docker",
"formulahendry.docker-explorer",
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"mongodb.mongodb-vscode",
"pmneo.tsimporter",
"austenc.tailwind-docs",
"bradlc.vscode-tailwindcss",
]
}
"recommendations": [
"ms-azuretools.vscode-docker",
"formulahendry.docker-explorer",
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"mongodb.mongodb-vscode",
"pmneo.tsimporter",
"austenc.tailwind-docs",
"bradlc.vscode-tailwindcss"
]
}
122 changes: 77 additions & 45 deletions components/AddToSlack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,89 @@ import { useState } from "react";
import Modal, { hideModal, showModal } from "./Modal";
import ClientApi from "@/lib/api/ClientApi";

const SLACK_WEBHOOK_INSTALL_URL = "https://my.slack.com/services/new/incoming-webhook/";
const SLACK_WEBHOOK_INSTALL_URL =
"https://my.slack.com/services/new/incoming-webhook/";

const api = new ClientApi();

function AddToSlackModal({ teamId }: { teamId: string }) {
const [webhookUrl, setWebhookUrl] = useState<string>();
const [errorMsg, setErrorMsg] = useState<string>("");
const [webhookUrl, setWebhookUrl] = useState<string>();
const [errorMsg, setErrorMsg] = useState<string>("");

function save() {
if (!webhookUrl) {
setErrorMsg("Webhook URL is required");
return;
}
function save() {
if (!webhookUrl) {
setErrorMsg("Webhook URL is required");
return;
}

api.setSlackWebhook(teamId, webhookUrl)
.catch((err) => setErrorMsg(err.message))
.then(() => hideModal("add-to-slack"));
}
api
.setSlackWebhook(teamId, webhookUrl)
.catch((err) => setErrorMsg(err.message))
.then(() => hideModal("add-to-slack"));
}

return (
<Modal id="add-to-slack" showCloseButton={false} className="flex flex-col gap-4">
<h2 className="text-xl">Add Gearbox to Slack</h2>
<div>
Install the Incoming Webhooks app here:{" "}
<a href={SLACK_WEBHOOK_INSTALL_URL} target="_blank" className="link link-accent">{SLACK_WEBHOOK_INSTALL_URL}</a>
</div>
<div>
Enter the Webhook URL here:
<input
value={webhookUrl}
onChange={(e) => setWebhookUrl(e.target.value)}
type="url"
placeholder="Webhook URL"
className="input input-bordered ml-2"
/>
</div>
<div className="flex gap-4 w-full justify-end">
<button className="btn btn-primary" onClick={save}>Save</button>
<button className="btn" onClick={() => hideModal("add-to-slack")}>Cancel</button>
</div>
{ errorMsg && <div className="text-red-500">{errorMsg}</div> }
</Modal>
);
return (
<Modal
id="add-to-slack"
showCloseButton={false}
className="flex flex-col gap-4"
>
<h2 className="text-xl">Add Gearbox to Slack</h2>
<div>
Install the Incoming Webhooks app here:{" "}
<a
href={SLACK_WEBHOOK_INSTALL_URL}
target="_blank"
className="link link-accent"
>
{SLACK_WEBHOOK_INSTALL_URL}
</a>
</div>
<div>
Enter the Webhook URL here:
<input
value={webhookUrl}
onChange={(e) => setWebhookUrl(e.target.value)}
type="url"
placeholder="Webhook URL"
className="input input-bordered ml-2"
/>
</div>
<div className="flex gap-4 w-full justify-end">
<button
className="btn btn-primary"
onClick={save}
>
Save
</button>
<button
className="btn"
onClick={() => hideModal("add-to-slack")}
>
Cancel
</button>
</div>
{errorMsg && <div className="text-red-500">{errorMsg}</div>}
</Modal>
);
}

export default function AddToSlack({ edit, teamId }: { edit: boolean, teamId: string }) {
return (<>
<button className="btn btn-accent btn-sm" onClick={() => showModal("add-to-slack")}>
{ edit ? "Change Slack Webhook" : "Add Gearbox to Slack" }
</button>
<AddToSlackModal teamId={teamId} />
</>
);
}
export default function AddToSlack({
edit,
teamId,
}: {
edit: boolean;
teamId: string;
}) {
return (
<>
<button
className="btn btn-accent btn-sm"
onClick={() => showModal("add-to-slack")}
>
{edit ? "Change Slack Webhook" : "Add Gearbox to Slack"}
</button>
<AddToSlackModal teamId={teamId} />
</>
);
}
72 changes: 40 additions & 32 deletions components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,46 @@ import { levelToClassName } from "@/lib/Xp";
import { BsGearFill } from "react-icons/bs";

export default function Avatar(props: {
user?: User | undefined;
scale?: string | undefined;
imgHeightOverride?: string | undefined;
showLevel?: boolean | undefined;
borderThickness?: number | undefined;
onClick?: () => void | undefined;
className?: string | undefined;
online?: boolean;
user?: User | undefined;
scale?: string | undefined;
imgHeightOverride?: string | undefined;
showLevel?: boolean | undefined;
borderThickness?: number | undefined;
onClick?: () => void | undefined;
className?: string | undefined;
online?: boolean;
}) {
const { session, status } = useCurrentSession();
const user = props.user ?? session?.user;
const image = user?.image ?? "/user.jpg";
const levelClass = levelToClassName(user?.level);
const admin = user?.admin;
const { session, status } = useCurrentSession();
const user = props.user ?? session?.user;
const image = user?.image ?? "/user.jpg";
const levelClass = levelToClassName(user?.level);
const admin = user?.admin;

return (
<div className={`avatar ${props.online && "online"} ${props.scale} ${props.className}`}>
{ (props.showLevel ?? true) &&
<div className="absolute z-10 bg-base-100 rounded-tl-xl rounded-br-xl h-6 w-14 text-center text-sm font-semibold">
LVL: {user?.level}
</div>
}
<div className={`w-28 ${props.imgHeightOverride ?? "h-28"} rounded-xl border-${props.borderThickness ?? 4} ${levelClass}`}>
<img src={image} onClick={props.onClick}></img>
</div>
{admin ? (
<div className="absolute z-10 -bottom-2 -left-2 text-slate-300 animate-spin-slow">
<BsGearFill size={36}></BsGearFill>
</div>
) : (
<></>
)}
</div>
);
return (
<div
className={`avatar ${props.online && "online"} ${props.scale} ${props.className}`}
>
{(props.showLevel ?? true) && (
<div className="absolute z-10 bg-base-100 rounded-tl-xl rounded-br-xl h-6 w-14 text-center text-sm font-semibold">
LVL: {user?.level}
</div>
)}
<div
className={`w-28 ${props.imgHeightOverride ?? "h-28"} rounded-xl border-${props.borderThickness ?? 4} ${levelClass}`}
>
<img
src={image}
alt={"Avatar"}
onClick={props.onClick}
></img>
</div>
{admin ? (
<div className="absolute z-10 -bottom-2 -left-2 text-slate-300 animate-spin-slow">
<BsGearFill size={36}></BsGearFill>
</div>
) : (
<></>
)}
</div>
);
}
Loading
Loading