feat: add ultracite (#452)

* Init ultracite

* Update scripts and biome.jsonc

* Update biome.jsonc

* Update biome.jsonc

* Update biome.jsonc

* Run format
This commit is contained in:
Hayden Bleasel
2025-07-25 00:41:34 +03:00
committed by GitHub
parent 7b840e9b4e
commit 5931ddb77a
113 changed files with 8033 additions and 7070 deletions
+46 -46
View File
@@ -3,58 +3,58 @@ import { useRouter } from "next/navigation";
import { signIn } from "@opencut/auth/client";
export function useLogin() {
const router = useRouter();
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [isEmailLoading, setIsEmailLoading] = useState(false);
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
const router = useRouter();
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [isEmailLoading, setIsEmailLoading] = useState(false);
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
const handleLogin = useCallback(async () => {
setError(null);
setIsEmailLoading(true);
const handleLogin = useCallback(async () => {
setError(null);
setIsEmailLoading(true);
const { error } = await signIn.email({
email,
password,
});
const { error } = await signIn.email({
email,
password,
});
if (error) {
setError(error.message || "An unexpected error occurred.");
setIsEmailLoading(false);
return;
}
if (error) {
setError(error.message || "An unexpected error occurred.");
setIsEmailLoading(false);
return;
}
router.push("/projects");
}, [router, email, password]);
router.push("/projects");
}, [router, email, password]);
const handleGoogleLogin = async () => {
setError(null);
setIsGoogleLoading(true);
const handleGoogleLogin = async () => {
setError(null);
setIsGoogleLoading(true);
try {
await signIn.social({
provider: "google",
callbackURL: "/projects",
});
} catch (error) {
setError("Failed to sign in with Google. Please try again.");
setIsGoogleLoading(false);
}
};
try {
await signIn.social({
provider: "google",
callbackURL: "/projects",
});
} catch (error) {
setError("Failed to sign in with Google. Please try again.");
setIsGoogleLoading(false);
}
};
const isAnyLoading = isEmailLoading || isGoogleLoading;
const isAnyLoading = isEmailLoading || isGoogleLoading;
return {
email,
setEmail,
password,
setPassword,
error,
isEmailLoading,
isGoogleLoading,
isAnyLoading,
handleLogin,
handleGoogleLogin,
};
return {
email,
setEmail,
password,
setPassword,
error,
isEmailLoading,
isGoogleLoading,
isAnyLoading,
handleLogin,
handleGoogleLogin,
};
}
+51 -51
View File
@@ -3,63 +3,63 @@ import { useRouter } from "next/navigation";
import { signUp, signIn } from "@opencut/auth/client";
export function useSignUp() {
const router = useRouter();
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [isEmailLoading, setIsEmailLoading] = useState(false);
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
const router = useRouter();
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [isEmailLoading, setIsEmailLoading] = useState(false);
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
const handleSignUp = useCallback(async () => {
setError(null);
setIsEmailLoading(true);
const handleSignUp = useCallback(async () => {
setError(null);
setIsEmailLoading(true);
const { error } = await signUp.email({
name,
email,
password,
});
const { error } = await signUp.email({
name,
email,
password,
});
if (error) {
setError(error.message || "An unexpected error occurred.");
setIsEmailLoading(false);
return;
}
if (error) {
setError(error.message || "An unexpected error occurred.");
setIsEmailLoading(false);
return;
}
router.push("/login");
}, [name, email, password, router]);
router.push("/login");
}, [name, email, password, router]);
const handleGoogleSignUp = useCallback(async () => {
setError(null);
setIsGoogleLoading(true);
const handleGoogleSignUp = useCallback(async () => {
setError(null);
setIsGoogleLoading(true);
try {
await signIn.social({
provider: "google",
});
try {
await signIn.social({
provider: "google",
});
router.push("/editor");
} catch (error) {
setError("Failed to sign up with Google. Please try again.");
setIsGoogleLoading(false);
}
}, [router]);
router.push("/editor");
} catch (error) {
setError("Failed to sign up with Google. Please try again.");
setIsGoogleLoading(false);
}
}, [router]);
const isAnyLoading = isEmailLoading || isGoogleLoading;
const isAnyLoading = isEmailLoading || isGoogleLoading;
return {
name,
setName,
email,
setEmail,
password,
setPassword,
error,
isEmailLoading,
isGoogleLoading,
isAnyLoading,
handleSignUp,
handleGoogleSignUp,
};
}
return {
name,
setName,
email,
setEmail,
password,
setPassword,
error,
isEmailLoading,
isGoogleLoading,
isAnyLoading,
handleSignUp,
handleGoogleSignUp,
};
}