back page update

This commit is contained in:
Samandar Turgunboyev
2025-12-03 11:00:57 +05:00
parent d4788c7cb2
commit 2fb567d93f
19 changed files with 38 additions and 34 deletions

View File

@@ -190,7 +190,7 @@ export default function District() {
}
return (
<DashboardLayout>
<DashboardLayout link="/">
<>
<div className="flex items-center justify-between">
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>

View File

@@ -345,7 +345,7 @@ const CreateDoctor = () => {
};
return (
<DashboardLayout>
<DashboardLayout link="/doctor">
<div className="max-w-3xl mx-auto space-y-6">
<h1 className="text-3xl font-bold">{"Qo'shish"}</h1>
<Form {...form}>
@@ -509,7 +509,7 @@ const CreateDoctor = () => {
name="streets"
render={({ field }) => (
<FormItem>
<FormLabel>{"Ko'cha"}</FormLabel>
<FormLabel>{"Obyekt"}</FormLabel>
<FormControl>
<Select
key={field.value}
@@ -520,7 +520,7 @@ const CreateDoctor = () => {
}}
>
<SelectTrigger className="w-full h-12">
<SelectValue placeholder="Ko'chalar" />
<SelectValue placeholder="Obyektlar" />
</SelectTrigger>
<SelectContent>
{streets?.map((s) => (

View File

@@ -23,7 +23,7 @@ const DoctorDetail = () => {
if (isLoading) {
return (
<DashboardLayout>
<DashboardLayout link="/doctor">
<div className="flex justify-center py-20">
<div className="flex flex-col items-center gap-3">
<div className="h-10 w-10 rounded-full border-4 border-gray-300 border-t-primary animate-spin"></div>
@@ -36,7 +36,7 @@ const DoctorDetail = () => {
if (isError) {
return (
<DashboardLayout>
<DashboardLayout link="/doctor">
<div className="flex flex-col items-center py-20 gap-4">
<p className="text-red-500 font-medium">
Ma'lumot yuklashda xatolik yuz berdi.
@@ -49,7 +49,7 @@ const DoctorDetail = () => {
if (!doctor) {
return (
<DashboardLayout>
<DashboardLayout link="/doctor">
<div className="flex flex-col items-center py-20 gap-3 text-center">
<p className="text-gray-500 text-lg">Shifokor topilmadi.</p>
<Button onClick={() => router("/physician")}>
@@ -61,7 +61,7 @@ const DoctorDetail = () => {
}
return (
<DashboardLayout>
<DashboardLayout link="/doctor">
<div className="max-w-3xl mx-auto bg-white border rounded-xl shadow-sm p-6">
<h1 className="text-2xl font-bold mb-2">
{doctor.first_name} {doctor.last_name}

View File

@@ -81,7 +81,7 @@ const Doctor = () => {
});
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="flex justify-between items-center">
<AddedButton onClick={() => router("/physician/added")} />
</div>

View File

@@ -186,7 +186,7 @@ const MyLocation: React.FC = () => {
});
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="space-y-4">
<Card>
<CardHeader className="flex flex-col">

View File

@@ -179,7 +179,7 @@ const CreateObject = () => {
}
return (
<DashboardLayout>
<DashboardLayout link="/object">
<div className="max-w-3xl mx-auto space-y-6">
<h1 className="text-3xl font-bold">{"Yangi obyekt qo'shish"}</h1>
<Form {...form}>

View File

@@ -62,7 +62,7 @@ const ObjectList = () => {
});
return (
<DashboardLayout>
<DashboardLayout link="/">
<AddedButton onClick={() => router("/object/added")} />
<div className="space-y-6">
<h1 className="text-3xl font-bold">Obyektlar royxati</h1>

View File

@@ -121,9 +121,7 @@ const ObjectMapPage = () => {
const L = (await import("leaflet")).default;
await import("leaflet/dist/leaflet.css");
await import("leaflet-routing-machine");
await import(
"leaflet-routing-machine/dist/leaflet-routing-machine.css"
);
await import("leaflet-routing-machine/dist/leaflet-routing-machine.css");
// Xaritani yaratish
if (!mapInstance.current) {
@@ -298,13 +296,13 @@ const ObjectMapPage = () => {
if (!lat || !lon)
return (
<DashboardLayout>
<DashboardLayout link="/object">
<p className="text-red-600">Koordinatalar mavjud emas</p>
</DashboardLayout>
);
return (
<DashboardLayout>
<DashboardLayout link="/object">
<div className="space-y-4">
{loading && (
<div className="rounded-lg bg-blue-50 p-4">

View File

@@ -229,7 +229,7 @@ const CreatePharmacy = () => {
};
return (
<DashboardLayout>
<DashboardLayout link="/pharmacy">
<div className="max-w-3xl mx-auto space-y-6">
<h1 className="text-3xl font-bold">{"Qo'shish"}</h1>
<Form {...form}>
@@ -357,7 +357,7 @@ const CreatePharmacy = () => {
name="streets"
render={({ field }) => (
<FormItem>
<FormLabel>{"Ko'cha"}</FormLabel>
<FormLabel>{"Obyekt"}</FormLabel>
<FormControl>
<Select
key={field.value}
@@ -368,7 +368,7 @@ const CreatePharmacy = () => {
}}
>
<SelectTrigger className="w-full h-12">
<SelectValue placeholder="Ko'chalar" />
<SelectValue placeholder="Obyektlar" />
</SelectTrigger>
<SelectContent>
{streets?.map((s) => (

View File

@@ -23,7 +23,7 @@ const PharmacyList = () => {
const [deleteDialog, setDeleteDialog] = useState(false);
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="flex justify-between items-center">
<AddedButton onClick={() => router("/pharmacy/added")} />
</div>

View File

@@ -296,13 +296,13 @@ const ObjectMapPage = () => {
if (!lat || !lon)
return (
<DashboardLayout>
<DashboardLayout link="/pharmacy">
<p className="text-red-600">Koordinatalar mavjud emas</p>
</DashboardLayout>
);
return (
<DashboardLayout>
<DashboardLayout link="/pharmacy">
<div className="space-y-4">
{loading && (
<div className="rounded-lg bg-blue-50 p-4">

View File

@@ -89,7 +89,7 @@ const PlanTour = () => {
};
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="max-w-7xl mx-auto">
<h1 className="text-4xl font-bold text-gray-900 mb-2">
Oylik to'lovlar

View File

@@ -104,7 +104,7 @@ export default function Plans() {
const grouped = groupByDate(data?.data.data || []);
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="space-y-4">
<div className="flex items-center justify-between">
<h1 className="text-3xl font-bold text-foreground">Kunlik Reja</h1>

View File

@@ -34,7 +34,7 @@ export function DetailViewPage() {
if (!item) return <div>{"Ma'lumot topilmadi"}</div>;
return (
<DashboardLayout>
<DashboardLayout link="/specification">
<div className="min-h-screen bg-gray-50">
<div className="max-w-5xl mx-auto">
<div className="bg-white rounded-lg shadow-lg overflow-hidden">

View File

@@ -22,7 +22,7 @@ export function HistoryListPage() {
if (isLoading) {
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="min-h-screen flex justify-center items-center">
<p className="text-gray-500 text-lg">Yuklanmoqda...</p>
</div>
@@ -32,7 +32,7 @@ export function HistoryListPage() {
if (isError) {
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="min-h-screen flex flex-col justify-center items-center">
<p className="text-red-600 text-lg mb-2">Xatolik yuz berdi</p>
<Button onClick={() => window.location.reload()}>
@@ -44,7 +44,7 @@ export function HistoryListPage() {
}
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="min-h-screen bg-gray-50">
<div className="max-w-5xl mx-auto">
<div className="flex justify-between items-center mb-6">

View File

@@ -165,7 +165,7 @@ export function SpecificationPage() {
const hasSelectedMedicines = medicines.some((m) => m.quantity > 0);
return (
<DashboardLayout>
<DashboardLayout link="/specification">
<div className="min-h-screen">
<div className="max-w-6xl mx-auto">
<h1 className="text-4xl font-bold text-foreground">

View File

@@ -139,7 +139,7 @@ export default function TourPlan() {
const years = Array.from({ length: 11 }, (_, i) => currentYearSelect - 5 + i);
return (
<DashboardLayout>
<DashboardLayout link="/">
<div className="space-y-6">
<h1 className="text-3xl font-bold">Tur Plan</h1>

View File

@@ -45,7 +45,13 @@ const navItems: NavItem[] = [
{ title: "To'lovlar", href: "/type-plan", icon: Banknote },
];
export function DashboardLayout({ children }: { children: ReactNode }) {
export function DashboardLayout({
children,
link,
}: {
children: ReactNode;
link: string;
}) {
const location = useLocation();
const pathname = location.pathname;
const router = useNavigate();
@@ -154,7 +160,7 @@ export function DashboardLayout({ children }: { children: ReactNode }) {
<div className="sticky top-0 z-40 flex justify-between h-16 shrink-0 items-center gap-x-4 border-b border-border bg-background px-1 shadow-sm sm:gap-x-6 sm:px-6 lg:px-8 lg:pl-72">
<Button
variant="default"
onClick={() => router(-1)}
onClick={() => router(link)}
className="group flex items-center gap-2 px-2 py-5 ml-2 text-foreground hover:text-primary hover:bg-accent/50 transition-all duration-200 rounded-lg"
>
<ChevronLeft className="size-7 transition-transform text-white group-hover:-translate-x-1" />

View File

@@ -17,7 +17,7 @@ export default defineConfig({
port: 5174,
host: true, // barcha hostlarga ruxsat
allowedHosts: [
"worth-fathers-turned-diamonds.trycloudflare.com", // ngrok host qo'shildi
"humanitarian-monroe-theories-philadelphia.trycloudflare.com", // ngrok host qo'shildi
],
},
});