Skip to content
Merged

ts/form #7605

Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion frontend/.oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"rules": {
"explicit-function-return-type": "off",
"no-explicit-any": "off",
"no-unsafe-assignment": "off"
"no-unsafe-assignment": "off",
"no-empty-function": "off"
}
},
{
Expand Down
82 changes: 0 additions & 82 deletions frontend/__tests__/components/ui/ValidatedInput.spec.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"dependencies": {
"@date-fns/utc": "1.2.0",
"@leonabcd123/modern-caps-lock": "2.2.2",
"@leonabcd123/modern-caps-lock": "3.0.4",
"@monkeytype/contracts": "workspace:*",
"@monkeytype/funbox": "workspace:*",
"@monkeytype/schemas": "workspace:*",
Expand All @@ -37,6 +37,7 @@
"@tanstack/pacer-lite": "0.2.1",
"@tanstack/query-db-collection": "1.0.27",
"@tanstack/solid-db": "0.2.10",
"@tanstack/solid-form": "1.28.4",
"@tanstack/solid-query": "5.90.23",
"@tanstack/solid-query-devtools": "5.91.3",
"@tanstack/solid-table": "8.21.3",
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/styles/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,14 @@
padding: 0;
}
}

@layer utilities {
.autofill-fix:-webkit-autofill,
.autofill-fix:-webkit-autofill:hover,
.autofill-fix:-webkit-autofill:focus {
@apply border-none font-(--font) caret-(--text-color) font-[inherit];
outline: 0.15em solid var(--main-color);
-webkit-text-fill-color: var(--text-color);
-webkit-box-shadow: 0 0 0 1000000px var(--sub-alt-color) inset;
}
}
63 changes: 18 additions & 45 deletions frontend/src/ts/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ import {
} from "./stores/notifications";
import { createErrorMessage } from "./utils/misc";

export type AuthResult =
| {
success: true;
}
| {
success: false;
message: string;
};

export const gmailProvider = new GoogleAuthProvider();
export const githubProvider = new GithubAuthProvider();

Expand Down Expand Up @@ -156,15 +165,7 @@ export async function signIn(
email: string,
password: string,
rememberMe: boolean,
): Promise<
| {
success: true;
}
| {
success: false;
message: string;
}
> {
): Promise<AuthResult> {
if (!isAuthAvailable()) {
return { success: false, message: "Authentication uninitialized" };
}
Expand All @@ -182,15 +183,7 @@ export async function signIn(
async function signInWithProvider(
provider: AuthProvider,
rememberMe: boolean,
): Promise<
| {
success: true;
}
| {
success: false;
message: string;
}
> {
): Promise<AuthResult> {
if (!isAuthAvailable()) {
return { success: false, message: "Authentication uninitialized" };
}
Expand All @@ -203,27 +196,15 @@ async function signInWithProvider(
return { success: true };
}

export async function signInWithGoogle(rememberMe: boolean): Promise<
| {
success: true;
}
| {
success: false;
message: string;
}
> {
export async function signInWithGoogle(
rememberMe: boolean,
): Promise<AuthResult> {
return signInWithProvider(gmailProvider, rememberMe);
}

export async function signInWithGitHub(rememberMe: boolean): Promise<
| {
success: true;
}
| {
success: false;
message: string;
}
> {
export async function signInWithGitHub(
rememberMe: boolean,
): Promise<AuthResult> {
return signInWithProvider(githubProvider, rememberMe);
}

Expand Down Expand Up @@ -272,15 +253,7 @@ export async function signUp(
name: string,
email: string,
password: string,
): Promise<
| {
success: true;
}
| {
success: false;
message: string;
}
> {
): Promise<AuthResult> {
if (!isAuthAvailable()) {
return { success: false, message: "Authentication uninitialized" };
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/ts/components/common/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ type BaseProps = {
balloon?: BalloonProps;
"router-link"?: true;
onClick?: () => void;
type?: HTMLButtonElement["type"];
onMouseEnter?: () => void;
onMouseLeave?: () => void;
dataset?: Record<string, string>;
active?: boolean;
};

type ButtonProps = BaseProps & {
export type ButtonProps = BaseProps & {
type?: "button" | "submit" | "reset";
href?: never;
sameTarget?: true;
Expand All @@ -31,6 +32,7 @@ type AnchorProps = BaseProps & {
href: string;
// onClick?: never;
disabled?: never;
type?: never;
};

export function Button(props: ButtonProps | AnchorProps): JSXElement {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/ts/components/core/DevTools.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SolidQueryDevtools } from "@tanstack/solid-query-devtools";
import { JSXElement } from "solid-js";

export function DevTools(): JSXElement {
return <SolidQueryDevtools />;
}
Loading
Loading