feat: update landing page and add new library and scan pages

- Refactor landing page content and links for better user experience.
- Introduce a new library page to display disease information with filtering and modal details.
- Add a scan page for users to upload images for diagnosis with a preview modal.
- Enhance login and registration pages with automatic navigation to the dashboard.
- Integrate vite-tsconfig-paths for improved path resolution in Vite configuration.
This commit is contained in:
seriouselly
2026-06-02 02:42:07 +07:00
parent 73772f5f56
commit 0745dd903d
20 changed files with 1029 additions and 287 deletions
+24 -12
View File
@@ -1,25 +1,32 @@
import { useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { AuthForm } from '@/components/auth-form';
import { apiClient } from '@/lib/api-client';
import { useAuthStore } from '@/store/auth-store';
import { useEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { AuthForm } from "@/components/auth-form";
import { apiClient } from "@/lib/api-client";
import { useAuthStore } from "@/store/auth-store";
export function LoginPage() {
const navigate = useNavigate();
useEffect(() => {
navigate("/dashboard");
}, [navigate]);
const queryClient = useQueryClient();
const setUser = useAuthStore((state) => state.setUser);
const [error, setError] = useState<string | null>(null);
const meQuery = useQuery({ queryKey: ['auth', 'me'], queryFn: () => apiClient.getMe() });
const meQuery = useQuery({
queryKey: ["auth", "me"],
queryFn: () => apiClient.getMe(),
});
const mutation = useMutation({
mutationFn: apiClient.login,
onSuccess: (response) => {
setUser(response.user);
queryClient.setQueryData(['auth', 'me'], response);
navigate('/dashboard');
queryClient.setQueryData(["auth", "me"], response);
navigate("/dashboard");
},
onError: (err) => setError(err instanceof Error ? err.message : 'Login gagal'),
onError: (err) =>
setError(err instanceof Error ? err.message : "Login gagal"),
});
return (
@@ -29,7 +36,9 @@ export function LoginPage() {
mode="login"
isSubmitting={mutation.isPending}
error={error}
googleOAuthEnabled={Boolean(meQuery.data?.features.googleOAuthEnabled)}
googleOAuthEnabled={Boolean(
meQuery.data?.features.googleOAuthEnabled,
)}
onSubmit={async ({ email, password }) => {
setError(null);
return mutation.mutateAsync({ email, password });
@@ -37,7 +46,10 @@ export function LoginPage() {
onFieldChange={() => setError(null)}
/>
<p className="text-center text-sm text-muted-foreground">
Belum punya akun? <Link className="text-primary" to="/register">Daftar</Link>
Belum punya akun?{" "}
<Link className="text-primary" to="/register">
Daftar
</Link>
</p>
</div>
</main>