@orsetra/shared-ui 1.10.23 → 1.10.25

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,5 +1,6 @@
1
1
  // UI Components exports
2
2
  export { Button } from './button'
3
+ export { NotFoundPage, type NotFoundPageProps } from './not-found-page'
3
4
  export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './card'
4
5
  export { Avatar, AvatarImage, AvatarFallback } from './avatar'
5
6
  export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from './dropdown-menu'
@@ -0,0 +1,81 @@
1
+ "use client"
2
+
3
+ export interface NotFoundPageProps {
4
+ /** Where "Back to home" navigates. Defaults to the app root. */
5
+ homeHref?: string
6
+ /** Where "Contact support" navigates. Omit to hide that button entirely. */
7
+ supportHref?: string
8
+ title?: string
9
+ description?: string
10
+ }
11
+
12
+ /**
13
+ * Shared 404 page content — the broken-route illustration (two reachable nodes,
14
+ * a severed connector, then a dashed "missing" node) plus heading, description
15
+ * and actions. Used by every app's app/not-found.tsx; each app supplies its own
16
+ * homeHref/supportHref and decides whether to wrap this in <html><body> (Next.js
17
+ * requires that wrapper only when not-found.tsx renders outside any layout).
18
+ */
19
+ export function NotFoundPage({
20
+ homeHref = "/",
21
+ supportHref,
22
+ title = "This route doesn't exist",
23
+ description = "The page you're looking for was moved, renamed, or never existed. Double-check the URL, or head back to your workspace.",
24
+ }: NotFoundPageProps) {
25
+ return (
26
+ <div className="min-h-screen w-full flex items-center justify-center bg-white px-6 py-16">
27
+ <div className="w-full max-w-[560px] flex flex-col items-center text-center">
28
+
29
+ {/* Broken-route illustration */}
30
+ <div className="flex items-center justify-center mb-12" aria-hidden="true">
31
+ {/* Node A: last known point */}
32
+ <div className="w-[52px] h-[52px] rounded-[10px] bg-ibm-blue-60 flex-shrink-0" />
33
+
34
+ {/* Connector 1: solid, healthy */}
35
+ <div className="w-14 h-0.5 bg-ibm-gray-30 flex-shrink-0" />
36
+
37
+ {/* Node B: still reachable */}
38
+ <div className="w-[52px] h-[52px] rounded-[10px] bg-white border-2 border-ibm-gray-30 flex-shrink-0" />
39
+
40
+ {/* Connector 2: broken, with gap + marker */}
41
+ <div className="flex items-center gap-1.5 flex-shrink-0">
42
+ <div className="w-5 border-t-2 border-dashed border-ibm-gray-30" />
43
+ <div className="w-[26px] h-[26px] rounded-full bg-carbon-red-10 flex items-center justify-center flex-shrink-0">
44
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#DA1E28" strokeWidth={2.5} strokeLinecap="round">
45
+ <path d="M18 6 6 18M6 6l12 12" />
46
+ </svg>
47
+ </div>
48
+ <div className="w-5 border-t-2 border-dashed border-ibm-gray-30" />
49
+ </div>
50
+
51
+ {/* Node C: the missing destination */}
52
+ <div className="w-[52px] h-[52px] rounded-[10px] bg-transparent border-2 border-dashed border-ibm-gray-30 flex-shrink-0" />
53
+ </div>
54
+
55
+ <p className="text-[13px] font-semibold tracking-wider text-ibm-blue-60 uppercase mb-2">Error 404</p>
56
+ <h1 className="text-[32px] leading-tight font-bold text-ibm-gray-100 mb-3">{title}</h1>
57
+ <p className="text-[15px] leading-relaxed text-ibm-gray-70 max-w-[420px] mb-9">{description}</p>
58
+
59
+ <div className="flex flex-wrap gap-3 justify-center">
60
+ <button
61
+ type="button"
62
+ onClick={() => { window.location.href = homeHref }}
63
+ className="inline-flex items-center justify-center h-11 px-6 bg-ibm-blue-60 text-white text-sm font-semibold hover:bg-ibm-blue-70 transition-colors"
64
+ >
65
+ Back to home
66
+ </button>
67
+ {supportHref && (
68
+ <button
69
+ type="button"
70
+ onClick={() => { window.location.href = supportHref }}
71
+ className="inline-flex items-center justify-center h-11 px-6 bg-white text-ibm-gray-100 text-sm font-semibold border border-ibm-gray-30 hover:bg-ibm-gray-10 transition-colors"
72
+ >
73
+ Contact support
74
+ </button>
75
+ )}
76
+ </div>
77
+
78
+ </div>
79
+ </div>
80
+ )
81
+ }
@@ -1,5 +1,6 @@
1
1
  "use client"
2
2
 
3
+ import { useContext } from "react"
3
4
  import { useRouter } from "next/navigation"
4
5
  import { LogOut, ChevronDown, type LucideIcon } from "lucide-react"
5
6
  import Avatar from "react-avatar"
@@ -12,6 +13,7 @@ import {
12
13
  DropdownMenuSeparator,
13
14
  DropdownMenuTrigger,
14
15
  } from "./dropdown-menu"
16
+ import { UserContext } from "../../context/user-context"
15
17
 
16
18
  // Type for configurable user menu items
17
19
  export interface UserMenuItem {
@@ -33,8 +35,10 @@ interface UserMenuProps {
33
35
 
34
36
  export function UserMenu({ username, onSignOut, menuConfig }: UserMenuProps) {
35
37
  const router = useRouter()
36
-
37
- const displayName = username || "User"
38
+ const userCtx = useContext(UserContext)
39
+
40
+ const displayName = username || userCtx?.profile?.name || userCtx?.profile?.preferred_username || "User"
41
+ const orgName = userCtx?.organization?.name
38
42
  const menuItems = menuConfig?.items || []
39
43
 
40
44
  return (
@@ -61,6 +65,9 @@ export function UserMenu({ username, onSignOut, menuConfig }: UserMenuProps) {
61
65
  </DropdownMenuTrigger>
62
66
  <DropdownMenuContent align="end" className="w-56 bg-white shadow-lg border border-ibm-gray-20">
63
67
  <DropdownMenuLabel>
68
+ {orgName && (
69
+ <p className="text-[11px] text-gray-400 uppercase tracking-widest mb-1">{orgName}</p>
70
+ )}
64
71
  <div className="flex flex-col space-y-1">
65
72
  <p className="text-sm font-medium leading-none">{displayName}</p>
66
73
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-ui",
3
- "version": "1.10.23",
3
+ "version": "1.10.25",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",