Skip to content

Commit e19677b

Browse files
fehmerMiodec
andauthored
use ts/forms
Co-authored-by: Miodec <jack@monkeytype.com>
1 parent 3a6781b commit e19677b

28 files changed

Lines changed: 1108 additions & 638 deletions

frontend/.oxlintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"rules": {
2222
"explicit-function-return-type": "off",
2323
"no-explicit-any": "off",
24-
"no-unsafe-assignment": "off"
24+
"no-unsafe-assignment": "off",
25+
"no-empty-function": "off"
2526
}
2627
},
2728
{

frontend/__tests__/components/ui/ValidatedInput.spec.tsx

Lines changed: 0 additions & 82 deletions
This file was deleted.

frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@date-fns/utc": "1.2.0",
27-
"@leonabcd123/modern-caps-lock": "2.2.2",
27+
"@leonabcd123/modern-caps-lock": "3.0.4",
2828
"@monkeytype/contracts": "workspace:*",
2929
"@monkeytype/funbox": "workspace:*",
3030
"@monkeytype/schemas": "workspace:*",
@@ -37,6 +37,7 @@
3737
"@tanstack/pacer-lite": "0.2.1",
3838
"@tanstack/query-db-collection": "1.0.27",
3939
"@tanstack/solid-db": "0.2.10",
40+
"@tanstack/solid-form": "1.28.4",
4041
"@tanstack/solid-query": "5.90.23",
4142
"@tanstack/solid-query-devtools": "5.91.3",
4243
"@tanstack/solid-table": "8.21.3",

frontend/src/styles/tailwind.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,14 @@
9191
padding: 0;
9292
}
9393
}
94+
95+
@layer utilities {
96+
.autofill-fix:-webkit-autofill,
97+
.autofill-fix:-webkit-autofill:hover,
98+
.autofill-fix:-webkit-autofill:focus {
99+
@apply border-none font-(--font) caret-(--text-color) font-[inherit];
100+
outline: 0.15em solid var(--main-color);
101+
-webkit-text-fill-color: var(--text-color);
102+
-webkit-box-shadow: 0 0 0 1000000px var(--sub-alt-color) inset;
103+
}
104+
}

frontend/src/ts/auth.tsx

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ import {
3434
} from "./stores/notifications";
3535
import { createErrorMessage } from "./utils/misc";
3636

37+
export type AuthResult =
38+
| {
39+
success: true;
40+
}
41+
| {
42+
success: false;
43+
message: string;
44+
};
45+
3746
export const gmailProvider = new GoogleAuthProvider();
3847
export const githubProvider = new GithubAuthProvider();
3948

@@ -156,15 +165,7 @@ export async function signIn(
156165
email: string,
157166
password: string,
158167
rememberMe: boolean,
159-
): Promise<
160-
| {
161-
success: true;
162-
}
163-
| {
164-
success: false;
165-
message: string;
166-
}
167-
> {
168+
): Promise<AuthResult> {
168169
if (!isAuthAvailable()) {
169170
return { success: false, message: "Authentication uninitialized" };
170171
}
@@ -182,15 +183,7 @@ export async function signIn(
182183
async function signInWithProvider(
183184
provider: AuthProvider,
184185
rememberMe: boolean,
185-
): Promise<
186-
| {
187-
success: true;
188-
}
189-
| {
190-
success: false;
191-
message: string;
192-
}
193-
> {
186+
): Promise<AuthResult> {
194187
if (!isAuthAvailable()) {
195188
return { success: false, message: "Authentication uninitialized" };
196189
}
@@ -203,27 +196,15 @@ async function signInWithProvider(
203196
return { success: true };
204197
}
205198

206-
export async function signInWithGoogle(rememberMe: boolean): Promise<
207-
| {
208-
success: true;
209-
}
210-
| {
211-
success: false;
212-
message: string;
213-
}
214-
> {
199+
export async function signInWithGoogle(
200+
rememberMe: boolean,
201+
): Promise<AuthResult> {
215202
return signInWithProvider(gmailProvider, rememberMe);
216203
}
217204

218-
export async function signInWithGitHub(rememberMe: boolean): Promise<
219-
| {
220-
success: true;
221-
}
222-
| {
223-
success: false;
224-
message: string;
225-
}
226-
> {
205+
export async function signInWithGitHub(
206+
rememberMe: boolean,
207+
): Promise<AuthResult> {
227208
return signInWithProvider(githubProvider, rememberMe);
228209
}
229210

@@ -272,15 +253,7 @@ export async function signUp(
272253
name: string,
273254
email: string,
274255
password: string,
275-
): Promise<
276-
| {
277-
success: true;
278-
}
279-
| {
280-
success: false;
281-
message: string;
282-
}
283-
> {
256+
): Promise<AuthResult> {
284257
if (!isAuthAvailable()) {
285258
return { success: false, message: "Authentication uninitialized" };
286259
}

frontend/src/ts/components/common/Button.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ type BaseProps = {
1414
balloon?: BalloonProps;
1515
"router-link"?: true;
1616
onClick?: () => void;
17+
type?: HTMLButtonElement["type"];
1718
onMouseEnter?: () => void;
1819
onMouseLeave?: () => void;
1920
dataset?: Record<string, string>;
2021
active?: boolean;
2122
};
2223

23-
type ButtonProps = BaseProps & {
24+
export type ButtonProps = BaseProps & {
2425
type?: "button" | "submit" | "reset";
2526
href?: never;
2627
sameTarget?: true;
@@ -31,6 +32,7 @@ type AnchorProps = BaseProps & {
3132
href: string;
3233
// onClick?: never;
3334
disabled?: never;
35+
type?: never;
3436
};
3537

3638
export function Button(props: ButtonProps | AnchorProps): JSXElement {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { SolidQueryDevtools } from "@tanstack/solid-query-devtools";
22
import { JSXElement } from "solid-js";
3-
43
export function DevTools(): JSXElement {
54
return <SolidQueryDevtools />;
65
}

0 commit comments

Comments
 (0)