Skip to content

Commit 50dfd19

Browse files
committed
all fixes
1 parent 8f47256 commit 50dfd19

File tree

17 files changed

+100
-39
lines changed

17 files changed

+100
-39
lines changed

apps/client/src/components/adminRouter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ function AdminLink(props: { path: string; name: string }) {
77

88
return (
99
<Link to={props.path}>
10-
<button className={twMerge("btn", selected && "btn-secondary")}>
10+
<button
11+
className={twMerge("btn", selected && "btn-secondary")}
12+
type="button"
13+
>
1114
{props.name}
1215
</button>
1316
</Link>

apps/client/src/components/styles.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { twMerge } from "tailwind-merge";
22

3-
type BaseProps<T = {}> = React.PropsWithChildren<T> & {
3+
type BaseProps<T = unknown> = React.PropsWithChildren<T> & {
44
className?: string;
55
};
66

@@ -46,12 +46,13 @@ export function Question({ children, className }: BaseProps) {
4646
);
4747
}
4848

49-
function SmallLoadingSpinner({ children, className }: BaseProps) {
49+
function SmallLoadingSpinner({ className }: BaseProps) {
5050
return (
5151
<svg
5252
className={twMerge("animate-spin h-5 w-5", className)}
5353
viewBox="0 0 24 24"
5454
>
55+
<title>Loading Spinner</title>
5556
<circle
5657
className="opacity-25"
5758
cx="12"

apps/client/src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** biome-ignore-all lint/suspicious/noUnknownAtRules: Tailwind does exist though isn't being detected */
12
@tailwind base;
23
@tailwind components;
34
@tailwind utilities;

apps/client/src/pages/room/JoinWaitingRoomPage.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Button, CenteredPageContainer, Heading } from "components/styles";
22
import { Field, Form, Formik } from "formik";
3+
import { useId } from "react";
34
import { useNavigate } from "react-router-dom";
45
import { routeBuilders } from "routes";
56
import type { UserLocation } from "server/src/dbschema/interfaces";
@@ -23,6 +24,8 @@ type FormValues = TypeOf<typeof schema>;
2324
export function JoinWaitingRoomPage(props: { roomId: string }) {
2425
const navigate = useNavigate();
2526

27+
const formId = useId();
28+
2629
const mutation = trpc.room.joinWaitingList.useMutation();
2730

2831
const disabled = mutation.isPending || mutation.isSuccess;
@@ -52,7 +55,7 @@ export function JoinWaitingRoomPage(props: { roomId: string }) {
5255
<Formik<FormValues>
5356
initialValues={{
5457
email: "",
55-
location: undefined as any,
58+
location: undefined as unknown as UserLocation,
5659
}}
5760
onSubmit={onSubmit}
5861
validationSchema={toFormikValidationSchema(schema)}
@@ -71,34 +74,46 @@ export function JoinWaitingRoomPage(props: { roomId: string }) {
7174
onChange={form.handleChange}
7275
/>
7376
<div className="flex items-start justify-center gap-4">
74-
<label className="flex items-center gap-2">
77+
<label
78+
className="flex items-center gap-2"
79+
htmlFor={`${formId}-InPerson`}
80+
>
7581
<Field
7682
type="radio"
7783
name="location"
7884
value={"InPerson" satisfies UserLocation}
7985
className="radio radio-primary"
86+
id={`${formId}-InPerson`}
8087
/>
8188
<span className="label-text text-xs md:text-sm">
8289
{locationEnumLabel.InPerson}
8390
</span>
8491
</label>
85-
<label className="flex items-center gap-2">
92+
<label
93+
className="flex items-center gap-2"
94+
htmlFor={`${formId}-Online`}
95+
>
8696
<Field
8797
type="radio"
8898
name="location"
8999
value={"Online" satisfies UserLocation}
90100
className="radio radio-primary"
101+
id={`${formId}-Online`}
91102
/>
92103
<span className="label-text text-xs md:text-sm">
93104
{locationEnumLabel.Online}
94105
</span>
95106
</label>
96-
<label className="flex items-center gap-2">
107+
<label
108+
className="flex items-center gap-2"
109+
htmlFor={`${formId}-Proxy`}
110+
>
97111
<Field
98112
type="radio"
99113
name="location"
100114
value={"Proxy" satisfies UserLocation}
101115
className="radio radio-primary"
116+
id={`${formId}-Proxy`}
102117
/>
103118
<span className="label-text text-xs md:text-sm">
104119
{locationEnumLabel.Proxy}

apps/client/src/pages/room/VotingRoomPage/hooks.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export interface QuestionVotingData {
1717

1818
export type VotingPageState = GetStatesUnion<typeof VotingPageState.enum>;
1919
export const VotingPageState = makeStates("vps", {
20-
loading: state<{}>(),
21-
waiting: state<{}>(),
22-
ended: state<{}>(),
20+
loading: state(),
21+
waiting: state(),
22+
ended: state(),
2323
viewingResults: state<ShowingResultsState>(),
2424
voting: state<QuestionVotingData>(),
25-
kicked: state<{}>(),
25+
kicked: state(),
2626
});
2727

2828
interface LastVote {
@@ -109,10 +109,10 @@ export function useVoterState(props: {
109109

110110
type InitialVoteFetchState = GetStatesUnion<typeof InitialVoteFetchState.enum>;
111111
const InitialVoteFetchState = makeStates("ivfs", {
112-
waitingForVoterState: state<{}>(),
113-
ignoring: state<{}>(),
112+
waitingForVoterState: state(),
113+
ignoring: state(),
114114
fetching: state<{ questionId: string }>(),
115-
fetched: state<{}>(),
115+
fetched: state(),
116116
});
117117

118118
/**

apps/client/src/pages/room/admin/QuestionSettingPage.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ResultsViewer } from "components/ResultsViewer";
33
import { Button, Heading, PageContainer, Question } from "components/styles";
44
import { Field, Form, Formik } from "formik";
55
import type React from "react";
6-
import { createRef, useState } from "react";
6+
import { createRef, useId, useState } from "react";
77
import type { QuestionFormat } from "server/src/dbschema/interfaces";
88
import type {
99
ShowingQuestionState,
@@ -36,8 +36,8 @@ type QuestionSettingPageState = GetStatesUnion<
3636
typeof QuestionSettingPageState.enum
3737
>;
3838
const QuestionSettingPageState = makeStates("qsps", {
39-
loading: state<{}>(),
40-
ended: state<{}>(),
39+
loading: state(),
40+
ended: state(),
4141
setQuestion: state<QuestionSettingData>(),
4242
askingQuestion: state<QuestionAskingData>(),
4343
});
@@ -163,6 +163,10 @@ const getId = () => id++;
163163
function SetQuestion({ data }: { data: QuestionSettingData }) {
164164
const [submitting, setSubmitting] = useState(false);
165165

166+
const questionTypeSelectId = useId();
167+
const questionTitleInputId = useId();
168+
const maxResultsInputId = useId();
169+
166170
const onSubmit = async (values: FormValues) => {
167171
setSubmitting(true);
168172

@@ -234,7 +238,10 @@ function SetQuestion({ data }: { data: QuestionSettingData }) {
234238
disabled={submitting}
235239
className="gap-4 w-full flex flex-col justify-center items-center"
236240
>
237-
<label className="form-control w-full mt-8 mb-2">
241+
<label
242+
className="form-control w-full mt-8 mb-2"
243+
htmlFor={questionTitleInputId}
244+
>
238245
<div className="label">
239246
<span className="label-text">Question</span>
240247
</div>
@@ -244,10 +251,14 @@ function SetQuestion({ data }: { data: QuestionSettingData }) {
244251
name="question"
245252
value={form.values.question}
246253
onChange={form.handleChange}
254+
id={questionTitleInputId}
247255
/>
248256
</label>
249257
<div className="flex gap-2 w-full">
250-
<label className="form-control mb-8 grow">
258+
<label
259+
className="form-control mb-8 grow"
260+
htmlFor={questionTypeSelectId}
261+
>
251262
<div className="label">
252263
<span className="label-text">Question Type</span>
253264
</div>
@@ -257,14 +268,18 @@ function SetQuestion({ data }: { data: QuestionSettingData }) {
257268
name="questionType"
258269
value={form.values.questionType}
259270
onChange={form.handleChange}
271+
id={questionTypeSelectId}
260272
>
261273
<option value="SingleVote">Single vote</option>
262274
<option value="PreferentialVote">
263275
Preferential vote
264276
</option>
265277
</Field>
266278
</label>
267-
<label className="form-control mb-8">
279+
<label
280+
className="form-control mb-8"
281+
htmlFor={maxResultsInputId}
282+
>
268283
<div className="label">
269284
<span className="label-text">Max Results</span>
270285
</div>
@@ -275,6 +290,7 @@ function SetQuestion({ data }: { data: QuestionSettingData }) {
275290
value={form.values.maxElected}
276291
onChange={form.handleChange}
277292
disabled={form.values.questionType === "SingleVote"}
293+
id={maxResultsInputId}
278294
/>
279295
</label>
280296
</div>
@@ -289,7 +305,7 @@ function SetQuestion({ data }: { data: QuestionSettingData }) {
289305
value={candidate.name}
290306
onChange={form.handleChange}
291307
ref={(el) => {
292-
// Unfortunately any is necessary here, because current is set to readonly in react
308+
// biome-ignore lint/suspicious/noExplicitAny: Unfortunately any is necessary here, because current is set to readonly in react
293309
(candidate.inputRef as any).current = el;
294310

295311
if (candidate.forceSelect) {

apps/client/src/utils/withRoomData.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function withRoomFetched<Props extends { room: RoomPublicInfo }>(
2828
</CenteredPageContainer>
2929
);
3030
} else {
31+
// biome-ignore lint/suspicious/noExplicitAny: This will be part of the router refactor
3132
return <Component room={room} {...(props as any)} />;
3233
}
3334
};

apps/server/src/live/states.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ export const BoardState = makeStates("bs", {
3737
blank: state<BlankRoomState>(),
3838
showingQuestion: state<ShowingQuestionState>(),
3939
showingResults: state<ShowingResultsState>(),
40-
ended: state<{}>(),
40+
ended: state(),
4141
});
4242

4343
export type VoterState = GetStatesUnion<typeof VoterState.enum>;
4444
export const VoterState = makeStates("vs", {
4545
blank: state<BlankRoomState>(),
4646
showingQuestion: state<ShowingQuestionState>(),
4747
showingResults: state<ShowingResultsState>(),
48-
ended: state<{}>(),
49-
kicked: state<{}>(),
48+
ended: state(),
49+
kicked: state(),
5050
});

apps/server/src/lock.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface PromiseQueue {
2-
promise: Promise<any>;
2+
promise: Promise<unknown>;
33
unresolvedCount: number;
44
}
55

@@ -18,6 +18,7 @@ export class AyncKeyLock {
1818
});
1919
}
2020

21+
// biome-ignore lint/style/noNonNullAssertion: We know it exists from the check above
2122
const queue = this.queues.get(key)!;
2223

2324
queue.unresolvedCount++;
@@ -59,6 +60,7 @@ export class AsyncLock {
5960
return newPromise;
6061
}
6162

63+
// biome-ignore lint/suspicious/noExplicitAny: The any isn't avoidable here
6264
wrapFn<Args extends readonly any[], Ret = void>(
6365
fn: (...args: Args) => Promise<Ret>,
6466
): (...args: Args) => Promise<Ret> {

apps/server/src/room/interaction/db/queries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
import type * as schema from "../../../dbschema/interfaces";
1010
import type { RoomUser } from "../../../dbschema/interfaces";
1111

12+
// biome-ignore lint/suspicious/noExplicitAny: The any isn't avoidable here
1213
type FromFn<T extends (...args: any[]) => any> = NonNullable<
1314
Awaited<ReturnType<T>>
1415
>;

0 commit comments

Comments
 (0)