feat:add redirect link to bpms

This commit is contained in:
MehrdadAdabi 2025-09-14 16:07:30 +03:30
parent d240fb39fa
commit 6fdfe83b1e
3 changed files with 55 additions and 31 deletions

View File

@ -5,17 +5,16 @@ import { cn } from "~/lib/utils";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { import {
PanelLeft, PanelLeft,
Search,
Bell,
Settings, Settings,
User, User,
Moon,
Sun,
Menu, Menu,
ChevronDown, ChevronDown,
Globe, Server,
HelpCircle,
} from "lucide-react"; } from "lucide-react";
import apiService from "~/lib/api";
interface HeaderProps { interface HeaderProps {
onToggleSidebar?: () => void; onToggleSidebar?: () => void;
@ -32,6 +31,18 @@ export function Header({
const [isProfileMenuOpen, setIsProfileMenuOpen] = useState(false); const [isProfileMenuOpen, setIsProfileMenuOpen] = useState(false);
const [isNotificationOpen, setIsNotificationOpen] = 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 ( return (
<header <header
className={cn( className={cn(
@ -111,6 +122,13 @@ export function Header({
<Settings className="h-4 w-4" /> <Settings className="h-4 w-4" />
تنظیمات تنظیمات
</Link> </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>
</div> </div>
)} )}

View File

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

View File

@ -15,6 +15,7 @@ import {
Settings, Settings,
Star, Star,
Workflow, Workflow,
DiscAlbum
} from "lucide-react"; } from "lucide-react";
import React, { useState } from "react"; import React, { useState } from "react";
import { Link, useLocation } from "react-router"; import { Link, useLocation } from "react-router";
@ -112,6 +113,7 @@ const menuItems: MenuItem[] = [
icon: null, icon: null,
href: "#", // This is not a route, it opens a popup href: "#", // This is not a route, it opens a popup
}, },
]; ];
const bottomMenuItems: MenuItem[] = [ const bottomMenuItems: MenuItem[] = [
@ -215,7 +217,7 @@ export function Sidebar({
}; };
if (item.id === "strategic-alignment") { if (item.id === "strategic-alignment") {
return ( return (
<button <button
className={cn( className={cn(
"w-full text-right", "w-full text-right",
@ -234,7 +236,7 @@ return (
</div> </div>
</div> </div>
</button> </button>
) )
} }