ikoncomponents 1.8.1 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { Check, CircleUserRound, FolderCode, Home, LoaderPinwheel, LogOut, PanelLeftClose, PanelLeftOpen, Settings, } from "lucide-react";
|
|
4
|
+
import { Bot, Check, CircleUserRound, FolderCode, Home, LoaderPinwheel, LogOut, Palette, PanelLeftClose, PanelLeftOpen, Settings, } from "lucide-react";
|
|
5
5
|
import { Button } from "../../shadcn/button";
|
|
6
6
|
import { cn } from "../../utils/cn";
|
|
7
7
|
import { useSidebar } from "../../shadcn/sidebar";
|
|
@@ -16,7 +16,9 @@ import Link from "next/link";
|
|
|
16
16
|
import { jwtDecode } from "jwt-decode";
|
|
17
17
|
import { Icon } from "../icon";
|
|
18
18
|
import { useRefresh } from "./RefreshContext";
|
|
19
|
-
export const MainSidebar = ({ baseUrl, platformUrl, releaseOpsUrl = "https://ikon-dev.keross.com/
|
|
19
|
+
export const MainSidebar = ({ baseUrl, platformUrl, releaseOpsUrl = "https://ikon-dev.keross.com/",
|
|
20
|
+
// baseUrl = "https://api.nexicron.com",
|
|
21
|
+
}) => {
|
|
20
22
|
const [user, setUser] = React.useState();
|
|
21
23
|
const [accounts, setAccounts] = React.useState([]);
|
|
22
24
|
const [selectedAccount, setSelectedAccount] = React.useState();
|
|
@@ -125,7 +127,11 @@ export const MainSidebar = ({ baseUrl, platformUrl, releaseOpsUrl = "https://iko
|
|
|
125
127
|
var _a, _b;
|
|
126
128
|
const hasIcon = Boolean(software.icon && software.icon.trim() !== "");
|
|
127
129
|
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", size: "icon", className: cn("h-10", expanded ? "w-full justify-start gap-3 px-3" : "w-10"), asChild: true, children: _jsxs(Link, { href: (_a = software.url) !== null && _a !== void 0 ? _a : "#", children: [hasIcon ? (_jsx(Icon, { name: toPascalCase((_b = software.icon) !== null && _b !== void 0 ? _b : ""), className: "h-8 w-8 shrink-0" })) : (_jsx(FolderCode, { className: "h-8 w-8 shrink-0" })), expanded ? (_jsx("span", { className: "truncate text-sm", children: software.displayName })) : (_jsx("span", { className: "sr-only", children: software.displayName }))] }) }) }), !expanded && (_jsx(TooltipContent, { side: "right", sideOffset: 5, children: software.displayName }))] }, software.displayName));
|
|
128
|
-
}) }), ((roles === null || roles === void 0 ? void 0 : roles.includes("ADMIN")) || (roles === null || roles === void 0 ? void 0 : roles.includes("DEVELOPER")) || (roles === null || roles === void 0 ? void 0 : roles.includes("SUPERADMIN"))) && (_jsx(_Fragment, { children:
|
|
130
|
+
}) }), ((roles === null || roles === void 0 ? void 0 : roles.includes("ADMIN")) || (roles === null || roles === void 0 ? void 0 : roles.includes("DEVELOPER")) || (roles === null || roles === void 0 ? void 0 : roles.includes("SUPERADMIN"))) && (_jsx(_Fragment, { children: [
|
|
131
|
+
{ key: "Release Ops", label: "Release Ops", href: `${releaseOpsUrl}/devtools/`, icon: LoaderPinwheel },
|
|
132
|
+
{ key: "IKON Studio", label: "IKON Studio", href: `${releaseOpsUrl}/ikon-studio`, icon: Palette },
|
|
133
|
+
{ key: "IKON AI Workforce", label: "IKON AI Workforce", href: `${releaseOpsUrl}/ikon-ai-workforce`, icon: Bot },
|
|
134
|
+
].map(({ key, label, href, icon: LinkIcon }) => (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", className: cn("h-10", expanded ? "w-full justify-start gap-3 px-3" : "w-10"), asChild: true, children: _jsxs("a", { href: href, target: "_blank", rel: "noopener noreferrer", children: [_jsx(LinkIcon, { className: "h-8 w-8 shrink-0" }), expanded ? (_jsx("span", { className: "truncate text-sm", children: label })) : (_jsx("span", { className: "sr-only", children: label }))] }) }) }), !expanded && (_jsx(TooltipContent, { side: "right", sideOffset: 5, children: label }))] }, key))) })), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", className: cn("h-10", expanded ? "w-full justify-start gap-3 px-3" : "w-10"), asChild: true, children: _jsxs(Link, { href: `${platformUrl}/settings`, children: [_jsx(Settings, { className: "h-8 w-8 shrink-0" }), expanded ? (_jsx("span", { className: "truncate text-sm", children: "Settings" })) : (_jsx("span", { className: "sr-only", children: "Settings" }))] }) }) }), !expanded && (_jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Settings" }))] }, "settings"), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "icon", className: cn("h-10", expanded ? "w-full justify-start gap-3 px-3" : "w-10"), children: [_jsx(CircleUserRound, { className: "h-8 w-8 shrink-0" }), expanded && (_jsx("span", { className: "truncate text-sm font-medium", children: (user === null || user === void 0 ? void 0 : user.userName) || "Profile" }))] }) }), _jsxs(DropdownMenuContent, { className: "w-55 p-0", side: "right", sideOffset: 8, children: [_jsxs("div", { className: "flex items-start gap-3 p-4 bg-card", children: [_jsx(CircleUserRound, { className: "h-8 w-8" }), _jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [_jsx("p", { className: "text-sm font-bold text-foreground blue-dark:text-muted-foreground truncate", children: user === null || user === void 0 ? void 0 : user.userName }), _jsx("p", { className: "text-xs text-muted-foreground truncate", children: user === null || user === void 0 ? void 0 : user.userEmail }), _jsx("p", { className: "text-sm text-muted-foreground font-semibold", children: selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.accountName })] })] }), _jsx(DropdownMenuSeparator, { className: "my-0" }), _jsxs(DropdownMenuItem, { onClick: async () => {
|
|
129
135
|
await clearAllCookieSession();
|
|
130
136
|
redirect(`${platformUrl}/login.html`);
|
|
131
137
|
}, className: "flex items-center gap-2 px-4 py-3 cursor-pointer focus:bg-destructive dark:focus:bg-destructive blue-dark:focus:bg-destructive", children: [_jsx(LogOut, { className: "h-4 w-4 text-foreground" }), _jsx("span", { children: "Log out" })] })] })] }), _jsx("div", { className: cn("mb-2 flex", expanded ? "justify-end" : "justify-center"), children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: expanded ? "default" : "icon", className: cn("h-8", expanded ? "w-full justify-start gap-3 px-3" : "w-8"), onClick: () => {
|