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 committed 2026-06-02 02:42:07 +07:00
1 parent 73772f5f56
commit 0745dd903d
20 files changed
+1029 -287

No files matched your search

+25 -13
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 RegisterPage() {
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.register,
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 : 'Registrasi gagal'),
onError: (err) =>
setError(err instanceof Error ? err.message : "Registrasi gagal"),
});
return (
@@ -29,15 +36,20 @@ export function RegisterPage() {
mode="register"
isSubmitting={mutation.isPending}
error={error}
googleOAuthEnabled={Boolean(meQuery.data?.features.googleOAuthEnabled)}
googleOAuthEnabled={Boolean(
meQuery.data?.features.googleOAuthEnabled,
)}
onSubmit={async ({ name, email, password }) => {
setError(null);
return mutation.mutateAsync({ name: name ?? '', email, password });
return mutation.mutateAsync({ name: name ?? "", email, password });
}}
onFieldChange={() => setError(null)}
/>
<p className="text-center text-sm text-muted-foreground">
Sudah punya akun? <Link className="text-primary" to="/login">Masuk</Link>
Sudah punya akun?{" "}
<Link className="text-primary" to="/login">
Masuk
</Link>
</p>
</div>
</main>