+
+ {/* عرض البيانات بشكل read-only بدون أي فورم أو زرار تعديل */}
+
+ {fields.map((f) => (
+
+
{f.label}
+
{f.value}
+
+ ))}
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/app/features/page.tsx b/app/features/page.tsx
index 90c2b79..fb51604 100644
--- a/app/features/page.tsx
+++ b/app/features/page.tsx
@@ -10,8 +10,7 @@ import {
ClipboardList,
FileBarChart2,
} from "lucide-react";
-import Navbar from "@/app/components/layout/Navbar";
-import Logo from "@/src/utils/logo";
+
type Tone = "blue" | "emerald" | "amber";
@@ -81,7 +80,7 @@ const featureGroups: { icon: typeof Car; tone: Tone; title: string; text: string
export default function FeaturesPage() {
return (
-
+
@@ -143,14 +142,6 @@ export default function FeaturesPage() {
-
);
}
\ No newline at end of file
diff --git a/app/frequently_asked_questions/page.tsx b/app/frequently_asked_questions/page.tsx
index 60ad86e..06e8553 100644
--- a/app/frequently_asked_questions/page.tsx
+++ b/app/frequently_asked_questions/page.tsx
@@ -3,8 +3,7 @@
import { useState } from "react";
import Link from "next/link";
import { ChevronDown } from "lucide-react";
-import Navbar from "@/app/components/layout/Navbar";
-import Logo from "@/src/utils/logo";
+
const faqs = [
{
@@ -42,7 +41,7 @@ export default function FaqPage() {
return (
-
+
@@ -105,14 +104,7 @@ export default function FaqPage() {
-
+
);
}
\ No newline at end of file
diff --git a/app/home/page.tsx b/app/home/page.tsx
index eff5ae8..5f48a3d 100644
--- a/app/home/page.tsx
+++ b/app/home/page.tsx
@@ -106,7 +106,7 @@ const roles = [
export default function HomePage() {
return (
-
+
{/* Hero */}
@@ -284,19 +284,7 @@ export default function HomePage() {
-
+
);
}
\ No newline at end of file
diff --git a/app/how_work/page.tsx b/app/how_work/page.tsx
index 913c8df..76653eb 100644
--- a/app/how_work/page.tsx
+++ b/app/how_work/page.tsx
@@ -33,7 +33,7 @@ const steps = [
export default function HowWorkPage() {
return (
-
+
@@ -95,14 +95,7 @@ export default function HowWorkPage() {
-
+
);
}
\ No newline at end of file
diff --git a/app/layout.tsx b/app/layout.tsx
index f39c7ba..c5b1f31 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,29 +1,9 @@
import type { Metadata } from "next";
import "@tabler/icons-webfont/dist/tabler-icons.min.css";
import "./globals.css";
+import ConditionalNavbar from "./components/layout/ConditionalNavbar";
-/**
- * NOT SHOWN IN THE ORIGINAL FILE SET.
- * This is the one file every RTL conversion ultimately hinges on:
- * `dir="rtl"` and `lang="ar"` belong on the root element so
- * (a) the browser's native bidi algorithm kicks in everywhere,
- * (b) Tailwind v4's `rtl:`/`ltr:` variants have something to key off,
- * (c) form controls, scrollbars, and native widgets mirror correctly.
- *
- * If your real app/layout.tsx differs (providers, fonts, etc.), keep
- * everything else as-is and only add the import below.
- *
- * ICON FONT: the project already uses Tabler Icons class names
- * everywhere (ti ti-layout-dashboard, ti ti-car, ti ti-route, ...)
- * but no stylesheet that defines those classes was ever loaded, so
- * every icon in the sidebar was silently rendering as nothing.
- * Self-hosted via `npm install @tabler/icons-webfont` rather than a
- * CDN — no external request at runtime, works behind
- * corporate proxies / restrictive network policies, and Next bundles
- * + fingerprints the CSS and font files automatically. Run
- * `npm install @tabler/icons-webfont` if it isn't already a
- * dependency, then this import resolves on its own.
- */
+import { Footer } from "./components/layout";
export const metadata: Metadata = {
title: "لوحة التحكم",
@@ -36,8 +16,14 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
+ // ⚠️ اتصلح: الـ Navbar والـ footer كانوا برة / وده HTML غير صالح
- {children}
+
+ {/* الناف بار بيظهر بس لو مفيش يوزر مسجل دخول */}
+
+ {children}
+
+
);
}
\ No newline at end of file
diff --git a/app/prices/page.tsx b/app/prices/page.tsx
index c1d0f04..0aed76b 100644
--- a/app/prices/page.tsx
+++ b/app/prices/page.tsx
@@ -49,7 +49,7 @@ const plans = [
export default function PricesPage() {
return (
-
+
@@ -121,14 +121,7 @@ export default function PricesPage() {
-
+
);
}
\ No newline at end of file
diff --git a/src/hooks/useCurrentUser.ts b/src/hooks/useCurrentUser.ts
new file mode 100644
index 0000000..b24b936
--- /dev/null
+++ b/src/hooks/useCurrentUser.ts
@@ -0,0 +1,34 @@
+"use client";
+
+import { useEffect, useState, useCallback } from "react";
+import { getStoredToken } from "@/src/lib/auth";
+import { userService, extractMeUser } from "@/src/services/user.service";
+import type { UserMe } from "@/src/types/user";
+
+export function useCurrentUser() {
+ const [user, setUser] = useState(null);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+
+ const load = useCallback(async () => {
+ setLoading(true);
+ setError(null);
+ try {
+ const token = getStoredToken();
+ const res = await userService.getMe(token);
+ const u = extractMeUser(res.data ?? res);
+ if (!u) throw new Error("لا توجد بيانات");
+ setUser(u as UserMe);
+ } catch {
+ setError("تعذر تحميل بيانات الحساب. حاول مرة أخرى.");
+ } finally {
+ setLoading(false);
+ }
+ }, []);
+
+ useEffect(() => {
+ load();
+ }, [load]);
+
+ return { user, loading, error, reload: load };
+}
\ No newline at end of file
diff --git a/src/services/user.service.ts b/src/services/user.service.ts
index 35bb359..5579609 100644
--- a/src/services/user.service.ts
+++ b/src/services/user.service.ts
@@ -4,7 +4,15 @@ import type { ApiListResponse, User, UserFormData, UserResponse } from "@/src/ty
import type { Role } from "@/src/types/role";
import type { Branch } from "@/src/types/branch";
-
+export interface MeApiResponse {
+ success: boolean;
+ message: string;
+ responseAt: string;
+ data: {
+ data: User[] | User;
+ meta?: { total: number; page: number; limit: number; totalPages: number };
+ };
+}
/**Building a query string to fetch users with search and pagination*/
@@ -49,7 +57,14 @@ export const userService = {
branch: { name: string };
};
}>(`users/${id}`, token),
+ getMe: (token: string | null) =>
+ get("users/me", token),
};
+export function extractMeUser(res: MeApiResponse): User | null {
+ const d = res.data?.data;
+ if (Array.isArray(d)) return d[0] ?? null;
+ return d ?? null;
+}
/** Converting the form data into a payload suitable for the API */
function buildPayload(
diff --git a/src/types/user.ts b/src/types/user.ts
index 7479c3d..c8c2a4e 100644
--- a/src/types/user.ts
+++ b/src/types/user.ts
@@ -111,4 +111,10 @@ export interface ApiErrorResponse {
path: string;
details: { field: string; code: string }[];
};
+}
+
+export interface UserMe extends User {
+ photo: string | null;
+ isDeleted: boolean;
+ updatedAt: string;
}
\ No newline at end of file