refactor: remove unused code and clean up query usage in dashboard and profile pages
This commit is contained in:
parent
f9ced9349b
commit
024b268000
|
|
@ -1,81 +0,0 @@
|
||||||
/**
|
|
||||||
* Example: Root Layout Integration with MobileNavbar
|
|
||||||
*
|
|
||||||
* This file shows how to integrate the MobileNavbar component
|
|
||||||
* into your main app layout structure.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { MobileNavbar } from "@/core/components/others";
|
|
||||||
import { Outlet } from "react-router-dom";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RootLayout Component
|
|
||||||
*
|
|
||||||
* This component should wrap your entire application.
|
|
||||||
* It provides:
|
|
||||||
* - Consistent layout structure
|
|
||||||
* - Fixed mobile navbar at bottom
|
|
||||||
* - Proper content padding on mobile
|
|
||||||
*/
|
|
||||||
export function RootLayout() {
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col min-h-screen" dir="rtl">
|
|
||||||
{/* Optional: Global Header */}
|
|
||||||
{/* <header className="sticky top-0 z-40 bg-white border-b border-gray-200">
|
|
||||||
<nav>Navigation header here</nav>
|
|
||||||
</header> */}
|
|
||||||
|
|
||||||
{/* Main Content Area - Routes render here via Outlet */}
|
|
||||||
<main className="flex-1 pb-20 md:pb-0">
|
|
||||||
<Outlet />
|
|
||||||
</main>
|
|
||||||
|
|
||||||
{/* Mobile Bottom Navigation - Fixed at bottom on mobile only */}
|
|
||||||
<MobileNavbar />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Router Configuration Example
|
|
||||||
*
|
|
||||||
* Place this in your router configuration file:
|
|
||||||
*
|
|
||||||
* import { RootLayout } from "@/layouts/RootLayout";
|
|
||||||
*
|
|
||||||
* const router = createBrowserRouter([
|
|
||||||
* {
|
|
||||||
* element: <RootLayout />,
|
|
||||||
* children: [
|
|
||||||
* { path: "/dashboard", element: <DashboardPage /> },
|
|
||||||
* { path: "/profile", element: <ProfilePage /> },
|
|
||||||
* { path: "/group-chat", element: <GroupChatPage /> },
|
|
||||||
* { path: "/ranking", element: <RankingPage /> },
|
|
||||||
* ],
|
|
||||||
* },
|
|
||||||
* ]);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Key Points:
|
|
||||||
*
|
|
||||||
* 1. pb-20 = padding-bottom on mobile
|
|
||||||
* - 5rem (80px) to accommodate navbar height + safe area
|
|
||||||
* - Prevents content from being hidden behind navbar
|
|
||||||
*
|
|
||||||
* 2. md:pb-0 = no padding on desktop
|
|
||||||
* - Navbar is hidden on desktop (md:hidden in navbar component)
|
|
||||||
* - So no padding needed
|
|
||||||
*
|
|
||||||
* 3. flex flex-col min-h-screen
|
|
||||||
* - Creates flexible column layout
|
|
||||||
* - Ensures navbar stays at bottom even with short content
|
|
||||||
*
|
|
||||||
* 4. dir="rtl"
|
|
||||||
* - Sets RTL direction for Persian text
|
|
||||||
* - Applies to all child elements
|
|
||||||
*
|
|
||||||
* 5. <Outlet />
|
|
||||||
* - React Router renders child routes here
|
|
||||||
* - Each page component renders inside the main tag
|
|
||||||
*/
|
|
||||||
|
|
@ -16,7 +16,7 @@ const DashboardPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { data, isLoading, error } = useQuery({
|
const { data, isLoading } = useQuery({
|
||||||
queryKey: ["userProfile"],
|
queryKey: ["userProfile"],
|
||||||
queryFn: fetchUserProfile,
|
queryFn: fetchUserProfile,
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,10 @@ import {
|
||||||
} from "@modules/dashboard/service/user.service";
|
} from "@modules/dashboard/service/user.service";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useEffect, useState, type FormEvent } from "react";
|
import { useEffect, useState, type FormEvent } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import type { RegistrationFormData } from "./profile.type";
|
import type { RegistrationFormData } from "./profile.type";
|
||||||
|
|
||||||
export function RegisterPage() {
|
export function RegisterPage() {
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user