@igstack/app-catalog-frontend-core 0.10.1 → 0.12.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.
Files changed (100) hide show
  1. package/dist/esm/__tests__/integration/harness/given.d.ts +1 -0
  2. package/dist/esm/__tests__/integration/skewWarning.integration.test.d.ts +0 -0
  3. package/dist/esm/__tests__/integration/tools/AppDetailTools.d.ts +5 -0
  4. package/dist/esm/__tests__/integration/tools/CatalogTools.d.ts +15 -1
  5. package/dist/esm/__tests__/modules/appCatalog/utils/resolveHelpers.test.d.ts +1 -0
  6. package/dist/esm/modules/appCatalog/hooks/useSessionSyncedState.d.ts +40 -0
  7. package/dist/esm/modules/appCatalog/hooks/useSessionSyncedState.js +40 -0
  8. package/dist/esm/modules/appCatalog/hooks/useSessionSyncedState.js.map +1 -0
  9. package/dist/esm/modules/appCatalog/ui/components/AccessPrerequisiteChain.d.ts +17 -0
  10. package/dist/esm/modules/appCatalog/ui/components/AccessPrerequisiteChain.js +61 -0
  11. package/dist/esm/modules/appCatalog/ui/components/AccessPrerequisiteChain.js.map +1 -0
  12. package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.js +9 -2
  13. package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.js.map +1 -1
  14. package/dist/esm/modules/appCatalog/ui/components/OnboardingCard.js +1 -1
  15. package/dist/esm/modules/appCatalog/ui/components/OnboardingCard.js.map +1 -1
  16. package/dist/esm/modules/appCatalog/ui/components/PersonBadge.d.ts +6 -0
  17. package/dist/esm/modules/appCatalog/ui/components/PersonBadge.js +95 -31
  18. package/dist/esm/modules/appCatalog/ui/components/PersonBadge.js.map +1 -1
  19. package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.d.ts +9 -1
  20. package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js +12 -3
  21. package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js.map +1 -1
  22. package/dist/esm/modules/appCatalog/ui/context/AppCatalogFiltersContext.js +3 -2
  23. package/dist/esm/modules/appCatalog/ui/context/AppCatalogFiltersContext.js.map +1 -1
  24. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.d.ts +5 -0
  25. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +73 -18
  26. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -1
  27. package/dist/esm/modules/appCatalog/ui/launcher/AttributionFooter.d.ts +9 -0
  28. package/dist/esm/modules/appCatalog/ui/launcher/AttributionFooter.js +31 -0
  29. package/dist/esm/modules/appCatalog/ui/launcher/AttributionFooter.js.map +1 -0
  30. package/dist/esm/modules/appCatalog/ui/launcher/LauncherDetailPanel.d.ts +16 -0
  31. package/dist/esm/modules/appCatalog/ui/launcher/LauncherDetailPanel.js +40 -0
  32. package/dist/esm/modules/appCatalog/ui/launcher/LauncherDetailPanel.js.map +1 -0
  33. package/dist/esm/modules/appCatalog/ui/launcher/LauncherHome.d.ts +19 -0
  34. package/dist/esm/modules/appCatalog/ui/launcher/LauncherHome.js +389 -0
  35. package/dist/esm/modules/appCatalog/ui/launcher/LauncherHome.js.map +1 -0
  36. package/dist/esm/modules/appCatalog/ui/launcher/ResourceIcon.d.ts +13 -0
  37. package/dist/esm/modules/appCatalog/ui/launcher/ResourceIcon.js +45 -0
  38. package/dist/esm/modules/appCatalog/ui/launcher/ResourceIcon.js.map +1 -0
  39. package/dist/esm/modules/appCatalog/ui/launcher/monogram.d.ts +4 -0
  40. package/dist/esm/modules/appCatalog/ui/launcher/monogram.js +41 -0
  41. package/dist/esm/modules/appCatalog/ui/launcher/monogram.js.map +1 -0
  42. package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js +40 -6
  43. package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js.map +1 -1
  44. package/dist/esm/modules/appCatalog/utils/markdownToPlainText.d.ts +1 -1
  45. package/dist/esm/modules/appCatalog/utils/markdownToPlainText.js.map +1 -1
  46. package/dist/esm/modules/appCatalog/utils/resolveHelpers.d.ts +10 -0
  47. package/dist/esm/modules/appCatalog/utils/resolveHelpers.js +17 -0
  48. package/dist/esm/modules/appCatalog/utils/resolveHelpers.js.map +1 -1
  49. package/dist/esm/routeTree.gen.d.ts +1 -1
  50. package/dist/esm/routes/_layout/app.$slug.d.ts +1 -1
  51. package/dist/esm/routes/_layout/app._slug.js +4 -3
  52. package/dist/esm/routes/_layout/app._slug.js.map +1 -1
  53. package/dist/esm/routes/_layout/catalog.apps.index.js +2 -1
  54. package/dist/esm/routes/_layout/catalog.apps.index.js.map +1 -1
  55. package/dist/esm/routes/_layout/index.js +2 -1
  56. package/dist/esm/routes/_layout/index.js.map +1 -1
  57. package/dist/esm/routes/_layout/service-desks.js +2 -1
  58. package/dist/esm/routes/_layout/service-desks.js.map +1 -1
  59. package/dist/esm/types/uiSettings.d.ts +15 -0
  60. package/dist/esm/ui/components/header/Header.js +1 -1
  61. package/dist/esm/ui/components/header/Header.js.map +1 -1
  62. package/dist/index.css +73 -66
  63. package/package.json +4 -4
  64. package/src/__tests__/integration/appCatalog.integration.test.ts +106 -0
  65. package/src/__tests__/integration/appDeepLink.integration.test.ts +50 -24
  66. package/src/__tests__/integration/appFreshness.integration.test.ts +3 -3
  67. package/src/__tests__/integration/crossRefLinkListView.integration.test.ts +8 -8
  68. package/src/__tests__/integration/harness/given.tsx +9 -1
  69. package/src/__tests__/integration/replacementLink.integration.test.ts +6 -2
  70. package/src/__tests__/integration/searchDeprecatedFallback.integration.test.ts +21 -16
  71. package/src/__tests__/integration/setup/testSetup.ts +1 -0
  72. package/src/__tests__/integration/skewWarning.integration.test.ts +56 -0
  73. package/src/__tests__/integration/tools/AppDetailTools.ts +13 -0
  74. package/src/__tests__/integration/tools/CatalogTools.ts +62 -11
  75. package/src/__tests__/integration/tools/GalleryTools.ts +7 -1
  76. package/src/__tests__/modules/appCatalog/utils/markdownToPlainText.test.ts +5 -5
  77. package/src/__tests__/modules/appCatalog/utils/resolveHelpers.test.ts +79 -0
  78. package/src/index.css +73 -66
  79. package/src/modules/appCatalog/hooks/useSessionSyncedState.ts +83 -0
  80. package/src/modules/appCatalog/ui/components/AccessPrerequisiteChain.tsx +89 -0
  81. package/src/modules/appCatalog/ui/components/AccessRequestSection.tsx +31 -2
  82. package/src/modules/appCatalog/ui/components/OnboardingCard.tsx +1 -1
  83. package/src/modules/appCatalog/ui/components/PersonBadge.tsx +103 -30
  84. package/src/modules/appCatalog/ui/components/SubResourcesSection.tsx +22 -1
  85. package/src/modules/appCatalog/ui/context/AppCatalogFiltersContext.tsx +11 -5
  86. package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +90 -23
  87. package/src/modules/appCatalog/ui/launcher/AttributionFooter.tsx +43 -0
  88. package/src/modules/appCatalog/ui/launcher/LauncherDetailPanel.tsx +52 -0
  89. package/src/modules/appCatalog/ui/launcher/LauncherHome.tsx +547 -0
  90. package/src/modules/appCatalog/ui/launcher/ResourceIcon.tsx +54 -0
  91. package/src/modules/appCatalog/ui/launcher/monogram.ts +41 -0
  92. package/src/modules/appCatalog/ui/pages/AppCatalogPage.tsx +75 -13
  93. package/src/modules/appCatalog/utils/markdownToPlainText.ts +1 -1
  94. package/src/modules/appCatalog/utils/resolveHelpers.ts +31 -0
  95. package/src/routes/_layout/app.$slug.tsx +7 -4
  96. package/src/routes/_layout/catalog.apps.index.tsx +4 -1
  97. package/src/routes/_layout/index.tsx +5 -1
  98. package/src/routes/_layout/service-desks.tsx +4 -1
  99. package/src/types/uiSettings.ts +15 -0
  100. package/src/ui/components/header/Header.tsx +3 -1
@@ -0,0 +1,389 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { Search, ArrowUpRight } from "lucide-react";
3
+ import { useState, useEffect, useMemo, useRef } from "react";
4
+ import { cn } from "../../../../lib/utils.js";
5
+ import { useAppClickHistory } from "../../hooks/useAppClickHistory.js";
6
+ import { markdownToPlainText } from "../../utils/markdownToPlainText.js";
7
+ import { AttributionFooter } from "./AttributionFooter.js";
8
+ import { ResourceIcon } from "./ResourceIcon.js";
9
+ import { searchResources } from "../../utils/searchApps.js";
10
+ const typeLabel = (t) => {
11
+ if (!t || t === "application") return null;
12
+ return t.charAt(0).toUpperCase() + t.slice(1);
13
+ };
14
+ function LaunchButton({
15
+ app,
16
+ onLaunch,
17
+ className
18
+ }) {
19
+ if (!app.appUrl) return null;
20
+ const prettyUrl = app.appUrl.replace(/^https?:\/\//, "");
21
+ return /* @__PURE__ */ jsx(
22
+ "a",
23
+ {
24
+ href: app.appUrl,
25
+ target: "_blank",
26
+ rel: "noopener noreferrer",
27
+ title: `Open → ${prettyUrl}`,
28
+ "aria-label": `Open ${app.displayName} in a new tab (${prettyUrl})`,
29
+ onClick: (e) => {
30
+ e.stopPropagation();
31
+ onLaunch(app);
32
+ },
33
+ className: cn(
34
+ "grid place-items-center rounded-full border border-border bg-card text-muted-foreground",
35
+ "hover:bg-primary hover:text-primary-foreground hover:border-primary transition-colors",
36
+ className
37
+ ),
38
+ children: /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })
39
+ }
40
+ );
41
+ }
42
+ function SectionHead({
43
+ title,
44
+ count,
45
+ action
46
+ }) {
47
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 mb-4", children: [
48
+ /* @__PURE__ */ jsx("h2", { className: "font-serif font-semibold text-[15px] tracking-tight m-0", children: title }),
49
+ count && /* @__PURE__ */ jsx("span", { className: "text-[13px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5", children: count }),
50
+ action && /* @__PURE__ */ jsx("div", { className: "ml-auto", children: action })
51
+ ] });
52
+ }
53
+ function ResourceRow({
54
+ app,
55
+ onAppClick,
56
+ onLaunch,
57
+ showNew = false
58
+ }) {
59
+ return /* @__PURE__ */ jsxs(
60
+ "button",
61
+ {
62
+ type: "button",
63
+ onClick: () => onAppClick(app),
64
+ title: `View ${app.displayName}`,
65
+ className: cn(
66
+ "group flex items-center gap-3.5 w-full text-left",
67
+ "bg-card border border-border rounded-[var(--radius)] px-3.5 py-3",
68
+ "hover:border-ring hover:shadow-sm transition-all"
69
+ ),
70
+ children: [
71
+ /* @__PURE__ */ jsx(ResourceIcon, { app, size: 38 }),
72
+ /* @__PURE__ */ jsxs("span", { className: "flex-1 min-w-0", children: [
73
+ /* @__PURE__ */ jsx("span", { className: "block text-[14.5px] font-semibold truncate", children: app.displayName }),
74
+ app.description && /* @__PURE__ */ jsx("span", { className: "block text-[13px] text-muted-foreground truncate", children: markdownToPlainText(app.description) })
75
+ ] }),
76
+ showNew && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold text-[#65a443] bg-[#65a443]/12 rounded-full px-2.5 py-0.5", children: "New" }),
77
+ typeLabel(app.type) && /* @__PURE__ */ jsx("span", { className: "text-[12px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5 whitespace-nowrap", children: typeLabel(app.type) }),
78
+ /* @__PURE__ */ jsx(LaunchButton, { app, onLaunch, className: "size-8" })
79
+ ]
80
+ }
81
+ );
82
+ }
83
+ function SearchResultsList({
84
+ apps,
85
+ searchValue,
86
+ onAppClick,
87
+ onLaunch,
88
+ onClear
89
+ }) {
90
+ const [focusedIndex, setFocusedIndex] = useState(-1);
91
+ const results = useMemo(
92
+ () => searchResources(apps, searchValue),
93
+ [apps, searchValue]
94
+ );
95
+ const matchedChildrenByParent = useMemo(() => {
96
+ const q = searchValue.trim().toLowerCase();
97
+ const map = /* @__PURE__ */ new Map();
98
+ if (!q) return map;
99
+ const resultSlugs = new Set(results.map((r) => r.slug));
100
+ for (const r of apps) {
101
+ if (!r.parentSlug || !resultSlugs.has(r.parentSlug)) continue;
102
+ const hay = `${r.displayName} ${r.abbreviation ?? ""} ${(r.aliases ?? []).join(" ")} ${r.description ?? ""}`.toLowerCase();
103
+ if (!hay.includes(q)) continue;
104
+ const list = map.get(r.parentSlug) ?? [];
105
+ list.push(r);
106
+ map.set(r.parentSlug, list);
107
+ }
108
+ return map;
109
+ }, [apps, results, searchValue]);
110
+ const didDeprecatedFallback = useMemo(
111
+ () => results.length > 0 && results.every((r) => Boolean(r.deprecated)),
112
+ [results]
113
+ );
114
+ useEffect(() => {
115
+ setFocusedIndex(-1);
116
+ }, [searchValue]);
117
+ useEffect(() => {
118
+ const onKey = (e) => {
119
+ if (results.length === 0) return;
120
+ if (e.key === "ArrowDown") {
121
+ e.preventDefault();
122
+ setFocusedIndex((i) => Math.min(i + 1, results.length - 1));
123
+ } else if (e.key === "ArrowUp") {
124
+ e.preventDefault();
125
+ setFocusedIndex((i) => Math.max(i - 1, 0));
126
+ } else if (e.key === "Enter") {
127
+ if (focusedIndex >= 0 && results[focusedIndex]) {
128
+ onAppClick(results[focusedIndex]);
129
+ }
130
+ } else if (e.key === "Escape") {
131
+ onClear();
132
+ }
133
+ };
134
+ document.addEventListener("keydown", onKey);
135
+ return () => document.removeEventListener("keydown", onKey);
136
+ }, [results, focusedIndex, onAppClick, onClear]);
137
+ return /* @__PURE__ */ jsxs("div", { className: "max-w-[620px] mx-auto mt-3", children: [
138
+ /* @__PURE__ */ jsx("div", { className: "text-[13px] text-muted-foreground mb-2 px-1", children: results.length === 0 ? `No results for "${searchValue}"` : `${results.length} result${results.length === 1 ? "" : "s"}` }),
139
+ didDeprecatedFallback && /* @__PURE__ */ jsxs(
140
+ "div",
141
+ {
142
+ role: "status",
143
+ className: "text-[13px] text-muted-foreground mb-2 px-1",
144
+ children: [
145
+ 'No active apps for "',
146
+ searchValue,
147
+ '" — showing deprecated matches.'
148
+ ]
149
+ }
150
+ ),
151
+ /* @__PURE__ */ jsx(
152
+ "div",
153
+ {
154
+ className: "flex flex-col gap-1.5",
155
+ role: "listbox",
156
+ "aria-label": "Search results",
157
+ children: results.map((app, i) => /* @__PURE__ */ jsxs(
158
+ "button",
159
+ {
160
+ type: "button",
161
+ role: "option",
162
+ title: `View ${app.displayName}`,
163
+ "aria-selected": focusedIndex === i,
164
+ onMouseEnter: () => setFocusedIndex(i),
165
+ onClick: () => onAppClick(app),
166
+ className: cn(
167
+ "group flex items-center gap-3.5 w-full text-left",
168
+ "bg-card border rounded-[var(--radius)] px-3.5 py-2.5",
169
+ "transition-all",
170
+ focusedIndex === i ? "border-ring shadow-sm bg-muted/30" : "border-border hover:border-ring hover:shadow-sm"
171
+ ),
172
+ children: [
173
+ /* @__PURE__ */ jsx(ResourceIcon, { app, size: 40 }),
174
+ /* @__PURE__ */ jsxs("span", { className: "flex-1 min-w-0", children: [
175
+ /* @__PURE__ */ jsxs("span", { className: "block text-[14px] font-semibold truncate", children: [
176
+ app.displayName,
177
+ app.abbreviation && app.abbreviation !== app.displayName && /* @__PURE__ */ jsxs("span", { className: "ml-1.5 text-[12px] font-normal text-muted-foreground", children: [
178
+ "(",
179
+ app.abbreviation,
180
+ ")"
181
+ ] })
182
+ ] }),
183
+ app.description && /* @__PURE__ */ jsx("span", { className: "block text-[12.5px] text-muted-foreground truncate", children: markdownToPlainText(app.description) }),
184
+ (() => {
185
+ const kids = matchedChildrenByParent.get(app.slug);
186
+ if (!kids || kids.length === 0) return null;
187
+ const names = kids.map((k) => k.displayName);
188
+ const shown = names.slice(0, 3).join(", ");
189
+ const extra = names.length > 3 ? ` +${names.length - 3} more` : "";
190
+ return /* @__PURE__ */ jsxs("span", { className: "mt-0.5 block text-[12px] text-primary truncate", children: [
191
+ "Matched ",
192
+ kids.length,
193
+ " sub-resource",
194
+ kids.length === 1 ? "" : "s",
195
+ ": ",
196
+ shown,
197
+ extra
198
+ ] });
199
+ })()
200
+ ] }),
201
+ typeLabel(app.type) && /* @__PURE__ */ jsx("span", { className: "text-[11.5px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5 whitespace-nowrap shrink-0", children: typeLabel(app.type) }),
202
+ /* @__PURE__ */ jsx(
203
+ LaunchButton,
204
+ {
205
+ app,
206
+ onLaunch,
207
+ className: "size-7 shrink-0 opacity-0 group-hover:opacity-100"
208
+ }
209
+ )
210
+ ]
211
+ },
212
+ app.slug
213
+ ))
214
+ }
215
+ ),
216
+ results.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-[11.5px] text-muted-foreground/60 text-center mt-3", children: "↑↓ navigate · ↵ view access · esc clear" })
217
+ ] });
218
+ }
219
+ function LauncherHome({
220
+ apps,
221
+ allResources,
222
+ searchValue,
223
+ onSearchChange,
224
+ onAppClick,
225
+ onLaunch,
226
+ totalCount
227
+ }) {
228
+ const { getTopApps } = useAppClickHistory();
229
+ const [topSlugs, setTopSlugs] = useState([]);
230
+ useEffect(() => {
231
+ void getTopApps(5).then(setTopSlugs);
232
+ }, [getTopApps]);
233
+ const bySlug = useMemo(() => {
234
+ const m = /* @__PURE__ */ new Map();
235
+ for (const a of apps) m.set(a.slug, a);
236
+ return m;
237
+ }, [apps]);
238
+ const frequent = useMemo(
239
+ () => topSlugs.map((s) => bySlug.get(s)).filter((a) => Boolean(a)).slice(0, 5),
240
+ [topSlugs, bySlug]
241
+ );
242
+ const fresh = useMemo(() => {
243
+ const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1e3;
244
+ return apps.filter((a) => {
245
+ var _a;
246
+ const t = (_a = a.freshness) == null ? void 0 : _a.lastCheckedAt;
247
+ return t ? new Date(t).getTime() >= weekAgo : false;
248
+ }).sort((a, b) => {
249
+ var _a, _b;
250
+ const ta = new Date(((_a = a.freshness) == null ? void 0 : _a.lastCheckedAt) ?? 0).getTime();
251
+ const tb = new Date(((_b = b.freshness) == null ? void 0 : _b.lastCheckedAt) ?? 0).getTime();
252
+ return tb - ta;
253
+ }).slice(0, 6);
254
+ }, [apps]);
255
+ const browse = useMemo(() => {
256
+ const promoted = new Set(frequent.map((a) => a.slug));
257
+ return [...apps].filter((a) => !promoted.has(a.slug)).sort((a, b) => a.displayName.localeCompare(b.displayName));
258
+ }, [apps, frequent]);
259
+ const browseLeft = browse.filter((_, i) => i % 2 === 0);
260
+ const browseRight = browse.filter((_, i) => i % 2 === 1);
261
+ const isSearching = searchValue.trim() !== "";
262
+ const searchRef = useRef(null);
263
+ useEffect(() => {
264
+ const onKey = (e) => {
265
+ var _a;
266
+ if ((e.metaKey || e.ctrlKey) && e.key === "k") {
267
+ e.preventDefault();
268
+ (_a = searchRef.current) == null ? void 0 : _a.focus();
269
+ }
270
+ };
271
+ document.addEventListener("keydown", onKey);
272
+ return () => document.removeEventListener("keydown", onKey);
273
+ }, []);
274
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-[1000px] pb-24", children: [
275
+ /* @__PURE__ */ jsxs("div", { className: "text-center pt-10 pb-1.5", children: [
276
+ /* @__PURE__ */ jsx("h1", { className: "font-serif font-semibold text-[30px] tracking-tight m-0 mb-1.5", children: "What do you need to get into?" }),
277
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground m-0 mb-6 text-[15px]", children: "Find any tool, see how to request access, or jump straight in." }),
278
+ /* @__PURE__ */ jsx("div", { className: "max-w-[620px] mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 bg-card border-[1.5px] border-input rounded-full px-5 h-14 shadow-sm focus-within:border-primary focus-within:ring-4 focus-within:ring-primary/15 transition-colors", children: [
279
+ /* @__PURE__ */ jsx(Search, { className: "size-5 shrink-0 text-muted-foreground" }),
280
+ /* @__PURE__ */ jsx(
281
+ "input",
282
+ {
283
+ type: "text",
284
+ value: searchValue,
285
+ onChange: (e) => onSearchChange(e.target.value),
286
+ placeholder: "Search apps, databases, cloud accounts, account IDs…",
287
+ autoComplete: "off",
288
+ autoFocus: true,
289
+ ref: searchRef,
290
+ "aria-label": "Search apps",
291
+ className: "flex-1 bg-transparent border-0 outline-none text-[16px] text-foreground placeholder:text-muted-foreground"
292
+ }
293
+ ),
294
+ !isSearching && /* @__PURE__ */ jsx("kbd", { className: "hidden sm:inline-flex items-center gap-0.5 text-[11px] text-muted-foreground/60 border border-muted-foreground/20 rounded px-1.5 py-0.5 font-mono shrink-0", children: typeof navigator !== "undefined" && navigator.platform.includes("Mac") ? "⌘K" : "Ctrl+K" })
295
+ ] }) })
296
+ ] }),
297
+ isSearching && /* @__PURE__ */ jsx(
298
+ SearchResultsList,
299
+ {
300
+ apps: allResources ?? apps,
301
+ searchValue,
302
+ onAppClick,
303
+ onLaunch,
304
+ onClear: () => onSearchChange("")
305
+ }
306
+ ),
307
+ !isSearching && /* @__PURE__ */ jsxs(Fragment, { children: [
308
+ frequent.length > 0 && /* @__PURE__ */ jsxs("section", { className: "mt-9", children: [
309
+ /* @__PURE__ */ jsx(SectionHead, { title: "Your apps", count: "frequent" }),
310
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-3.5", children: frequent.map((app) => /* @__PURE__ */ jsxs(
311
+ "button",
312
+ {
313
+ type: "button",
314
+ onClick: () => onAppClick(app),
315
+ title: `View ${app.displayName}`,
316
+ className: "group relative bg-card border border-border rounded-[var(--radius)] px-3.5 pt-[18px] pb-4 text-center shadow-sm hover:-translate-y-0.5 hover:shadow-md transition-all",
317
+ children: [
318
+ /* @__PURE__ */ jsx(
319
+ LaunchButton,
320
+ {
321
+ app,
322
+ onLaunch,
323
+ className: "absolute top-2.5 right-2.5 size-[26px] opacity-0 group-hover:opacity-100"
324
+ }
325
+ ),
326
+ /* @__PURE__ */ jsx(
327
+ ResourceIcon,
328
+ {
329
+ app,
330
+ size: 46,
331
+ className: "mx-auto mb-3"
332
+ }
333
+ ),
334
+ /* @__PURE__ */ jsx("span", { className: "block text-[13.5px] font-bold truncate", children: app.displayName })
335
+ ]
336
+ },
337
+ app.slug
338
+ )) })
339
+ ] }),
340
+ fresh.length > 0 && /* @__PURE__ */ jsxs("section", { className: "mt-9", children: [
341
+ /* @__PURE__ */ jsx(
342
+ SectionHead,
343
+ {
344
+ title: "New this week",
345
+ count: `${fresh.length} added`
346
+ }
347
+ ),
348
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: fresh.map((app) => /* @__PURE__ */ jsx(
349
+ ResourceRow,
350
+ {
351
+ app,
352
+ onAppClick,
353
+ onLaunch,
354
+ showNew: true
355
+ },
356
+ app.slug
357
+ )) })
358
+ ] }),
359
+ /* @__PURE__ */ jsxs("section", { className: "mt-9", children: [
360
+ /* @__PURE__ */ jsx(SectionHead, { title: "Browse all", count: `${totalCount} resources` }),
361
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2", children: [
362
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: browseLeft.map((app) => /* @__PURE__ */ jsx(
363
+ ResourceRow,
364
+ {
365
+ app,
366
+ onAppClick,
367
+ onLaunch
368
+ },
369
+ app.slug
370
+ )) }),
371
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: browseRight.map((app) => /* @__PURE__ */ jsx(
372
+ ResourceRow,
373
+ {
374
+ app,
375
+ onAppClick,
376
+ onLaunch
377
+ },
378
+ app.slug
379
+ )) })
380
+ ] })
381
+ ] }),
382
+ /* @__PURE__ */ jsx(AttributionFooter, {})
383
+ ] })
384
+ ] });
385
+ }
386
+ export {
387
+ LauncherHome
388
+ };
389
+ //# sourceMappingURL=LauncherHome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LauncherHome.js","sources":["../../../../../../src/modules/appCatalog/ui/launcher/LauncherHome.tsx"],"sourcesContent":["import type { Resource } from '@igstack/app-catalog-backend-core'\nimport { ArrowUpRight, Search } from 'lucide-react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '~/lib/utils'\nimport { useAppClickHistory } from '../../hooks/useAppClickHistory'\nimport { markdownToPlainText } from '../../utils/markdownToPlainText'\nimport { AttributionFooter } from './AttributionFooter'\nimport { ResourceIcon } from './ResourceIcon'\nimport { searchResources } from '../../utils/searchApps'\n\n/**\n * Adaptive-home discovery spine (issue #38, increment 1) — matches the\n * option-a-launcher prototype:\n * Your apps (frequent) → New this week → Browse all\n * Rendered by AppCatalogPage when there is no active search and no open detail.\n * The hero search box drives the same `searchValue` used elsewhere; typing hands\n * off to the results view (increment 2 refines the morph).\n */\n\n// Type pill text. Plain \"application\" resources are the common case and don't\n// need a badge (the user asked not to show a bare \"App\" badge); only surface a\n// pill for distinctive types (database, cloud, service, …).\nconst typeLabel = (t?: string): string | null => {\n if (!t || t === 'application') return null\n return t.charAt(0).toUpperCase() + t.slice(1)\n}\n\nexport interface LauncherHomeProps {\n /** All root (non-child) resources, already filtered for deprecated per settings. */\n apps: Resource[]\n /**\n * All resources INCLUDING children/sub-resources. Passed to search so a query\n * matching a sub-resource (e.g. an AWS account, an alias/account ID) surfaces\n * its parent — preserving the existing cross-sub-resource search behavior.\n * Falls back to `apps` when omitted.\n */\n allResources?: Resource[]\n searchValue: string\n onSearchChange: (v: string) => void\n onAppClick: (app: Resource) => void\n onLaunch: (app: Resource) => void\n /** Total resource count for the \"Browse all\" label. */\n totalCount: number\n}\n\nfunction LaunchButton({\n app,\n onLaunch,\n className,\n}: {\n app: Resource\n onLaunch: (app: Resource) => void\n className?: string\n}) {\n if (!app.appUrl) return null\n // Show the destination URL on hover (user ask) — the native title tooltip\n // reveals where the ↗ jumps to, e.g. \"Open → console.aws.amazon.com\".\n const prettyUrl = app.appUrl.replace(/^https?:\\/\\//, '')\n return (\n <a\n href={app.appUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={`Open → ${prettyUrl}`}\n aria-label={`Open ${app.displayName} in a new tab (${prettyUrl})`}\n onClick={(e) => {\n e.stopPropagation()\n onLaunch(app)\n }}\n className={cn(\n 'grid place-items-center rounded-full border border-border bg-card text-muted-foreground',\n 'hover:bg-primary hover:text-primary-foreground hover:border-primary transition-colors',\n className,\n )}\n >\n <ArrowUpRight className=\"size-3.5\" />\n </a>\n )\n}\n\nfunction SectionHead({\n title,\n count,\n action,\n}: {\n title: string\n count?: string\n action?: React.ReactNode\n}) {\n return (\n <div className=\"flex items-center gap-2.5 mb-4\">\n <h2 className=\"font-serif font-semibold text-[15px] tracking-tight m-0\">\n {title}\n </h2>\n {count && (\n <span className=\"text-[13px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5\">\n {count}\n </span>\n )}\n {action && <div className=\"ml-auto\">{action}</div>}\n </div>\n )\n}\n\n/** Small row used by \"New this week\" and \"Browse all\". */\nfunction ResourceRow({\n app,\n onAppClick,\n onLaunch,\n showNew = false,\n}: {\n app: Resource\n onAppClick: (app: Resource) => void\n onLaunch: (app: Resource) => void\n showNew?: boolean\n}) {\n return (\n <button\n type=\"button\"\n onClick={() => onAppClick(app)}\n title={`View ${app.displayName}`}\n className={cn(\n 'group flex items-center gap-3.5 w-full text-left',\n 'bg-card border border-border rounded-[var(--radius)] px-3.5 py-3',\n 'hover:border-ring hover:shadow-sm transition-all',\n )}\n >\n <ResourceIcon app={app} size={38} />\n <span className=\"flex-1 min-w-0\">\n <span className=\"block text-[14.5px] font-semibold truncate\">\n {app.displayName}\n </span>\n {app.description && (\n <span className=\"block text-[13px] text-muted-foreground truncate\">\n {markdownToPlainText(app.description)}\n </span>\n )}\n </span>\n {showNew && (\n <span className=\"text-[11px] font-bold text-[#65a443] bg-[#65a443]/12 rounded-full px-2.5 py-0.5\">\n New\n </span>\n )}\n {typeLabel(app.type) && (\n <span className=\"text-[12px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5 whitespace-nowrap\">\n {typeLabel(app.type)}\n </span>\n )}\n <LaunchButton app={app} onLaunch={onLaunch} className=\"size-8\" />\n </button>\n )\n}\n\n/**\n * Keyboard-navigable search results list — increment 2 of the launcher redesign.\n * Appears below the hero search box when the user types, replacing the\n * discovery spine. Pressing ↑↓ navigates, ↵ opens detail, Esc clears.\n */\nfunction SearchResultsList({\n apps,\n searchValue,\n onAppClick,\n onLaunch,\n onClear,\n}: {\n apps: Resource[]\n searchValue: string\n onAppClick: (app: Resource) => void\n onLaunch: (app: Resource) => void\n onClear: () => void\n}) {\n const [focusedIndex, setFocusedIndex] = useState(-1)\n\n const results = useMemo(\n () => searchResources(apps, searchValue),\n [apps, searchValue],\n )\n\n // For each result, the child/sub-resources of it that themselves match the\n // query — so a parent surfaced only via its children (e.g. AWS Console via a\n // \"biom\" account) tells the user WHICH sub-resources matched, instead of an\n // unexplained parent. Keyed by parent slug.\n const matchedChildrenByParent = useMemo(() => {\n const q = searchValue.trim().toLowerCase()\n const map = new Map<string, Resource[]>()\n if (!q) return map\n const resultSlugs = new Set(results.map((r) => r.slug))\n for (const r of apps) {\n if (!r.parentSlug || !resultSlugs.has(r.parentSlug)) continue\n const hay = `${r.displayName} ${r.abbreviation ?? ''} ${(\n r.aliases ?? []\n ).join(' ')} ${r.description ?? ''}`.toLowerCase()\n if (!hay.includes(q)) continue\n const list = map.get(r.parentSlug) ?? []\n list.push(r)\n map.set(r.parentSlug, list)\n }\n return map\n }, [apps, results, searchValue])\n\n // #11 deprecated fallback: when EVERY match is a deprecated app (i.e. there\n // are no active matches for the query, only deprecated ones), surface a\n // notice so the user understands why they're seeing archived tools. The\n // deprecated apps are already in `results` because the launcher feeds search\n // the full resource set; this just labels the situation.\n const didDeprecatedFallback = useMemo(\n () => results.length > 0 && results.every((r) => Boolean(r.deprecated)),\n [results],\n )\n\n // Reset focus when results change\n useEffect(() => {\n setFocusedIndex(-1)\n }, [searchValue])\n\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (results.length === 0) return\n if (e.key === 'ArrowDown') {\n e.preventDefault()\n setFocusedIndex((i) => Math.min(i + 1, results.length - 1))\n } else if (e.key === 'ArrowUp') {\n e.preventDefault()\n setFocusedIndex((i) => Math.max(i - 1, 0))\n } else if (e.key === 'Enter') {\n if (focusedIndex >= 0 && results[focusedIndex]) {\n onAppClick(results[focusedIndex])\n }\n } else if (e.key === 'Escape') {\n onClear()\n }\n }\n document.addEventListener('keydown', onKey)\n return () => document.removeEventListener('keydown', onKey)\n }, [results, focusedIndex, onAppClick, onClear])\n\n return (\n <div className=\"max-w-[620px] mx-auto mt-3\">\n {/* Meta line */}\n <div className=\"text-[13px] text-muted-foreground mb-2 px-1\">\n {results.length === 0\n ? `No results for \"${searchValue}\"`\n : `${results.length} result${results.length === 1 ? '' : 's'}`}\n </div>\n\n {/* #11: deprecated-only fallback notice */}\n {didDeprecatedFallback && (\n <div\n role=\"status\"\n className=\"text-[13px] text-muted-foreground mb-2 px-1\"\n >\n No active apps for &quot;{searchValue}&quot; — showing deprecated\n matches.\n </div>\n )}\n\n {/* Results */}\n <div\n className=\"flex flex-col gap-1.5\"\n role=\"listbox\"\n aria-label=\"Search results\"\n >\n {results.map((app, i) => (\n <button\n key={app.slug}\n type=\"button\"\n role=\"option\"\n title={`View ${app.displayName}`}\n aria-selected={focusedIndex === i}\n onMouseEnter={() => setFocusedIndex(i)}\n onClick={() => onAppClick(app)}\n className={cn(\n 'group flex items-center gap-3.5 w-full text-left',\n 'bg-card border rounded-[var(--radius)] px-3.5 py-2.5',\n 'transition-all',\n focusedIndex === i\n ? 'border-ring shadow-sm bg-muted/30'\n : 'border-border hover:border-ring hover:shadow-sm',\n )}\n >\n <ResourceIcon app={app} size={40} />\n <span className=\"flex-1 min-w-0\">\n <span className=\"block text-[14px] font-semibold truncate\">\n {app.displayName}\n {app.abbreviation && app.abbreviation !== app.displayName && (\n <span className=\"ml-1.5 text-[12px] font-normal text-muted-foreground\">\n ({app.abbreviation})\n </span>\n )}\n </span>\n {app.description && (\n <span className=\"block text-[12.5px] text-muted-foreground truncate\">\n {markdownToPlainText(app.description)}\n </span>\n )}\n {(() => {\n const kids = matchedChildrenByParent.get(app.slug)\n if (!kids || kids.length === 0) return null\n const names = kids.map((k) => k.displayName)\n const shown = names.slice(0, 3).join(', ')\n const extra =\n names.length > 3 ? ` +${names.length - 3} more` : ''\n return (\n <span className=\"mt-0.5 block text-[12px] text-primary truncate\">\n Matched {kids.length} sub-resource\n {kids.length === 1 ? '' : 's'}: {shown}\n {extra}\n </span>\n )\n })()}\n </span>\n {typeLabel(app.type) && (\n <span className=\"text-[11.5px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5 whitespace-nowrap shrink-0\">\n {typeLabel(app.type)}\n </span>\n )}\n <LaunchButton\n app={app}\n onLaunch={onLaunch}\n className=\"size-7 shrink-0 opacity-0 group-hover:opacity-100\"\n />\n </button>\n ))}\n </div>\n\n {/* Keyboard hint */}\n {results.length > 0 && (\n <p className=\"text-[11.5px] text-muted-foreground/60 text-center mt-3\">\n ↑↓ navigate · ↵ view access · esc clear\n </p>\n )}\n </div>\n )\n}\n\nexport function LauncherHome({\n apps,\n allResources,\n searchValue,\n onSearchChange,\n onAppClick,\n onLaunch,\n totalCount,\n}: LauncherHomeProps) {\n const { getTopApps } = useAppClickHistory()\n const [topSlugs, setTopSlugs] = useState<string[]>([])\n\n useEffect(() => {\n void getTopApps(5).then(setTopSlugs)\n }, [getTopApps])\n\n const bySlug = useMemo(() => {\n const m = new Map<string, Resource>()\n for (const a of apps) m.set(a.slug, a)\n return m\n }, [apps])\n\n // Your apps: frequently-clicked (personalized). Empty on a cold new machine.\n const frequent = useMemo(\n () =>\n topSlugs\n .map((s) => bySlug.get(s))\n .filter((a): a is Resource => Boolean(a))\n .slice(0, 5),\n [topSlugs, bySlug],\n )\n\n // New this week: apps whose sources were checked in the last 7 days, as a\n // proxy for \"recently added/updated\" (frontend Resource has no createdAt yet;\n // see #38). Falls back to empty (section hidden) when no freshness data.\n const fresh = useMemo(() => {\n const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1000\n return apps\n .filter((a) => {\n const t = a.freshness?.lastCheckedAt\n return t ? new Date(t).getTime() >= weekAgo : false\n })\n .sort((a, b) => {\n const ta = new Date(a.freshness?.lastCheckedAt ?? 0).getTime()\n const tb = new Date(b.freshness?.lastCheckedAt ?? 0).getTime()\n return tb - ta\n })\n .slice(0, 6)\n }, [apps])\n\n // Browse all: everything not already promoted to \"Your apps\", alpha by name.\n const browse = useMemo(() => {\n const promoted = new Set(frequent.map((a) => a.slug))\n return [...apps]\n .filter((a) => !promoted.has(a.slug))\n .sort((a, b) => a.displayName.localeCompare(b.displayName))\n }, [apps, frequent])\n\n const browseLeft = browse.filter((_, i) => i % 2 === 0)\n const browseRight = browse.filter((_, i) => i % 2 === 1)\n\n const isSearching = searchValue.trim() !== ''\n const searchRef = useRef<HTMLInputElement>(null)\n\n // ⌘K / Ctrl+K focuses the hero search box from anywhere on the page.\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key === 'k') {\n e.preventDefault()\n searchRef.current?.focus()\n }\n }\n document.addEventListener('keydown', onKey)\n return () => document.removeEventListener('keydown', onKey)\n }, [])\n\n return (\n <div className=\"mx-auto w-full max-w-[1000px] pb-24\">\n {/* hero */}\n <div className=\"text-center pt-10 pb-1.5\">\n <h1 className=\"font-serif font-semibold text-[30px] tracking-tight m-0 mb-1.5\">\n What do you need to get into?\n </h1>\n <p className=\"text-muted-foreground m-0 mb-6 text-[15px]\">\n Find any tool, see how to request access, or jump straight in.\n </p>\n <div className=\"max-w-[620px] mx-auto\">\n <div className=\"flex items-center gap-3 bg-card border-[1.5px] border-input rounded-full px-5 h-14 shadow-sm focus-within:border-primary focus-within:ring-4 focus-within:ring-primary/15 transition-colors\">\n <Search className=\"size-5 shrink-0 text-muted-foreground\" />\n <input\n type=\"text\"\n value={searchValue}\n onChange={(e) => onSearchChange(e.target.value)}\n placeholder=\"Search apps, databases, cloud accounts, account IDs…\"\n autoComplete=\"off\"\n autoFocus\n ref={searchRef}\n aria-label=\"Search apps\"\n className=\"flex-1 bg-transparent border-0 outline-none text-[16px] text-foreground placeholder:text-muted-foreground\"\n />\n {!isSearching && (\n <kbd className=\"hidden sm:inline-flex items-center gap-0.5 text-[11px] text-muted-foreground/60 border border-muted-foreground/20 rounded px-1.5 py-0.5 font-mono shrink-0\">\n {typeof navigator !== 'undefined' &&\n navigator.platform.includes('Mac')\n ? '⌘K'\n : 'Ctrl+K'}\n </kbd>\n )}\n </div>\n </div>\n </div>\n\n {/* Search morph: when typing, show compact results list instead of the discovery spine */}\n {isSearching && (\n <SearchResultsList\n apps={allResources ?? apps}\n searchValue={searchValue}\n onAppClick={onAppClick}\n onLaunch={onLaunch}\n onClear={() => onSearchChange('')}\n />\n )}\n\n {/* Discovery spine: only shown when not searching */}\n {!isSearching && (\n <>\n {/* Your apps */}\n {frequent.length > 0 && (\n <section className=\"mt-9\">\n <SectionHead title=\"Your apps\" count=\"frequent\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-3.5\">\n {frequent.map((app) => (\n <button\n type=\"button\"\n key={app.slug}\n onClick={() => onAppClick(app)}\n title={`View ${app.displayName}`}\n className=\"group relative bg-card border border-border rounded-[var(--radius)] px-3.5 pt-[18px] pb-4 text-center shadow-sm hover:-translate-y-0.5 hover:shadow-md transition-all\"\n >\n <LaunchButton\n app={app}\n onLaunch={onLaunch}\n className=\"absolute top-2.5 right-2.5 size-[26px] opacity-0 group-hover:opacity-100\"\n />\n <ResourceIcon\n app={app}\n size={46}\n className=\"mx-auto mb-3\"\n />\n <span className=\"block text-[13.5px] font-bold truncate\">\n {app.displayName}\n </span>\n </button>\n ))}\n </div>\n </section>\n )}\n\n {/* New this week */}\n {fresh.length > 0 && (\n <section className=\"mt-9\">\n <SectionHead\n title=\"New this week\"\n count={`${fresh.length} added`}\n />\n <div className=\"flex flex-col gap-2\">\n {fresh.map((app) => (\n <ResourceRow\n key={app.slug}\n app={app}\n onAppClick={onAppClick}\n onLaunch={onLaunch}\n showNew\n />\n ))}\n </div>\n </section>\n )}\n\n {/* Browse all */}\n <section className=\"mt-9\">\n <SectionHead title=\"Browse all\" count={`${totalCount} resources`} />\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-2\">\n <div className=\"flex flex-col gap-2\">\n {browseLeft.map((app) => (\n <ResourceRow\n key={app.slug}\n app={app}\n onAppClick={onAppClick}\n onLaunch={onLaunch}\n />\n ))}\n </div>\n <div className=\"flex flex-col gap-2\">\n {browseRight.map((app) => (\n <ResourceRow\n key={app.slug}\n app={app}\n onAppClick={onAppClick}\n onLaunch={onLaunch}\n />\n ))}\n </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AAA,YACA;AAAA,YACA;AAAA,YACA,SAAO;AAAA,UAAA;AAAA,UAJF,IAAI;AAAA,QAAA,CAMZ,EAAA,CACH;AAAA,MAAA,GACF;AAAA,MAIF,qBAAC,WAAA,EAAQ,WAAU,QACjB,UAAA;AAAA,QAAA,oBAAC,eAAY,OAAM,cAAa,OAAO,GAAG,UAAU,cAAc;AAAA,QAClE,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,UAAA,oBAAC,SAAI,WAAU,uBACZ,UAAA,WAAW,IAAI,CAAC,QACf;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,YAHK,IAAI;AAAA,UAAA,CAKZ,GACH;AAAA,8BACC,OAAA,EAAI,WAAU,uBACZ,UAAA,YAAY,IAAI,CAAC,QAChB;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,YAHK,IAAI;AAAA,UAAA,CAKZ,EAAA,CACH;AAAA,QAAA,EAAA,CACF;AAAA,MAAA,GACF;AAAA,0BAEC,mBAAA,CAAA,CAAkB;AAAA,IAAA,EAAA,CACrB;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -0,0 +1,13 @@
1
+ import { Resource } from '@igstack/app-catalog-backend-core';
2
+ /**
3
+ * Resource icon used across the launcher UI.
4
+ * - If the app has an `iconName`, render the served image (`/api/icons/<name>`).
5
+ * - Otherwise fall back to a flat crayon-colored monogram chip (prototype look),
6
+ * NOT a generic glyph, so every resource still has a recognizable "scent".
7
+ */
8
+ export declare function ResourceIcon({ app, size, className, rounded, }: {
9
+ app: Pick<Resource, 'iconName' | 'displayName' | 'abbreviation' | 'slug'>;
10
+ size?: number;
11
+ className?: string;
12
+ rounded?: string;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { cn } from "../../../../lib/utils.js";
4
+ import { monogramInitials, monogramColor } from "./monogram.js";
5
+ function ResourceIcon({
6
+ app,
7
+ size = 40,
8
+ className,
9
+ rounded = "rounded-[12px]"
10
+ }) {
11
+ const [imageError, setImageError] = useState(false);
12
+ const dim = { width: size, height: size };
13
+ if (app.iconName && !imageError) {
14
+ return /* @__PURE__ */ jsx(
15
+ "img",
16
+ {
17
+ src: `/api/icons/${app.iconName}`,
18
+ alt: "",
19
+ "aria-hidden": "true",
20
+ style: dim,
21
+ className: cn(rounded, "shrink-0 object-contain", className),
22
+ onError: () => setImageError(true)
23
+ }
24
+ );
25
+ }
26
+ const initials = monogramInitials(app.displayName, app.abbreviation);
27
+ const bg = monogramColor(app.slug || app.displayName);
28
+ return /* @__PURE__ */ jsx(
29
+ "span",
30
+ {
31
+ "aria-hidden": "true",
32
+ style: { ...dim, background: bg, fontSize: Math.round(size * 0.36) },
33
+ className: cn(
34
+ rounded,
35
+ "shrink-0 grid place-items-center font-semibold text-white font-serif tracking-tight select-none",
36
+ className
37
+ ),
38
+ children: initials
39
+ }
40
+ );
41
+ }
42
+ export {
43
+ ResourceIcon
44
+ };
45
+ //# sourceMappingURL=ResourceIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceIcon.js","sources":["../../../../../../src/modules/appCatalog/ui/launcher/ResourceIcon.tsx"],"sourcesContent":["import { useState } from 'react'\nimport type { Resource } from '@igstack/app-catalog-backend-core'\nimport { cn } from '~/lib/utils'\nimport { monogramColor, monogramInitials } from './monogram'\n\n/**\n * Resource icon used across the launcher UI.\n * - If the app has an `iconName`, render the served image (`/api/icons/<name>`).\n * - Otherwise fall back to a flat crayon-colored monogram chip (prototype look),\n * NOT a generic glyph, so every resource still has a recognizable \"scent\".\n */\nexport function ResourceIcon({\n app,\n size = 40,\n className,\n rounded = 'rounded-[12px]',\n}: {\n app: Pick<Resource, 'iconName' | 'displayName' | 'abbreviation' | 'slug'>\n size?: number\n className?: string\n rounded?: string\n}) {\n const [imageError, setImageError] = useState(false)\n const dim = { width: size, height: size }\n\n if (app.iconName && !imageError) {\n return (\n <img\n src={`/api/icons/${app.iconName}`}\n alt=\"\"\n aria-hidden=\"true\"\n style={dim}\n className={cn(rounded, 'shrink-0 object-contain', className)}\n onError={() => setImageError(true)}\n />\n )\n }\n\n const initials = monogramInitials(app.displayName, app.abbreviation)\n const bg = monogramColor(app.slug || app.displayName)\n return (\n <span\n aria-hidden=\"true\"\n style={{ ...dim, background: bg, fontSize: Math.round(size * 0.36) }}\n className={cn(\n rounded,\n 'shrink-0 grid place-items-center font-semibold text-white font-serif tracking-tight select-none',\n className,\n )}\n >\n {initials}\n </span>\n )\n}\n"],"names":[],"mappings":";;;;AAWO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,UAAU;AACZ,GAKG;AACD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,MAAM,EAAE,OAAO,MAAM,QAAQ,KAAA;AAEnC,MAAI,IAAI,YAAY,CAAC,YAAY;AAC/B,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK,cAAc,IAAI,QAAQ;AAAA,QAC/B,KAAI;AAAA,QACJ,eAAY;AAAA,QACZ,OAAO;AAAA,QACP,WAAW,GAAG,SAAS,2BAA2B,SAAS;AAAA,QAC3D,SAAS,MAAM,cAAc,IAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EAGvC;AAEA,QAAM,WAAW,iBAAiB,IAAI,aAAa,IAAI,YAAY;AACnE,QAAM,KAAK,cAAc,IAAI,QAAQ,IAAI,WAAW;AACpD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAO,EAAE,GAAG,KAAK,YAAY,IAAI,UAAU,KAAK,MAAM,OAAO,IAAI,EAAA;AAAA,MACjE,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGD,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -0,0 +1,4 @@
1
+ /** Stable hash → palette index, so a given slug always maps to one color. */
2
+ export declare function monogramColor(key: string): string;
3
+ /** Up-to-2-char initials from a display name / abbreviation. */
4
+ export declare function monogramInitials(name: string, abbreviation?: string): string;
@@ -0,0 +1,41 @@
1
+ const CRAYON_PALETTE = [
2
+ "#dc6827",
3
+ // orange
4
+ "#eca832",
5
+ // amber
6
+ "#e4724a",
7
+ // coral
8
+ "#f07a84",
9
+ // pink
10
+ "#3782c2",
11
+ // blue
12
+ "#388aca",
13
+ // blue-2
14
+ "#65a443",
15
+ // green
16
+ "#2c2622"
17
+ // ink
18
+ ];
19
+ function monogramColor(key) {
20
+ let hash = 0;
21
+ for (let i = 0; i < key.length; i++) {
22
+ hash = hash * 31 + key.charCodeAt(i) | 0;
23
+ }
24
+ const idx = Math.abs(hash) % CRAYON_PALETTE.length;
25
+ return CRAYON_PALETTE[idx];
26
+ }
27
+ function monogramInitials(name, abbreviation) {
28
+ const base = (abbreviation || name).trim();
29
+ if (!base) return "?";
30
+ if (abbreviation) return abbreviation.slice(0, 2).toUpperCase();
31
+ const words = base.replace(/[^A-Za-z0-9 ]/g, "").split(/\s+/).filter(Boolean);
32
+ if (words.length >= 2) {
33
+ return (words[0][0] + words[1][0]).toUpperCase();
34
+ }
35
+ return base.slice(0, 2).toUpperCase();
36
+ }
37
+ export {
38
+ monogramColor,
39
+ monogramInitials
40
+ };
41
+ //# sourceMappingURL=monogram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monogram.js","sources":["../../../../../../src/modules/appCatalog/ui/launcher/monogram.ts"],"sourcesContent":["// Deterministic crayon-palette monogram color for an app that has no icon.\n// Mirrors the prototype's flat brand-color chips (option-a-launcher.html):\n// a small warm palette drawn from the logo, picked stably by slug so the same\n// app always gets the same color.\n\nconst CRAYON_PALETTE = [\n '#dc6827', // orange\n '#eca832', // amber\n '#e4724a', // coral\n '#f07a84', // pink\n '#3782c2', // blue\n '#388aca', // blue-2\n '#65a443', // green\n '#2c2622', // ink\n]\n\n/** Stable hash → palette index, so a given slug always maps to one color. */\nexport function monogramColor(key: string): string {\n let hash = 0\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) | 0\n }\n const idx = Math.abs(hash) % CRAYON_PALETTE.length\n return CRAYON_PALETTE[idx] as string\n}\n\n/** Up-to-2-char initials from a display name / abbreviation. */\nexport function monogramInitials(name: string, abbreviation?: string): string {\n const base = (abbreviation || name).trim()\n if (!base) return '?'\n // If an abbreviation is given, use its first 2 chars verbatim (e.g. \"K8\", \"EH\").\n if (abbreviation) return abbreviation.slice(0, 2).toUpperCase()\n const words = base\n .replace(/[^A-Za-z0-9 ]/g, '')\n .split(/\\s+/)\n .filter(Boolean)\n if (words.length >= 2) {\n return (words[0]![0]! + words[1]![0]!).toUpperCase()\n }\n return base.slice(0, 2).toUpperCase()\n}\n"],"names":[],"mappings":"AAKA,MAAM,iBAAiB;AAAA,EACrB;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAGO,SAAS,cAAc,KAAqB;AACjD,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,WAAQ,OAAO,KAAK,IAAI,WAAW,CAAC,IAAK;AAAA,EAC3C;AACA,QAAM,MAAM,KAAK,IAAI,IAAI,IAAI,eAAe;AAC5C,SAAO,eAAe,GAAG;AAC3B;AAGO,SAAS,iBAAiB,MAAc,cAA+B;AAC5E,QAAM,QAAQ,gBAAgB,MAAM,KAAA;AACpC,MAAI,CAAC,KAAM,QAAO;AAElB,MAAI,aAAc,QAAO,aAAa,MAAM,GAAG,CAAC,EAAE,YAAA;AAClD,QAAM,QAAQ,KACX,QAAQ,kBAAkB,EAAE,EAC5B,MAAM,KAAK,EACX,OAAO,OAAO;AACjB,MAAI,MAAM,UAAU,GAAG;AACrB,YAAQ,MAAM,CAAC,EAAG,CAAC,IAAK,MAAM,CAAC,EAAG,CAAC,GAAI,YAAA;AAAA,EACzC;AACA,SAAO,KAAK,MAAM,GAAG,CAAC,EAAE,YAAA;AAC1B;"}
@@ -12,6 +12,8 @@ import { OnboardingCard } from "../components/OnboardingCard.js";
12
12
  import { useAppCatalogFilters } from "../context/AppCatalogFiltersContext.js";
13
13
  import { FilterBar } from "../filters/FilterBar.js";
14
14
  import { AppCatalogGrid } from "../grid/AppCatalogGrid.js";
15
+ import { LauncherHome } from "../launcher/LauncherHome.js";
16
+ import { LauncherDetailPanel } from "../launcher/LauncherDetailPanel.js";
15
17
  function AppCatalogPage({
16
18
  selectedSlug
17
19
  } = {}) {
@@ -88,19 +90,17 @@ function AppCatalogPage({
88
90
  topAppSlugs,
89
91
  searchValue: deferredSearchValue
90
92
  });
93
+ const legacyGridActive = filterState.recentMode || Object.keys(filterState.tagFilters).length > 0;
91
94
  useEffect(() => {
92
- if (filteredApps.length === 1 && filteredApps[0] && !selectedAppSlug) {
95
+ if (legacyGridActive && filteredApps.length === 1 && filteredApps[0] && !selectedAppSlug) {
93
96
  void navigate({
94
97
  to: "/app/$slug",
95
98
  params: { slug: filteredApps[0].slug },
96
- search: (prev) => ({
97
- ...prev,
98
- q: searchValue === "" ? void 0 : searchValue
99
- }),
99
+ search: (prev) => prev,
100
100
  replace: true
101
101
  });
102
102
  }
103
- }, [filteredApps, selectedAppSlug, navigate, searchValue]);
103
+ }, [legacyGridActive, filteredApps, selectedAppSlug, navigate]);
104
104
  useEffect(() => {
105
105
  if (!selectedAppSlug || resources.length === 0) return;
106
106
  const canonical = resources.some((r) => r.slug === selectedAppSlug);
@@ -125,6 +125,14 @@ function AppCatalogPage({
125
125
  search: (prev) => prev
126
126
  });
127
127
  };
128
+ const handleLaunch = (app) => {
129
+ if (app.appUrl) window.open(app.appUrl, "_blank", "noopener,noreferrer");
130
+ };
131
+ const showLauncherHome = !filterState.recentMode && Object.keys(filterState.tagFilters).length === 0;
132
+ const launcherSelectedApp = useMemo(
133
+ () => selectedAppSlug ? resources.find((r) => r.slug === selectedAppSlug) ?? null : null,
134
+ [selectedAppSlug, resources]
135
+ );
128
136
  const handleClearFilters = () => {
129
137
  setSearchValue("");
130
138
  actions.clearAllFilters();
@@ -141,6 +149,32 @@ function AppCatalogPage({
141
149
  return /* @__PURE__ */ jsx("div", { className: "py-6 text-muted-foreground", children: "Loading…" });
142
150
  }
143
151
  const groupingDefinition = tagsDefinitions[0];
152
+ if (showLauncherHome) {
153
+ return /* @__PURE__ */ jsxs("div", { className: "flex-1 min-h-0 overflow-y-auto", children: [
154
+ /* @__PURE__ */ jsx(
155
+ LauncherHome,
156
+ {
157
+ apps: rootResources.filter(
158
+ (a) => filterState.showDeprecated || !a.deprecated
159
+ ),
160
+ allResources: resources,
161
+ searchValue,
162
+ onSearchChange: setSearchValue,
163
+ onAppClick: handleAppClick,
164
+ onLaunch: handleLaunch,
165
+ totalCount: totalAppsCount
166
+ }
167
+ ),
168
+ launcherSelectedApp && /* @__PURE__ */ jsx(
169
+ LauncherDetailPanel,
170
+ {
171
+ app: launcherSelectedApp,
172
+ onClose: () => void navigate({ to: "/" }),
173
+ onAppClick: handleAppClick
174
+ }
175
+ )
176
+ ] });
177
+ }
144
178
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 min-h-0", children: [
145
179
  /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(OnboardingCard, {}) }),
146
180
  /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(