Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaxking committed Sep 3, 2024
1 parent 1aa58a7 commit eeb3901
Show file tree
Hide file tree
Showing 96 changed files with 5,343 additions and 5,193 deletions.
1 change: 0 additions & 1 deletion client/models/FIRST/custom-match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Alliance, FIRSTAlliance } from './alliance';
import { CustomMatches as CM_Obj } from '../../../server/utilities/tables';
import { ServerRequest } from '../../utilities/requests';
import { MatchInterface } from './interfaces/match';
import { Whiteboard } from '../whiteboard/whiteboard';
import { Strategy } from './strategy';
import { CompLevel } from '../../../shared/submodules/tatorscout-calculations/tba';

Expand Down
8 changes: 4 additions & 4 deletions client/models/FIRST/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ export class FIRSTEvent extends Cache<FIRSTEventData> {
public static retrieve(event: TBAEvent) {
if (FIRSTEvent.cache.has(event.key)) {
return FIRSTEvent.cache.get(event.key) as FIRSTEvent;
} else {
return new FIRSTEvent(event);
}
return new FIRSTEvent(event);
}

/**
Expand Down Expand Up @@ -270,7 +269,7 @@ export class FIRSTEvent extends Cache<FIRSTEventData> {
...(() => {
if (t.cache.has('pictures'))
return t.cache.get('pictures') as TeamPicture[];
else return [];
return [];
})(),
p
].filter(
Expand All @@ -286,7 +285,8 @@ export class FIRSTEvent extends Cache<FIRSTEventData> {
const teams = await this.getTeams();
if (teams.isOk()) {
return teams.value.find(t => t.tba.team_number === teamNumber);
} else return undefined;
}
return undefined;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion client/models/FIRST/match-scouting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class MatchScouting extends Cache<MatchScoutingEvents> {
if (cached) return cached;

const res = await ServerRequest.post<MatchScoutingObj | undefined>(
`/api/match-scouting/from-id`,
'/api/match-scouting/from-id',
{
id
}
Expand Down
4 changes: 1 addition & 3 deletions client/models/FIRST/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { Alliance, FIRSTAlliance } from './alliance';
import { Matches } from '../../../server/utilities/tables';
import { TBA } from '../../utilities/tba';
import { MatchInterface } from './interfaces/match';
import { Whiteboard } from '../whiteboard/whiteboard';
import { FIRSTWhiteboard } from './whiteboard';

/**
Expand Down Expand Up @@ -104,9 +103,8 @@ export class FIRSTMatch
public static retrieve(match: TBAMatch, event: TBAEvent) {
if (FIRSTMatch.cache.has(match.key)) {
return FIRSTMatch.cache.get(match.key) as FIRSTMatch;
} else {
return new FIRSTMatch(match, FIRSTEvent.retrieve(event));
}
return new FIRSTMatch(match, FIRSTEvent.retrieve(event));
}

public static current?: FIRSTMatch = undefined;
Expand Down
5 changes: 2 additions & 3 deletions client/models/FIRST/question-scouting/answer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Answer extends Cache<AnswerEvents> {

if (res.isOk()) {
if (res.value) return new Answer(res.value, eventKey);
else return undefined;
return undefined;
}
throw res.error;
});
Expand Down Expand Up @@ -125,9 +125,8 @@ export class Answer extends Cache<AnswerEvents> {
if (q.isOk()) {
if (!q.value) throw new Error('question not found');
return q.value;
} else {
throw q.error;
}
throw q.error;
});
}
}
Expand Down
8 changes: 4 additions & 4 deletions client/models/FIRST/question-scouting/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class Group extends Cache<GroupUpdates> {

if (res.isOk()) {
if (res.value) return new Group(res.value);
else return undefined;
return undefined;
}
throw res.error;
});
Expand All @@ -97,9 +97,8 @@ export class Group extends Cache<GroupUpdates> {

if (groups.isOk()) {
return groups.value.map(g => new Group(g));
} else {
throw groups.error;
}
throw groups.error;
});
}

Expand Down Expand Up @@ -163,7 +162,8 @@ export class Group extends Cache<GroupUpdates> {
this.cache.set('questions', questions);

return questions;
} else throw res.error;
}
throw res.error;
});
}

Expand Down
5 changes: 3 additions & 2 deletions client/models/FIRST/question-scouting/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class Question extends Cache<QuestionUpdates> {

if (res.isOk()) {
if (res.value) return new Question(res.value);
else return undefined;
return undefined;
}
throw res.error;
});
Expand Down Expand Up @@ -199,7 +199,8 @@ export class Question extends Cache<QuestionUpdates> {
const res = await Answer.fromTeam(team.number, event);
if (res.isOk()) {
return res.value.find(q => q.questionId === this.id);
} else throw res.error;
}
throw res.error;
});
}

Expand Down
5 changes: 3 additions & 2 deletions client/models/FIRST/question-scouting/section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class Section extends Cache<SectionUpdates> {

if (res.isOk()) {
if (res.value) return new Section(res.value);
else return undefined;
return undefined;
}
throw res.error;
});
Expand Down Expand Up @@ -186,7 +186,8 @@ export class Section extends Cache<SectionUpdates> {
Group.cache.delete(id);
group.destroy();
return;
} else throw res.error;
}
throw res.error;
});
}

Expand Down
6 changes: 2 additions & 4 deletions client/models/FIRST/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ export class Strategy extends Cache<StrategyUpdateData> {
public static retrieve(strategy: S): Strategy {
if (Strategy.cache.has(strategy.id)) {
return Strategy.cache.get(strategy.id) as Strategy;
} else {
return new Strategy(strategy);
}
return new Strategy(strategy);
}

public readonly id: string;
Expand Down Expand Up @@ -239,9 +238,8 @@ export class Check extends EventEmitter<CheckEvents> {
toggle(check: string) {
if (this.has(check)) {
return this.remove(check);
} else {
return this.add(check);
}
return this.add(check);
}

has(check: string) {
Expand Down
2 changes: 1 addition & 1 deletion client/models/FIRST/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export class FIRSTTeam extends Cache<FIRSTTeamEventData> {
return this.cache.get('pictures') as TeamPicture[];
}
const res = await ServerRequest.post<TeamPicture[]>(
`/api/teams/get-pictures`,
'/api/teams/get-pictures',
{
eventKey: this.event.key,
teamNumber: this.number
Expand Down
2 changes: 1 addition & 1 deletion client/models/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class Trace<action = Action> extends Drawable<Trace<Action>> {
export class Heatmap {
public static get spline() {
return new Spline(
...[
[
Color.fromName('blue'),
Color.fromName('green'),
Color.fromName('red'),
Expand Down
1 change: 1 addition & 0 deletions client/models/whiteboard/field-whiteboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const colors: [Color, Color, Color, Color, Color, Color] = [
class FieldBoardState extends WhiteboardState {
static fromJSON(json: string): FieldBoardState | undefined {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const obj = JSON.parse(json) as any;
if (!obj.initPositions || !obj.paths) {
throw new Error('Invalid JSON: ' + json);
Expand Down
1 change: 1 addition & 0 deletions client/models/whiteboard/whiteboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type Path = {
export class WhiteboardState {
static fromJSON(json: string): WhiteboardState | undefined {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const obj = JSON.parse(json) as any;
if (!obj.initPositions || !obj.states) {
throw new Error('Invalid JSON: ' + json);
Expand Down
141 changes: 72 additions & 69 deletions client/views/components/Setting.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,73 +54,76 @@
</script>

<div class="row">
{#if type === 'range'}
<div
class="col-{labelwidth} d-flex justify-content-center align-items-center"
>
<label for="{ids.range}" class="form-label m-0">
{name}
<slot />
<!-- <span class="badge bg-secondary ms-2">{value !== undefined ? value : ''}</span> -->
</label>
</div>
<div class="col-{inputWidth}">
<input
type="range"
min="{options[0] || 0}"
max="{options[1] || 100}"
class="form-range"
id="{ids.range}"
bind:value
on:change="{e => {
onChange(e.currentTarget.value);
}}"
/>
</div>
{:else if type === 'switch'}
<div
class="col-{labelwidth} d-flex justify-content-center align-items-center"
>
<label class="form-check-label m-0" for="{ids.switch}">{name}</label
>
<slot />
<!-- <span class="badge bg-secondary ms-2">{value !== undefined ? value : ''}</span> -->
</div>
<div class="col-{inputWidth}">
<div class="form-check form-switch">
<input
class="form-check-input"
type="checkbox"
role="switch"
id="{ids.switch}"
bind:checked="{value}"
on:change="{e => {
onChange(e.currentTarget.checked);
}}"
/>
</div>
</div>
{:else if type === 'select'}
<div
class="col-{labelwidth} d-flex justify-content-center align-items-center"
>
<slot />
<label for="{ids.select}" class="form-label m-0">{name}</label>
<!-- <span class="badge bg-secondary ms-2">{value !== undefined ? value : ''}</span> -->
</div>
<div class="col-{inputWidth}">
<select
id="{ids.select}"
bind:value
on:change="{e => {
onChange(e.currentTarget.value);
}}"
class="form-select"
>
{#each options as option}
<option value="{option}">{option}</option>
{/each}
</select>
</div>
{/if}
{#if type === 'range'}
<div class="col-{labelwidth} d-flex justify-content-center align-items-center"
>
<label
class="form-label m-0"
for="{ids.range}">
{name}
<slot />
<!-- <span class="badge bg-secondary ms-2">{value !== undefined ? value : ''}</span> -->
</label>
</div>
<div class="col-{inputWidth}">
<input
id="{ids.range}"
class="form-range"
max="{options[1] || 100}"
min="{options[0] || 0}"
type="range"
bind:value
on:change="{e => {
onChange(e.currentTarget.value);
}}"
/>
</div>
{:else if type === 'switch'}
<div class="col-{labelwidth} d-flex justify-content-center align-items-center"
>
<label
class="form-check-label m-0"
for="{ids.switch}">{name}</label
>
<slot />
<!-- <span class="badge bg-secondary ms-2">{value !== undefined ? value : ''}</span> -->
</div>
<div class="col-{inputWidth}">
<div class="form-check form-switch">
<input
id="{ids.switch}"
class="form-check-input"
role="switch"
type="checkbox"
bind:checked="{value}"
on:change="{e => {
onChange(e.currentTarget.checked);
}}"
/>
</div>
</div>
{:else if type === 'select'}
<div class="col-{labelwidth} d-flex justify-content-center align-items-center"
>
<slot />
<label
class="form-label m-0"
for="{ids.select}">{name}</label>
<!-- <span class="badge bg-secondary ms-2">{value !== undefined ? value : ''}</span> -->
</div>
<div class="col-{inputWidth}">
<select
id="{ids.select}"
class="form-select"
bind:value
on:change="{e => {
onChange(e.currentTarget.value);
}}"
>
{#each options as option}
<option value="{option}">{option}</option>
{/each}
</select>
</div>
{/if}
</div>
4 changes: 2 additions & 2 deletions client/views/components/SignIn.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
}
ServerRequest.post('/account/sign-in', {
username: username.trim(),
password: password.trim()
username: username.trim(),
password: password.trim()
});
};
Expand Down
12 changes: 6 additions & 6 deletions client/views/components/SignUp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
}
ServerRequest.post('/account/sign-up', {
username: username.trim(),
password: password.trim(),
confirmPassword: confirmPassword.trim(),
email: email.trim(),
firstName: firstName.trim(),
lastName: lastName.trim()
username: username.trim(),
password: password.trim(),
confirmPassword: confirmPassword.trim(),
email: email.trim(),
firstName: firstName.trim(),
lastName: lastName.trim()
});
};
Expand Down
Loading

0 comments on commit eeb3901

Please sign in to comment.