@akinon/ui-shell-dev 1.5.2 → 1.5.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.
package/dist/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
}
|
|
26
26
|
</style>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-DoWxl4fH.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/assets/index-CX4XmW02.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-shell-dev",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Development shell application for Akinon UI Protocol plugins",
|
|
6
6
|
"type": "module",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"react-router-dom": "^6.28.0",
|
|
23
23
|
"vite": "*",
|
|
24
24
|
"@akinon/app-shell": "1.4.1",
|
|
25
|
-
"@akinon/fonts-jost-variable": "2.1.0",
|
|
26
25
|
"@akinon/icons": "1.1.0",
|
|
27
|
-
"@akinon/
|
|
28
|
-
"@akinon/ui-utils": "1.1.0"
|
|
26
|
+
"@akinon/fonts-jost-variable": "2.1.0",
|
|
27
|
+
"@akinon/ui-utils": "1.1.0",
|
|
28
|
+
"@akinon/ui-react": "1.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/cors": "^2.8.17",
|
package/src/pages/External.tsx
CHANGED
|
@@ -11,7 +11,11 @@ export const PageExternal: React.FC<{ id: number; path?: string }> = ({
|
|
|
11
11
|
const location = useLocation();
|
|
12
12
|
// Compute splat (unmatched) path after the configured base `path`.
|
|
13
13
|
// Example: base "/keywords" and current pathname "/external/app/keywords/5/edit" -> splat "/5/edit".
|
|
14
|
-
const
|
|
14
|
+
const basePathRaw = path ?? '';
|
|
15
|
+
const basePath =
|
|
16
|
+
basePathRaw && !basePathRaw.startsWith('/')
|
|
17
|
+
? `/${basePathRaw}`
|
|
18
|
+
: basePathRaw;
|
|
15
19
|
const pathname = location.pathname;
|
|
16
20
|
const indexOfBase = pathname.indexOf(basePath);
|
|
17
21
|
const splat =
|
package/src/utils/navigation.tsx
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import type { RegisteredApp } from '@akinon/app-shell';
|
|
2
2
|
import type { TMenuItemType } from '@akinon/ui-react';
|
|
3
3
|
|
|
4
|
+
interface LocaleLabelMap {
|
|
5
|
+
[locale: string]: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function resolveLabel(label: unknown, locale: string): string {
|
|
9
|
+
if (typeof label === 'string') return label;
|
|
10
|
+
if (
|
|
11
|
+
label &&
|
|
12
|
+
typeof label === 'object' &&
|
|
13
|
+
!Array.isArray(label) &&
|
|
14
|
+
typeof (label as LocaleLabelMap)[locale] === 'string'
|
|
15
|
+
)
|
|
16
|
+
return (label as LocaleLabelMap)[locale];
|
|
17
|
+
// Fallbacks: try common keys, then stringify-safe default
|
|
18
|
+
const map = label as LocaleLabelMap | undefined;
|
|
19
|
+
if (map) {
|
|
20
|
+
if (typeof map.en === 'string') return map.en;
|
|
21
|
+
if (typeof map.tr === 'string') return map.tr;
|
|
22
|
+
}
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ensureLeadingSlash(path: string): string {
|
|
27
|
+
if (!path) return '/';
|
|
28
|
+
return path.startsWith('/') ? path : `/${path}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
4
31
|
const STATIC_NAVIGATION_ITEMS: TMenuItemType[] = [
|
|
5
32
|
{
|
|
6
33
|
key: '/',
|
|
@@ -59,31 +86,32 @@ export const getFullpageNavigationItems = (
|
|
|
59
86
|
return apps
|
|
60
87
|
.filter(app => app.type === 'full_page')
|
|
61
88
|
.map((app): TMenuItemType => {
|
|
89
|
+
const appConfig = configs.get(app.id) as { menu?: unknown[] } | undefined;
|
|
90
|
+
|
|
91
|
+
const children = appConfig?.menu
|
|
92
|
+
?.map((sub: unknown): TMenuItemType | false => {
|
|
93
|
+
const { child, path, label } = (sub || {}) as {
|
|
94
|
+
child?: unknown;
|
|
95
|
+
path?: string;
|
|
96
|
+
label?: unknown;
|
|
97
|
+
};
|
|
98
|
+
if (child || !path) return false;
|
|
99
|
+
const normalizedPath = ensureLeadingSlash(path);
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
key: `/external/${app.slug}${normalizedPath}`,
|
|
103
|
+
label: resolveLabel(label, 'en') || undefined,
|
|
104
|
+
icon: 'eksi'
|
|
105
|
+
} as TMenuItemType;
|
|
106
|
+
})
|
|
107
|
+
.filter(Boolean) as TMenuItemType[] | undefined;
|
|
108
|
+
|
|
62
109
|
return {
|
|
63
110
|
key: `/external/${app.slug}`,
|
|
64
|
-
label: app.name,
|
|
111
|
+
label: resolveLabel(app.name as unknown, 'en') || app.name,
|
|
65
112
|
icon: 'stoklistesi',
|
|
66
|
-
children
|
|
67
|
-
|
|
68
|
-
menu: TMenuItemType[];
|
|
69
|
-
}
|
|
70
|
-
)?.menu
|
|
71
|
-
?.map((sub: unknown): TMenuItemType | false => {
|
|
72
|
-
const { child, path, label } = sub as {
|
|
73
|
-
child: unknown;
|
|
74
|
-
path: string;
|
|
75
|
-
label: string;
|
|
76
|
-
};
|
|
77
|
-
if (child) return false;
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
key: `/external/${app.slug}${path}`,
|
|
81
|
-
label: label,
|
|
82
|
-
icon: 'eksi'
|
|
83
|
-
};
|
|
84
|
-
})
|
|
85
|
-
.filter(Boolean) as TMenuItemType[]
|
|
86
|
-
};
|
|
113
|
+
children
|
|
114
|
+
} as TMenuItemType;
|
|
87
115
|
});
|
|
88
116
|
};
|
|
89
117
|
|