@igstack/app-catalog-frontend-core 0.13.3 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +0 -1
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js.map +1 -1
- package/dist/esm/modules/appCatalog/hooks/useUpdateApp.d.ts +1 -0
- package/dist/esm/modules/appCatalog/ui/components/Highlight.d.ts +8 -0
- package/dist/esm/modules/appCatalog/ui/components/Highlight.js +20 -0
- package/dist/esm/modules/appCatalog/ui/components/Highlight.js.map +1 -0
- package/dist/esm/modules/appCatalog/ui/components/PersonBadge.js +0 -1
- package/dist/esm/modules/appCatalog/ui/components/PersonBadge.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js +1 -0
- package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js +0 -1
- package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/TierVariantsSection.js +0 -1
- package/dist/esm/modules/appCatalog/ui/components/TierVariantsSection.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +33 -19
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/launcher/LauncherDetailPanel.js +31 -10
- package/dist/esm/modules/appCatalog/ui/launcher/LauncherDetailPanel.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/launcher/LauncherHome.js +26 -9
- package/dist/esm/modules/appCatalog/ui/launcher/LauncherHome.js.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/integration/appCatalog.integration.test.ts +43 -0
- package/src/__tests__/integration/appDeepLink.integration.test.ts +24 -1
- package/src/__tests__/integration/appFreshness.integration.test.ts +15 -0
- package/src/modules/appCatalog/ui/components/Highlight.tsx +26 -0
- package/src/modules/appCatalog/ui/components/ScreenshotGallery.tsx +3 -0
- package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +40 -21
- package/src/modules/appCatalog/ui/launcher/LauncherDetailPanel.tsx +21 -1
- package/src/modules/appCatalog/ui/launcher/LauncherHome.tsx +26 -9
|
@@ -1 +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 "{searchValue}" — 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 </div>\n </div>\n </section>\n\n <AttributionFooter />\n </>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;AAsBA,MAAM,YAAY,CAAC,MAA8B;AAC/C,MAAI,CAAC,KAAK,MAAM,cAAe,QAAO;AACtC,SAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC;AAC9C;AAoBA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,MAAI,CAAC,IAAI,OAAQ,QAAO;AAGxB,QAAM,YAAY,IAAI,OAAO,QAAQ,gBAAgB,EAAE;AACvD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM,IAAI;AAAA,MACV,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,OAAO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ACZ,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;"}
|
|
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, X } 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'\nimport { Highlight } from '../components/Highlight'\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 "{searchValue}" — 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 <Highlight text={app.displayName} query={searchValue} />\n {app.abbreviation && app.abbreviation !== app.displayName && (\n <span className=\"ml-1.5 text-[12px] font-normal text-muted-foreground\">\n (<Highlight text={app.abbreviation} query={searchValue} />)\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 shown = kids.slice(0, 3)\n const extra = kids.length > 3 ? ` +${kids.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'}:{' '}\n {shown.map((k, idx) => (\n <span key={k.slug}>\n {idx > 0 && ', '}\n <Highlight text={k.displayName} query={searchValue} />\n </span>\n ))}\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 <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => {\n onSearchChange('')\n searchRef.current?.focus()\n }}\n className=\"shrink-0 rounded-full p-1 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n ) : (\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 </div>\n </div>\n </section>\n\n <AttributionFooter />\n </>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;AAuBA,MAAM,YAAY,CAAC,MAA8B;AAC/C,MAAI,CAA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AAA,MAAA,GACF;AAAA,MAID,MAAM,SAAS,KACd,qBAAC,WAAA,EAAQ,WAAU,QACjB,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,OAAO,GAAG,MAAM,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,4BAEvB,OAAA,EAAI,WAAU,uBACZ,UAAA,MAAM,IAAI,CAAC,QACV;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC;AAAA,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;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igstack/app-catalog-frontend-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
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-
|
|
138
|
-
"@igstack/app-catalog-
|
|
137
|
+
"@igstack/app-catalog-shared-core": "0.14.1",
|
|
138
|
+
"@igstack/app-catalog-backend-core": "0.14.1"
|
|
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": "
|
|
147
|
+
"gitHead": "30c7add877ea524033c3f4e96b4e4c56a1a933e8",
|
|
148
148
|
"scripts": {
|
|
149
149
|
"build": "vite build",
|
|
150
150
|
"build:lenient": "vite build --mode lenient",
|
|
@@ -328,4 +328,47 @@ describe('App Catalog Integration', () => {
|
|
|
328
328
|
/(?<![\d])0(?![\d]).*clear filters/i,
|
|
329
329
|
)
|
|
330
330
|
})
|
|
331
|
+
|
|
332
|
+
it('highlights matched query text in search result app names (#57)', async () => {
|
|
333
|
+
const { ui } = await given(
|
|
334
|
+
magazine.custom(({ backendCfg }) => {
|
|
335
|
+
backendCfg.withApp({ displayName: 'Kubernetes Platform' })
|
|
336
|
+
backendCfg.withApp({ displayName: 'Other Tool' })
|
|
337
|
+
}),
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
await ui.catalog.search('kube')
|
|
341
|
+
|
|
342
|
+
await waitFor(() => {
|
|
343
|
+
const marks = document.querySelectorAll('mark')
|
|
344
|
+
const markTexts = [...marks].map((m) => String(m.textContent))
|
|
345
|
+
expect(markTexts.some((t) => t.toLowerCase().includes('kube'))).toBe(true)
|
|
346
|
+
})
|
|
347
|
+
})
|
|
348
|
+
|
|
349
|
+
it('clear (×) button appears when search has text and clears on click (#54)', async () => {
|
|
350
|
+
const { ui } = await given(magazine.full())
|
|
351
|
+
|
|
352
|
+
// Before typing: no clear button
|
|
353
|
+
expect(
|
|
354
|
+
document.querySelector('[aria-label="Clear search"]'),
|
|
355
|
+
).not.toBeInTheDocument()
|
|
356
|
+
|
|
357
|
+
// After typing: clear button appears
|
|
358
|
+
await ui.catalog.search('jira')
|
|
359
|
+
await waitFor(() => {
|
|
360
|
+
expect(
|
|
361
|
+
document.querySelector('[aria-label="Clear search"]'),
|
|
362
|
+
).toBeInTheDocument()
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
// Click × — input clears, button disappears
|
|
366
|
+
fireEvent.click(document.querySelector('[aria-label="Clear search"]')!)
|
|
367
|
+
await waitFor(() => {
|
|
368
|
+
expect(ui.catalog.getSearchInput().value).toBe('')
|
|
369
|
+
expect(
|
|
370
|
+
document.querySelector('[aria-label="Clear search"]'),
|
|
371
|
+
).not.toBeInTheDocument()
|
|
372
|
+
})
|
|
373
|
+
})
|
|
331
374
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import { fireEvent, waitFor } from '@testing-library/react'
|
|
2
|
+
import { fireEvent, screen, waitFor } from '@testing-library/react'
|
|
3
3
|
import '@testing-library/jest-dom/vitest'
|
|
4
4
|
|
|
5
5
|
import { given } from './harness/given'
|
|
@@ -45,6 +45,29 @@ describe('App deep-link routing', () => {
|
|
|
45
45
|
expect(router.state.location.pathname).toBe('/')
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
+
it('Esc closes card opened by mouse click (#53 bug 1)', async () => {
|
|
49
|
+
const { ui, router } = await given(magazine.full(), { initialRoute: '/' })
|
|
50
|
+
// Open via click (mouse, not keyboard nav)
|
|
51
|
+
await ui.catalog.openApp('Jira')
|
|
52
|
+
await waitFor(() => expect(ui.catalog.isDetailPanelOpen()).toBe(true))
|
|
53
|
+
// Esc should close — no "dead click" needed
|
|
54
|
+
fireEvent.keyDown(document, { key: 'Escape', code: 'Escape' })
|
|
55
|
+
await waitFor(() => expect(ui.catalog.isDetailPanelOpen()).toBe(false))
|
|
56
|
+
expect(router.state.location.pathname).toBe('/')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('closes the detail panel when the × close button is clicked (#59)', async () => {
|
|
60
|
+
const { ui, router } = await given(magazine.full(), { initialRoute: '/' })
|
|
61
|
+
await ui.catalog.openApp('Jira')
|
|
62
|
+
await waitFor(() => expect(ui.catalog.isDetailPanelOpen()).toBe(true))
|
|
63
|
+
const closeBtn = screen.getByRole('button', { name: /^Close$/i })
|
|
64
|
+
fireEvent.click(closeBtn)
|
|
65
|
+
await waitFor(() => {
|
|
66
|
+
expect(ui.catalog.isDetailPanelOpen()).toBe(false)
|
|
67
|
+
})
|
|
68
|
+
expect(router.state.location.pathname).toBe('/')
|
|
69
|
+
})
|
|
70
|
+
|
|
48
71
|
it('ignores legacy ?app= query param (no detail opens)', async () => {
|
|
49
72
|
const { ui } = await given(magazine.full(), { initialRoute: '/?app=jira' })
|
|
50
73
|
await waitFor(() => {
|
|
@@ -45,6 +45,21 @@ describe('App freshness line', () => {
|
|
|
45
45
|
expect(screen.getByText(/may be out of date/i)).toBeInTheDocument()
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
+
it('shows "Added" date before Sources when createdAt is present (#55)', async () => {
|
|
49
|
+
const { ui } = await given(
|
|
50
|
+
magazine.full(({ backendCfg }) => {
|
|
51
|
+
backendCfg.withApp({
|
|
52
|
+
slug: 'dated-app',
|
|
53
|
+
displayName: 'Dated App',
|
|
54
|
+
createdAt: iso(30 * DAY),
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
{ initialRoute: '/app/dated-app' },
|
|
58
|
+
)
|
|
59
|
+
await waitFor(() => expect(ui.catalog.isDetailPanelOpen()).toBe(true))
|
|
60
|
+
expect(screen.getByText(/Added/i)).toBeInTheDocument()
|
|
61
|
+
})
|
|
62
|
+
|
|
48
63
|
it('shows no freshness line when the app was never scanned', async () => {
|
|
49
64
|
const { ui } = await given(
|
|
50
65
|
magazine.full(({ backendCfg }) => {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { highlightText } from '../../utils/searchApps'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Highlights all case-insensitive occurrences of `query` in `text`.
|
|
5
|
+
* Renders plain text when query is empty or has no match.
|
|
6
|
+
*/
|
|
7
|
+
export function Highlight({ text, query }: { text: string; query: string }) {
|
|
8
|
+
if (!query.trim()) return <>{text}</>
|
|
9
|
+
const segments = highlightText(text, query)
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
{segments.map((seg, i) =>
|
|
13
|
+
seg.highlight ? (
|
|
14
|
+
<mark
|
|
15
|
+
key={i}
|
|
16
|
+
className="bg-primary/15 text-primary rounded-[2px] px-[1px] font-semibold not-italic"
|
|
17
|
+
>
|
|
18
|
+
{seg.text}
|
|
19
|
+
</mark>
|
|
20
|
+
) : (
|
|
21
|
+
seg.text
|
|
22
|
+
),
|
|
23
|
+
)}
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -49,6 +49,9 @@ export function ScreenshotGallery({
|
|
|
49
49
|
className="h-[85vh] w-full max-w-[calc(100vw-2rem)] sm:max-w-[calc(100vw-3rem)] md:max-w-[calc(100vw-4rem)] p-0 overflow-hidden"
|
|
50
50
|
showCloseButton={true}
|
|
51
51
|
onEscapeKeyDown={(e) => {
|
|
52
|
+
// Stop propagation so the Esc event doesn't reach outer document listeners
|
|
53
|
+
// (e.g. SearchResultsList's raw keydown handler, which would clear search).
|
|
54
|
+
e.stopPropagation()
|
|
52
55
|
// If Gallery is in fullscreen, its capture listener already handled Escape.
|
|
53
56
|
// Prevent Radix from also closing the dialog on the same event.
|
|
54
57
|
if (isFullscreenRef.current) {
|
|
@@ -8,7 +8,15 @@ import {
|
|
|
8
8
|
getCoreRowModel,
|
|
9
9
|
useReactTable,
|
|
10
10
|
} from '@tanstack/react-table'
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
AppWindow,
|
|
13
|
+
CalendarPlus,
|
|
14
|
+
Clock,
|
|
15
|
+
ExternalLink,
|
|
16
|
+
Plus,
|
|
17
|
+
Trash2,
|
|
18
|
+
X,
|
|
19
|
+
} from 'lucide-react'
|
|
12
20
|
import React, { useState } from 'react'
|
|
13
21
|
import { useHotkeys } from 'react-hotkeys-hook'
|
|
14
22
|
import { cn } from '~/lib/utils'
|
|
@@ -356,26 +364,7 @@ export function AppDetails({
|
|
|
356
364
|
<span className="text-muted-foreground">—</span>
|
|
357
365
|
)}
|
|
358
366
|
</div>
|
|
359
|
-
{/*
|
|
360
|
-
drives "New this week"), so the date is visible in the card
|
|
361
|
-
itself, not only in the muted footer. */}
|
|
362
|
-
{app.freshness?.lastCheckedAt && (
|
|
363
|
-
<div className="mt-1 px-3">
|
|
364
|
-
<span
|
|
365
|
-
className="inline-flex items-center gap-1 text-xs text-muted-foreground"
|
|
366
|
-
title={app.freshness.lastCheckedAt}
|
|
367
|
-
>
|
|
368
|
-
<Clock className="size-3" />
|
|
369
|
-
Updated {formatRelativeTime(app.freshness.lastCheckedAt)}
|
|
370
|
-
{app.freshness.isStale && (
|
|
371
|
-
<span className="italic opacity-75">
|
|
372
|
-
{' '}
|
|
373
|
-
· may be out of date
|
|
374
|
-
</span>
|
|
375
|
-
)}
|
|
376
|
-
</span>
|
|
377
|
-
</div>
|
|
378
|
-
)}
|
|
367
|
+
{/* Updated/Added metadata moved to consolidated section before Sources (#55) */}
|
|
379
368
|
</div>
|
|
380
369
|
</div>
|
|
381
370
|
</div>
|
|
@@ -536,6 +525,36 @@ export function AppDetails({
|
|
|
536
525
|
</div>
|
|
537
526
|
)}
|
|
538
527
|
|
|
528
|
+
{/* Metadata: Added / Updated */}
|
|
529
|
+
{(app.createdAt || app.freshness?.lastCheckedAt) && (
|
|
530
|
+
<div className="mt-6 flex flex-wrap gap-x-5 gap-y-1">
|
|
531
|
+
{app.createdAt && (
|
|
532
|
+
<span
|
|
533
|
+
className="inline-flex items-center gap-1 text-xs text-muted-foreground"
|
|
534
|
+
title={app.createdAt}
|
|
535
|
+
>
|
|
536
|
+
<CalendarPlus className="size-3" />
|
|
537
|
+
Added {formatRelativeTime(app.createdAt)}
|
|
538
|
+
</span>
|
|
539
|
+
)}
|
|
540
|
+
{app.freshness?.lastCheckedAt && (
|
|
541
|
+
<span
|
|
542
|
+
className="inline-flex items-center gap-1 text-xs text-muted-foreground"
|
|
543
|
+
title={app.freshness.lastCheckedAt}
|
|
544
|
+
>
|
|
545
|
+
<Clock className="size-3" />
|
|
546
|
+
Updated {formatRelativeTime(app.freshness.lastCheckedAt)}
|
|
547
|
+
{app.freshness.isStale && (
|
|
548
|
+
<span className="italic opacity-75">
|
|
549
|
+
{' '}
|
|
550
|
+
· may be out of date
|
|
551
|
+
</span>
|
|
552
|
+
)}
|
|
553
|
+
</span>
|
|
554
|
+
)}
|
|
555
|
+
</div>
|
|
556
|
+
)}
|
|
557
|
+
|
|
539
558
|
{/* Sources */}
|
|
540
559
|
<div className="mt-6">
|
|
541
560
|
<h3 className="mb-2 text-sm font-medium">Sources</h3>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Resource } from '@igstack/app-catalog-backend-core'
|
|
2
|
+
import { X } from 'lucide-react'
|
|
3
|
+
import { useEffect, useRef } from 'react'
|
|
2
4
|
import { AppDetails } from '../grid/AppCatalogGrid'
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -20,6 +22,14 @@ export function LauncherDetailPanel({
|
|
|
20
22
|
onClose: () => void
|
|
21
23
|
onAppClick?: (app: Resource) => void
|
|
22
24
|
}) {
|
|
25
|
+
const dialogRef = useRef<HTMLDivElement>(null)
|
|
26
|
+
|
|
27
|
+
// Focus the dialog on mount so Esc hotkeys fire immediately, even when
|
|
28
|
+
// the card was opened by a mouse click (which leaves focus on the grid row).
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
dialogRef.current?.focus()
|
|
31
|
+
}, [])
|
|
32
|
+
|
|
23
33
|
return (
|
|
24
34
|
<div className="fixed inset-0 z-50 flex items-start justify-center overflow-y-auto p-4 sm:p-6 md:p-10">
|
|
25
35
|
{/* scrim */}
|
|
@@ -34,11 +44,21 @@ export function LauncherDetailPanel({
|
|
|
34
44
|
prose inside AppDetails is width-capped separately so it stays
|
|
35
45
|
readable. Caps at 94vw so it never touches the edges. */}
|
|
36
46
|
<div
|
|
47
|
+
ref={dialogRef}
|
|
37
48
|
role="dialog"
|
|
38
49
|
aria-modal="true"
|
|
39
50
|
aria-label={`${app.displayName} details`}
|
|
40
|
-
|
|
51
|
+
tabIndex={-1}
|
|
52
|
+
className="relative w-full max-w-[min(1120px,94vw)] my-auto rounded-[var(--radius)] border border-border bg-background shadow-2xl animate-in fade-in zoom-in-95 duration-200 outline-none"
|
|
41
53
|
>
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
aria-label="Close"
|
|
57
|
+
onClick={onClose}
|
|
58
|
+
className="absolute top-3 right-3 z-10 rounded-full p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors"
|
|
59
|
+
>
|
|
60
|
+
<X className="size-4" />
|
|
61
|
+
</button>
|
|
42
62
|
<div className="max-h-[85vh] overflow-y-auto px-6 py-5 sm:px-8 sm:py-7">
|
|
43
63
|
<AppDetails
|
|
44
64
|
app={app}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Resource } from '@igstack/app-catalog-backend-core'
|
|
2
|
-
import { ArrowUpRight, Search } from 'lucide-react'
|
|
2
|
+
import { ArrowUpRight, Search, X } from 'lucide-react'
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
4
4
|
import { cn } from '~/lib/utils'
|
|
5
5
|
import { useAppClickHistory } from '../../hooks/useAppClickHistory'
|
|
@@ -7,6 +7,7 @@ import { markdownToPlainText } from '../../utils/markdownToPlainText'
|
|
|
7
7
|
import { AttributionFooter } from './AttributionFooter'
|
|
8
8
|
import { ResourceIcon } from './ResourceIcon'
|
|
9
9
|
import { searchResources } from '../../utils/searchApps'
|
|
10
|
+
import { Highlight } from '../components/Highlight'
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Adaptive-home discovery spine (issue #38, increment 1) — matches the
|
|
@@ -281,10 +282,10 @@ function SearchResultsList({
|
|
|
281
282
|
<ResourceIcon app={app} size={40} />
|
|
282
283
|
<span className="flex-1 min-w-0">
|
|
283
284
|
<span className="block text-[14px] font-semibold truncate">
|
|
284
|
-
{app.displayName}
|
|
285
|
+
<Highlight text={app.displayName} query={searchValue} />
|
|
285
286
|
{app.abbreviation && app.abbreviation !== app.displayName && (
|
|
286
287
|
<span className="ml-1.5 text-[12px] font-normal text-muted-foreground">
|
|
287
|
-
({app.abbreviation})
|
|
288
|
+
(<Highlight text={app.abbreviation} query={searchValue} />)
|
|
288
289
|
</span>
|
|
289
290
|
)}
|
|
290
291
|
</span>
|
|
@@ -296,14 +297,18 @@ function SearchResultsList({
|
|
|
296
297
|
{(() => {
|
|
297
298
|
const kids = matchedChildrenByParent.get(app.slug)
|
|
298
299
|
if (!kids || kids.length === 0) return null
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
const extra =
|
|
302
|
-
names.length > 3 ? ` +${names.length - 3} more` : ''
|
|
300
|
+
const shown = kids.slice(0, 3)
|
|
301
|
+
const extra = kids.length > 3 ? ` +${kids.length - 3} more` : ''
|
|
303
302
|
return (
|
|
304
303
|
<span className="mt-0.5 block text-[12px] text-primary truncate">
|
|
305
304
|
Matched {kids.length} sub-resource
|
|
306
|
-
{kids.length === 1 ? '' : 's'}:
|
|
305
|
+
{kids.length === 1 ? '' : 's'}:{' '}
|
|
306
|
+
{shown.map((k, idx) => (
|
|
307
|
+
<span key={k.slug}>
|
|
308
|
+
{idx > 0 && ', '}
|
|
309
|
+
<Highlight text={k.displayName} query={searchValue} />
|
|
310
|
+
</span>
|
|
311
|
+
))}
|
|
307
312
|
{extra}
|
|
308
313
|
</span>
|
|
309
314
|
)
|
|
@@ -433,7 +438,19 @@ export function LauncherHome({
|
|
|
433
438
|
aria-label="Search apps"
|
|
434
439
|
className="flex-1 bg-transparent border-0 outline-none text-[16px] text-foreground placeholder:text-muted-foreground"
|
|
435
440
|
/>
|
|
436
|
-
{
|
|
441
|
+
{isSearching ? (
|
|
442
|
+
<button
|
|
443
|
+
type="button"
|
|
444
|
+
aria-label="Clear search"
|
|
445
|
+
onClick={() => {
|
|
446
|
+
onSearchChange('')
|
|
447
|
+
searchRef.current?.focus()
|
|
448
|
+
}}
|
|
449
|
+
className="shrink-0 rounded-full p-1 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors"
|
|
450
|
+
>
|
|
451
|
+
<X className="size-4" />
|
|
452
|
+
</button>
|
|
453
|
+
) : (
|
|
437
454
|
<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">
|
|
438
455
|
{typeof navigator !== 'undefined' &&
|
|
439
456
|
navigator.platform.includes('Mac')
|