@igstack/app-catalog-frontend-core 0.4.0-alpha-20260807030804 → 0.4.0-alpha-20260807033203

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.
@@ -6,6 +6,8 @@ export declare class CatalogTools {
6
6
  private user;
7
7
  /**
8
8
  * Click an app row by display name.
9
+ * Works against both the table/grid view and the launcher home (#38), which
10
+ * renders app rows as buttons rather than a <table>.
9
11
  * Throws with list of visible apps if name not found.
10
12
  */
11
13
  openApp(name: string): Promise<void>;
@@ -39,6 +41,13 @@ export declare class CatalogTools {
39
41
  * Whether the onboarding/welcome card is visible.
40
42
  */
41
43
  isOnboardingVisible(): boolean;
44
+ /**
45
+ * Read app rows from the launcher home (#38): buttons titled "View <name>".
46
+ * Name is the first `.font-semibold`/`.font-bold` span; description the
47
+ * `.text-muted-foreground` span. Deduped by name (an app can appear both in
48
+ * "Your apps" and "Browse all").
49
+ */
50
+ private getLauncherRows;
42
51
  /**
43
52
  * Get the main catalog table (first table on page, skipping sub-resource tables in detail panel).
44
53
  */
@@ -0,0 +1,12 @@
1
+ import { Resource } from '@igstack/app-catalog-backend-core';
2
+ export interface LauncherHomeProps {
3
+ /** All root (non-child) resources, already filtered for deprecated per settings. */
4
+ apps: Resource[];
5
+ searchValue: string;
6
+ onSearchChange: (v: string) => void;
7
+ onAppClick: (app: Resource) => void;
8
+ onLaunch: (app: Resource) => void;
9
+ /** Total resource count for the "Browse all" label. */
10
+ totalCount: number;
11
+ }
12
+ export declare function LauncherHome({ apps, searchValue, onSearchChange, onAppClick, onLaunch, totalCount, }: LauncherHomeProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,208 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Search, ArrowUpRight } from "lucide-react";
3
+ import { useState, useEffect, useMemo } 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 { ResourceIcon } from "./ResourceIcon.js";
8
+ const typeLabel = (t) => {
9
+ if (!t || t === "application") return "App";
10
+ return t.charAt(0).toUpperCase() + t.slice(1);
11
+ };
12
+ function LaunchButton({
13
+ app,
14
+ onLaunch,
15
+ className
16
+ }) {
17
+ if (!app.appUrl) return null;
18
+ return /* @__PURE__ */ jsx(
19
+ "a",
20
+ {
21
+ href: app.appUrl,
22
+ target: "_blank",
23
+ rel: "noopener noreferrer",
24
+ title: `Open ${app.displayName} in a new tab`,
25
+ "aria-label": `Open ${app.displayName} in a new tab`,
26
+ onClick: (e) => {
27
+ e.stopPropagation();
28
+ onLaunch(app);
29
+ },
30
+ className: cn(
31
+ "grid place-items-center rounded-full border border-border bg-card text-muted-foreground",
32
+ "hover:bg-primary hover:text-primary-foreground hover:border-primary transition-colors",
33
+ className
34
+ ),
35
+ children: /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })
36
+ }
37
+ );
38
+ }
39
+ function SectionHead({
40
+ title,
41
+ count,
42
+ action
43
+ }) {
44
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 mb-4", children: [
45
+ /* @__PURE__ */ jsx("h2", { className: "font-serif font-semibold text-[15px] tracking-tight m-0", children: title }),
46
+ count && /* @__PURE__ */ jsx("span", { className: "text-[13px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5", children: count }),
47
+ action && /* @__PURE__ */ jsx("div", { className: "ml-auto", children: action })
48
+ ] });
49
+ }
50
+ function ResourceRow({
51
+ app,
52
+ onAppClick,
53
+ onLaunch,
54
+ showNew = false
55
+ }) {
56
+ return /* @__PURE__ */ jsxs(
57
+ "button",
58
+ {
59
+ type: "button",
60
+ onClick: () => onAppClick(app),
61
+ title: `View ${app.displayName}`,
62
+ className: cn(
63
+ "group flex items-center gap-3.5 w-full text-left",
64
+ "bg-card border border-border rounded-[var(--radius)] px-3.5 py-3",
65
+ "hover:border-ring hover:shadow-sm transition-all"
66
+ ),
67
+ children: [
68
+ /* @__PURE__ */ jsx(ResourceIcon, { app, size: 38 }),
69
+ /* @__PURE__ */ jsxs("span", { className: "flex-1 min-w-0", children: [
70
+ /* @__PURE__ */ jsx("span", { className: "block text-[14.5px] font-semibold truncate", children: app.displayName }),
71
+ app.description && /* @__PURE__ */ jsx("span", { className: "block text-[13px] text-muted-foreground truncate", children: markdownToPlainText(app.description) })
72
+ ] }),
73
+ showNew && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-bold text-[#65a443] bg-[#65a443]/12 rounded-full px-2.5 py-0.5", children: "New" }),
74
+ /* @__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) }),
75
+ /* @__PURE__ */ jsx(LaunchButton, { app, onLaunch, className: "size-8" })
76
+ ]
77
+ }
78
+ );
79
+ }
80
+ function LauncherHome({
81
+ apps,
82
+ searchValue,
83
+ onSearchChange,
84
+ onAppClick,
85
+ onLaunch,
86
+ totalCount
87
+ }) {
88
+ const { getTopApps } = useAppClickHistory();
89
+ const [topSlugs, setTopSlugs] = useState([]);
90
+ useEffect(() => {
91
+ void getTopApps(5).then(setTopSlugs);
92
+ }, [getTopApps]);
93
+ const bySlug = useMemo(() => {
94
+ const m = /* @__PURE__ */ new Map();
95
+ for (const a of apps) m.set(a.slug, a);
96
+ return m;
97
+ }, [apps]);
98
+ const frequent = useMemo(
99
+ () => topSlugs.map((s) => bySlug.get(s)).filter((a) => Boolean(a)).slice(0, 5),
100
+ [topSlugs, bySlug]
101
+ );
102
+ const fresh = useMemo(() => {
103
+ const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1e3;
104
+ return apps.filter((a) => {
105
+ var _a;
106
+ const t = (_a = a.freshness) == null ? void 0 : _a.lastCheckedAt;
107
+ return t ? new Date(t).getTime() >= weekAgo : false;
108
+ }).sort((a, b) => {
109
+ var _a, _b;
110
+ const ta = new Date(((_a = a.freshness) == null ? void 0 : _a.lastCheckedAt) ?? 0).getTime();
111
+ const tb = new Date(((_b = b.freshness) == null ? void 0 : _b.lastCheckedAt) ?? 0).getTime();
112
+ return tb - ta;
113
+ }).slice(0, 6);
114
+ }, [apps]);
115
+ const browse = useMemo(() => {
116
+ const promoted = new Set(frequent.map((a) => a.slug));
117
+ return [...apps].filter((a) => !promoted.has(a.slug)).sort((a, b) => a.displayName.localeCompare(b.displayName));
118
+ }, [apps, frequent]);
119
+ const browseLeft = browse.filter((_, i) => i % 2 === 0);
120
+ const browseRight = browse.filter((_, i) => i % 2 === 1);
121
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-[1000px] pb-24", children: [
122
+ /* @__PURE__ */ jsxs("div", { className: "text-center pt-10 pb-1.5", children: [
123
+ /* @__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?" }),
124
+ /* @__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." }),
125
+ /* @__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: [
126
+ /* @__PURE__ */ jsx(Search, { className: "size-5 shrink-0 text-muted-foreground" }),
127
+ /* @__PURE__ */ jsx(
128
+ "input",
129
+ {
130
+ type: "text",
131
+ value: searchValue,
132
+ onChange: (e) => onSearchChange(e.target.value),
133
+ placeholder: "Search apps, databases, cloud accounts, account IDs…",
134
+ autoComplete: "off",
135
+ autoFocus: true,
136
+ "aria-label": "Search apps",
137
+ className: "flex-1 bg-transparent border-0 outline-none text-[16px] text-foreground placeholder:text-muted-foreground"
138
+ }
139
+ )
140
+ ] }) })
141
+ ] }),
142
+ frequent.length > 0 && /* @__PURE__ */ jsxs("section", { className: "mt-9", children: [
143
+ /* @__PURE__ */ jsx(SectionHead, { title: "Your apps", count: "frequent" }),
144
+ /* @__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(
145
+ "button",
146
+ {
147
+ type: "button",
148
+ onClick: () => onAppClick(app),
149
+ title: `View ${app.displayName}`,
150
+ 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",
151
+ children: [
152
+ /* @__PURE__ */ jsx(
153
+ LaunchButton,
154
+ {
155
+ app,
156
+ onLaunch,
157
+ className: "absolute top-2.5 right-2.5 size-[26px] opacity-0 group-hover:opacity-100"
158
+ }
159
+ ),
160
+ /* @__PURE__ */ jsx(ResourceIcon, { app, size: 46, className: "mx-auto mb-3" }),
161
+ /* @__PURE__ */ jsx("span", { className: "block text-[13.5px] font-bold truncate", children: app.displayName })
162
+ ]
163
+ },
164
+ app.slug
165
+ )) })
166
+ ] }),
167
+ fresh.length > 0 && /* @__PURE__ */ jsxs("section", { className: "mt-9", children: [
168
+ /* @__PURE__ */ jsx(SectionHead, { title: "New this week", count: `${fresh.length} added` }),
169
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: fresh.map((app) => /* @__PURE__ */ jsx(
170
+ ResourceRow,
171
+ {
172
+ app,
173
+ onAppClick,
174
+ onLaunch,
175
+ showNew: true
176
+ },
177
+ app.slug
178
+ )) })
179
+ ] }),
180
+ /* @__PURE__ */ jsxs("section", { className: "mt-9", children: [
181
+ /* @__PURE__ */ jsx(SectionHead, { title: "Browse all", count: `${totalCount} resources` }),
182
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2", children: [
183
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: browseLeft.map((app) => /* @__PURE__ */ jsx(
184
+ ResourceRow,
185
+ {
186
+ app,
187
+ onAppClick,
188
+ onLaunch
189
+ },
190
+ app.slug
191
+ )) }),
192
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: browseRight.map((app) => /* @__PURE__ */ jsx(
193
+ ResourceRow,
194
+ {
195
+ app,
196
+ onAppClick,
197
+ onLaunch
198
+ },
199
+ app.slug
200
+ )) })
201
+ ] })
202
+ ] })
203
+ ] });
204
+ }
205
+ export {
206
+ LauncherHome
207
+ };
208
+ //# 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, useState } from 'react'\nimport { cn } from '~/lib/utils'\nimport { useAppClickHistory } from '../../hooks/useAppClickHistory'\nimport { markdownToPlainText } from '../../utils/markdownToPlainText'\nimport { ResourceIcon } from './ResourceIcon'\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\nconst typeLabel = (t?: string): string => {\n if (!t || t === 'application') return 'App'\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 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 return (\n <a\n href={app.appUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={`Open ${app.displayName} in a new tab`}\n aria-label={`Open ${app.displayName} in a new tab`}\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 <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 <LaunchButton app={app} onLaunch={onLaunch} className=\"size-8\" />\n </button>\n )\n}\n\nexport function LauncherHome({\n apps,\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 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 aria-label=\"Search apps\"\n className=\"flex-1 bg-transparent border-0 outline-none text-[16px] text-foreground placeholder:text-muted-foreground\"\n />\n </div>\n </div>\n </div>\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 app={app} size={46} className=\"mx-auto mb-3\" />\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 title=\"New this week\" count={`${fresh.length} added`} />\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 </div>\n </div>\n </section>\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;AAiBA,MAAM,YAAY,CAAC,MAAuB;AACxC,MAAI,CAAC,KAAK,MAAM,cAAe,QAAO;AACtC,SAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC;AAC9C;AAaA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,MAAI,CAAC,IAAI,OAAQ,QAAO;AACxB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM,IAAI;AAAA,MACV,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,OAAO,QAAQ,IAAI,WAAW;AAAA,MAC9B,cAAY,QAAQ,IAAI,WAAW;AAAA,MACnC,SAAS,CAAC,MAAM;AACd,UAAE,gBAAA;AACF,iBAAS,GAAG;AAAA,MACd;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA,oBAAC,cAAA,EAAa,WAAU,WAAA,CAAW;AAAA,IAAA;AAAA,EAAA;AAGzC;AAEA,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SACE,qBAAC,OAAA,EAAI,WAAU,kCACb,UAAA;AAAA,IAAA,oBAAC,MAAA,EAAG,WAAU,2DACX,UAAA,OACH;AAAA,IACC,SACC,oBAAC,QAAA,EAAK,WAAU,yE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;AAAA,UAAA;AAAA,QAAA;AAAA,QAbK,IAAI;AAAA,MAAA,CAeZ,EAAA,CACH;AAAA,IAAA,GACF;AAAA,IAID,MAAM,SAAS,KACd,qBAAC,WAAA,EAAQ,WAAU,QACjB,UAAA;AAAA,MAAA,oBAAC,eAAY,OAAM,iBAAgB,OAAO,GAAG,MAAM,MAAM,UAAU;AAAA,0BAClE,OAAA,EAAI,WAAU,uBACZ,UAAA,MAAM,IAAI,CAAC,QACV;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC;AAAA,UACA;AAAA,UACA;AAAA,UACA,SAAO;AAAA,QAAA;AAAA,QAJF,IAAI;AAAA,MAAA,CAMZ,EAAA,CACH;AAAA,IAAA,GACF;AAAA,IAIF,qBAAC,WAAA,EAAQ,WAAU,QACjB,UAAA;AAAA,MAAA,oBAAC,eAAY,OAAM,cAAa,OAAO,GAAG,UAAU,cAAc;AAAA,MAClE,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,QAAA,oBAAC,SAAI,WAAU,uBACZ,UAAA,WAAW,IAAI,CAAC,QACf;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAHK,IAAI;AAAA,QAAA,CAKZ,GACH;AAAA,4BACC,OAAA,EAAI,WAAU,uBACZ,UAAA,YAAY,IAAI,CAAC,QAChB;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAHK,IAAI;AAAA,QAAA,CAKZ,EAAA,CACH;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;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,7 @@ 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";
15
16
  function AppCatalogPage({
16
17
  selectedSlug
17
18
  } = {}) {
@@ -122,6 +123,10 @@ function AppCatalogPage({
122
123
  search: (prev) => prev
123
124
  });
124
125
  };
126
+ const handleLaunch = (app) => {
127
+ if (app.appUrl) window.open(app.appUrl, "_blank", "noopener,noreferrer");
128
+ };
129
+ const showLauncherHome = !selectedAppSlug && deferredSearchValue.trim() === "" && !filterState.recentMode && Object.keys(filterState.tagFilters).length === 0;
125
130
  const handleClearFilters = () => {
126
131
  setSearchValue("");
127
132
  actions.clearAllFilters();
@@ -138,6 +143,21 @@ function AppCatalogPage({
138
143
  return /* @__PURE__ */ jsx("div", { className: "py-6 text-muted-foreground", children: "Loading…" });
139
144
  }
140
145
  const groupingDefinition = tagsDefinitions[0];
146
+ if (showLauncherHome) {
147
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ jsx(
148
+ LauncherHome,
149
+ {
150
+ apps: rootResources.filter(
151
+ (a) => filterState.showDeprecated || !a.deprecated
152
+ ),
153
+ searchValue,
154
+ onSearchChange: setSearchValue,
155
+ onAppClick: handleAppClick,
156
+ onLaunch: handleLaunch,
157
+ totalCount: totalAppsCount
158
+ }
159
+ ) });
160
+ }
141
161
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 min-h-0", children: [
142
162
  /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(OnboardingCard, {}) }),
143
163
  /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"AppCatalogPage.js","sources":["../../../../../../src/modules/appCatalog/ui/pages/AppCatalogPage.tsx"],"sourcesContent":["import type { Resource } from '@igstack/app-catalog-backend-core'\nimport { useNavigate } from '@tanstack/react-router'\nimport { X } from 'lucide-react'\nimport { useDeferredValue, useEffect, useMemo, useState } from 'react'\nimport { Button } from '~/ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '~/ui/empty'\nimport { useAppCatalogContext } from '../../context/AppCatalogContext'\nimport { useAppClickHistory } from '../../hooks/useAppClickHistory'\nimport { useAppCounts } from '../../hooks/useAppCounts'\nimport { searchResources } from '../../utils/searchApps'\nimport { OnboardingCard } from '../components/OnboardingCard'\nimport { useAppCatalogFilters } from '../context/AppCatalogFiltersContext'\nimport { FilterBar } from '../filters/FilterBar'\nimport { AppCatalogGrid } from '../grid/AppCatalogGrid'\n\nexport function AppCatalogPage({\n selectedSlug,\n}: { selectedSlug?: string } = {}) {\n const { resources, isLoadingApps, tagsDefinitions } = useAppCatalogContext()\n const { state: filterState, actions } = useAppCatalogFilters()\n const { getTopApps } = useAppClickHistory()\n const navigate = useNavigate()\n\n // Selected app comes from the route path (/app/<slug>); undefined = nothing open\n const selectedAppSlug = selectedSlug\n\n // Search value from context (URL-synced in AppCatalogFiltersContext)\n const searchValue = filterState.searchValue\n const setSearchValue = actions.setSearchValue\n\n // Defer the search value used for filtering to avoid blocking the input\n const deferredSearchValue = useDeferredValue(searchValue)\n\n // State for top apps (loaded async)\n const [topAppSlugs, setTopAppSlugs] = useState<string[]>([])\n\n // Load top apps on mount to calculate recent count\n useEffect(() => {\n void getTopApps(10).then(setTopAppSlugs)\n }, [getTopApps])\n\n // Get root resources for filtering (children handled internally by searchResources)\n const rootResources = useMemo(\n () => resources.filter((r) => !r.parentSlug),\n [resources],\n )\n\n // Dev-only skew warning: data arrived (resources > 0) but nothing is top-level\n // (rootResources === 0). That fingerprints a frontend/backend-core version skew\n // or a stale service worker — NOT a normal empty search/filter (those still have\n // rootResources). Guarded to dev so prod users never see it.\n useEffect(() => {\n if (\n import.meta.env.DEV &&\n !isLoadingApps &&\n resources.length > 0 &&\n rootResources.length === 0\n ) {\n console.warn(\n `[app-catalog] Loaded ${resources.length} resources but 0 are top-level — ` +\n `likely a frontend/backend-core version skew or a stale service worker. ` +\n `Check the version footer (be X / fe Y) and hard-reload.`,\n )\n }\n }, [isLoadingApps, resources.length, rootResources.length])\n\n const { filteredApps, didDeprecatedFallback } = useMemo(() => {\n const childResources = resources.filter((r) => r.parentSlug)\n\n // Apply recent mode / tag filters / search over a base set of root apps.\n const runPipeline = (base: typeof rootResources) => {\n let result = base\n\n // Apply recent mode or tag filters\n if (filterState.recentMode) {\n // Filter to top 10 most clicked apps\n result = result.filter((app) => topAppSlugs.includes(app.slug))\n } else if (Object.keys(filterState.tagFilters).length > 0) {\n // Apply tag filters (AND condition)\n result = result.filter((app) => {\n return Object.entries(filterState.tagFilters).every(\n ([prefix, value]) => {\n const fullTag = `${prefix}:${value}`\n return app.tags?.some(\n (tag) => tag.toLowerCase() === fullTag.toLowerCase(),\n )\n },\n )\n })\n }\n\n // Apply search (using deferred value). Pass all resources so children\n // contribute to parent scoring.\n return searchResources(\n [...result, ...childResources],\n deferredSearchValue,\n )\n }\n\n // Matches among non-deprecated (\"active\") apps only.\n const activeMatches = runPipeline(\n rootResources.filter((app) => !app.deprecated),\n )\n\n // #11: derive the fallback purely from the data (not the toggle), so it\n // stays stable after the toggle auto-enables below — otherwise the notice\n // would flicker off as soon as showDeprecated flips to true.\n // Fallback applies when there's a query, no active matches, but deprecated\n // apps DO match.\n const hasQuery = deferredSearchValue.trim() !== ''\n if (hasQuery && activeMatches.length === 0) {\n const allMatches = runPipeline(rootResources)\n if (allMatches.length > 0) {\n return { filteredApps: allMatches, didDeprecatedFallback: true }\n }\n }\n\n // Normal display: include deprecated only when the toggle is on.\n const result = filterState.showDeprecated\n ? runPipeline(rootResources)\n : activeMatches\n return { filteredApps: result, didDeprecatedFallback: false }\n }, [\n rootResources,\n resources,\n deferredSearchValue,\n filterState.recentMode,\n filterState.tagFilters,\n filterState.showDeprecated,\n topAppSlugs,\n ])\n\n // #11: when the search fell back to deprecated results, enable the\n // \"Show Deprecated Apps\" toggle so the state is visible and consistent.\n // Runs as an effect (not in render) to avoid a side effect during useMemo.\n useEffect(() => {\n if (didDeprecatedFallback && !filterState.showDeprecated) {\n actions.setShowDeprecated(true)\n }\n }, [didDeprecatedFallback, filterState.showDeprecated, actions])\n\n // Calculate counts for FilterBar\n const { allCount, recentCount, deprecatedCount } = useAppCounts({\n apps: rootResources,\n topAppSlugs,\n searchValue: deferredSearchValue,\n })\n\n // Auto-open details when only 1 result. The search value persists in\n // sessionStorage (see AppCatalogFiltersContext), so it survives this route\n // change and the provider's remount on its own — we no longer carry it into\n // the URL as `q` (#27, replacing the #10 URL workaround). Preserve any other\n // (still-URL-synced) filter params via `(prev) => prev`.\n useEffect(() => {\n if (filteredApps.length === 1 && filteredApps[0] && !selectedAppSlug) {\n void navigate({\n to: '/app/$slug',\n params: { slug: filteredApps[0].slug },\n search: (prev) => prev,\n replace: true,\n })\n }\n }, [filteredApps, selectedAppSlug, navigate])\n\n // #22: alias → canonical redirect. When an app is renamed its old slug is\n // kept in `aliases[]`. If the URL slug matches no canonical slug but does\n // match some app's alias, redirect (replace) to that app's canonical slug so\n // old bookmarks resolve instead of showing a blank catalog. Guard on a real\n // canonical miss so we never fight the normal detail-open path. Note: this is\n // a client-side SPA redirect (replace), not an HTTP 301 — see ig-umbrella#22.\n useEffect(() => {\n if (!selectedAppSlug || resources.length === 0) return\n const canonical = resources.some((r) => r.slug === selectedAppSlug)\n if (canonical) return\n const aliased = resources.find((r) => r.aliases?.includes(selectedAppSlug))\n if (aliased) {\n void navigate({\n to: '/app/$slug',\n params: { slug: aliased.slug },\n search: (prev) => prev,\n replace: true,\n })\n }\n }, [selectedAppSlug, resources, navigate])\n\n const handleAppClick = (app: Resource) => {\n void navigate({\n to: '/app/$slug',\n params: { slug: app.slug },\n search: (prev) => prev,\n })\n }\n\n const handleClearFilters = () => {\n setSearchValue('')\n actions.clearAllFilters()\n void navigate({ to: '/' })\n }\n\n // Calculate total apps count (respecting showDeprecated setting)\n const totalAppsCount = useMemo(() => {\n let count = rootResources.length\n if (!filterState.showDeprecated) {\n count = rootResources.filter((app) => !app.deprecated).length\n }\n return count\n }, [rootResources, filterState.showDeprecated])\n\n if (isLoadingApps) {\n return <div className=\"py-6 text-muted-foreground\">Loading…</div>\n }\n\n // Use first tag definition for grouping\n const groupingDefinition = tagsDefinitions[0]\n\n return (\n <div className=\"flex flex-col flex-1 min-h-0\">\n <div className=\"shrink-0\">\n <OnboardingCard />\n </div>\n\n <div className=\"shrink-0\">\n <FilterBar\n totalCount={allCount}\n recentCount={recentCount}\n deprecatedCount={deprecatedCount}\n apps={rootResources}\n />\n </div>\n\n {didDeprecatedFallback && (\n <div\n role=\"status\"\n className=\"shrink-0 px-1 pb-2 text-sm text-muted-foreground\"\n >\n {`No active apps${\n searchValue ? ` for \"${searchValue}\"` : ''\n } — showing deprecated matches.`}\n </div>\n )}\n\n <div className=\"flex-1 min-h-0\">\n {filteredApps.length === 0 && !selectedAppSlug ? (\n <Empty>\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n <X className=\"h-6 w-6\" />\n </EmptyMedia>\n <EmptyTitle>\n No apps found{searchValue && ` for \"${searchValue}\"`}\n </EmptyTitle>\n <EmptyDescription>\n Try adjusting your search or filters\n </EmptyDescription>\n </EmptyHeader>\n <EmptyContent>\n {searchValue && (\n <Button\n variant=\"outline\"\n onClick={() => {\n setSearchValue('')\n void navigate({ to: '/' })\n }}\n className=\"gap-2\"\n >\n <X className=\"h-4 w-4\" />\n Clear search\n </Button>\n )}\n </EmptyContent>\n </Empty>\n ) : (\n <AppCatalogGrid\n apps={filteredApps}\n selectedAppSlug={selectedAppSlug}\n groupingDefinition={groupingDefinition}\n onAppClick={handleAppClick}\n onClosePanel={() => void navigate({ to: '/' })}\n hasSearch={!!deferredSearchValue}\n searchQuery={deferredSearchValue}\n totalAppsCount={totalAppsCount}\n onClearFilters={handleClearFilters}\n />\n )}\n </div>\n </div>\n )\n}\n"],"names":["result"],"mappings":";;;;;;;;;;;;;;AAsBO,SAAS,eAAe;AAAA,EAC7B;AACF,IAA+B,IAAI;AACjC,QAAM,EAAE,WAAW,eAAe,gBAAA,IAAoB,qBAAA;AACtD,QAAM,EAAE,OAAO,aAAa,QAAA,IAAY,qBAAA;AACxC,QAAM,EAAE,WAAA,IAAe,mBAAA;AACvB,QAAM,WAAW,YAAA;AAGjB,QAAM,kBAAkB;AAGxB,QAAM,cAAc,YAAY;AAChC,QAAM,iBAAiB,QAAQ;AAG/B,QAAM,sBAAsB,iBAAiB,WAAW;AAGxD,QAAM,CAAC,aAAa,cAAc,IAAI,SAAmB,CAAA,CAAE;AAG3D,YAAU,MAAM;AACd,SAAK,WAAW,EAAE,EAAE,KAAK,cAAc;AAAA,EACzC,GAAG,CAAC,UAAU,CAAC;AAGf,QAAM,gBAAgB;AAAA,IACpB,MAAM,UAAU,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU;AAAA,IAC3C,CAAC,SAAS;AAAA,EAAA;AAOZ,YAAU,MAAM;AAAA,EAahB,GAAG,CAAC,eAAe,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;AAAA,QACA,oBAAC,oBAAiB,UAAA,wCAElB;AAAA,MAAA,GACF;AAAA,MACA,oBAAC,gBACE,UAAA,eACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,2BAAe,EAAE;AACjB,iBAAK,SAAS,EAAE,IAAI,KAAK;AAAA,UAC3B;AAAA,UACA,WAAU;AAAA,UAEV,UAAA;AAAA,YAAA,oBAAC,GAAA,EAAE,WAAU,WAAU;AAAA,YAAE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,GAI/B;AAAA,IAAA,EAAA,CACF,IAEA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,cAAc,MAAM,KAAK,SAAS,EAAE,IAAI,KAAK;AAAA,QAC7C,WAAW,CAAC,CAAC;AAAA,QACb,aAAa;AAAA,QACb;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAGtB;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"AppCatalogPage.js","sources":["../../../../../../src/modules/appCatalog/ui/pages/AppCatalogPage.tsx"],"sourcesContent":["import type { Resource } from '@igstack/app-catalog-backend-core'\nimport { useNavigate } from '@tanstack/react-router'\nimport { X } from 'lucide-react'\nimport { useDeferredValue, useEffect, useMemo, useState } from 'react'\nimport { Button } from '~/ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '~/ui/empty'\nimport { useAppCatalogContext } from '../../context/AppCatalogContext'\nimport { useAppClickHistory } from '../../hooks/useAppClickHistory'\nimport { useAppCounts } from '../../hooks/useAppCounts'\nimport { searchResources } from '../../utils/searchApps'\nimport { OnboardingCard } from '../components/OnboardingCard'\nimport { useAppCatalogFilters } from '../context/AppCatalogFiltersContext'\nimport { FilterBar } from '../filters/FilterBar'\nimport { AppCatalogGrid } from '../grid/AppCatalogGrid'\nimport { LauncherHome } from '../launcher/LauncherHome'\n\nexport function AppCatalogPage({\n selectedSlug,\n}: { selectedSlug?: string } = {}) {\n const { resources, isLoadingApps, tagsDefinitions } = useAppCatalogContext()\n const { state: filterState, actions } = useAppCatalogFilters()\n const { getTopApps } = useAppClickHistory()\n const navigate = useNavigate()\n\n // Selected app comes from the route path (/app/<slug>); undefined = nothing open\n const selectedAppSlug = selectedSlug\n\n // Search value from context (URL-synced in AppCatalogFiltersContext)\n const searchValue = filterState.searchValue\n const setSearchValue = actions.setSearchValue\n\n // Defer the search value used for filtering to avoid blocking the input\n const deferredSearchValue = useDeferredValue(searchValue)\n\n // State for top apps (loaded async)\n const [topAppSlugs, setTopAppSlugs] = useState<string[]>([])\n\n // Load top apps on mount to calculate recent count\n useEffect(() => {\n void getTopApps(10).then(setTopAppSlugs)\n }, [getTopApps])\n\n // Get root resources for filtering (children handled internally by searchResources)\n const rootResources = useMemo(\n () => resources.filter((r) => !r.parentSlug),\n [resources],\n )\n\n // Dev-only skew warning: data arrived (resources > 0) but nothing is top-level\n // (rootResources === 0). That fingerprints a frontend/backend-core version skew\n // or a stale service worker — NOT a normal empty search/filter (those still have\n // rootResources). Guarded to dev so prod users never see it.\n useEffect(() => {\n if (\n import.meta.env.DEV &&\n !isLoadingApps &&\n resources.length > 0 &&\n rootResources.length === 0\n ) {\n console.warn(\n `[app-catalog] Loaded ${resources.length} resources but 0 are top-level — ` +\n `likely a frontend/backend-core version skew or a stale service worker. ` +\n `Check the version footer (be X / fe Y) and hard-reload.`,\n )\n }\n }, [isLoadingApps, resources.length, rootResources.length])\n\n const { filteredApps, didDeprecatedFallback } = useMemo(() => {\n const childResources = resources.filter((r) => r.parentSlug)\n\n // Apply recent mode / tag filters / search over a base set of root apps.\n const runPipeline = (base: typeof rootResources) => {\n let result = base\n\n // Apply recent mode or tag filters\n if (filterState.recentMode) {\n // Filter to top 10 most clicked apps\n result = result.filter((app) => topAppSlugs.includes(app.slug))\n } else if (Object.keys(filterState.tagFilters).length > 0) {\n // Apply tag filters (AND condition)\n result = result.filter((app) => {\n return Object.entries(filterState.tagFilters).every(\n ([prefix, value]) => {\n const fullTag = `${prefix}:${value}`\n return app.tags?.some(\n (tag) => tag.toLowerCase() === fullTag.toLowerCase(),\n )\n },\n )\n })\n }\n\n // Apply search (using deferred value). Pass all resources so children\n // contribute to parent scoring.\n return searchResources(\n [...result, ...childResources],\n deferredSearchValue,\n )\n }\n\n // Matches among non-deprecated (\"active\") apps only.\n const activeMatches = runPipeline(\n rootResources.filter((app) => !app.deprecated),\n )\n\n // #11: derive the fallback purely from the data (not the toggle), so it\n // stays stable after the toggle auto-enables below — otherwise the notice\n // would flicker off as soon as showDeprecated flips to true.\n // Fallback applies when there's a query, no active matches, but deprecated\n // apps DO match.\n const hasQuery = deferredSearchValue.trim() !== ''\n if (hasQuery && activeMatches.length === 0) {\n const allMatches = runPipeline(rootResources)\n if (allMatches.length > 0) {\n return { filteredApps: allMatches, didDeprecatedFallback: true }\n }\n }\n\n // Normal display: include deprecated only when the toggle is on.\n const result = filterState.showDeprecated\n ? runPipeline(rootResources)\n : activeMatches\n return { filteredApps: result, didDeprecatedFallback: false }\n }, [\n rootResources,\n resources,\n deferredSearchValue,\n filterState.recentMode,\n filterState.tagFilters,\n filterState.showDeprecated,\n topAppSlugs,\n ])\n\n // #11: when the search fell back to deprecated results, enable the\n // \"Show Deprecated Apps\" toggle so the state is visible and consistent.\n // Runs as an effect (not in render) to avoid a side effect during useMemo.\n useEffect(() => {\n if (didDeprecatedFallback && !filterState.showDeprecated) {\n actions.setShowDeprecated(true)\n }\n }, [didDeprecatedFallback, filterState.showDeprecated, actions])\n\n // Calculate counts for FilterBar\n const { allCount, recentCount, deprecatedCount } = useAppCounts({\n apps: rootResources,\n topAppSlugs,\n searchValue: deferredSearchValue,\n })\n\n // Auto-open details when only 1 result. The search value persists in\n // sessionStorage (see AppCatalogFiltersContext), so it survives this route\n // change and the provider's remount on its own — we no longer carry it into\n // the URL as `q` (#27, replacing the #10 URL workaround). Preserve any other\n // (still-URL-synced) filter params via `(prev) => prev`.\n useEffect(() => {\n if (filteredApps.length === 1 && filteredApps[0] && !selectedAppSlug) {\n void navigate({\n to: '/app/$slug',\n params: { slug: filteredApps[0].slug },\n search: (prev) => prev,\n replace: true,\n })\n }\n }, [filteredApps, selectedAppSlug, navigate])\n\n // #22: alias → canonical redirect. When an app is renamed its old slug is\n // kept in `aliases[]`. If the URL slug matches no canonical slug but does\n // match some app's alias, redirect (replace) to that app's canonical slug so\n // old bookmarks resolve instead of showing a blank catalog. Guard on a real\n // canonical miss so we never fight the normal detail-open path. Note: this is\n // a client-side SPA redirect (replace), not an HTTP 301 — see ig-umbrella#22.\n useEffect(() => {\n if (!selectedAppSlug || resources.length === 0) return\n const canonical = resources.some((r) => r.slug === selectedAppSlug)\n if (canonical) return\n const aliased = resources.find((r) => r.aliases?.includes(selectedAppSlug))\n if (aliased) {\n void navigate({\n to: '/app/$slug',\n params: { slug: aliased.slug },\n search: (prev) => prev,\n replace: true,\n })\n }\n }, [selectedAppSlug, resources, navigate])\n\n const handleAppClick = (app: Resource) => {\n void navigate({\n to: '/app/$slug',\n params: { slug: app.slug },\n search: (prev) => prev,\n })\n }\n\n const handleLaunch = (app: Resource) => {\n if (app.appUrl) window.open(app.appUrl, '_blank', 'noopener,noreferrer')\n }\n\n // Adaptive-home launcher (#38): shown on the bare catalog view — no search\n // text, no tag/recent filters, and nothing selected. Search + detail keep the\n // existing grid/panel path so all prior behavior is preserved.\n const showLauncherHome =\n !selectedAppSlug &&\n deferredSearchValue.trim() === '' &&\n !filterState.recentMode &&\n Object.keys(filterState.tagFilters).length === 0\n\n const handleClearFilters = () => {\n setSearchValue('')\n actions.clearAllFilters()\n void navigate({ to: '/' })\n }\n\n // Calculate total apps count (respecting showDeprecated setting)\n const totalAppsCount = useMemo(() => {\n let count = rootResources.length\n if (!filterState.showDeprecated) {\n count = rootResources.filter((app) => !app.deprecated).length\n }\n return count\n }, [rootResources, filterState.showDeprecated])\n\n if (isLoadingApps) {\n return <div className=\"py-6 text-muted-foreground\">Loading…</div>\n }\n\n // Use first tag definition for grouping\n const groupingDefinition = tagsDefinitions[0]\n\n // Adaptive-home launcher view (#38, increment 1): the discovery spine.\n if (showLauncherHome) {\n return (\n <div className=\"flex flex-col flex-1 min-h-0\">\n <LauncherHome\n apps={rootResources.filter(\n (a) => filterState.showDeprecated || !a.deprecated,\n )}\n searchValue={searchValue}\n onSearchChange={setSearchValue}\n onAppClick={handleAppClick}\n onLaunch={handleLaunch}\n totalCount={totalAppsCount}\n />\n </div>\n )\n }\n\n return (\n <div className=\"flex flex-col flex-1 min-h-0\">\n <div className=\"shrink-0\">\n <OnboardingCard />\n </div>\n\n <div className=\"shrink-0\">\n <FilterBar\n totalCount={allCount}\n recentCount={recentCount}\n deprecatedCount={deprecatedCount}\n apps={rootResources}\n />\n </div>\n\n {didDeprecatedFallback && (\n <div\n role=\"status\"\n className=\"shrink-0 px-1 pb-2 text-sm text-muted-foreground\"\n >\n {`No active apps${\n searchValue ? ` for \"${searchValue}\"` : ''\n } — showing deprecated matches.`}\n </div>\n )}\n\n <div className=\"flex-1 min-h-0\">\n {filteredApps.length === 0 && !selectedAppSlug ? (\n <Empty>\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n <X className=\"h-6 w-6\" />\n </EmptyMedia>\n <EmptyTitle>\n No apps found{searchValue && ` for \"${searchValue}\"`}\n </EmptyTitle>\n <EmptyDescription>\n Try adjusting your search or filters\n </EmptyDescription>\n </EmptyHeader>\n <EmptyContent>\n {searchValue && (\n <Button\n variant=\"outline\"\n onClick={() => {\n setSearchValue('')\n void navigate({ to: '/' })\n }}\n className=\"gap-2\"\n >\n <X className=\"h-4 w-4\" />\n Clear search\n </Button>\n )}\n </EmptyContent>\n </Empty>\n ) : (\n <AppCatalogGrid\n apps={filteredApps}\n selectedAppSlug={selectedAppSlug}\n groupingDefinition={groupingDefinition}\n onAppClick={handleAppClick}\n onClosePanel={() => void navigate({ to: '/' })}\n hasSearch={!!deferredSearchValue}\n searchQuery={deferredSearchValue}\n totalAppsCount={totalAppsCount}\n onClearFilters={handleClearFilters}\n />\n )}\n </div>\n </div>\n )\n}\n"],"names":["result"],"mappings":";;;;;;;;;;;;;;;AAuBO,SAAS,eAAe;AAAA,EAC7B;AACF,IAA+B,IAAI;AACjC,QAAM,EAAE,WAAW,eAAe,gBAAA,IAAoB,qBAAA;AACtD,QAAM,EAAE,OAAO,aAAa,QAAA,IAAY,qBAAA;AACxC,QAAM,EAAE,WAAA,IAAe,mBAAA;AACvB,QAAM,WAAW,YAAA;AAGjB,QAAM,kBAAkB;AAGxB,QAAM,cAAc,YAAY;AAChC,QAAM,iBAAiB,QAAQ;AAG/B,QAAM,sBAAsB,iBAAiB,WAAW;AAGxD,QAAM,CAAC,aAAa,cAAc,IAAI,SAAmB,CAAA,CAAE;AAG3D,YAAU,MAAM;AACd,SAAK,WAAW,EAAE,EAAE,KAAK,cAAc;AAAA,EACzC,GAAG,CAAC,UAAU,CAAC;AAGf,QAAM,gBAAgB;AAAA,IACpB,MAAM,UAAU,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU;AAAA,IAC3C,CAAC,SAAS;AAAA,EAAA;AAOZ,YAAU,MAAM;AAAA,EAahB,GAAG,CAAC,eAAe,UAAU,QAAQ,cAAc,MAAM,CAAC;AAE1D,QAAM,EAAE,cAAc,sBAAA,IAA0B,QAAQ,MAAM;AAC5D,UAAM,iBAAiB,UAAU,OAAO,CAAC,MAAM,EAAE,UAAU;AAG3D,UAAM,cAAc,CAAC,SAA+B;AAClD,UAAIA,UAAS;AAGb,UAAI,YAAY,YAAY;AAE1BA,kBAASA,QAAO,OAAO,CAAC,QAAQ,YAAY,SAAS,IAAI,IAAI,CAAC;AAAA,MAChE,WAAW,OAAO,KAAK,YAAY,UAAU,EAAE,SAAS,GAAG;AAEzDA,kBAASA,QAAO,OAAO,CAAC,QAAQ;AAC9B,iBAAO,OAAO,QA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AAU,UAAA,CAAU,GACzB;AAAA,6BACC,YAAA,EAAW,UAAA;AAAA,UAAA;AAAA,UACI,eAAe,SAAS,WAAW;AAAA,QAAA,GACnD;AAAA,QACA,oBAAC,oBAAiB,UAAA,wCAElB;AAAA,MAAA,GACF;AAAA,MACA,oBAAC,gBACE,UAAA,eACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,2BAAe,EAAE;AACjB,iBAAK,SAAS,EAAE,IAAI,KAAK;AAAA,UAC3B;AAAA,UACA,WAAU;AAAA,UAEV,UAAA;AAAA,YAAA,oBAAC,GAAA,EAAE,WAAU,WAAU;AAAA,YAAE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,GAI/B;AAAA,IAAA,EAAA,CACF,IAEA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,cAAc,MAAM,KAAK,SAAS,EAAE,IAAI,KAAK;AAAA,QAC7C,WAAW,CAAC,CAAC;AAAA,QACb,aAAa;AAAA,QACb;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAGtB;AAAA,EAAA,GACF;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igstack/app-catalog-frontend-core",
3
- "version": "0.4.0-alpha-20260807030804",
3
+ "version": "0.4.0-alpha-20260807033203",
4
4
  "description": "Frontend core library for App Catalog",
5
5
  "homepage": "https://github.com/lislon/app-catalog",
6
6
  "repository": {
@@ -134,8 +134,8 @@
134
134
  "vite-plugin-static-copy": "^3.1.4",
135
135
  "vite-plugin-svgr": "^4.2.0",
136
136
  "vitest": "^4.1.2",
137
- "@igstack/app-catalog-backend-core": "0.4.0-alpha-20260807030804",
138
- "@igstack/app-catalog-shared-core": "0.4.0-alpha-20260807030804"
137
+ "@igstack/app-catalog-backend-core": "0.4.0-alpha-20260807033203",
138
+ "@igstack/app-catalog-shared-core": "0.4.0-alpha-20260807033203"
139
139
  },
140
140
  "peerDependencies": {
141
141
  "react": "19.1.2",
@@ -144,7 +144,7 @@
144
144
  "vite": "^6.3.5",
145
145
  "vite-plugin-svgr": "^4.2.0"
146
146
  },
147
- "gitHead": "da9ef2be9093d62ed8aeab8e27bdfe981b5bf85a",
147
+ "gitHead": "8bd7edd7cdd8478c306398e987aaa5f6b8ea509d",
148
148
  "scripts": {
149
149
  "build": "vite build",
150
150
  "build:lenient": "vite build --mode lenient",
@@ -11,24 +11,33 @@ export class CatalogTools {
11
11
 
12
12
  /**
13
13
  * Click an app row by display name.
14
+ * Works against both the table/grid view and the launcher home (#38), which
15
+ * renders app rows as buttons rather than a <table>.
14
16
  * Throws with list of visible apps if name not found.
15
17
  */
16
18
  async openApp(name: string): Promise<void> {
17
19
  const table = this.getCatalogTable()
18
- if (!table) throw new Error('No catalog table found')
19
- const rows = within(table).getAllByRole('row')
20
-
21
- for (const row of rows) {
22
- const nameEl = row.querySelector('.font-medium')
23
- if (nameEl?.textContent.trim() === name) {
24
- await this.user.click(row)
20
+ if (table) {
21
+ const rows = within(table).getAllByRole('row')
22
+ for (const row of rows) {
23
+ const nameEl = row.querySelector('.font-medium')
24
+ if (nameEl?.textContent.trim() === name) {
25
+ await this.user.click(row)
26
+ return
27
+ }
28
+ }
29
+ } else {
30
+ // Launcher home: rows are buttons titled "View <name>".
31
+ const btn = screen.queryByTitle(`View ${name}`)
32
+ if (btn) {
33
+ await this.user.click(btn)
25
34
  return
26
35
  }
27
36
  }
28
37
 
29
38
  const visibleNames = this.getTableData().map((r) => r.name)
30
39
  throw new Error(
31
- `App "${name}" not found in table. Visible apps: [${visibleNames.join(', ')}]`,
40
+ `App "${name}" not found. Visible apps: [${visibleNames.join(', ')}]`,
32
41
  )
33
42
  }
34
43
 
@@ -63,7 +72,10 @@ export class CatalogTools {
63
72
  `Cannot read table — global error on page: ${bodyText.slice(0, 500)}`,
64
73
  )
65
74
  }
66
- throw new Error('No table found on page')
75
+ // Launcher home (#38): no <table>; read the app row buttons instead.
76
+ const launcherRows = this.getLauncherRows()
77
+ if (launcherRows.length > 0) return launcherRows
78
+ throw new Error('No table or launcher rows found on page')
67
79
  }
68
80
 
69
81
  const rows = within(table).getAllByRole('row')
@@ -129,6 +141,30 @@ export class CatalogTools {
129
141
  return !!screen.queryByText('Welcome to App Catalog')
130
142
  }
131
143
 
144
+ /**
145
+ * Read app rows from the launcher home (#38): buttons titled "View <name>".
146
+ * Name is the first `.font-semibold`/`.font-bold` span; description the
147
+ * `.text-muted-foreground` span. Deduped by name (an app can appear both in
148
+ * "Your apps" and "Browse all").
149
+ */
150
+ private getLauncherRows(): TableRow[] {
151
+ const buttons = Array.from(
152
+ document.querySelectorAll<HTMLElement>('button[title^="View "]'),
153
+ )
154
+ const seen = new Set<string>()
155
+ const result: TableRow[] = []
156
+ for (const btn of buttons) {
157
+ const name = (btn.getAttribute('title') ?? '')
158
+ .replace(/^View\s+/, '')
159
+ .trim()
160
+ if (!name || seen.has(name)) continue
161
+ seen.add(name)
162
+ const descEl = btn.querySelector('.text-muted-foreground')
163
+ result.push({ name, description: descEl?.textContent.trim() ?? '' })
164
+ }
165
+ return result
166
+ }
167
+
132
168
  /**
133
169
  * Get the main catalog table (first table on page, skipping sub-resource tables in detail panel).
134
170
  */
@@ -0,0 +1,298 @@
1
+ import type { Resource } from '@igstack/app-catalog-backend-core'
2
+ import { ArrowUpRight, Search } from 'lucide-react'
3
+ import { useEffect, useMemo, useState } from 'react'
4
+ import { cn } from '~/lib/utils'
5
+ import { useAppClickHistory } from '../../hooks/useAppClickHistory'
6
+ import { markdownToPlainText } from '../../utils/markdownToPlainText'
7
+ import { ResourceIcon } from './ResourceIcon'
8
+
9
+ /**
10
+ * Adaptive-home discovery spine (issue #38, increment 1) — matches the
11
+ * option-a-launcher prototype:
12
+ * Your apps (frequent) → New this week → Browse all
13
+ * Rendered by AppCatalogPage when there is no active search and no open detail.
14
+ * The hero search box drives the same `searchValue` used elsewhere; typing hands
15
+ * off to the results view (increment 2 refines the morph).
16
+ */
17
+
18
+ const typeLabel = (t?: string): string => {
19
+ if (!t || t === 'application') return 'App'
20
+ return t.charAt(0).toUpperCase() + t.slice(1)
21
+ }
22
+
23
+ export interface LauncherHomeProps {
24
+ /** All root (non-child) resources, already filtered for deprecated per settings. */
25
+ apps: Resource[]
26
+ searchValue: string
27
+ onSearchChange: (v: string) => void
28
+ onAppClick: (app: Resource) => void
29
+ onLaunch: (app: Resource) => void
30
+ /** Total resource count for the "Browse all" label. */
31
+ totalCount: number
32
+ }
33
+
34
+ function LaunchButton({
35
+ app,
36
+ onLaunch,
37
+ className,
38
+ }: {
39
+ app: Resource
40
+ onLaunch: (app: Resource) => void
41
+ className?: string
42
+ }) {
43
+ if (!app.appUrl) return null
44
+ return (
45
+ <a
46
+ href={app.appUrl}
47
+ target="_blank"
48
+ rel="noopener noreferrer"
49
+ title={`Open ${app.displayName} in a new tab`}
50
+ aria-label={`Open ${app.displayName} in a new tab`}
51
+ onClick={(e) => {
52
+ e.stopPropagation()
53
+ onLaunch(app)
54
+ }}
55
+ className={cn(
56
+ 'grid place-items-center rounded-full border border-border bg-card text-muted-foreground',
57
+ 'hover:bg-primary hover:text-primary-foreground hover:border-primary transition-colors',
58
+ className,
59
+ )}
60
+ >
61
+ <ArrowUpRight className="size-3.5" />
62
+ </a>
63
+ )
64
+ }
65
+
66
+ function SectionHead({
67
+ title,
68
+ count,
69
+ action,
70
+ }: {
71
+ title: string
72
+ count?: string
73
+ action?: React.ReactNode
74
+ }) {
75
+ return (
76
+ <div className="flex items-center gap-2.5 mb-4">
77
+ <h2 className="font-serif font-semibold text-[15px] tracking-tight m-0">
78
+ {title}
79
+ </h2>
80
+ {count && (
81
+ <span className="text-[13px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5">
82
+ {count}
83
+ </span>
84
+ )}
85
+ {action && <div className="ml-auto">{action}</div>}
86
+ </div>
87
+ )
88
+ }
89
+
90
+ /** Small row used by "New this week" and "Browse all". */
91
+ function ResourceRow({
92
+ app,
93
+ onAppClick,
94
+ onLaunch,
95
+ showNew = false,
96
+ }: {
97
+ app: Resource
98
+ onAppClick: (app: Resource) => void
99
+ onLaunch: (app: Resource) => void
100
+ showNew?: boolean
101
+ }) {
102
+ return (
103
+ <button
104
+ type="button"
105
+ onClick={() => onAppClick(app)}
106
+ title={`View ${app.displayName}`}
107
+ className={cn(
108
+ 'group flex items-center gap-3.5 w-full text-left',
109
+ 'bg-card border border-border rounded-[var(--radius)] px-3.5 py-3',
110
+ 'hover:border-ring hover:shadow-sm transition-all',
111
+ )}
112
+ >
113
+ <ResourceIcon app={app} size={38} />
114
+ <span className="flex-1 min-w-0">
115
+ <span className="block text-[14.5px] font-semibold truncate">
116
+ {app.displayName}
117
+ </span>
118
+ {app.description && (
119
+ <span className="block text-[13px] text-muted-foreground truncate">
120
+ {markdownToPlainText(app.description)}
121
+ </span>
122
+ )}
123
+ </span>
124
+ {showNew && (
125
+ <span className="text-[11px] font-bold text-[#65a443] bg-[#65a443]/12 rounded-full px-2.5 py-0.5">
126
+ New
127
+ </span>
128
+ )}
129
+ <span className="text-[12px] text-muted-foreground bg-muted rounded-full px-2.5 py-0.5 whitespace-nowrap">
130
+ {typeLabel(app.type)}
131
+ </span>
132
+ <LaunchButton app={app} onLaunch={onLaunch} className="size-8" />
133
+ </button>
134
+ )
135
+ }
136
+
137
+ export function LauncherHome({
138
+ apps,
139
+ searchValue,
140
+ onSearchChange,
141
+ onAppClick,
142
+ onLaunch,
143
+ totalCount,
144
+ }: LauncherHomeProps) {
145
+ const { getTopApps } = useAppClickHistory()
146
+ const [topSlugs, setTopSlugs] = useState<string[]>([])
147
+
148
+ useEffect(() => {
149
+ void getTopApps(5).then(setTopSlugs)
150
+ }, [getTopApps])
151
+
152
+ const bySlug = useMemo(() => {
153
+ const m = new Map<string, Resource>()
154
+ for (const a of apps) m.set(a.slug, a)
155
+ return m
156
+ }, [apps])
157
+
158
+ // Your apps: frequently-clicked (personalized). Empty on a cold new machine.
159
+ const frequent = useMemo(
160
+ () =>
161
+ topSlugs
162
+ .map((s) => bySlug.get(s))
163
+ .filter((a): a is Resource => Boolean(a))
164
+ .slice(0, 5),
165
+ [topSlugs, bySlug],
166
+ )
167
+
168
+ // New this week: apps whose sources were checked in the last 7 days, as a
169
+ // proxy for "recently added/updated" (frontend Resource has no createdAt yet;
170
+ // see #38). Falls back to empty (section hidden) when no freshness data.
171
+ const fresh = useMemo(() => {
172
+ const weekAgo = Date.now() - 7 * 24 * 60 * 60 * 1000
173
+ return apps
174
+ .filter((a) => {
175
+ const t = a.freshness?.lastCheckedAt
176
+ return t ? new Date(t).getTime() >= weekAgo : false
177
+ })
178
+ .sort((a, b) => {
179
+ const ta = new Date(a.freshness?.lastCheckedAt ?? 0).getTime()
180
+ const tb = new Date(b.freshness?.lastCheckedAt ?? 0).getTime()
181
+ return tb - ta
182
+ })
183
+ .slice(0, 6)
184
+ }, [apps])
185
+
186
+ // Browse all: everything not already promoted to "Your apps", alpha by name.
187
+ const browse = useMemo(() => {
188
+ const promoted = new Set(frequent.map((a) => a.slug))
189
+ return [...apps]
190
+ .filter((a) => !promoted.has(a.slug))
191
+ .sort((a, b) => a.displayName.localeCompare(b.displayName))
192
+ }, [apps, frequent])
193
+
194
+ const browseLeft = browse.filter((_, i) => i % 2 === 0)
195
+ const browseRight = browse.filter((_, i) => i % 2 === 1)
196
+
197
+ return (
198
+ <div className="mx-auto w-full max-w-[1000px] pb-24">
199
+ {/* hero */}
200
+ <div className="text-center pt-10 pb-1.5">
201
+ <h1 className="font-serif font-semibold text-[30px] tracking-tight m-0 mb-1.5">
202
+ What do you need to get into?
203
+ </h1>
204
+ <p className="text-muted-foreground m-0 mb-6 text-[15px]">
205
+ Find any tool, see how to request access, or jump straight in.
206
+ </p>
207
+ <div className="max-w-[620px] mx-auto">
208
+ <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">
209
+ <Search className="size-5 shrink-0 text-muted-foreground" />
210
+ <input
211
+ type="text"
212
+ value={searchValue}
213
+ onChange={(e) => onSearchChange(e.target.value)}
214
+ placeholder="Search apps, databases, cloud accounts, account IDs…"
215
+ autoComplete="off"
216
+ autoFocus
217
+ aria-label="Search apps"
218
+ className="flex-1 bg-transparent border-0 outline-none text-[16px] text-foreground placeholder:text-muted-foreground"
219
+ />
220
+ </div>
221
+ </div>
222
+ </div>
223
+
224
+ {/* Your apps */}
225
+ {frequent.length > 0 && (
226
+ <section className="mt-9">
227
+ <SectionHead title="Your apps" count="frequent" />
228
+ <div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-3.5">
229
+ {frequent.map((app) => (
230
+ <button
231
+ type="button"
232
+ key={app.slug}
233
+ onClick={() => onAppClick(app)}
234
+ title={`View ${app.displayName}`}
235
+ 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"
236
+ >
237
+ <LaunchButton
238
+ app={app}
239
+ onLaunch={onLaunch}
240
+ className="absolute top-2.5 right-2.5 size-[26px] opacity-0 group-hover:opacity-100"
241
+ />
242
+ <ResourceIcon app={app} size={46} className="mx-auto mb-3" />
243
+ <span className="block text-[13.5px] font-bold truncate">
244
+ {app.displayName}
245
+ </span>
246
+ </button>
247
+ ))}
248
+ </div>
249
+ </section>
250
+ )}
251
+
252
+ {/* New this week */}
253
+ {fresh.length > 0 && (
254
+ <section className="mt-9">
255
+ <SectionHead title="New this week" count={`${fresh.length} added`} />
256
+ <div className="flex flex-col gap-2">
257
+ {fresh.map((app) => (
258
+ <ResourceRow
259
+ key={app.slug}
260
+ app={app}
261
+ onAppClick={onAppClick}
262
+ onLaunch={onLaunch}
263
+ showNew
264
+ />
265
+ ))}
266
+ </div>
267
+ </section>
268
+ )}
269
+
270
+ {/* Browse all */}
271
+ <section className="mt-9">
272
+ <SectionHead title="Browse all" count={`${totalCount} resources`} />
273
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-2">
274
+ <div className="flex flex-col gap-2">
275
+ {browseLeft.map((app) => (
276
+ <ResourceRow
277
+ key={app.slug}
278
+ app={app}
279
+ onAppClick={onAppClick}
280
+ onLaunch={onLaunch}
281
+ />
282
+ ))}
283
+ </div>
284
+ <div className="flex flex-col gap-2">
285
+ {browseRight.map((app) => (
286
+ <ResourceRow
287
+ key={app.slug}
288
+ app={app}
289
+ onAppClick={onAppClick}
290
+ onLaunch={onLaunch}
291
+ />
292
+ ))}
293
+ </div>
294
+ </div>
295
+ </section>
296
+ </div>
297
+ )
298
+ }
@@ -0,0 +1,54 @@
1
+ import { useState } from 'react'
2
+ import type { Resource } from '@igstack/app-catalog-backend-core'
3
+ import { cn } from '~/lib/utils'
4
+ import { monogramColor, monogramInitials } from './monogram'
5
+
6
+ /**
7
+ * Resource icon used across the launcher UI.
8
+ * - If the app has an `iconName`, render the served image (`/api/icons/<name>`).
9
+ * - Otherwise fall back to a flat crayon-colored monogram chip (prototype look),
10
+ * NOT a generic glyph, so every resource still has a recognizable "scent".
11
+ */
12
+ export function ResourceIcon({
13
+ app,
14
+ size = 40,
15
+ className,
16
+ rounded = 'rounded-[12px]',
17
+ }: {
18
+ app: Pick<Resource, 'iconName' | 'displayName' | 'abbreviation' | 'slug'>
19
+ size?: number
20
+ className?: string
21
+ rounded?: string
22
+ }) {
23
+ const [imageError, setImageError] = useState(false)
24
+ const dim = { width: size, height: size }
25
+
26
+ if (app.iconName && !imageError) {
27
+ return (
28
+ <img
29
+ src={`/api/icons/${app.iconName}`}
30
+ alt=""
31
+ aria-hidden="true"
32
+ style={dim}
33
+ className={cn(rounded, 'shrink-0 object-contain', className)}
34
+ onError={() => setImageError(true)}
35
+ />
36
+ )
37
+ }
38
+
39
+ const initials = monogramInitials(app.displayName, app.abbreviation)
40
+ const bg = monogramColor(app.slug || app.displayName)
41
+ return (
42
+ <span
43
+ aria-hidden="true"
44
+ style={{ ...dim, background: bg, fontSize: Math.round(size * 0.36) }}
45
+ className={cn(
46
+ rounded,
47
+ 'shrink-0 grid place-items-center font-semibold text-white font-serif tracking-tight select-none',
48
+ className,
49
+ )}
50
+ >
51
+ {initials}
52
+ </span>
53
+ )
54
+ }
@@ -0,0 +1,41 @@
1
+ // Deterministic crayon-palette monogram color for an app that has no icon.
2
+ // Mirrors the prototype's flat brand-color chips (option-a-launcher.html):
3
+ // a small warm palette drawn from the logo, picked stably by slug so the same
4
+ // app always gets the same color.
5
+
6
+ const CRAYON_PALETTE = [
7
+ '#dc6827', // orange
8
+ '#eca832', // amber
9
+ '#e4724a', // coral
10
+ '#f07a84', // pink
11
+ '#3782c2', // blue
12
+ '#388aca', // blue-2
13
+ '#65a443', // green
14
+ '#2c2622', // ink
15
+ ]
16
+
17
+ /** Stable hash → palette index, so a given slug always maps to one color. */
18
+ export function monogramColor(key: string): string {
19
+ let hash = 0
20
+ for (let i = 0; i < key.length; i++) {
21
+ hash = (hash * 31 + key.charCodeAt(i)) | 0
22
+ }
23
+ const idx = Math.abs(hash) % CRAYON_PALETTE.length
24
+ return CRAYON_PALETTE[idx] as string
25
+ }
26
+
27
+ /** Up-to-2-char initials from a display name / abbreviation. */
28
+ export function monogramInitials(name: string, abbreviation?: string): string {
29
+ const base = (abbreviation || name).trim()
30
+ if (!base) return '?'
31
+ // If an abbreviation is given, use its first 2 chars verbatim (e.g. "K8", "EH").
32
+ if (abbreviation) return abbreviation.slice(0, 2).toUpperCase()
33
+ const words = base
34
+ .replace(/[^A-Za-z0-9 ]/g, '')
35
+ .split(/\s+/)
36
+ .filter(Boolean)
37
+ if (words.length >= 2) {
38
+ return (words[0]![0]! + words[1]![0]!).toUpperCase()
39
+ }
40
+ return base.slice(0, 2).toUpperCase()
41
+ }
@@ -19,6 +19,7 @@ import { OnboardingCard } from '../components/OnboardingCard'
19
19
  import { useAppCatalogFilters } from '../context/AppCatalogFiltersContext'
20
20
  import { FilterBar } from '../filters/FilterBar'
21
21
  import { AppCatalogGrid } from '../grid/AppCatalogGrid'
22
+ import { LauncherHome } from '../launcher/LauncherHome'
22
23
 
23
24
  export function AppCatalogPage({
24
25
  selectedSlug,
@@ -198,6 +199,19 @@ export function AppCatalogPage({
198
199
  })
199
200
  }
200
201
 
202
+ const handleLaunch = (app: Resource) => {
203
+ if (app.appUrl) window.open(app.appUrl, '_blank', 'noopener,noreferrer')
204
+ }
205
+
206
+ // Adaptive-home launcher (#38): shown on the bare catalog view — no search
207
+ // text, no tag/recent filters, and nothing selected. Search + detail keep the
208
+ // existing grid/panel path so all prior behavior is preserved.
209
+ const showLauncherHome =
210
+ !selectedAppSlug &&
211
+ deferredSearchValue.trim() === '' &&
212
+ !filterState.recentMode &&
213
+ Object.keys(filterState.tagFilters).length === 0
214
+
201
215
  const handleClearFilters = () => {
202
216
  setSearchValue('')
203
217
  actions.clearAllFilters()
@@ -220,6 +234,24 @@ export function AppCatalogPage({
220
234
  // Use first tag definition for grouping
221
235
  const groupingDefinition = tagsDefinitions[0]
222
236
 
237
+ // Adaptive-home launcher view (#38, increment 1): the discovery spine.
238
+ if (showLauncherHome) {
239
+ return (
240
+ <div className="flex flex-col flex-1 min-h-0">
241
+ <LauncherHome
242
+ apps={rootResources.filter(
243
+ (a) => filterState.showDeprecated || !a.deprecated,
244
+ )}
245
+ searchValue={searchValue}
246
+ onSearchChange={setSearchValue}
247
+ onAppClick={handleAppClick}
248
+ onLaunch={handleLaunch}
249
+ totalCount={totalAppsCount}
250
+ />
251
+ </div>
252
+ )
253
+ }
254
+
223
255
  return (
224
256
  <div className="flex flex-col flex-1 min-h-0">
225
257
  <div className="shrink-0">