Compare commits

...

2 Commits

Author SHA1 Message Date
MehrdadAdabi
f1b4d313eb Merge branch 'main' of http://git.sepehrdata.com/Saeed0920/inogen 2025-09-14 16:09:20 +03:30
MehrdadAdabi
6fdfe83b1e feat:add redirect link to bpms 2025-09-14 16:07:30 +03:30
3 changed files with 53 additions and 36 deletions

View File

@ -5,17 +5,16 @@ import { cn } from "~/lib/utils";
import { Button } from "~/components/ui/button";
import {
PanelLeft,
Search,
Bell,
Settings,
User,
Moon,
Sun,
Menu,
ChevronDown,
Globe,
HelpCircle,
Server,
} from "lucide-react";
import apiService from "~/lib/api";
interface HeaderProps {
onToggleSidebar?: () => void;
@ -32,6 +31,18 @@ export function Header({
const [isProfileMenuOpen, setIsProfileMenuOpen] = useState(false);
const [isNotificationOpen, setIsNotificationOpen] = useState(false);
const redirectHandler = async () => {
try {
const getData = await apiService.post('/GenerateSsoCode')
const url = `http://localhost:3000/redirect/${getData.data}`;
// const url = `https://inogen-bpms.pelekan.org/redirect/${getData.data}`;
window.open(url, "_blank");
} catch (error) {
console.log(error);
}
}
return (
<header
className={cn(
@ -111,6 +122,13 @@ export function Header({
<Settings className="h-4 w-4" />
تنظیمات
</Link>
<button
className="flex w-full items-center gap-2 px-3 py-2 text-sm text-gray-300 hover:bg-gradient-to-r hover:from-emerald-500/10 hover:to-teal-500/10 hover:text-emerald-300 font-persian"
onClick={redirectHandler}>
<Server className="h-4 w-4" />
ورود به سامانه BPMS
</button>
</div>
</div>
)}

View File

@ -3,6 +3,7 @@ import { cn } from "~/lib/utils";
import { Sidebar } from "./sidebar";
import { Header } from "./header";
import { StrategicAlignmentPopup } from "./strategic-alignment-popup";
import apiService from "~/lib/api";
interface DashboardLayoutProps {
children: React.ReactNode;
@ -27,10 +28,12 @@ export function DashboardLayout({
setIsMobileSidebarOpen(!isMobileSidebarOpen);
};
return (
<div
className="h-screen flex overflow-hidden bg-[linear-gradient(to_bottom_left,#464861,20%,#111628)] relative overflow-x-hidden"
dir="rtl"
dir="rtl"
>
{/* Gradient overlay */}
<div className="absolute inset-0 pointer-events-none" />
@ -58,6 +61,7 @@ export function DashboardLayout({
onToggleCollapse={toggleSidebarCollapse}
className="h-full flex-shrink-0 relative z-10"
onStrategicAlignmentClick={() => setIsStrategicAlignmentPopupOpen(true)}
/>
</div>

View File

@ -15,6 +15,7 @@ import {
Settings,
Star,
Workflow,
DiscAlbum
} from "lucide-react";
import React, { useState } from "react";
import { Link, useLocation } from "react-router";
@ -38,7 +39,7 @@ interface MenuItem {
}
const menuItems: MenuItem[] = [
{
id: "dashboard",
label: "صفحه اصلی",
@ -106,12 +107,13 @@ const menuItems: MenuItem[] = [
icon: Star,
href: "/dashboard/top-innovations",
},
{
{
id: "strategic-alignment",
label: "میزان انطباق راهبردی",
icon: null,
href: "#", // This is not a route, it opens a popup
},
];
const bottomMenuItems: MenuItem[] = [
@ -214,30 +216,23 @@ export function Sidebar({
}
};
if (item.id === "strategic-alignment") {
return (
<button
key={item.id}
className={cn(
"w-full text-right",
)}
onClick={handleClick}
>
<div
className={cn(
"flex items-center justify-center w-full px-2 rounded-lg mt-4 transition-all duration-200 group",
)}
>
<div className="flex justify-center rounded-xl border-gray-500/20 border-2 cursor-pointer transition-all hover:bg-[#3F415A]/50 bg-[#3F415A] py-2 text-center items-center gap-3 min-w-0 flex-1">
<span className="font-persian text-sm font-medium truncate">
{item.label}
</span>
</div>
</div>
</button>
)
if (item.id === "strategic-alignment") {
return (
<button
key={item.id}
className={cn(
"flex items-center justify-center w-full px-2 rounded-lg mt-4 transition-all duration-200 group",
)}
>
<div className="flex justify-center rounded-xl border-gray-500/20 border-2 cursor-pointer transition-all hover:bg-[#3F415A]/50 bg-[#3F415A] py-2 text-center items-center gap-3 min-w-0 flex-1">
<span className="font-persian text-sm font-medium truncate">
{item.label}
</span>
</div>
</button>
)
}
}
return (
<div key={item.id} className="relative">
@ -293,10 +288,10 @@ return (
"w-full text-right",
// Disable pointer cursor when child is active (cannot collapse)
item.children &&
item.children.some(
(child) => child.href && location.pathname === child.href
) &&
"cursor-not-allowed"
item.children.some(
(child) => child.href && location.pathname === child.href
) &&
"cursor-not-allowed"
)}
onClick={handleClick}
>