@reflagged/shell 1.1.0 → 1.2.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reflagged/shell",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Shared app shell for Reflagged services — OIDC auth, SSO, app switcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"./api/oidc-callback": "./src/lib/api/oidc-callback.ts",
|
|
26
26
|
"./api/oidc-signout": "./src/lib/api/oidc-signout.ts",
|
|
27
27
|
"./api/shell-info": "./src/lib/api/shell-info.ts",
|
|
28
|
-
"./package.json": "./package.json"
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
"./components/ServiceIcon": "./src/components/ServiceIcon.tsx"
|
|
29
30
|
},
|
|
30
31
|
"scripts": {
|
|
31
32
|
"typecheck": "tsc --noEmit"
|
|
@@ -38,7 +39,8 @@
|
|
|
38
39
|
"next": "^15.4.0",
|
|
39
40
|
"payload": "^3.79.0",
|
|
40
41
|
"react": "^19.2.0",
|
|
41
|
-
"react-dom": "^19.2.0"
|
|
42
|
+
"react-dom": "^19.2.0",
|
|
43
|
+
"lucide-react": ">=0.400.0"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@types/react": "^19.2.0",
|
|
@@ -47,6 +49,12 @@
|
|
|
47
49
|
"payload": "^3.79.0",
|
|
48
50
|
"react": "^19.2.0",
|
|
49
51
|
"react-dom": "^19.2.0",
|
|
50
|
-
"typescript": "^5.7.0"
|
|
52
|
+
"typescript": "^5.7.0",
|
|
53
|
+
"lucide-react": "^0.500.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"lucide-react": {
|
|
57
|
+
"optional": false
|
|
58
|
+
}
|
|
51
59
|
}
|
|
52
60
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { createPortal } from 'react-dom'
|
|
5
5
|
import { loadAppConfig } from '../config'
|
|
6
|
+
import { ServiceIcon } from './ServiceIcon'
|
|
6
7
|
|
|
7
8
|
type Booking = {
|
|
8
9
|
id: string
|
|
@@ -11,6 +12,12 @@ type Booking = {
|
|
|
11
12
|
status: string
|
|
12
13
|
url: string | null
|
|
13
14
|
iconUrl: string | null
|
|
15
|
+
/**
|
|
16
|
+
* Lucide name of the service icon, from rflgd-base. Optional: an older
|
|
17
|
+
* platform does not send it, and then the initial stands in — the way it
|
|
18
|
+
* always did.
|
|
19
|
+
*/
|
|
20
|
+
icon?: string | null
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
type Org = {
|
|
@@ -391,7 +398,7 @@ export function BrandSwitcher() {
|
|
|
391
398
|
fontWeight: 600,
|
|
392
399
|
}}
|
|
393
400
|
>
|
|
394
|
-
{b.label.
|
|
401
|
+
<ServiceIcon name={b.icon} label={b.label} />
|
|
395
402
|
</div>
|
|
396
403
|
<div style={{ flex: 1, minWidth: 0 }}>
|
|
397
404
|
<div style={{ fontWeight: 500, fontSize: 13.5 }}>{b.label}</div>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AudioLines,
|
|
5
|
+
Bot,
|
|
6
|
+
Box,
|
|
7
|
+
Brain,
|
|
8
|
+
Contact,
|
|
9
|
+
Factory,
|
|
10
|
+
ListMusic,
|
|
11
|
+
MailPlus,
|
|
12
|
+
MessageSquareText,
|
|
13
|
+
PenTool,
|
|
14
|
+
ShieldCheck,
|
|
15
|
+
Users,
|
|
16
|
+
type LucideIcon,
|
|
17
|
+
} from 'lucide-react'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The icon a service shows in the app switcher.
|
|
21
|
+
*
|
|
22
|
+
* Which icon a service gets is rflgd-base's decision — it sends the lucide
|
|
23
|
+
* name in `/api/shell/me` (`serviceIconName()`), so switcher, launchpad and
|
|
24
|
+
* catalog show the same mark. This file only holds the components to render
|
|
25
|
+
* those names with.
|
|
26
|
+
*
|
|
27
|
+
* Listed one by one rather than looked up in lucide's `icons` object, and that
|
|
28
|
+
* is the whole reason this file exists: an index lookup defeats tree shaking,
|
|
29
|
+
* and all ~1500 icons would land in the bundle of every app using this
|
|
30
|
+
* package. Ten repositories depend on it.
|
|
31
|
+
*
|
|
32
|
+
* The cost is a list that can fall behind the platform's. It degrades to
|
|
33
|
+
* exactly today's behaviour — a service whose name is not here shows its
|
|
34
|
+
* initial, as every service did before. Nothing breaks, it just looks
|
|
35
|
+
* unfinished, and adding the icon here is a one-line fix.
|
|
36
|
+
*/
|
|
37
|
+
const ICONS: Record<string, LucideIcon> = {
|
|
38
|
+
AudioLines,
|
|
39
|
+
Bot,
|
|
40
|
+
Box,
|
|
41
|
+
Brain,
|
|
42
|
+
Contact,
|
|
43
|
+
Factory,
|
|
44
|
+
ListMusic,
|
|
45
|
+
MailPlus,
|
|
46
|
+
MessageSquareText,
|
|
47
|
+
PenTool,
|
|
48
|
+
ShieldCheck,
|
|
49
|
+
Users,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function ServiceIcon({
|
|
53
|
+
name,
|
|
54
|
+
label,
|
|
55
|
+
size = 18,
|
|
56
|
+
}: {
|
|
57
|
+
/** Lucide name from the platform, e.g. 'Brain'. */
|
|
58
|
+
name?: string | null
|
|
59
|
+
/** Fallback when the name is missing or not bundled here. */
|
|
60
|
+
label: string
|
|
61
|
+
size?: number
|
|
62
|
+
}) {
|
|
63
|
+
const Icon = name ? ICONS[name] : undefined
|
|
64
|
+
if (!Icon) return <>{label.slice(0, 1).toUpperCase()}</>
|
|
65
|
+
return <Icon size={size} strokeWidth={1.75} aria-hidden />
|
|
66
|
+
}
|