Restore Ultracite + fix sidebar (#1233)

This commit is contained in:
Hayden Bleasel 2025-09-21 11:02:31 -07:00 committed by GitHub
parent 8fbfc253fa
commit 947ed094a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
177 changed files with 6908 additions and 8306 deletions

View file

@ -1,52 +1,51 @@
'use client';
"use client";
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useActionState, useEffect, useState } from 'react';
import { toast } from '@/components/toast';
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useSession } from "next-auth/react";
import { useActionState, useEffect, useState } from "react";
import { AuthForm } from '@/components/auth-form';
import { SubmitButton } from '@/components/submit-button';
import { login, type LoginActionState } from '../actions';
import { useSession } from 'next-auth/react';
import { AuthForm } from "@/components/auth-form";
import { SubmitButton } from "@/components/submit-button";
import { toast } from "@/components/toast";
import { type LoginActionState, login } from "../actions";
export default function Page() {
const router = useRouter();
const [email, setEmail] = useState('');
const [email, setEmail] = useState("");
const [isSuccessful, setIsSuccessful] = useState(false);
const [state, formAction] = useActionState<LoginActionState, FormData>(
login,
{
status: 'idle',
},
status: "idle",
}
);
const { update: updateSession } = useSession();
useEffect(() => {
if (state.status === 'failed') {
if (state.status === "failed") {
toast({
type: 'error',
description: 'Invalid credentials!',
type: "error",
description: "Invalid credentials!",
});
} else if (state.status === 'invalid_data') {
} else if (state.status === "invalid_data") {
toast({
type: 'error',
description: 'Failed validating your submission!',
type: "error",
description: "Failed validating your submission!",
});
} else if (state.status === 'success') {
} else if (state.status === "success") {
setIsSuccessful(true);
updateSession();
router.refresh();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state.status]);
}, [state.status, router.refresh, updateSession]);
const handleSubmit = (formData: FormData) => {
setEmail(formData.get('email') as string);
setEmail(formData.get("email") as string);
formAction(formData);
};
@ -64,12 +63,12 @@ export default function Page() {
<p className="mt-4 text-center text-gray-600 text-sm dark:text-zinc-400">
{"Don't have an account? "}
<Link
href="/register"
className="font-semibold text-gray-800 hover:underline dark:text-zinc-200"
href="/register"
>
Sign up
</Link>
{' for free.'}
{" for free."}
</p>
</AuthForm>
</div>