Skip to content

Commit

Permalink
Fixed code style across entire codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmineee-li committed Apr 22, 2024
1 parent 028ff84 commit bc318b8
Show file tree
Hide file tree
Showing 40 changed files with 587 additions and 588 deletions.
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Remaining TODOs:

Depends on #{number of PR}


### Test Plan <!-- Required -->

<!-- Provide screenshots or point out the additional unit tests -->
Expand All @@ -36,7 +35,7 @@ Depends on #{number of PR}

- A newly discovered dependency that hasn’t been addressed

### Breaking Changes <!-- Optional -->
### Breaking Changes <!-- Optional -->

<!-- Keep items that apply: -->

Expand Down
2 changes: 1 addition & 1 deletion .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"CurrentProjectSetting": "No Configurations"
}
}
9 changes: 2 additions & 7 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"ExpandedNodes": [
"",
"\\game",
"\\game\\lib",
"\\game\\test"
],
"ExpandedNodes": ["", "\\game", "\\game\\lib", "\\game\\test"],
"SelectedNode": "\\game\\lib\\main.dart",
"PreviewInSolutionExplorer": false
}
}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
"flutterMode": "release"
}
]
}
}
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"typescript.preferences.importModuleSpecifier": "relative",
"githubPullRequests.ignoredPullRequestBranches": [
"master"
],
"githubPullRequests.ignoredPullRequestBranches": ["master"],
"typescript.tsdk": "node_modules/typescript/lib"
}
}
2 changes: 1 addition & 1 deletion admin/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
16 changes: 8 additions & 8 deletions admin/src/components/Challenges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function toForm(challenge: ChallengeDto) {
function fromForm(
form: EntryForm[],
eventId: string,
id: string
id: string,
): ChallengeDto {
return {
id,
Expand Down Expand Up @@ -194,7 +194,7 @@ export function Challenges() {
entryButtonText="CREATE"
onEntry={() => {
serverData.updateChallenge(
fromForm(form, serverData.selectedEvent, "")
fromForm(form, serverData.selectedEvent, ""),
);
setCreateModalOpen(false);
}}
Expand All @@ -209,7 +209,7 @@ export function Challenges() {
entryButtonText="EDIT"
onEntry={() => {
serverData.updateChallenge(
fromForm(form, serverData.selectedEvent, currentId)
fromForm(form, serverData.selectedEvent, currentId),
);
setEditModalOpen(false);
}}
Expand Down Expand Up @@ -255,7 +255,7 @@ export function Challenges() {
: compareTwoStrings(b.name ?? "", query) -
compareTwoStrings(a.name ?? "", query) +
compareTwoStrings(b.description ?? "", query) -
compareTwoStrings(a.description ?? "", query)
compareTwoStrings(a.description ?? "", query),
)
.map((chal: ChallengeDto) => (
<ChallengeCard
Expand All @@ -266,8 +266,8 @@ export function Challenges() {
selectedEvent.challenges = moveUp(
selectedEvent.challenges,
selectedEvent.challenges.findIndex(
(id: string) => id === chal.id
) ?? 0
(id: string) => id === chal.id,
) ?? 0,
);
serverData.updateEvent(selectedEvent);
}}
Expand All @@ -276,8 +276,8 @@ export function Challenges() {
selectedEvent.challenges = moveDown(
selectedEvent.challenges,
selectedEvent.challenges.findIndex(
(id: string) => id === chal.id
)
(id: string) => id === chal.id,
),
);
serverData.updateEvent(selectedEvent);
}}
Expand Down
6 changes: 3 additions & 3 deletions admin/src/components/EntryModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function OptionEntryFormBox(props: { form: OptionEntryForm }) {
value={val}
onChange={(e) =>
setVal(
props.form.options[(props.form.value = e.target.selectedIndex)]
props.form.options[(props.form.value = e.target.selectedIndex)],
)
}
>
Expand Down Expand Up @@ -111,7 +111,7 @@ function DateEntryFormBox(props: { form: DateEntryForm }) {

useEffect(
() => setVal(props.form.date.toISOString().slice(0, -1)),
[props.form]
[props.form],
);

return (
Expand Down Expand Up @@ -175,7 +175,7 @@ function DraggableMarker(props: {
}
},
}),
[]
[],
);

return (
Expand Down
12 changes: 6 additions & 6 deletions admin/src/components/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ function EventCard(props: {
props.event.difficulty === "Easy"
? "Easy"
: props.event.difficulty === "Normal"
? "Normal"
: "Hard";
? "Normal"
: "Hard";

let categoryInput = props.event.category as string;
const categoryType =
Expand Down Expand Up @@ -154,8 +154,8 @@ function fromForm(form: EntryForm[], id: string): EventDto {
(form[5] as OptionEntryForm).value === 0
? EventDifficultyDto.Easy
: (form[5] as OptionEntryForm).value === 1
? EventDifficultyDto.Normal
: EventDifficultyDto.Hard,
? EventDifficultyDto.Normal
: EventDifficultyDto.Hard,

latitudeF: 0,
longitudeF: 0,
Expand Down Expand Up @@ -284,14 +284,14 @@ export function Events() {
serverData.organizations
.get(serverData.selectedOrg)
?.events?.map((evId: string) => serverData.events.get(evId)!)
.filter((ev?: EventDto) => !!ev) ?? []
.filter((ev?: EventDto) => !!ev) ?? [],
)
.sort(
(a: EventDto, b: EventDto) =>
compareTwoStrings(b.name ?? "", query) -
compareTwoStrings(a.name ?? "", query) +
compareTwoStrings(b.description ?? "", query) -
compareTwoStrings(a.description ?? "", query)
compareTwoStrings(a.description ?? "", query),
)
.map((ev) => (
<EventCard
Expand Down
6 changes: 3 additions & 3 deletions admin/src/components/Groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ function getColumns(setRowsData: any, serverData: any) {

let rowsClone = [...tableManager.rowsApi.rows];
let deletedRowIndex = rowsClone.findIndex(
(r) => r.id === data.id
(r) => r.id === data.id,
);
rowsClone.splice(deletedRowIndex, 1);

const newData = Array.from(serverData.groups.values()).map((gr) =>
toForm(gr)
toForm(gr),
);
newData.forEach((gr) => {
let index = rowsClone.findIndex((r) => r.id === gr.id);
Expand All @@ -185,7 +185,7 @@ function getColumns(setRowsData: any, serverData: any) {
export function Groups() {
const serverData = useContext(ServerDataContext);
const [rowsData, setRowsData] = useState(
Array.from(serverData.groups.values()).map((gr) => toForm(gr))
Array.from(serverData.groups.values()).map((gr) => toForm(gr)),
);

return (
Expand Down
9 changes: 4 additions & 5 deletions admin/src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ const ModalBackground = styled.div<{ opacity: number }>`
transition: opacity 0.15s;
overflow-y: auto;
${(props) =>
css`
opacity: ${props.opacity};
`}
${(props) => css`
opacity: ${props.opacity};
`}
`;

const ModalLayout = styled.div`
Expand Down Expand Up @@ -97,7 +96,7 @@ export function Modal(props: {
</ModalButtonPanel>
</ModalLayout>
</ModalBackground>,
document.getElementById("modal-root")!
document.getElementById("modal-root")!,
);
}
return <></>;
Expand Down
6 changes: 3 additions & 3 deletions admin/src/components/Organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function makeForm() {
function fromForm(
form: EntryForm[],
id: string,
oldDto: OrganizationDto
oldDto: OrganizationDto,
): OrganizationDto {
return {
...oldDto,
Expand Down Expand Up @@ -176,7 +176,7 @@ export function Organizations() {
.sort(
(a, b) =>
compareTwoStrings(b.name ?? "", query) -
compareTwoStrings(a.name ?? "", query)
compareTwoStrings(a.name ?? "", query),
)
.map((org) => (
<OrganizationCard
Expand Down Expand Up @@ -207,7 +207,7 @@ export function Organizations() {
characterLimit: 256,
value: "",
},
] as EntryForm[]
] as EntryForm[],
);
setOldDto(org);
setAddManagerModalOpen(true);
Expand Down
6 changes: 3 additions & 3 deletions admin/src/components/ServerApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ export class ServerApi {
}

onUpdateAchievementData(
callback: (data: dto.UpdateAchievementDataDto) => void
callback: (data: dto.UpdateAchievementDataDto) => void,
) {
this.socket.removeAllListeners("updateAchievementData");
this.socket.on("updateAchievementData", (data) => callback(data));
}

onUpdateAchievementTrackerData(
callback: (data: dto.AchievementTrackerDto) => void
callback: (data: dto.AchievementTrackerDto) => void,
) {
this.socket.removeAllListeners("updateAchievementTrackerData");
this.socket.on("updateAchievementTrackerData", (data) => callback(data));
Expand Down Expand Up @@ -184,7 +184,7 @@ export class ServerApi {
}

onUpdateOrganizationData(
callback: (data: dto.UpdateOrganizationDataDto) => void
callback: (data: dto.UpdateOrganizationDataDto) => void,
) {
this.socket.removeAllListeners("updateOrganizationData");
this.socket.on("updateOrganizationData", (data) => callback(data));
Expand Down
18 changes: 9 additions & 9 deletions admin/src/components/ServerData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function ServerDataProvider(props: { children: ReactNode }) {

const sock = useMemo(
() => new ServerApi(connection.connection!),
[connection]
[connection],
);

const [serverData, setServerData] = useState(() => ({ ...defaultData }));
Expand Down Expand Up @@ -118,7 +118,7 @@ export function ServerDataProvider(props: { children: ReactNode }) {
sock.updateOrganizationData({ organization: { id }, deleted: true });
},
}),
[serverData, setServerData, sock]
[serverData, setServerData, sock],
);

useEffect(() => {
Expand All @@ -142,13 +142,13 @@ export function ServerDataProvider(props: { children: ReactNode }) {
sock.requestChallengeData({
challenges:
(data.event as EventDto).challenges?.filter(
(chal: string) => !(chal in oldChallenges)
(chal: string) => !(chal in oldChallenges),
) ?? [],
});

serverData.events.set(
(data.event as EventDto).id,
data.event as EventDto
data.event as EventDto,
);
}

Expand All @@ -160,7 +160,7 @@ export function ServerDataProvider(props: { children: ReactNode }) {
} else {
serverData.challenges.set(
(data.challenge as ChallengeDto).id,
data.challenge as ChallengeDto
data.challenge as ChallengeDto,
);
}

Expand All @@ -181,7 +181,7 @@ export function ServerDataProvider(props: { children: ReactNode }) {
} else {
serverData.groups.set(
(data.group as GroupDto).id,
data.group as GroupDto
data.group as GroupDto,
);
}

Expand All @@ -193,18 +193,18 @@ export function ServerDataProvider(props: { children: ReactNode }) {
} else {
const oldEvents =
serverData.organizations.get(
(data.organization as OrganizationDto).id
(data.organization as OrganizationDto).id,
)?.events ?? [];

sock.requestEventData({
events: (data.organization as OrganizationDto).events?.filter(
(ev: string) => !(ev in oldEvents)
(ev: string) => !(ev in oldEvents),
),
});

serverData.organizations.set(
(data.organization as OrganizationDto).id,
data.organization as OrganizationDto
data.organization as OrganizationDto,
);
}

Expand Down
4 changes: 2 additions & 2 deletions admin/src/components/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function getColumns(setRowsData: any, serverData: any) {

let rowsClone = [...tableManager.rowsApi.rows];
let updatedRowIndex = rowsClone.findIndex(
(r) => r.id === data.id
(r) => r.id === data.id,
);
rowsClone[updatedRowIndex] = data;

Expand All @@ -213,7 +213,7 @@ function getColumns(setRowsData: any, serverData: any) {
export function Users() {
const serverData = useContext(ServerDataContext);
const [rowsData, setRowsData] = useState(
Array.from(serverData.users.values()).map((us) => toForm(us))
Array.from(serverData.users.values()).map((us) => toForm(us)),
);

return (
Expand Down
8 changes: 4 additions & 4 deletions admin/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ dd {
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
ul[role="list"],
ol[role="list"] {
list-style: none;
}

Expand Down Expand Up @@ -60,9 +60,9 @@ select {
/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
html:focus-within {
scroll-behavior: auto;
scroll-behavior: auto;
}

*,
*::before,
*::after {
Expand Down
Loading

0 comments on commit bc318b8

Please sign in to comment.