@igstack/app-catalog-frontend-core 0.3.1-alpha-20260317200702 → 0.3.1-alpha-20260320140750
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/__tests__/modules/appCatalog/ScreenshotPreview.test.d.ts +0 -0
- package/dist/esm/__tests__/modules/gallery/EscapeDismissal.integration.test.d.ts +0 -0
- package/dist/esm/__tests__/modules/gallery/Gallery.escape.test.d.ts +0 -0
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.d.ts +9 -4
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +6 -6
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js +18 -2
- package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +128 -108
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -1
- package/dist/esm/modules/appCatalog/utils/searchApps.d.ts +10 -7
- package/dist/esm/modules/appCatalog/utils/searchApps.js +26 -14
- package/dist/esm/modules/appCatalog/utils/searchApps.js.map +1 -1
- package/dist/esm/modules/gallery/Gallery.d.ts +2 -1
- package/dist/esm/modules/gallery/Gallery.js +29 -11
- package/dist/esm/modules/gallery/Gallery.js.map +1 -1
- package/dist/esm/ui/components/header/Header.js +40 -11
- package/dist/esm/ui/components/header/Header.js.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/integration/setup/testSetup.ts +34 -0
- package/src/__tests__/modules/appCatalog/ScreenshotPreview.test.tsx +61 -0
- package/src/__tests__/modules/gallery/EscapeDismissal.integration.test.tsx +116 -0
- package/src/__tests__/modules/gallery/Gallery.escape.test.tsx +91 -0
- package/src/modules/appCatalog/context/AppCatalogContext.tsx +16 -6
- package/src/modules/appCatalog/ui/components/AppDetailModal.tsx +4 -4
- package/src/modules/appCatalog/ui/components/ScreenshotGallery.tsx +19 -2
- package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +179 -138
- package/src/modules/appCatalog/utils/searchApps.ts +51 -30
- package/src/modules/gallery/Gallery.tsx +35 -11
- package/src/ui/components/header/Header.tsx +34 -16
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { AppApprovalMethod, AppForCatalog, GroupingTagDefinition } from '@igstack/app-catalog-backend-core';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
export interface VersionInfo {
|
|
4
|
+
displayName: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AppVersionInfo {
|
|
8
|
+
backend?: VersionInfo;
|
|
9
|
+
frontend?: VersionInfo;
|
|
10
|
+
}
|
|
3
11
|
export interface AppCatalogContextIface {
|
|
4
12
|
apps: Array<AppForCatalog>;
|
|
5
13
|
isLoadingApps: boolean;
|
|
6
14
|
tagsDefinitions: Array<GroupingTagDefinition>;
|
|
7
15
|
approvalMethods: Array<AppApprovalMethod>;
|
|
8
|
-
|
|
9
|
-
displayName: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
};
|
|
16
|
+
versions?: AppVersionInfo;
|
|
12
17
|
}
|
|
13
18
|
export declare const AppCatalogContext: import('react').Context<AppCatalogContextIface | undefined>;
|
|
14
19
|
interface AppCatalogProviderProps {
|
|
@@ -15,7 +15,7 @@ import "../../../ui/empty.js";
|
|
|
15
15
|
import "../../../ui/button.js";
|
|
16
16
|
const AppCatalogContext = createContext(void 0);
|
|
17
17
|
function AppCatalogProvider({ children }) {
|
|
18
|
-
var _a;
|
|
18
|
+
var _a, _b;
|
|
19
19
|
const { data, isLoading: isLoadingApps } = useQuery(
|
|
20
20
|
ApiQueryMagazineAppCatalog.getAppCatalog()
|
|
21
21
|
);
|
|
@@ -25,24 +25,24 @@ function AppCatalogProvider({ children }) {
|
|
|
25
25
|
isLoadingApps,
|
|
26
26
|
tagsDefinitions: (data == null ? void 0 : data.tagsDefinitions) ?? [],
|
|
27
27
|
approvalMethods: (data == null ? void 0 : data.approvalMethods) ?? [],
|
|
28
|
-
|
|
28
|
+
versions: data == null ? void 0 : data.versions
|
|
29
29
|
}),
|
|
30
30
|
[
|
|
31
31
|
data == null ? void 0 : data.approvalMethods,
|
|
32
32
|
data == null ? void 0 : data.apps,
|
|
33
33
|
data == null ? void 0 : data.tagsDefinitions,
|
|
34
|
-
data == null ? void 0 : data.
|
|
34
|
+
data == null ? void 0 : data.versions,
|
|
35
35
|
isLoadingApps
|
|
36
36
|
]
|
|
37
37
|
);
|
|
38
38
|
useEffect(() => {
|
|
39
|
-
var _a2;
|
|
40
|
-
if (((_a2 = data == null ? void 0 : data.
|
|
39
|
+
var _a2, _b2;
|
|
40
|
+
if (((_b2 = (_a2 = data == null ? void 0 : data.versions) == null ? void 0 : _a2.backend) == null ? void 0 : _b2.displayName) === "local") {
|
|
41
41
|
document.title = "Local";
|
|
42
42
|
} else {
|
|
43
43
|
document.title = "App Catalog";
|
|
44
44
|
}
|
|
45
|
-
}, [(_a = data == null ? void 0 : data.
|
|
45
|
+
}, [(_b = (_a = data == null ? void 0 : data.versions) == null ? void 0 : _a.backend) == null ? void 0 : _b.displayName]);
|
|
46
46
|
return /* @__PURE__ */ jsx(AppCatalogContext, { value: contextValue, children });
|
|
47
47
|
}
|
|
48
48
|
function useAppCatalogContext() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppCatalogContext.js","sources":["../../../../../src/modules/appCatalog/context/AppCatalogContext.tsx"],"sourcesContent":["import type {\n AppApprovalMethod,\n AppForCatalog,\n GroupingTagDefinition,\n} from '@igstack/app-catalog-backend-core'\nimport { useQuery } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { createContext, use, useEffect, useMemo } from 'react'\nimport { ApiQueryMagazineAppCatalog } from '~/modules/appCatalog'\n\nexport interface AppCatalogContextIface {\n apps: Array<AppForCatalog>\n isLoadingApps: boolean\n tagsDefinitions: Array<GroupingTagDefinition>\n approvalMethods: Array<AppApprovalMethod>\n
|
|
1
|
+
{"version":3,"file":"AppCatalogContext.js","sources":["../../../../../src/modules/appCatalog/context/AppCatalogContext.tsx"],"sourcesContent":["import type {\n AppApprovalMethod,\n AppForCatalog,\n GroupingTagDefinition,\n} from '@igstack/app-catalog-backend-core'\nimport { useQuery } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { createContext, use, useEffect, useMemo } from 'react'\nimport { ApiQueryMagazineAppCatalog } from '~/modules/appCatalog'\n\nexport interface VersionInfo {\n displayName: string\n url?: string\n}\n\nexport interface AppVersionInfo {\n backend?: VersionInfo\n frontend?: VersionInfo\n}\n\nexport interface AppCatalogContextIface {\n apps: Array<AppForCatalog>\n isLoadingApps: boolean\n tagsDefinitions: Array<GroupingTagDefinition>\n approvalMethods: Array<AppApprovalMethod>\n versions?: AppVersionInfo\n}\n\nexport const AppCatalogContext = createContext<\n AppCatalogContextIface | undefined\n>(undefined)\n\ninterface AppCatalogProviderProps {\n children: ReactNode\n}\n\nexport function AppCatalogProvider({ children }: AppCatalogProviderProps) {\n const { data, isLoading: isLoadingApps } = useQuery(\n ApiQueryMagazineAppCatalog.getAppCatalog(),\n )\n\n const contextValue = useMemo<AppCatalogContextIface>(\n () => ({\n apps: data?.apps ?? [],\n isLoadingApps,\n tagsDefinitions: data?.tagsDefinitions ?? [],\n approvalMethods: data?.approvalMethods ?? [],\n versions: data?.versions,\n }),\n [\n data?.approvalMethods,\n data?.apps,\n data?.tagsDefinitions,\n data?.versions,\n isLoadingApps,\n ],\n )\n\n // Update document title based on backend version\n useEffect(() => {\n if (data?.versions?.backend?.displayName === 'local') {\n document.title = 'Local'\n } else {\n document.title = 'App Catalog'\n }\n }, [data?.versions?.backend?.displayName])\n\n return <AppCatalogContext value={contextValue}>{children}</AppCatalogContext>\n}\n\nexport function useAppCatalogContext(): AppCatalogContextIface {\n const context = use(AppCatalogContext)\n if (!context) {\n throw new Error(\n 'useAppCatalogContext must be used within AppCatalogProvider',\n )\n }\n return context\n}\n"],"names":["_b","_a"],"mappings":";;;;;;;;;;;;;;;AA4BO,MAAM,oBAAoB,cAE/B,MAAS;AAMJ,SAAS,mBAAmB,EAAE,YAAqC;;AACxE,QAAM,EAAE,MAAM,WAAW,cAAA,IAAkB;AAAA,IACzC,2BAA2B,cAAA;AAAA,EAAc;AAG3C,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL,OAAM,6BAAM,SAAQ,CAAA;AAAA,MACpB;AAAA,MACA,kBAAiB,6BAAM,oBAAmB,CAAA;AAAA,MAC1C,kBAAiB,6BAAM,oBAAmB,CAAA;AAAA,MAC1C,UAAU,6BAAM;AAAA,IAAA;AAAA,IAElB;AAAA,MACE,6BAAM;AAAA,MACN,6BAAM;AAAA,MACN,6BAAM;AAAA,MACN,6BAAM;AAAA,MACN;AAAA,IAAA;AAAA,EACF;AAIF,YAAU,MAAM;;AACd,UAAIA,OAAAC,MAAA,6BAAM,aAAN,gBAAAA,IAAgB,YAAhB,gBAAAD,IAAyB,iBAAgB,SAAS;AACpD,eAAS,QAAQ;AAAA,IACnB,OAAO;AACL,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,EAAC,wCAAM,aAAN,mBAAgB,YAAhB,mBAAyB,WAAW,CAAC;AAEzC,SAAO,oBAAC,mBAAA,EAAkB,OAAO,cAAe,SAAA,CAAS;AAC3D;AAEO,SAAS,uBAA+C;AAC7D,QAAM,UAAU,IAAI,iBAAiB;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
2
|
+
import { useRef, useMemo } from "react";
|
|
3
3
|
import { Gallery } from "../../../gallery/Gallery.js";
|
|
4
4
|
import { Dialog, DialogContent, DialogTitle } from "../../../../ui/dialog.js";
|
|
5
5
|
import { VisuallyHidden } from "../../../../ui/visually-hidden.js";
|
|
@@ -11,6 +11,7 @@ function ScreenshotGallery({
|
|
|
11
11
|
onOpenChange,
|
|
12
12
|
title
|
|
13
13
|
}) {
|
|
14
|
+
const isFullscreenRef = useRef(false);
|
|
14
15
|
const images = useMemo(
|
|
15
16
|
() => screenshotIds.map((id) => ({
|
|
16
17
|
url: `/api/screenshots/${id}`,
|
|
@@ -27,9 +28,24 @@ function ScreenshotGallery({
|
|
|
27
28
|
"aria-describedby": void 0,
|
|
28
29
|
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",
|
|
29
30
|
showCloseButton: true,
|
|
31
|
+
onEscapeKeyDown: (e) => {
|
|
32
|
+
if (isFullscreenRef.current) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
}
|
|
35
|
+
},
|
|
30
36
|
children: [
|
|
31
37
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(DialogTitle, { children: title || `${app.alias || app.displayName} screenshots` }) }),
|
|
32
|
-
/* @__PURE__ */ jsx(
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
Gallery,
|
|
40
|
+
{
|
|
41
|
+
images,
|
|
42
|
+
initialIndex,
|
|
43
|
+
title,
|
|
44
|
+
onFullscreenChange: (fs) => {
|
|
45
|
+
isFullscreenRef.current = fs;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
)
|
|
33
49
|
]
|
|
34
50
|
}
|
|
35
51
|
) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenshotGallery.js","sources":["../../../../../../src/modules/appCatalog/ui/components/ScreenshotGallery.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport type { AppForCatalog } from '@igstack/app-catalog-backend-core'\n\nimport { Gallery } from '~/modules/gallery/Gallery'\nimport type { GalleryImage } from '~/modules/gallery/Gallery'\nimport { Dialog, DialogContent, DialogTitle } from '~/ui/dialog'\nimport { VisuallyHidden } from '~/ui/visually-hidden'\n\nexport interface ScreenshotGalleryProps {\n app: AppForCatalog\n screenshotIds: Array<string>\n initialIndex?: number\n open: boolean\n onOpenChange: (open: boolean) => void\n title?: string\n}\n\nexport function ScreenshotGallery({\n app,\n screenshotIds,\n initialIndex = 0,\n open,\n onOpenChange,\n title,\n}: ScreenshotGalleryProps) {\n // Transform screenshot IDs to full URLs\n const images: Array<GalleryImage> = useMemo(\n () =>\n screenshotIds.map((id) => ({\n url: `/api/screenshots/${id}`,\n alt: `${app.alias || app.displayName} screenshot`,\n })),\n [screenshotIds, app.alias, app.displayName],\n )\n\n // Don't render if no screenshots\n if (screenshotIds.length === 0) {\n return null\n }\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n aria-describedby={undefined}\n 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\"\n showCloseButton={true}\n >\n <VisuallyHidden>\n <DialogTitle>\n {title || `${app.alias || app.displayName} screenshots`}\n </DialogTitle>\n </VisuallyHidden>\n <Gallery
|
|
1
|
+
{"version":3,"file":"ScreenshotGallery.js","sources":["../../../../../../src/modules/appCatalog/ui/components/ScreenshotGallery.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\n\nimport type { AppForCatalog } from '@igstack/app-catalog-backend-core'\n\nimport { Gallery } from '~/modules/gallery/Gallery'\nimport type { GalleryImage } from '~/modules/gallery/Gallery'\nimport { Dialog, DialogContent, DialogTitle } from '~/ui/dialog'\nimport { VisuallyHidden } from '~/ui/visually-hidden'\n\nexport interface ScreenshotGalleryProps {\n app: AppForCatalog\n screenshotIds: Array<string>\n initialIndex?: number\n open: boolean\n onOpenChange: (open: boolean) => void\n title?: string\n}\n\nexport function ScreenshotGallery({\n app,\n screenshotIds,\n initialIndex = 0,\n open,\n onOpenChange,\n title,\n}: ScreenshotGalleryProps) {\n // Track whether Gallery is in fullscreen — if so, block Radix from closing on Escape\n const isFullscreenRef = useRef(false)\n\n // Transform screenshot IDs to full URLs\n const images: Array<GalleryImage> = useMemo(\n () =>\n screenshotIds.map((id) => ({\n url: `/api/screenshots/${id}`,\n alt: `${app.alias || app.displayName} screenshot`,\n })),\n [screenshotIds, app.alias, app.displayName],\n )\n\n // Don't render if no screenshots\n if (screenshotIds.length === 0) {\n return null\n }\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n aria-describedby={undefined}\n 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\"\n showCloseButton={true}\n onEscapeKeyDown={(e) => {\n // If Gallery is in fullscreen, its capture listener already handled Escape.\n // Prevent Radix from also closing the dialog on the same event.\n if (isFullscreenRef.current) {\n e.preventDefault()\n }\n }}\n >\n <VisuallyHidden>\n <DialogTitle>\n {title || `${app.alias || app.displayName} screenshots`}\n </DialogTitle>\n </VisuallyHidden>\n <Gallery\n images={images}\n initialIndex={initialIndex}\n title={title}\n onFullscreenChange={(fs) => {\n isFullscreenRef.current = fs\n }}\n />\n </DialogContent>\n </Dialog>\n )\n}\n"],"names":[],"mappings":";;;;;AAkBO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AAEzB,QAAM,kBAAkB,OAAO,KAAK;AAGpC,QAAM,SAA8B;AAAA,IAClC,MACE,cAAc,IAAI,CAAC,QAAQ;AAAA,MACzB,KAAK,oBAAoB,EAAE;AAAA,MAC3B,KAAK,GAAG,IAAI,SAAS,IAAI,WAAW;AAAA,IAAA,EACpC;AAAA,IACJ,CAAC,eAAe,IAAI,OAAO,IAAI,WAAW;AAAA,EAAA;AAI5C,MAAI,cAAc,WAAW,GAAG;AAC9B,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,QAAA,EAAO,MAAY,cAClB,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,oBAAkB;AAAA,MAClB,WAAU;AAAA,MACV,iBAAiB;AAAA,MACjB,iBAAiB,CAAC,MAAM;AAGtB,YAAI,gBAAgB,SAAS;AAC3B,YAAE,eAAA;AAAA,QACJ;AAAA,MACF;AAAA,MAEA,UAAA;AAAA,QAAA,oBAAC,gBAAA,EACC,UAAA,oBAAC,aAAA,EACE,UAAA,SAAS,GAAG,IAAI,SAAS,IAAI,WAAW,eAAA,CAC3C,GACF;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,oBAAoB,CAAC,OAAO;AAC1B,8BAAgB,UAAU;AAAA,YAC5B;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -32,7 +32,7 @@ function HighlightedText({
|
|
|
32
32
|
(segment, index) => segment.highlight ? /* @__PURE__ */ jsx(
|
|
33
33
|
"mark",
|
|
34
34
|
{
|
|
35
|
-
className: "bg-yellow-
|
|
35
|
+
className: "bg-yellow-300 dark:bg-yellow-600/60 font-semibold text-gray-900 dark:text-gray-100",
|
|
36
36
|
children: segment.text
|
|
37
37
|
},
|
|
38
38
|
index
|
|
@@ -145,19 +145,7 @@ function AppDetails({
|
|
|
145
145
|
/* @__PURE__ */ jsx(AppIcon, { app, className: "size-16" }),
|
|
146
146
|
/* @__PURE__ */ jsxs("div", { className: "-mx-3 flex-1 min-w-0", children: [
|
|
147
147
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3", children: [
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
InlineEditableField,
|
|
150
|
-
{
|
|
151
|
-
value: app.alias || app.displayName,
|
|
152
|
-
onSave: (alias) => updateApp.mutate({
|
|
153
|
-
id: app.id,
|
|
154
|
-
data: { alias: alias || null }
|
|
155
|
-
}),
|
|
156
|
-
placeholder: app.displayName,
|
|
157
|
-
className: "text-2xl font-semibold",
|
|
158
|
-
viewClassName: "min-w-0 text-2xl font-semibold"
|
|
159
|
-
}
|
|
160
|
-
),
|
|
148
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-semibold min-w-0", children: app.alias ? `${app.displayName} (${app.alias})` : app.displayName }),
|
|
161
149
|
app.deprecated && /* @__PURE__ */ jsx(
|
|
162
150
|
Badge,
|
|
163
151
|
{
|
|
@@ -166,10 +154,6 @@ function AppDetails({
|
|
|
166
154
|
}
|
|
167
155
|
)
|
|
168
156
|
] }),
|
|
169
|
-
app.alias && /* @__PURE__ */ jsx("div", { className: "mt-1 px-3", children: /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
170
|
-
"Full name: ",
|
|
171
|
-
app.displayName
|
|
172
|
-
] }) }),
|
|
173
157
|
isAdmin && /* @__PURE__ */ jsxs("div", { className: "mt-1 px-3", children: [
|
|
174
158
|
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground mr-2", children: "Slug:" }),
|
|
175
159
|
/* @__PURE__ */ jsx(
|
|
@@ -181,7 +165,7 @@ function AppDetails({
|
|
|
181
165
|
}
|
|
182
166
|
)
|
|
183
167
|
] }),
|
|
184
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 px-3", children: /* @__PURE__ */ jsx(
|
|
168
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 px-3", children: isAdmin ? /* @__PURE__ */ jsx(
|
|
185
169
|
InlineEditableField,
|
|
186
170
|
{
|
|
187
171
|
value: app.appUrl ?? "",
|
|
@@ -196,13 +180,26 @@ function AppDetails({
|
|
|
196
180
|
onClick: () => recordClick(app.slug),
|
|
197
181
|
className: "inline-flex items-center gap-1 rounded-md py-1 text-sm text-blue-600 hover:bg-accent/30 hover:underline dark:text-blue-400 transition-all",
|
|
198
182
|
children: [
|
|
199
|
-
url.
|
|
183
|
+
url.replace(/https?:\/\//g, ""),
|
|
200
184
|
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5 shrink-0 opacity-40 group-hover:opacity-100 transition-opacity" })
|
|
201
185
|
]
|
|
202
186
|
}
|
|
203
187
|
) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "—" })
|
|
204
188
|
}
|
|
205
|
-
)
|
|
189
|
+
) : app.appUrl ? /* @__PURE__ */ jsxs(
|
|
190
|
+
"a",
|
|
191
|
+
{
|
|
192
|
+
href: app.appUrl,
|
|
193
|
+
target: "_blank",
|
|
194
|
+
rel: "noopener noreferrer",
|
|
195
|
+
onClick: () => recordClick(app.slug),
|
|
196
|
+
className: "inline-flex items-center gap-1 rounded-md py-1 text-sm text-blue-600 hover:bg-accent/30 hover:underline dark:text-blue-400 transition-all",
|
|
197
|
+
children: [
|
|
198
|
+
app.appUrl.replace(/https?:\/\//g, ""),
|
|
199
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5 shrink-0 opacity-40 transition-opacity" })
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "—" }) })
|
|
206
203
|
] })
|
|
207
204
|
] }) }),
|
|
208
205
|
app.deprecated && (() => {
|
|
@@ -239,7 +236,7 @@ function AppDetails({
|
|
|
239
236
|
})(),
|
|
240
237
|
/* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
|
|
241
238
|
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-sm font-medium", children: "Description" }),
|
|
242
|
-
/* @__PURE__ */ jsx(
|
|
239
|
+
isAdmin ? /* @__PURE__ */ jsx(
|
|
243
240
|
InlineEditableField,
|
|
244
241
|
{
|
|
245
242
|
value: app.description ?? "",
|
|
@@ -248,7 +245,7 @@ function AppDetails({
|
|
|
248
245
|
placeholder: "Description",
|
|
249
246
|
className: "min-h-[4rem] resize-y text-sm text-muted-foreground"
|
|
250
247
|
}
|
|
251
|
-
)
|
|
248
|
+
) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: app.description || "—" })
|
|
252
249
|
] }),
|
|
253
250
|
app.screenshotIds && app.screenshotIds.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
|
|
254
251
|
/* @__PURE__ */ jsxs("h3", { className: "mb-2 text-sm font-medium", children: [
|
|
@@ -284,7 +281,7 @@ function AppDetails({
|
|
|
284
281
|
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-primary truncate",
|
|
285
282
|
children: [
|
|
286
283
|
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0" }),
|
|
287
|
-
link.title || link.url.
|
|
284
|
+
link.title || link.url.replace(/https?:\/\//g, "")
|
|
288
285
|
]
|
|
289
286
|
},
|
|
290
287
|
link.url
|
|
@@ -300,95 +297,117 @@ function AppDetails({
|
|
|
300
297
|
] }),
|
|
301
298
|
/* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
|
|
302
299
|
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-sm font-medium", children: "Sources" }),
|
|
303
|
-
/* @__PURE__ */
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
300
|
+
isAdmin ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
301
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-2", children: displaySources.map((url, index) => {
|
|
302
|
+
const isDraft = draftSource !== null && index === sourceUrls.length;
|
|
303
|
+
return /* @__PURE__ */ jsxs(
|
|
304
|
+
"li",
|
|
305
|
+
{
|
|
306
|
+
className: "flex items-center gap-2 text-xs",
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground shrink-0", children: [
|
|
309
|
+
index + 1,
|
|
310
|
+
"."
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ jsx(
|
|
313
|
+
InlineEditableField,
|
|
314
|
+
{
|
|
315
|
+
value: url,
|
|
316
|
+
initialEditMode: isDraft,
|
|
317
|
+
onCancel: isDraft ? () => setDraftSource(null) : void 0,
|
|
318
|
+
onSave: (newUrl) => {
|
|
319
|
+
if (isDraft) {
|
|
320
|
+
setDraftSource(null);
|
|
321
|
+
if (newUrl) {
|
|
322
|
+
updateApp.mutate({
|
|
323
|
+
id: app.id,
|
|
324
|
+
data: { sources: [...sourceUrls, newUrl] }
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
const next = [...sourceUrls];
|
|
329
|
+
next[index] = newUrl;
|
|
324
330
|
updateApp.mutate({
|
|
325
331
|
id: app.id,
|
|
326
|
-
data: { sources:
|
|
332
|
+
data: { sources: next.filter(Boolean) }
|
|
327
333
|
});
|
|
328
334
|
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
335
|
+
},
|
|
336
|
+
placeholder: "https://...",
|
|
337
|
+
viewClassName: "flex-1 min-w-0",
|
|
338
|
+
renderView: (val) => val ? /* @__PURE__ */ jsxs(
|
|
339
|
+
"a",
|
|
340
|
+
{
|
|
341
|
+
href: val,
|
|
342
|
+
target: "_blank",
|
|
343
|
+
rel: "noopener noreferrer",
|
|
344
|
+
className: "hover:text-primary inline-flex items-center gap-1 truncate",
|
|
345
|
+
children: [
|
|
346
|
+
val.replace(/https?:\/\//g, ""),
|
|
347
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0" })
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "—" })
|
|
351
|
+
}
|
|
352
|
+
),
|
|
353
|
+
!isDraft && /* @__PURE__ */ jsx(
|
|
354
|
+
Button,
|
|
355
|
+
{
|
|
356
|
+
type: "button",
|
|
357
|
+
variant: "ghost",
|
|
358
|
+
size: "icon-sm",
|
|
359
|
+
"aria-label": "Remove source",
|
|
360
|
+
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
361
|
+
onClick: () => {
|
|
362
|
+
const next = sourceUrls.filter(
|
|
363
|
+
(_, i) => i !== index
|
|
364
|
+
);
|
|
332
365
|
updateApp.mutate({
|
|
333
366
|
id: app.id,
|
|
334
|
-
data: { sources: next
|
|
367
|
+
data: { sources: next }
|
|
335
368
|
});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
),
|
|
355
|
-
|
|
356
|
-
Button,
|
|
357
|
-
{
|
|
358
|
-
type: "button",
|
|
359
|
-
variant: "ghost",
|
|
360
|
-
size: "icon-sm",
|
|
361
|
-
"aria-label": "Remove source",
|
|
362
|
-
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
363
|
-
onClick: () => {
|
|
364
|
-
const next = sourceUrls.filter((_, i) => i !== index);
|
|
365
|
-
updateApp.mutate({
|
|
366
|
-
id: app.id,
|
|
367
|
-
data: { sources: next }
|
|
368
|
-
});
|
|
369
|
-
},
|
|
370
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
|
|
371
|
-
}
|
|
372
|
-
)
|
|
369
|
+
},
|
|
370
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
]
|
|
374
|
+
},
|
|
375
|
+
isDraft ? "draft" : `${index}-${url}`
|
|
376
|
+
);
|
|
377
|
+
}) }),
|
|
378
|
+
/* @__PURE__ */ jsxs(
|
|
379
|
+
Button,
|
|
380
|
+
{
|
|
381
|
+
type: "button",
|
|
382
|
+
variant: "ghost",
|
|
383
|
+
size: "sm",
|
|
384
|
+
className: "mt-2 gap-1 text-muted-foreground",
|
|
385
|
+
onClick: () => setDraftSource(""),
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
|
|
388
|
+
"Add source"
|
|
373
389
|
]
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
] }) : /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: sourceUrls.map((url, index) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2 text-xs", children: [
|
|
393
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground shrink-0", children: [
|
|
394
|
+
index + 1,
|
|
395
|
+
"."
|
|
396
|
+
] }),
|
|
397
|
+
url ? /* @__PURE__ */ jsxs(
|
|
398
|
+
"a",
|
|
399
|
+
{
|
|
400
|
+
href: url,
|
|
401
|
+
target: "_blank",
|
|
402
|
+
rel: "noopener noreferrer",
|
|
403
|
+
className: "hover:text-primary inline-flex items-center gap-1 truncate",
|
|
404
|
+
children: [
|
|
405
|
+
url.replace(/https?:\/\//g, ""),
|
|
406
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0" })
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "—" })
|
|
410
|
+
] }, index)) })
|
|
392
411
|
] })
|
|
393
412
|
] }),
|
|
394
413
|
/* @__PURE__ */ jsx(
|
|
@@ -406,6 +425,9 @@ function AppDetails({
|
|
|
406
425
|
}
|
|
407
426
|
function groupApps(apps, groupingDef, hasSearch) {
|
|
408
427
|
var _a;
|
|
428
|
+
if (hasSearch) {
|
|
429
|
+
return [{ groupName: "All Apps", apps: [...apps] }];
|
|
430
|
+
}
|
|
409
431
|
if (!groupingDef) {
|
|
410
432
|
const sortedApps = [...apps].sort(
|
|
411
433
|
(a, b) => a.displayName.localeCompare(b.displayName)
|
|
@@ -447,9 +469,7 @@ function groupApps(apps, groupingDef, hasSearch) {
|
|
|
447
469
|
);
|
|
448
470
|
result.push({ groupName: "Other", apps: sortedUngrouped });
|
|
449
471
|
}
|
|
450
|
-
|
|
451
|
-
result.sort((a, b) => b.apps.length - a.apps.length);
|
|
452
|
-
}
|
|
472
|
+
result.sort((a, b) => b.apps.length - a.apps.length);
|
|
453
473
|
return result;
|
|
454
474
|
}
|
|
455
475
|
function AppCatalogGrid({
|