feat:add redirect link to bpms
This commit is contained in:
parent
d240fb39fa
commit
6fdfe83b1e
|
|
@ -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>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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,29 +216,29 @@ export function Sidebar({
|
|||
}
|
||||
};
|
||||
|
||||
if (item.id === "strategic-alignment") {
|
||||
return (
|
||||
<button
|
||||
if (item.id === "strategic-alignment") {
|
||||
return (
|
||||
<button
|
||||
className={cn(
|
||||
"w-full text-right",
|
||||
)}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
"w-full text-right",
|
||||
"flex items-center justify-center w-full px-2 rounded-lg mt-4 transition-all duration-200 group",
|
||||
)}
|
||||
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 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>
|
||||
)
|
||||
</div>
|
||||
</button>
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={item.id} className="relative">
|
||||
|
|
@ -292,10 +294,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}
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user