@orsetra/shared-ui 1.17.0 → 1.18.1
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/components/layout/business-unit-switcher.tsx +33 -0
- package/components/layout/environment-gate.tsx +4 -6
- package/components/layout/index.ts +1 -0
- package/components/layout/layout-container.tsx +29 -13
- package/components/layout/sidebar/sidebar.tsx +3 -44
- package/components/layout/user-panel.tsx +2 -37
- package/components/ui/environment-required.tsx +138 -43
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { ChevronDown } from "lucide-react"
|
|
4
|
+
import { useUserContext } from "../../context/user-context"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The business unit of the page, in the header, drawn as the environment switcher. It opens the
|
|
8
|
+
* dialog of the application (openBusinessUnitSwitcher of the user context): what follows a change of
|
|
9
|
+
* business unit stays the application's.
|
|
10
|
+
*/
|
|
11
|
+
export function BusinessUnitSwitcher() {
|
|
12
|
+
const { currentProject, organization, openBusinessUnitSwitcher } = useUserContext()
|
|
13
|
+
const loading = !currentProject && !organization
|
|
14
|
+
const label = currentProject?.name ?? "Business unit"
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
onClick={() => openBusinessUnitSwitcher()}
|
|
20
|
+
disabled={loading}
|
|
21
|
+
title="Change business unit"
|
|
22
|
+
aria-haspopup="dialog"
|
|
23
|
+
className="h-8 w-40 flex-shrink-0 flex items-center justify-between gap-1.5 px-2.5 bg-gray-200/70 text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-colors disabled:cursor-default"
|
|
24
|
+
>
|
|
25
|
+
{loading ? (
|
|
26
|
+
<span className="h-2.5 w-20 bg-gray-300 animate-pulse" aria-label="Loading business unit" />
|
|
27
|
+
) : (
|
|
28
|
+
<span className="truncate text-xs font-medium uppercase tracking-wider">{label}</span>
|
|
29
|
+
)}
|
|
30
|
+
<ChevronDown className="h-3.5 w-3.5 flex-shrink-0 text-gray-500" />
|
|
31
|
+
</button>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -11,9 +11,11 @@ export interface EnvironmentGateProps {
|
|
|
11
11
|
children: ReactNode
|
|
12
12
|
required?: boolean
|
|
13
13
|
createHref?: string
|
|
14
|
+
/** Address of the home application, for the links of the page without environment. */
|
|
15
|
+
mainBaseUrl?: string
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
export function EnvironmentGate({ children, required = true, createHref }: EnvironmentGateProps) {
|
|
18
|
+
export function EnvironmentGate({ children, required = true, createHref, mainBaseUrl }: EnvironmentGateProps) {
|
|
17
19
|
const { status, current, lost, dismissLost } = useEnvironmentContext()
|
|
18
20
|
const view = environmentGateView(status, required)
|
|
19
21
|
|
|
@@ -26,11 +28,7 @@ export function EnvironmentGate({ children, required = true, createHref }: Envir
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
if (view === "required") {
|
|
29
|
-
return
|
|
30
|
-
<div className="p-4">
|
|
31
|
-
<EnvironmentRequired createHref={createHref} />
|
|
32
|
-
</div>
|
|
33
|
-
)
|
|
31
|
+
return <EnvironmentRequired createHref={createHref} mainBaseUrl={mainBaseUrl} />
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
return (
|
|
@@ -35,6 +35,7 @@ export {
|
|
|
35
35
|
export { RootLayoutWrapper, ibmPlexSans, ibmPlexMono } from './root-layout-wrapper'
|
|
36
36
|
export { LayoutContainer, type LayoutContainerProps } from './layout-container'
|
|
37
37
|
export { EnvironmentSwitcher, type EnvironmentSwitcherProps } from './environment-switcher'
|
|
38
|
+
export { BusinessUnitSwitcher } from './business-unit-switcher'
|
|
38
39
|
export { EnvironmentGate, type EnvironmentGateProps } from './environment-gate'
|
|
39
40
|
export { ProjectGate, useStoreHydrated, type ProjectGateProps } from './project-gate'
|
|
40
41
|
export { PageWithSidePanel } from './page-with-side-panel'
|
|
@@ -9,9 +9,10 @@ import { Button } from "../ui"
|
|
|
9
9
|
import { Logo } from "../ui/logo"
|
|
10
10
|
import { getMenuFromPath } from "../../lib/menu-utils"
|
|
11
11
|
import { useIsMobile } from "../../hooks/use-mobile"
|
|
12
|
-
import { Menu } from "lucide-react"
|
|
12
|
+
import { LifeBuoy, Menu } from "lucide-react"
|
|
13
13
|
import { UserPanel } from "./user-panel"
|
|
14
14
|
import { EnvironmentSwitcher } from "./environment-switcher"
|
|
15
|
+
import { BusinessUnitSwitcher } from "./business-unit-switcher"
|
|
15
16
|
import { EnvironmentGate } from "./environment-gate"
|
|
16
17
|
import { ProjectGate } from "./project-gate"
|
|
17
18
|
import type { ProjectSelection } from "../../lib/project-requirement"
|
|
@@ -128,31 +129,46 @@ function LayoutContent({
|
|
|
128
129
|
const handleSecondarySidebarOpen = () => setOpen(true)
|
|
129
130
|
const createEnvironmentHref = main_base_url ? `${main_base_url}/infra/environments` : undefined
|
|
130
131
|
const environmentRequired = isEnvironmentRequired ? isEnvironmentRequired(pathname) : true
|
|
132
|
+
// The application of the page: the header of its secondary menu (none on the home page).
|
|
133
|
+
const appTitle = sectionLabels[currentMenu]
|
|
134
|
+
// The support of the platform; '#' is the default of the build argument when it is not given.
|
|
135
|
+
const configuredSupport = process.env.NEXT_PUBLIC_SUPPORT_URL
|
|
136
|
+
const supportHref = configuredSupport && configuredSupport !== '#' ? configuredSupport : `${main_base_url}/support`
|
|
131
137
|
|
|
132
138
|
return (
|
|
133
139
|
<div className="flex flex-col h-screen w-full bg-white overflow-hidden">
|
|
134
140
|
<SpeculationRules />
|
|
135
141
|
<header className="h-14 bg-gray-50 border-b border-ui-border flex-shrink-0">
|
|
136
|
-
<div className="h-full flex items-center justify-between">
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<Logo href={main_base_url} />
|
|
142
|
+
<div className="h-full flex items-center justify-between gap-3 px-4 md:px-6">
|
|
143
|
+
{/* The mark, the business unit, the main menu; then the application and its environment. */}
|
|
144
|
+
<div className="min-w-0 flex items-center gap-2">
|
|
145
|
+
<Logo href={main_base_url} iconOnly className="flex-shrink-0" />
|
|
146
|
+
<BusinessUnitSwitcher />
|
|
142
147
|
<Button
|
|
143
148
|
variant="ghost"
|
|
144
149
|
size="sm"
|
|
145
150
|
onClick={handleMainSidebarToggle}
|
|
146
|
-
className="h-8 w-8 p-0 hover:bg-ui-background text-text-secondary"
|
|
151
|
+
className="h-8 w-8 p-0 flex-shrink-0 hover:bg-ui-background text-text-secondary"
|
|
147
152
|
title="Menu principal"
|
|
148
153
|
>
|
|
149
154
|
<Menu className="h-5 w-5" />
|
|
150
155
|
</Button>
|
|
156
|
+
{appTitle && (
|
|
157
|
+
<span className="hidden md:inline-block ml-2 pl-4 border-l border-ui-border text-sm font-semibold text-text-primary truncate">
|
|
158
|
+
{appTitle}
|
|
159
|
+
</span>
|
|
160
|
+
)}
|
|
161
|
+
<EnvironmentSwitcher createHref={createEnvironmentHref} />
|
|
151
162
|
</div>
|
|
152
|
-
<div className="flex
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
<div className="flex items-center gap-1 flex-shrink-0">
|
|
164
|
+
<a
|
|
165
|
+
href={supportHref}
|
|
166
|
+
title="Support"
|
|
167
|
+
className="h-9 flex items-center gap-1.5 px-2 text-sm text-text-secondary hover:text-text-primary hover:bg-ui-background no-underline"
|
|
168
|
+
>
|
|
169
|
+
<LifeBuoy className="h-4 w-4" />
|
|
170
|
+
<span className="hidden md:inline">Support</span>
|
|
171
|
+
</a>
|
|
156
172
|
<UserPanel main_base_url={main_base_url} />
|
|
157
173
|
</div>
|
|
158
174
|
</div>
|
|
@@ -186,7 +202,7 @@ function LayoutContent({
|
|
|
186
202
|
|
|
187
203
|
<main className="flex-1 bg-ibm-gray-10 min-h-0 overflow-auto">
|
|
188
204
|
<ProjectGate selection={projectSelection} required={isProjectRequired} mainBaseUrl={main_base_url}>
|
|
189
|
-
<EnvironmentGate required={environmentRequired} createHref={createEnvironmentHref}>
|
|
205
|
+
<EnvironmentGate required={environmentRequired} createHref={createEnvironmentHref} mainBaseUrl={main_base_url}>
|
|
190
206
|
{children}
|
|
191
207
|
</EnvironmentGate>
|
|
192
208
|
</ProjectGate>
|
|
@@ -5,7 +5,7 @@ import { Slot } from "@radix-ui/react-slot"
|
|
|
5
5
|
import { VariantProps, cva } from "class-variance-authority"
|
|
6
6
|
import { PanelLeft, ChevronLeft, ChevronRight } from "lucide-react"
|
|
7
7
|
import Link from "next/link"
|
|
8
|
-
import { usePathname, useSearchParams
|
|
8
|
+
import { usePathname, useSearchParams } from "next/navigation"
|
|
9
9
|
|
|
10
10
|
import { useIsMobile } from "../../../hooks/use-mobile"
|
|
11
11
|
import { cn } from "../../../lib/utils"
|
|
@@ -232,12 +232,11 @@ interface SidebarProps {
|
|
|
232
232
|
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
function Sidebar({ currentMenu, sidebarMenus = {}, main_base_url = "",
|
|
235
|
+
function Sidebar({ currentMenu, sidebarMenus = {}, main_base_url = "", getCurrentMenuItem, mainMenuItems = [] }: SidebarProps = {}) {
|
|
236
236
|
const pathname = usePathname()
|
|
237
237
|
const searchParams = useSearchParams()
|
|
238
|
-
const router = useRouter()
|
|
239
238
|
const { state, toggleSidebar } = useSidebar()
|
|
240
|
-
const { injectedItems
|
|
239
|
+
const { injectedItems } = useSidebarNavigation()
|
|
241
240
|
|
|
242
241
|
const isInjecting = injectedItems !== null // null = default nav, undefined/array = detail page mounted
|
|
243
242
|
const currentNavigation: SubMenuItem[] = isInjecting
|
|
@@ -246,11 +245,6 @@ function Sidebar({ currentMenu, sidebarMenus = {}, main_base_url = "", sectionLa
|
|
|
246
245
|
|
|
247
246
|
const isCollapsed = state === "collapsed"
|
|
248
247
|
|
|
249
|
-
const currentMainMenuItem = React.useMemo(
|
|
250
|
-
() => mainMenuItems.find(m => m.id === currentMenu),
|
|
251
|
-
[mainMenuItems, currentMenu]
|
|
252
|
-
)
|
|
253
|
-
|
|
254
248
|
const filteredMainItems = React.useMemo(() => {
|
|
255
249
|
if (!isCollapsed || mainMenuItems.length === 0 || isInjecting) return []
|
|
256
250
|
const navIds = new Set(currentNavigation.map((n) => n.id))
|
|
@@ -262,41 +256,6 @@ function Sidebar({ currentMenu, sidebarMenus = {}, main_base_url = "", sectionLa
|
|
|
262
256
|
className="h-full flex-shrink-0 flex flex-col bg-gray-50 min-w-[var(--sidebar-width-icon)] transition-[width] duration-200 overflow-visible"
|
|
263
257
|
style={{ width: isCollapsed ? "var(--sidebar-width-icon)" : "var(--sidebar-width)" }}
|
|
264
258
|
>
|
|
265
|
-
{/* Section label — hidden when collapsed */}
|
|
266
|
-
{!isCollapsed && (
|
|
267
|
-
injectedItems === undefined ? (
|
|
268
|
-
<div className="h-8 lg:h-10 flex items-center px-3 lg:px-4 flex-shrink-0 gap-2 border-r border-ui-border">
|
|
269
|
-
<div className="h-4 w-4 bg-gray-200 animate-pulse rounded flex-shrink-0" />
|
|
270
|
-
<div className="h-2.5 w-20 bg-gray-200 animate-pulse rounded" />
|
|
271
|
-
</div>
|
|
272
|
-
) : (injectedTitle || (currentMenu && sectionLabels[currentMenu])) ? (
|
|
273
|
-
<div className="h-8 lg:h-10 flex items-center px-3 lg:px-4 flex-shrink-0 gap-2 border-r border-ui-border">
|
|
274
|
-
{isInjecting ? (
|
|
275
|
-
<button
|
|
276
|
-
type="button"
|
|
277
|
-
onClick={() => injectedBackHref ? router.push(injectedBackHref) : router.back()}
|
|
278
|
-
className="h-6 w-6 flex items-center justify-center text-text-secondary hover:text-text-primary hover:bg-ui-background rounded transition-colors flex-shrink-0"
|
|
279
|
-
title="Back"
|
|
280
|
-
>
|
|
281
|
-
<ChevronLeft className="h-3.5 w-3.5" />
|
|
282
|
-
</button>
|
|
283
|
-
) : currentMainMenuItem ? (
|
|
284
|
-
<button
|
|
285
|
-
type="button"
|
|
286
|
-
onClick={() => router.push(currentMainMenuItem.href)}
|
|
287
|
-
className="h-6 w-6 flex items-center justify-center text-text-secondary hover:text-text-primary hover:bg-ui-background rounded transition-colors flex-shrink-0"
|
|
288
|
-
title={currentMainMenuItem.label}
|
|
289
|
-
>
|
|
290
|
-
<currentMainMenuItem.icon className="h-3.5 w-3.5" />
|
|
291
|
-
</button>
|
|
292
|
-
) : null}
|
|
293
|
-
<h2 className="text-xs font-semibold text-text-secondary capitalize tracking-wide truncate flex-1">
|
|
294
|
-
{injectedTitle || sectionLabels[currentMenu!]}
|
|
295
|
-
</h2>
|
|
296
|
-
</div>
|
|
297
|
-
) : null
|
|
298
|
-
)}
|
|
299
|
-
|
|
300
259
|
{/* Nav */}
|
|
301
260
|
<nav className={cn(
|
|
302
261
|
"flex-1 overflow-y-auto border-r border-ui-border",
|
|
@@ -20,7 +20,7 @@ interface UserPanelProps {
|
|
|
20
20
|
|
|
21
21
|
export function UserPanel({ main_base_url }: UserPanelProps) {
|
|
22
22
|
const [open, setOpen] = useState(false)
|
|
23
|
-
const { profile,
|
|
23
|
+
const { profile, organization, logout } = useUserContext()
|
|
24
24
|
|
|
25
25
|
const displayName =
|
|
26
26
|
profile?.name || profile?.preferred_username || profile?.email || "User"
|
|
@@ -54,7 +54,7 @@ export function UserPanel({ main_base_url }: UserPanelProps) {
|
|
|
54
54
|
>
|
|
55
55
|
<DropdownMenuPrimitive.Arrow width={16} height={8} style={{ fill: 'white', stroke: '#e5e7eb', strokeWidth: 1 }} />
|
|
56
56
|
|
|
57
|
-
{/* Organisation
|
|
57
|
+
{/* Organisation (the business unit is chosen in the header) */}
|
|
58
58
|
<div className="flex items-stretch">
|
|
59
59
|
|
|
60
60
|
{/* Gauche — Organisation */}
|
|
@@ -72,41 +72,6 @@ export function UserPanel({ main_base_url }: UserPanelProps) {
|
|
|
72
72
|
<ChevronRight className="h-4 w-4 text-gray-300 flex-shrink-0 group-hover:text-gray-500 transition-colors" />
|
|
73
73
|
</a>
|
|
74
74
|
|
|
75
|
-
{/* Séparateur vertical */}
|
|
76
|
-
<div className="flex items-center py-3">
|
|
77
|
-
<div className="w-px h-full bg-gray-200" />
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
{/* Droite — Business Unit */}
|
|
81
|
-
<div className="flex flex-col justify-center flex-1 min-w-0 px-4 py-4">
|
|
82
|
-
<span className="text-[11px] text-gray-400 uppercase tracking-widest mb-1">Business Unit</span>
|
|
83
|
-
<span className="text-sm font-semibold text-gray-900 uppercase truncate">
|
|
84
|
-
{currentProject?.name ?? '—'}
|
|
85
|
-
</span>
|
|
86
|
-
<div className="flex items-center gap-3 mt-1.5">
|
|
87
|
-
<button
|
|
88
|
-
onClick={() => {
|
|
89
|
-
close()
|
|
90
|
-
// Deferred: closing this dropdown and opening the dialog in
|
|
91
|
-
// the same tick races Radix's body pointer-events cleanup,
|
|
92
|
-
// leaving the whole app unclickable until a refresh.
|
|
93
|
-
setTimeout(() => openBusinessUnitSwitcher(), 0)
|
|
94
|
-
}}
|
|
95
|
-
className="text-xs text-[#0f62fe] hover:underline"
|
|
96
|
-
>
|
|
97
|
-
Switch
|
|
98
|
-
</button>
|
|
99
|
-
{currentProject && organization && (
|
|
100
|
-
<a
|
|
101
|
-
href={`${main_base_url}/business-units/${currentProject.id}`}
|
|
102
|
-
onClick={close}
|
|
103
|
-
className="text-xs text-[#0f62fe] hover:underline"
|
|
104
|
-
>
|
|
105
|
-
Settings
|
|
106
|
-
</a>
|
|
107
|
-
)}
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
75
|
|
|
111
76
|
</div>
|
|
112
77
|
|
|
@@ -1,59 +1,154 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { ArrowRight, BookOpen, Globe, LifeBuoy, Plus, Server } from "lucide-react"
|
|
3
3
|
import { cn } from "../../lib/utils"
|
|
4
4
|
|
|
5
5
|
export interface EnvironmentRequiredProps {
|
|
6
6
|
createHref?: string
|
|
7
|
+
/** Address of the home application: the links to the environments and targets pages. */
|
|
8
|
+
mainBaseUrl?: string
|
|
7
9
|
className?: string
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
const DOCS_URL = process.env.NEXT_PUBLIC_DOCS_URL
|
|
13
|
+
const CONFIGURED_SUPPORT = process.env.NEXT_PUBLIC_SUPPORT_URL
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Environments of a business unit on the target they run on, the last one still to create: in the
|
|
17
|
+
* style of the empty states of the console (gray ground, black outlines, blue in use, dashed teal to
|
|
18
|
+
* create). Drawn here rather than shipped as a file, so that every application has it.
|
|
19
|
+
*/
|
|
20
|
+
function EnvironmentsIllustration() {
|
|
11
21
|
return (
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
<svg
|
|
23
|
+
viewBox="0 0 1024 1024"
|
|
24
|
+
className="w-full max-w-[280px] h-auto"
|
|
25
|
+
role="img"
|
|
26
|
+
aria-label="Environments running on a target, one still to create"
|
|
17
27
|
>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
<rect width="1024" height="1024" fill="#f4f4f4"/>
|
|
29
|
+
<rect x="128" y="250" width="232" height="250" fill="#ffffff" stroke="#161616" strokeWidth="5"/>
|
|
30
|
+
<rect x="162" y="290" width="164" height="70" fill="#0f62fe"/>
|
|
31
|
+
<rect x="162" y="384" width="164" height="70" fill="#a6c8ff"/>
|
|
32
|
+
<line x1="244" y1="500" x2="244" y2="620" stroke="#8d8d8d" strokeWidth="4"/>
|
|
33
|
+
<rect x="396" y="250" width="232" height="250" fill="#ffffff" stroke="#161616" strokeWidth="5"/>
|
|
34
|
+
<rect x="430" y="290" width="164" height="70" fill="#0f62fe"/>
|
|
35
|
+
<rect x="430" y="384" width="164" height="70" fill="#0f62fe"/>
|
|
36
|
+
<line x1="512" y1="500" x2="512" y2="620" stroke="#8d8d8d" strokeWidth="4"/>
|
|
37
|
+
<rect x="664" y="250" width="232" height="250" fill="#d9fbfb" stroke="#007d79" strokeWidth="5" strokeDasharray="18 12"/>
|
|
38
|
+
<rect x="774" y="335" width="12" height="80" fill="#007d79"/>
|
|
39
|
+
<rect x="740" y="369" width="80" height="12" fill="#007d79"/>
|
|
40
|
+
<line x1="780" y1="500" x2="780" y2="620" stroke="#007d79" strokeWidth="4"/>
|
|
41
|
+
<rect x="128" y="620" width="768" height="128" fill="#161616"/>
|
|
42
|
+
<rect x="176" y="664" width="88" height="40" fill="#ffffff"/>
|
|
43
|
+
<rect x="296" y="664" width="88" height="40" fill="#ffffff"/>
|
|
44
|
+
<rect x="416" y="664" width="88" height="40" fill="#ffffff"/>
|
|
45
|
+
</svg>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The cards of the getting-start pages: icon, title with an arrow, a line of explanation. */
|
|
50
|
+
function EntryCard({ icon: Icon, title, description, href }: { icon: typeof Globe; title: string; description: string; href?: string }) {
|
|
51
|
+
const body = (
|
|
52
|
+
<>
|
|
53
|
+
<Icon className="h-6 w-6 text-ibm-blue-60 mb-3" />
|
|
54
|
+
<span className="flex items-center gap-1.5 text-sm font-semibold text-ibm-gray-100 mb-1 group-hover:text-ibm-blue-60">
|
|
55
|
+
{title}
|
|
56
|
+
{href && <ArrowRight className="h-3.5 w-3.5 text-ibm-blue-60" />}
|
|
57
|
+
</span>
|
|
58
|
+
<span className="block text-sm text-ibm-gray-60 leading-relaxed">{description}</span>
|
|
59
|
+
</>
|
|
60
|
+
)
|
|
61
|
+
const cls = "group bg-white px-6 py-5 flex flex-col text-left"
|
|
62
|
+
if (!href) return <div className={cls}>{body}</div>
|
|
63
|
+
const external = href.startsWith("http") && !!DOCS_URL && href.startsWith(DOCS_URL)
|
|
64
|
+
return (
|
|
65
|
+
<a href={href} className={cls} {...(external ? { target: "_blank", rel: "noopener noreferrer" } : {})}>
|
|
66
|
+
{body}
|
|
67
|
+
</a>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The page an application shows while its business unit has no environment: laid out as the
|
|
73
|
+
* getting-start pages, a banner with the picture and the way to create one, what an environment
|
|
74
|
+
* and a target are, then the documentation and the support.
|
|
75
|
+
*/
|
|
76
|
+
export function EnvironmentRequired({ createHref, mainBaseUrl, className }: EnvironmentRequiredProps) {
|
|
77
|
+
const base = (mainBaseUrl ?? "").replace(/\/+$/, "")
|
|
78
|
+
const docOrPage = (docPath: string, page: string) =>
|
|
79
|
+
DOCS_URL ? `${DOCS_URL}${docPath}` : base ? `${base}${page}` : undefined
|
|
80
|
+
const supportHref = CONFIGURED_SUPPORT && CONFIGURED_SUPPORT !== "#" ? CONFIGURED_SUPPORT : base ? `${base}/support` : undefined
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div className={cn("min-h-full bg-ibm-gray-10", className)}>
|
|
84
|
+
<div className="p-4 sm:p-6">
|
|
85
|
+
<div className="bg-white mb-6">
|
|
86
|
+
<div className="flex flex-col md:flex-row-reverse items-center gap-8 md:gap-12 px-10 py-12">
|
|
87
|
+
<div className="flex-shrink-0 w-full max-w-[280px]">
|
|
88
|
+
<EnvironmentsIllustration />
|
|
89
|
+
</div>
|
|
90
|
+
<div className="flex-1 min-w-0 text-center md:text-left">
|
|
91
|
+
<h1 className="text-2xl font-semibold text-ibm-gray-100 mb-3">Create an environment to get started</h1>
|
|
92
|
+
<p className="text-sm md:text-base text-ibm-gray-60 leading-relaxed max-w-2xl mx-auto md:mx-0 mb-6">
|
|
93
|
+
This application works inside an environment. What you create here is deployed to the environment
|
|
94
|
+
selected at the top of the page, and this business unit has none yet.
|
|
95
|
+
</p>
|
|
96
|
+
{createHref ? (
|
|
97
|
+
<a
|
|
98
|
+
href={createHref}
|
|
99
|
+
className="inline-flex items-center gap-2 h-11 px-8 text-sm font-medium bg-ibm-blue-60 text-white hover:bg-ibm-blue-70 transition-colors"
|
|
100
|
+
>
|
|
101
|
+
<Plus className="h-4 w-4" />
|
|
102
|
+
Create an environment
|
|
103
|
+
</a>
|
|
104
|
+
) : (
|
|
105
|
+
<p className="text-sm text-ibm-gray-60">Open Environments in the main menu to create one.</p>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
36
108
|
</div>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div className="mb-6">
|
|
112
|
+
<h2 className="text-xs font-semibold text-ibm-gray-50 uppercase tracking-widest mb-3">What you will find here</h2>
|
|
113
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-px bg-ibm-gray-20">
|
|
114
|
+
<EntryCard
|
|
115
|
+
icon={Globe}
|
|
116
|
+
title="Environments"
|
|
117
|
+
description="A stage of your business unit: development, staging, production. Each one has its own settings and its own permissions."
|
|
118
|
+
href={docOrPage("/infra/environments", "/infra/environments")}
|
|
119
|
+
/>
|
|
120
|
+
<EntryCard
|
|
121
|
+
icon={Server}
|
|
122
|
+
title="Targets"
|
|
123
|
+
description="Where an environment runs: a place on a cluster we operate or on a cluster of your own, in the region you choose."
|
|
124
|
+
href={docOrPage("/infra/targets", "/infra/targets")}
|
|
125
|
+
/>
|
|
43
126
|
</div>
|
|
44
127
|
</div>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
128
|
+
|
|
129
|
+
{(DOCS_URL || supportHref) && (
|
|
130
|
+
<div className="mt-2 border-t border-ui-border pt-5 flex flex-col sm:flex-row gap-6 sm:gap-10">
|
|
131
|
+
{DOCS_URL && (
|
|
132
|
+
<a
|
|
133
|
+
href={DOCS_URL}
|
|
134
|
+
target="_blank"
|
|
135
|
+
rel="noopener noreferrer"
|
|
136
|
+
className="flex items-center gap-2 text-sm text-ibm-gray-60 hover:text-ibm-blue-60 transition-colors"
|
|
137
|
+
>
|
|
138
|
+
<BookOpen className="h-4 w-4 flex-shrink-0" />
|
|
139
|
+
Documentation
|
|
140
|
+
</a>
|
|
141
|
+
)}
|
|
142
|
+
{supportHref && (
|
|
143
|
+
<a
|
|
144
|
+
href={supportHref}
|
|
145
|
+
className="flex items-center gap-2 text-sm text-ibm-gray-60 hover:text-ibm-blue-60 transition-colors"
|
|
146
|
+
>
|
|
147
|
+
<LifeBuoy className="h-4 w-4 flex-shrink-0" />
|
|
148
|
+
Contact support
|
|
149
|
+
</a>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
57
152
|
)}
|
|
58
153
|
</div>
|
|
59
154
|
</div>
|