Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
413e238
[npm]: Bump react and @types/react
dependabot[bot] Sep 23, 2024
bee8073
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Sep 23, 2024
592a7bb
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Sep 25, 2024
fa9aeaa
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Sep 27, 2024
2114299
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Oct 3, 2024
0bf077d
[npm]: Bump typescript from 5.0.4 to 5.6.2
dependabot[bot] Oct 7, 2024
8dbc39d
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.6.2
renatodellosso Oct 7, 2024
e4a9657
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.6.2
renatodellosso Oct 8, 2024
a81e082
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.6.2
renatodellosso Oct 8, 2024
d453ad5
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.6.2
renatodellosso Oct 12, 2024
185ce1d
[npm]: Bump cloc from 2.0.0-cloc to 2.11.0
dependabot[bot] Oct 20, 2024
12d1019
[npm]: Bump jose from 5.9.3 to 5.9.6
dependabot[bot] Oct 20, 2024
4328393
Merge branch 'main' into dependabot/npm_and_yarn/cloc-2.11.0
renatodellosso Oct 21, 2024
b5dc18e
Merge branch 'main' into dependabot/npm_and_yarn/jose-5.9.6
renatodellosso Oct 21, 2024
f8775a6
[npm]: Bump socket.io from 4.8.0 to 4.8.1
dependabot[bot] Oct 28, 2024
e8e7c7f
Merge branch 'main' into dependabot/npm_and_yarn/socket.io-4.8.1
renatodellosso Nov 3, 2024
063f901
Merge branch 'main' into dependabot/npm_and_yarn/jose-5.9.6
renatodellosso Nov 3, 2024
f314c84
Merge branch 'main' into dependabot/npm_and_yarn/cloc-2.11.0
renatodellosso Nov 3, 2024
83ddd05
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.6.2
renatodellosso Nov 3, 2024
bf0ac42
Merge branch 'main' into dependabot/npm_and_yarn/cloc-2.11.0
renatodellosso Nov 12, 2024
70073c5
[npm]: Bump the npm_and_yarn group with 3 updates
dependabot[bot] Nov 15, 2024
50e89ca
Merge branch 'main' into dependabot/npm_and_yarn/socket.io-4.8.1
renatodellosso Nov 15, 2024
f614b74
Merge branch 'main' into dependabot/npm_and_yarn/socket.io-4.8.1
renatodellosso Nov 15, 2024
aebf7b9
Merge branch 'main' into dependabot/npm_and_yarn/jose-5.9.6
renatodellosso Nov 15, 2024
302e502
Merge branch 'main' into dependabot/npm_and_yarn/cloc-2.11.0
renatodellosso Nov 15, 2024
cc20e0a
Removed PWA
renatodellosso Nov 18, 2024
7ed5279
Merge branch 'main' into remove-pwa
renatodellosso Nov 19, 2024
249a642
Removed PWA-specific files and un-PWAified comp page
renatodellosso Nov 19, 2024
b4d2691
Merge branch 'remove-pwa' of github.com:Decatur-Robotics/Gearbox into…
renatodellosso Nov 19, 2024
ae044b7
Remove CompetitionIndex
renatodellosso Nov 19, 2024
1a7cc55
Un-PWAified Container
renatodellosso Nov 19, 2024
e9bb6ed
Merge branch 'main' into dependabot/npm_and_yarn/cloc-2.11.0
renatodellosso Nov 19, 2024
581d165
Merge branch 'main' into dependabot/npm_and_yarn/jose-5.9.6
renatodellosso Nov 19, 2024
a8045cc
Merge branch 'main' into dependabot/npm_and_yarn/socket.io-4.8.1
renatodellosso Nov 19, 2024
e149af9
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.6.2
renatodellosso Nov 19, 2024
fde3f2e
Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-f014aee0bc
renatodellosso Nov 19, 2024
6427c21
UnPWAified the stats page
renatodellosso Nov 21, 2024
cea3246
De-PWAified Form
renatodellosso Nov 21, 2024
2ed2de6
Remove unneeded import
renatodellosso Nov 21, 2024
f22b7a8
Test signed commit
renatodellosso Nov 21, 2024
b6ab47c
Test signed commit 2
renatodellosso Nov 21, 2024
7cbcaf2
Test signed commit 3
renatodellosso Nov 21, 2024
edd8d07
UnPWAify Pit Reports
renatodellosso Nov 21, 2024
0d739fb
Remove QR code sharing feature and unused SubjectiveReportForm component
renatodellosso Nov 21, 2024
9e264aa
UnPWAify Picklists
renatodellosso Nov 21, 2024
d196e3d
Remove import from offline utils
renatodellosso Nov 21, 2024
62c1cdd
Fixed unPWAifying issues
renatodellosso Nov 22, 2024
8847c12
Merge branch 'main' into remove-pwa
renatodellosso Nov 22, 2024
c65170c
Refactor CD workflow to remove secret handling and streamline job con…
renatodellosso Nov 23, 2024
189eef7
Reworked Slack notifications to use webhooks
renatodellosso Nov 23, 2024
fccd7ad
Unit tests for setSlackWebhook
renatodellosso Nov 23, 2024
6f77b8f
Merge pull request #253 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 23, 2024
ff50599
Merge pull request #265 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 23, 2024
62624e7
Merge pull request #267 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 23, 2024
83dbb32
Merge pull request #270 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 23, 2024
fa185e8
Remove loading box on team index page
renatodellosso Nov 23, 2024
421fc2e
No comps message for season page
renatodellosso Nov 23, 2024
d377bb4
Whitespace changed in double ternary
renatodellosso Nov 23, 2024
d16b1de
Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-f014aee0bc
renatodellosso Nov 23, 2024
36f5a14
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Nov 23, 2024
de5c76f
refactor: update createUser type to Omit<AdapterUser, "id"> for bette…
renatodellosso Nov 23, 2024
21e81f1
Merge pull request #276 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 23, 2024
472b45f
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Nov 23, 2024
31b3cd0
[npm]: Bump cross-spawn from 7.0.3 to 7.0.6 in the npm_and_yarn group
dependabot[bot] Nov 23, 2024
567a4e9
fix: ensure dragRef is non-null in TeamCard component
renatodellosso Nov 23, 2024
3bf2c13
Merge branch 'dependabot/npm_and_yarn/multi-5afa9e7274' of github.com…
renatodellosso Nov 23, 2024
8e2ab45
Merge pull request #294 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 23, 2024
7469d7f
fix: update dragRef to be non-null in TeamCard component
renatodellosso Nov 23, 2024
7da2827
Convert alerts to toasts
renatodellosso Nov 23, 2024
54cc62b
Overrode the type check in picklist dragrefs
renatodellosso Nov 24, 2024
12a8398
Merge branch 'main' into dependabot/npm_and_yarn/multi-5afa9e7274
renatodellosso Nov 24, 2024
55a2327
Merge pull request #237 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 24, 2024
bfa3b06
Styled toasts
renatodellosso Nov 24, 2024
fac4e0c
Merge branch 'main' into toast-instead-of-alert
BanEvading Nov 25, 2024
486eafc
Merge pull request #295 from Decatur-Robotics/toast-instead-of-alert
renatodellosso Nov 25, 2024
29c9095
[npm]: Bump daisyui from 4.12.12 to 4.12.14
dependabot[bot] Nov 25, 2024
6ed7fd3
[npm]: Bump nodemailer from 6.9.14 to 6.9.16
dependabot[bot] Nov 25, 2024
b553fe2
[npm]: Bump formidable from 3.5.1 to 3.5.2
dependabot[bot] Nov 25, 2024
7f6e470
Merge pull request #296 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 26, 2024
3b242c4
Merge pull request #297 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 26, 2024
55ea53f
Merge pull request #298 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 26, 2024
48a47c9
[npm]: Bump next from 14.2.14 to 15.0.3
dependabot[bot] Nov 26, 2024
1daf3e7
Remove console.log in App
renatodellosso Nov 26, 2024
d78664d
Removed console.logs in AccessLevels
renatodellosso Nov 27, 2024
f6f8ef5
Merge branch 'main' into dependabot/npm_and_yarn/next-15.0.3
renatodellosso Nov 27, 2024
f742ac6
Merge pull request #300 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Nov 27, 2024
e3cb590
Started unit tests for AccessLevels
renatodellosso Dec 2, 2024
ccb37a3
Finished unit tests. Still need to group tests and extract repeated p…
renatodellosso Dec 2, 2024
948852a
[npm]: Bump eslint-config-next from 13.3.1 to 15.0.3
dependabot[bot] Dec 2, 2024
4a9f715
[npm]: Bump react-dom and @types/react-dom
dependabot[bot] Dec 2, 2024
161e1df
[npm]: Bump tsx from 4.19.1 to 4.19.2
dependabot[bot] Dec 2, 2024
bbe3042
Merge pull request #348 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 3, 2024
701c7c6
Merge pull request #349 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 3, 2024
b0376ba
Merge pull request #346 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 3, 2024
5a037fb
Converted repeated tests into functions and groups tests with describe()
renatodellosso Dec 3, 2024
6bd2357
[npm]: Bump eslint from 8.39.0 to 9.16.0
dependabot[bot] Dec 3, 2024
5d42034
Merge branch 'main' into access-levels-unit-tests
renatodellosso Dec 3, 2024
623ab5b
Merge pull request #347 from Decatur-Robotics/dependabot/npm_and_yarn…
renatodellosso Dec 3, 2024
1b03870
Merge branch 'main' into no-loading-boxes-when-there-is-no-data
renatodellosso Dec 3, 2024
0aa3918
Merge branch 'main' into access-levels-unit-tests
renatodellosso Dec 3, 2024
3ec586a
Merge branch 'main' into fix-slack-notifications
renatodellosso Dec 3, 2024
c125def
Merge branch 'main' of github.com:Decatur-Robotics/Gearbox into remov…
renatodellosso Dec 3, 2024
6f2ab28
Delete comp index
renatodellosso Dec 3, 2024
4a78fb1
Merge pull request #292 from Decatur-Robotics/fix-slack-notifications
Tr01ler Dec 3, 2024
1d8a53c
Merge branch 'main' into no-loading-boxes-when-there-is-no-data
Tr01ler Dec 3, 2024
b02b6cd
Merge pull request #293 from Decatur-Robotics/no-loading-boxes-when-t…
Tr01ler Dec 3, 2024
dcb0603
Add type checks for addObject
renatodellosso Dec 3, 2024
90c0553
Add type checks for updateObject
renatodellosso Dec 3, 2024
7e78dc1
Merge branch 'main' of github.com:Decatur-Robotics/Gearbox into type-…
renatodellosso Dec 3, 2024
b28f2f8
Merge branch 'main' into access-levels-unit-tests
Tr01ler Dec 3, 2024
6726588
Add Webhook type safety for DbInterface
renatodellosso Dec 3, 2024
9fa1354
Fix test utils import
renatodellosso Dec 3, 2024
f5e0a3b
Merge pull request #350 from Decatur-Robotics/access-levels-unit-tests
Tr01ler Dec 3, 2024
9dc51af
Fix types for unit tests
renatodellosso Dec 3, 2024
e8612a7
Merge branch 'main' into type-safety-for-add-object
renatodellosso Dec 3, 2024
61e382b
Merge branch 'main' of github.com:Decatur-Robotics/Gearbox into remov…
renatodellosso Dec 3, 2024
7273c49
Fixed access levels unit tests typing
renatodellosso Dec 3, 2024
6fffb8c
Merge pull request #291 from Decatur-Robotics/remove-pwa
Tr01ler Dec 3, 2024
a720664
Merge branch 'main' into type-safety-for-add-object
renatodellosso Dec 4, 2024
d5500d0
Merge pull request #353 from Decatur-Robotics/type-safety-for-add-object
BanEvading Dec 5, 2024
df1eef3
Configured ESLint and added GH action
renatodellosso Dec 5, 2024
8705634
Accidently added the tech club website, removed it now
renatodellosso Dec 5, 2024
20267f1
Update linting configuration to fail on warnings
renatodellosso Dec 5, 2024
ec405b6
Refactor linting command to enforce no warnings and update workflow c…
renatodellosso Dec 5, 2024
c540a3d
Refactor ESLint configuration: remove .eslintrc.json, add eslint.conf…
renatodellosso Dec 5, 2024
15ce1d3
Refactor GitHub Actions workflows: update triggers for CI, lint, and …
renatodellosso Dec 5, 2024
7b5c4b7
Remove pull_request trigger from CI workflow
renatodellosso Dec 5, 2024
bf46ab6
Simplify CI workflow triggers by consolidating event definitions
renatodellosso Dec 5, 2024
c10d5f3
Update onpush workflow to trigger on push to main branch
renatodellosso Dec 5, 2024
bc6765c
Add pull_request trigger to CI workflow
renatodellosso Dec 5, 2024
2633c43
Merge pull request #354 from Decatur-Robotics/configure-eslint
renatodellosso Dec 5, 2024
f830af5
Publishing Branch to improve/implement prettier
Tr01ler Dec 5, 2024
5e0e0cc
Added a yml file for github workflows automation
Tr01ler Dec 5, 2024
9ce8e65
Merge branch 'main' into autoformatter
renatodellosso Dec 5, 2024
f0c4f8d
Add more extension recommendations
renatodellosso Dec 5, 2024
c250f21
Refactor CI workflows and update package.json for prettier checks
renatodellosso Dec 5, 2024
2dac398
Merge branch 'main' into autoformatter
renatodellosso Dec 5, 2024
38c4cb5
Add comma to extensions.json
renatodellosso Dec 5, 2024
7a39575
Merge pull request #356 from Decatur-Robotics/autoformatter
renatodellosso Dec 5, 2024
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
adf0b0d
Fixed match numbers
renatodellosso Dec 7, 2024
ab67792
Merge branch 'main' of github.com:Decatur-Robotics/Gearbox
renatodellosso Dec 7, 2024
b42df85
Remove SWC minification and rename method to getCompetitionQualifying…
renatodellosso Dec 8, 2024
3373f24
[npm]: Bump dotenv from 16.4.5 to 16.4.7
dependabot[bot] Dec 9, 2024
35f102e
[npm]: Bump socket.io-client from 4.7.2 to 4.8.1
dependabot[bot] Dec 9, 2024
d1bc2fe
Merge branch 'main' into autoformatter
renatodellosso Dec 10, 2024
c27bb69
Merge pull request #365 from Decatur-Robotics/dependabot/npm_and_yarn…
BanEvading Dec 10, 2024
8c34c9d
Merge branch 'main' into dependabot/npm_and_yarn/dotenv-16.4.7
BanEvading Dec 10, 2024
6b5359d
[npm]: Bump @types/jest from 29.5.13 to 29.5.14
dependabot[bot] Dec 10, 2024
a342325
Merge pull request #362 from Decatur-Robotics/dependabot/npm_and_yarn…
BanEvading Dec 10, 2024
75a1681
Merge branch 'main' into dependabot/npm_and_yarn/types/jest-29.5.14
BanEvading Dec 10, 2024
f6c0890
[npm]: Bump nanoid from 3.3.7 to 3.3.8 in the npm_and_yarn group
dependabot[bot] Dec 10, 2024
e88041a
Merge pull request #363 from Decatur-Robotics/dependabot/npm_and_yarn…
BanEvading Dec 10, 2024
b8de7f7
Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-af93afb32e
BanEvading Dec 10, 2024
1935663
Merge branch 'main' into autoformatter
renatodellosso Dec 10, 2024
67f0737
Fix formatting
renatodellosso Dec 10, 2024
83ee97f
Merge pull request #366 from Decatur-Robotics/dependabot/npm_and_yarn…
BanEvading 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
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
4 changes: 3 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
NEXT_PUBLIC_API_URL=http://localhost:3000/api
NEXT_PUBLIC_API_URL=http://localhost:3000/api

DEVELOPER_EMAILS=["test@gmail.com"]
8 changes: 0 additions & 8 deletions .eslintrc.json

This file was deleted.

20 changes: 1 addition & 19 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
name: CD

on:
workflow_call:
secrets:
SSL_KEY:
required: true
SSL_CERT:
required: true
ENV_FILE:
required: true
workflow_dispatch: # Allows manual triggering of the workflow
on: [workflow_call, workflow_dispatch]

permissions:
packages: write
Expand All @@ -27,15 +18,6 @@ jobs:

- name: Create certs directory
run: mkdir certs

- name: Write SSL key
run: echo "${{ secrets.SSL_KEY }}" > certs/ssl.key

- name: Write SSL cert
run: echo "${{ secrets.SSL_CERT }}" > certs/ssl.cert

- name: Write ENV file
run: echo "${{ secrets.ENV_FILE }}" > .env

- name: Build and export
uses: docker/build-push-action@v6
Expand Down
34 changes: 23 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: CI

on:
pull_request:
branches:
- main
workflow_call:
workflow_dispatch: # Allows manual triggering of the workflow
on: [workflow_call, workflow_dispatch, pull_request]

jobs:
build:
Expand All @@ -16,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 @@ -28,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"

- name: Install dependencies
run: npm install

- name: Unit tests
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'
node-version: "20"

- name: Install dependencies
run: npm install

- name: Unit Tests
run: npm run test
- name: Lint
run: npm run lint
28 changes: 28 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check Formatting

on:
push:
branches:
- main
pull_request:
workflow_call:
workflow_dispatch:

jobs:
check_formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install dependencies
run: npm install

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

15 changes: 6 additions & 9 deletions .github/workflows/onpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ on:
push:
branches:
- main
workflow_dispatch: # Allows manual triggering of the workflow
workflow_call:
workflow_dispatch:

jobs:
ci:
uses: ./.github/workflows/ci.yml

cd:
needs:
- ci
uses: ./.github/workflows/cd.yml
secrets:
SSL_KEY: ${{ secrets.SSL_KEY }}
SSL_CERT: ${{ secrets.SSL_CERT }}
ENV_FILE: ${{ secrets.ENV_FILE }}
# 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
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"tabWidth": 2,
"useTabs": false
"tabWidth": 2,
"useTabs": true,
"singleAttributePerLine": true
}
16 changes: 11 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"recommendations": [
"ms-azuretools.vscode-docker",
"formulahendry.docker-explorer"
]
}
"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"
]
}
14 changes: 12 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"editor.tabSize": 2,
"prettier.enable": false
"editor.tabSize": 2,
"prettier.enable": true,
"files.autoSave": "afterDelay",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.format.enable": false,
"prettier.configPath": ".prettierrc"
}
102 changes: 88 additions & 14 deletions components/AddToSlack.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,90 @@
import { useRouter } from "next/router";
import { useState } from "react";
import Modal, { hideModal, showModal } from "./Modal";
import ClientApi from "@/lib/api/ClientApi";

export default function AddToSlack() {
const host = window ? window.location.host : "4026.org";
const SLACK_WEBHOOK_INSTALL_URL =
"https://my.slack.com/services/new/incoming-webhook/";

return (
<a className="link text-accent" href={`
https://slack.com/oauth/v2/authorize
?client_id=${process.env.NEXT_PUBLIC_SLACK_CLIENT_ID}
&scope=chat:write,commands&user_scope=email,openid
&redirect_uri=https://${host}/api/addSlackBot
`}>
Add Gearbox to Slack
</a>
);
}
const api = new ClientApi();

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

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

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>
);
}

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