@jmruthers/pace-core 0.5.101 → 0.5.102
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/{PublicLoadingSpinner-C2h8zg67.d.ts → PublicLoadingSpinner-Cvgk-V0F.d.ts} +22 -55
- package/dist/{chunk-2ZYHCFUO.js → chunk-7ME4Z5OY.js} +148 -12
- package/dist/chunk-7ME4Z5OY.js.map +1 -0
- package/dist/{chunk-MKMKUCPF.js → chunk-SZWRW5FD.js} +20 -139
- package/dist/chunk-SZWRW5FD.js.map +1 -0
- package/dist/{chunk-A5DFMP3O.js → chunk-UDWTCBSH.js} +127 -498
- package/dist/chunk-UDWTCBSH.js.map +1 -0
- package/dist/components.d.ts +1 -1
- package/dist/components.js +2 -8
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +5 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -12
- package/dist/index.js.map +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +2 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +77 -35
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +11 -24
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UseEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +29 -96
- package/docs/implementation-guides/file-reference-system.md +53 -2
- package/package.json +1 -1
- package/src/components/FileDisplay/FileDisplay.test.tsx +1 -1
- package/src/components/FileDisplay/FileDisplay.tsx +189 -300
- package/src/components/PublicLayout/PublicPageHeader.tsx +14 -9
- package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +25 -35
- package/src/components/PublicLayout/index.ts +2 -5
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/examples/PublicEventPage.tsx +17 -7
- package/src/examples/PublicPageApp.tsx +18 -8
- package/src/hooks/useFileReference.ts +10 -1
- package/src/utils/file-reference.ts +24 -7
- package/src/utils/storage/helpers.ts +12 -1
- package/dist/chunk-2ZYHCFUO.js.map +0 -1
- package/dist/chunk-A5DFMP3O.js.map +0 -1
- package/dist/chunk-MKMKUCPF.js.map +0 -1
- package/docs/api/interfaces/EventLogoProps.md +0 -152
- package/src/components/PublicLayout/EventLogo.tsx +0 -474
|
@@ -42,10 +42,9 @@ import {
|
|
|
42
42
|
useAppConfig,
|
|
43
43
|
useFileDisplay,
|
|
44
44
|
useIsPublicPage,
|
|
45
|
-
usePublicEventLogo,
|
|
46
45
|
usePublicFileDisplay,
|
|
47
46
|
usePublicPageContext
|
|
48
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-SZWRW5FD.js";
|
|
49
48
|
import {
|
|
50
49
|
useToast
|
|
51
50
|
} from "./chunk-QPCAGLUS.js";
|
|
@@ -304,7 +303,7 @@ var Toast = React5.forwardRef(({ className, ...props }, ref) => {
|
|
|
304
303
|
ref,
|
|
305
304
|
"data-testid": "toast-root",
|
|
306
305
|
className: cn(
|
|
307
|
-
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
306
|
+
"group pointer-events-auto bg-background relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
308
307
|
className
|
|
309
308
|
),
|
|
310
309
|
...props
|
|
@@ -3004,7 +3003,7 @@ function FileUpload({
|
|
|
3004
3003
|
}
|
|
3005
3004
|
|
|
3006
3005
|
// src/components/FileDisplay/FileDisplay.tsx
|
|
3007
|
-
import { useState as useState12, useEffect as useEffect8, useRef as useRef5, useContext } from "react";
|
|
3006
|
+
import { useState as useState12, useEffect as useEffect8, useRef as useRef5, useContext, useMemo as useMemo9 } from "react";
|
|
3008
3007
|
|
|
3009
3008
|
// src/hooks/useFileUrl.ts
|
|
3010
3009
|
import { useState as useState11, useEffect as useEffect7, useCallback as useCallback7, useRef as useRef4 } from "react";
|
|
@@ -3079,6 +3078,21 @@ function useFileUrl(fileReference, options) {
|
|
|
3079
3078
|
// src/components/FileDisplay/FileDisplay.tsx
|
|
3080
3079
|
init_UnifiedAuthProvider();
|
|
3081
3080
|
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3081
|
+
var fallbackSizeClasses = {
|
|
3082
|
+
xs: "h-4 w-4 text-xs",
|
|
3083
|
+
sm: "h-6 w-6 text-sm",
|
|
3084
|
+
md: "h-8 w-8 text-base",
|
|
3085
|
+
lg: "h-12 w-12 text-lg",
|
|
3086
|
+
xl: "h-16 w-16 text-xl",
|
|
3087
|
+
"2xl": "h-20 w-20 text-2xl"
|
|
3088
|
+
};
|
|
3089
|
+
function defaultGenerateFallbackText(fileName) {
|
|
3090
|
+
if (!fileName) return "FL";
|
|
3091
|
+
const baseName = fileName.replace(/\.[^/.]+$/, "");
|
|
3092
|
+
const words = baseName.split(/[\s\-_]+/);
|
|
3093
|
+
if (words.length === 0) return "FL";
|
|
3094
|
+
return words.map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
3095
|
+
}
|
|
3082
3096
|
function FileDisplayContent({
|
|
3083
3097
|
isLoading,
|
|
3084
3098
|
error,
|
|
@@ -3094,18 +3108,28 @@ function FileDisplayContent({
|
|
|
3094
3108
|
children,
|
|
3095
3109
|
onDelete,
|
|
3096
3110
|
clearError,
|
|
3097
|
-
supabase,
|
|
3098
3111
|
organisation_id,
|
|
3099
|
-
loadingUrls = /* @__PURE__ */ new Set(),
|
|
3100
3112
|
loadingComponent: LoadingComponent,
|
|
3101
|
-
errorComponent: ErrorComponent
|
|
3113
|
+
errorComponent: ErrorComponent,
|
|
3114
|
+
showFallback = false,
|
|
3115
|
+
generateFallbackText = defaultGenerateFallbackText,
|
|
3116
|
+
fallbackText,
|
|
3117
|
+
fallbackSize = "md"
|
|
3102
3118
|
}) {
|
|
3103
3119
|
const [imageError, setImageError] = useState12(false);
|
|
3104
3120
|
const [internalFileUrls, setInternalFileUrls] = useState12(new Map(fileUrls));
|
|
3105
3121
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState12(false);
|
|
3106
|
-
const loadedFilesRef = useRef5(/* @__PURE__ */ new Set());
|
|
3107
|
-
const loadingUrlsRef = useRef5(new Set(loadingUrls));
|
|
3108
3122
|
const fileReferencesRef = useRef5([]);
|
|
3123
|
+
const computedFallbackText = useMemo9(() => {
|
|
3124
|
+
if (fallbackText) return fallbackText;
|
|
3125
|
+
const fileName = fileReference?.file_metadata?.fileName;
|
|
3126
|
+
return generateFallbackText(fileName);
|
|
3127
|
+
}, [fallbackText, fileReference, generateFallbackText]);
|
|
3128
|
+
const fallbackClasses = useMemo9(() => {
|
|
3129
|
+
const sizeClass = fallbackSizeClasses[fallbackSize];
|
|
3130
|
+
const baseClasses = "flex items-center justify-center bg-sec-100 text-sec-600 font-semibold rounded";
|
|
3131
|
+
return `${baseClasses} ${sizeClass} ${className}`.trim();
|
|
3132
|
+
}, [fallbackSize, className]);
|
|
3109
3133
|
useEffect8(() => {
|
|
3110
3134
|
setInternalFileUrls(new Map(fileUrls));
|
|
3111
3135
|
}, [fileUrls]);
|
|
@@ -3114,48 +3138,9 @@ function FileDisplayContent({
|
|
|
3114
3138
|
const prevIds = fileReferencesRef.current.map((f) => f.id).join(",");
|
|
3115
3139
|
if (currentIds !== prevIds) {
|
|
3116
3140
|
fileReferencesRef.current = fileReferences;
|
|
3117
|
-
loadedFilesRef.current.clear();
|
|
3118
3141
|
setInternalFileUrls(/* @__PURE__ */ new Map());
|
|
3119
3142
|
}
|
|
3120
3143
|
}, [fileReferences]);
|
|
3121
|
-
useEffect8(() => {
|
|
3122
|
-
if (!supabase || category || fileReferences.length === 0) return;
|
|
3123
|
-
const loadFileUrls = async () => {
|
|
3124
|
-
const urlsToLoad = fileReferences.filter((fileRef) => {
|
|
3125
|
-
return !loadedFilesRef.current.has(fileRef.id) && !loadingUrlsRef.current.has(fileRef.id);
|
|
3126
|
-
});
|
|
3127
|
-
if (urlsToLoad.length === 0) return;
|
|
3128
|
-
loadingUrlsRef.current = /* @__PURE__ */ new Set([...loadingUrlsRef.current, ...urlsToLoad.map((f) => f.id)]);
|
|
3129
|
-
for (const fileRef of urlsToLoad) {
|
|
3130
|
-
try {
|
|
3131
|
-
let url = null;
|
|
3132
|
-
if (fileRef.is_public) {
|
|
3133
|
-
url = getPublicUrl(supabase, fileRef.file_path, true);
|
|
3134
|
-
} else {
|
|
3135
|
-
const signedUrlResult = await getSignedUrl(supabase, fileRef.file_path, {
|
|
3136
|
-
appName: "file-reference",
|
|
3137
|
-
orgId: organisation_id,
|
|
3138
|
-
expiresIn: 3600
|
|
3139
|
-
});
|
|
3140
|
-
url = signedUrlResult?.url || null;
|
|
3141
|
-
}
|
|
3142
|
-
if (url) {
|
|
3143
|
-
setInternalFileUrls((prev) => {
|
|
3144
|
-
const updated = new Map(prev);
|
|
3145
|
-
updated.set(fileRef.id, url);
|
|
3146
|
-
return updated;
|
|
3147
|
-
});
|
|
3148
|
-
loadedFilesRef.current.add(fileRef.id);
|
|
3149
|
-
}
|
|
3150
|
-
} catch (error2) {
|
|
3151
|
-
console.error(`Failed to load URL for file ${fileRef.id}:`, error2);
|
|
3152
|
-
} finally {
|
|
3153
|
-
loadingUrlsRef.current.delete(fileRef.id);
|
|
3154
|
-
}
|
|
3155
|
-
}
|
|
3156
|
-
};
|
|
3157
|
-
loadFileUrls();
|
|
3158
|
-
}, [category, fileReferences.map((f) => f.id).join(","), supabase, organisation_id]);
|
|
3159
3144
|
const handleDeleteClick = () => {
|
|
3160
3145
|
setDeleteDialogOpen(true);
|
|
3161
3146
|
};
|
|
@@ -3166,8 +3151,20 @@ function FileDisplayContent({
|
|
|
3166
3151
|
}
|
|
3167
3152
|
setImageError(false);
|
|
3168
3153
|
};
|
|
3169
|
-
const handleImageError = () => {
|
|
3154
|
+
const handleImageError = (e) => {
|
|
3170
3155
|
setImageError(true);
|
|
3156
|
+
if (showFallback && e) {
|
|
3157
|
+
const target = e.target;
|
|
3158
|
+
target.style.display = "none";
|
|
3159
|
+
if (target.nextSibling && target.nextSibling.className.includes("bg-sec-100")) {
|
|
3160
|
+
return;
|
|
3161
|
+
}
|
|
3162
|
+
const fallback = document.createElement("div");
|
|
3163
|
+
fallback.className = fallbackClasses;
|
|
3164
|
+
fallback.textContent = computedFallbackText;
|
|
3165
|
+
fallback.title = fileReference?.file_metadata?.fileName || "File";
|
|
3166
|
+
target.parentNode?.insertBefore(fallback, target.nextSibling);
|
|
3167
|
+
}
|
|
3171
3168
|
};
|
|
3172
3169
|
const getFileIcon = (fileType) => {
|
|
3173
3170
|
if (fileType.startsWith("image/")) return "\u{1F5BC}\uFE0F";
|
|
@@ -3186,6 +3183,24 @@ function FileDisplayContent({
|
|
|
3186
3183
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
3187
3184
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3188
3185
|
};
|
|
3186
|
+
if (fileCount === 0 && !isLoading) {
|
|
3187
|
+
if (showFallback) {
|
|
3188
|
+
return /* @__PURE__ */ jsxs18("div", { className: fallbackClasses, title: "No file", children: [
|
|
3189
|
+
computedFallbackText,
|
|
3190
|
+
children
|
|
3191
|
+
] });
|
|
3192
|
+
}
|
|
3193
|
+
return /* @__PURE__ */ jsxs18("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
|
|
3194
|
+
"No files found",
|
|
3195
|
+
children
|
|
3196
|
+
] });
|
|
3197
|
+
}
|
|
3198
|
+
if (isLoading && showFallback && fileCount === 0) {
|
|
3199
|
+
return /* @__PURE__ */ jsxs18("div", { className: fallbackClasses, title: "Loading...", children: [
|
|
3200
|
+
computedFallbackText,
|
|
3201
|
+
children
|
|
3202
|
+
] });
|
|
3203
|
+
}
|
|
3189
3204
|
if (isLoading) {
|
|
3190
3205
|
if (LoadingComponent) {
|
|
3191
3206
|
return /* @__PURE__ */ jsx22(LoadingComponent, {});
|
|
@@ -3196,6 +3211,9 @@ function FileDisplayContent({
|
|
|
3196
3211
|
if (ErrorComponent) {
|
|
3197
3212
|
return /* @__PURE__ */ jsx22(ErrorComponent, { error, retry: clearError });
|
|
3198
3213
|
}
|
|
3214
|
+
if (showFallback) {
|
|
3215
|
+
return /* @__PURE__ */ jsx22("div", { className: fallbackClasses, title: "File unavailable", children: computedFallbackText });
|
|
3216
|
+
}
|
|
3199
3217
|
return /* @__PURE__ */ jsxs18("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
|
|
3200
3218
|
/* @__PURE__ */ jsxs18("div", { className: "text-acc-600", children: [
|
|
3201
3219
|
"Error loading file: ",
|
|
@@ -3211,15 +3229,12 @@ function FileDisplayContent({
|
|
|
3211
3229
|
)
|
|
3212
3230
|
] });
|
|
3213
3231
|
}
|
|
3214
|
-
if (fileCount === 0) {
|
|
3215
|
-
return /* @__PURE__ */ jsxs18("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
|
|
3216
|
-
"No files found",
|
|
3217
|
-
children
|
|
3218
|
-
] });
|
|
3219
|
-
}
|
|
3220
3232
|
if ((category || displayOnly) && fileReference) {
|
|
3221
3233
|
const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
|
|
3222
|
-
if (displayOnly && isImage && !
|
|
3234
|
+
if (displayOnly && isImage && !showDelete) {
|
|
3235
|
+
if (imageError && showFallback) {
|
|
3236
|
+
return /* @__PURE__ */ jsx22("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
|
|
3237
|
+
}
|
|
3223
3238
|
if (!fileUrl) {
|
|
3224
3239
|
return /* @__PURE__ */ jsx22("div", { className: `bg-sec-100 rounded animate-pulse ${className || "max-w-full h-48"}`, children: /* @__PURE__ */ jsx22("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx22("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) }) });
|
|
3225
3240
|
}
|
|
@@ -3233,6 +3248,9 @@ function FileDisplayContent({
|
|
|
3233
3248
|
}
|
|
3234
3249
|
);
|
|
3235
3250
|
}
|
|
3251
|
+
if (displayOnly && showFallback && (!fileUrl || imageError || !isImage)) {
|
|
3252
|
+
return /* @__PURE__ */ jsx22("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText });
|
|
3253
|
+
}
|
|
3236
3254
|
return /* @__PURE__ */ jsxs18("div", { className: `space-y-2 ${className}`, children: [
|
|
3237
3255
|
isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
3238
3256
|
/* @__PURE__ */ jsx22(
|
|
@@ -3264,7 +3282,10 @@ function FileDisplayContent({
|
|
|
3264
3282
|
] })
|
|
3265
3283
|
] }) })
|
|
3266
3284
|
] })
|
|
3267
|
-
] }) :
|
|
3285
|
+
] }) : isImage && imageError && showFallback ? (
|
|
3286
|
+
// Show fallback when image fails to load and fallback is enabled
|
|
3287
|
+
/* @__PURE__ */ jsx22("div", { className: fallbackClasses, title: fileReference.file_metadata.fileName || "File", children: computedFallbackText })
|
|
3288
|
+
) : /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
3268
3289
|
/* @__PURE__ */ jsx22("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
|
|
3269
3290
|
/* @__PURE__ */ jsxs18("div", { className: "flex-1 min-w-0", children: [
|
|
3270
3291
|
/* @__PURE__ */ jsx22("div", { className: "font-medium text-sec-900 truncate", children: fileReference.file_metadata.fileName || "Unknown file" }),
|
|
@@ -3301,10 +3322,9 @@ function FileDisplayContent({
|
|
|
3301
3322
|
fileReferences.map((fileRef) => {
|
|
3302
3323
|
const isImage = fileRef.file_metadata.fileType?.startsWith("image/");
|
|
3303
3324
|
const fileUrl2 = internalFileUrls.get(fileRef.id) || null;
|
|
3304
|
-
const isLoadingUrl = loadingUrlsRef.current.has(fileRef.id);
|
|
3305
3325
|
const canDownload = !isImage && fileUrl2;
|
|
3306
3326
|
return /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
3307
|
-
|
|
3327
|
+
isImage && fileUrl2 ? /* @__PURE__ */ jsx22(
|
|
3308
3328
|
"img",
|
|
3309
3329
|
{
|
|
3310
3330
|
src: fileUrl2,
|
|
@@ -3348,160 +3368,21 @@ function FileDisplayContent({
|
|
|
3348
3368
|
children
|
|
3349
3369
|
] });
|
|
3350
3370
|
}
|
|
3351
|
-
function FileDisplayBackwardsCompat({
|
|
3352
|
-
supabase,
|
|
3353
|
-
table_name,
|
|
3354
|
-
record_id,
|
|
3355
|
-
organisation_id,
|
|
3356
|
-
category,
|
|
3357
|
-
displayOnly = false,
|
|
3358
|
-
showUpload = false,
|
|
3359
|
-
showDelete = false,
|
|
3360
|
-
className = "",
|
|
3361
|
-
children,
|
|
3362
|
-
loadingComponent,
|
|
3363
|
-
errorComponent
|
|
3364
|
-
}) {
|
|
3365
|
-
const {
|
|
3366
|
-
isLoading: isLoadingForRecord,
|
|
3367
|
-
error: errorForRecord,
|
|
3368
|
-
fileUrl,
|
|
3369
|
-
fileReference,
|
|
3370
|
-
fileReferences,
|
|
3371
|
-
fileCount,
|
|
3372
|
-
loadFileReference,
|
|
3373
|
-
loadFileUrl,
|
|
3374
|
-
loadFileReferences,
|
|
3375
|
-
loadFileCount,
|
|
3376
|
-
deleteFile,
|
|
3377
|
-
clearError
|
|
3378
|
-
} = useFileReferenceForRecord(supabase, table_name, record_id, organisation_id);
|
|
3379
|
-
const {
|
|
3380
|
-
getFilesByCategory,
|
|
3381
|
-
isLoading: isLoadingCategory,
|
|
3382
|
-
error: errorCategory
|
|
3383
|
-
} = useFileReference(supabase);
|
|
3384
|
-
const [categoryFileReferences, setCategoryFileReferences] = useState12([]);
|
|
3385
|
-
const categoryFileReference = categoryFileReferences[0] || null;
|
|
3386
|
-
const categoryFileUrlHook = useFileUrl(categoryFileReference, {
|
|
3387
|
-
supabase,
|
|
3388
|
-
organisation_id,
|
|
3389
|
-
autoLoad: !!categoryFileReference
|
|
3390
|
-
});
|
|
3391
|
-
const [displayOnlyFileReference, setDisplayOnlyFileReference] = useState12(null);
|
|
3392
|
-
const displayOnlyFileUrlHook = useFileUrl(displayOnlyFileReference, {
|
|
3393
|
-
supabase,
|
|
3394
|
-
organisation_id,
|
|
3395
|
-
autoLoad: !!displayOnlyFileReference
|
|
3396
|
-
});
|
|
3397
|
-
useEffect8(() => {
|
|
3398
|
-
if (category) {
|
|
3399
|
-
const loadCategoryFiles = async () => {
|
|
3400
|
-
try {
|
|
3401
|
-
const files = await getFilesByCategory(table_name, record_id, category, organisation_id);
|
|
3402
|
-
setCategoryFileReferences(files);
|
|
3403
|
-
if (files.length === 0) {
|
|
3404
|
-
setCategoryFileReferences([]);
|
|
3405
|
-
}
|
|
3406
|
-
} catch (err) {
|
|
3407
|
-
console.error("[FileDisplayBackwardsCompat] Error loading files by category:", err);
|
|
3408
|
-
}
|
|
3409
|
-
};
|
|
3410
|
-
loadCategoryFiles();
|
|
3411
|
-
} else {
|
|
3412
|
-
setCategoryFileReferences([]);
|
|
3413
|
-
}
|
|
3414
|
-
}, [category, table_name, record_id, organisation_id, supabase, getFilesByCategory]);
|
|
3415
|
-
useEffect8(() => {
|
|
3416
|
-
if (!category) {
|
|
3417
|
-
loadFileCount();
|
|
3418
|
-
loadFileReferences();
|
|
3419
|
-
}
|
|
3420
|
-
}, [loadFileCount, loadFileReferences, category]);
|
|
3421
|
-
useEffect8(() => {
|
|
3422
|
-
if (!category && fileReference) {
|
|
3423
|
-
loadFileUrl();
|
|
3424
|
-
}
|
|
3425
|
-
}, [category, fileReference, loadFileUrl]);
|
|
3426
|
-
useEffect8(() => {
|
|
3427
|
-
if (displayOnly && !category && fileReferences.length > 0) {
|
|
3428
|
-
const imageFiles = fileReferences.filter(
|
|
3429
|
-
(f) => f.file_metadata.fileType?.startsWith("image/")
|
|
3430
|
-
);
|
|
3431
|
-
const targetFile = imageFiles.length > 0 ? imageFiles[0] : fileReferences[0];
|
|
3432
|
-
setDisplayOnlyFileReference(targetFile);
|
|
3433
|
-
} else {
|
|
3434
|
-
setDisplayOnlyFileReference(null);
|
|
3435
|
-
}
|
|
3436
|
-
}, [displayOnly, category, fileReferences]);
|
|
3437
|
-
const handleDelete = async () => {
|
|
3438
|
-
await deleteFile(true);
|
|
3439
|
-
};
|
|
3440
|
-
let finalFileReference = null;
|
|
3441
|
-
let finalFileUrl = null;
|
|
3442
|
-
let finalFileReferences = [];
|
|
3443
|
-
let finalFileCount = 0;
|
|
3444
|
-
let finalIsLoading = false;
|
|
3445
|
-
let finalError = null;
|
|
3446
|
-
if (category) {
|
|
3447
|
-
finalFileReference = categoryFileReference;
|
|
3448
|
-
finalFileUrl = categoryFileUrlHook.url;
|
|
3449
|
-
finalFileReferences = categoryFileReferences;
|
|
3450
|
-
finalFileCount = categoryFileReferences.length;
|
|
3451
|
-
finalIsLoading = isLoadingCategory || categoryFileUrlHook.isLoading;
|
|
3452
|
-
finalError = errorCategory || categoryFileUrlHook.error;
|
|
3453
|
-
} else if (displayOnly) {
|
|
3454
|
-
finalFileReference = displayOnlyFileReference;
|
|
3455
|
-
finalFileUrl = displayOnlyFileUrlHook.url;
|
|
3456
|
-
finalFileReferences = displayOnlyFileReference ? [displayOnlyFileReference] : [];
|
|
3457
|
-
finalFileCount = displayOnlyFileReference ? 1 : 0;
|
|
3458
|
-
finalIsLoading = isLoadingForRecord || displayOnlyFileUrlHook.isLoading;
|
|
3459
|
-
finalError = errorForRecord || displayOnlyFileUrlHook.error;
|
|
3460
|
-
} else {
|
|
3461
|
-
finalFileReference = fileReference;
|
|
3462
|
-
finalFileUrl = fileUrl;
|
|
3463
|
-
finalFileReferences = fileReferences;
|
|
3464
|
-
finalFileCount = fileCount;
|
|
3465
|
-
finalIsLoading = isLoadingForRecord;
|
|
3466
|
-
finalError = errorForRecord;
|
|
3467
|
-
}
|
|
3468
|
-
return /* @__PURE__ */ jsx22(
|
|
3469
|
-
FileDisplayContent,
|
|
3470
|
-
{
|
|
3471
|
-
isLoading: finalIsLoading,
|
|
3472
|
-
error: finalError,
|
|
3473
|
-
fileUrl: finalFileUrl,
|
|
3474
|
-
fileReference: finalFileReference,
|
|
3475
|
-
fileReferences: finalFileReferences,
|
|
3476
|
-
fileUrls: /* @__PURE__ */ new Map(),
|
|
3477
|
-
fileCount: finalFileCount,
|
|
3478
|
-
category,
|
|
3479
|
-
displayOnly,
|
|
3480
|
-
showDelete,
|
|
3481
|
-
className,
|
|
3482
|
-
children,
|
|
3483
|
-
onDelete: handleDelete,
|
|
3484
|
-
clearError,
|
|
3485
|
-
supabase,
|
|
3486
|
-
organisation_id,
|
|
3487
|
-
loadingUrls: /* @__PURE__ */ new Set(),
|
|
3488
|
-
loadingComponent,
|
|
3489
|
-
errorComponent
|
|
3490
|
-
}
|
|
3491
|
-
);
|
|
3492
|
-
}
|
|
3493
3371
|
function FileDisplayPublic({
|
|
3494
3372
|
table_name,
|
|
3495
3373
|
record_id,
|
|
3496
3374
|
organisation_id,
|
|
3497
3375
|
category,
|
|
3498
3376
|
displayOnly = false,
|
|
3499
|
-
showUpload = false,
|
|
3500
3377
|
showDelete = false,
|
|
3501
3378
|
className = "",
|
|
3502
3379
|
children,
|
|
3503
3380
|
loadingComponent,
|
|
3504
|
-
errorComponent
|
|
3381
|
+
errorComponent,
|
|
3382
|
+
showFallback,
|
|
3383
|
+
generateFallbackText,
|
|
3384
|
+
fallbackText,
|
|
3385
|
+
fallbackSize
|
|
3505
3386
|
}) {
|
|
3506
3387
|
const publicPageContext = useContext(PublicPageContext);
|
|
3507
3388
|
const supabase = publicPageContext?.supabase ?? null;
|
|
@@ -3525,7 +3406,6 @@ function FileDisplayPublic({
|
|
|
3525
3406
|
{ supabase }
|
|
3526
3407
|
);
|
|
3527
3408
|
const handleDelete = async () => {
|
|
3528
|
-
console.warn("[FileDisplay] Delete operation not supported in public context");
|
|
3529
3409
|
};
|
|
3530
3410
|
let finalFileReference = fileReference;
|
|
3531
3411
|
let finalFileUrl = fileUrl;
|
|
@@ -3557,10 +3437,13 @@ function FileDisplayPublic({
|
|
|
3557
3437
|
className,
|
|
3558
3438
|
children,
|
|
3559
3439
|
onDelete: showDelete ? handleDelete : void 0,
|
|
3560
|
-
supabase,
|
|
3561
3440
|
organisation_id,
|
|
3562
3441
|
loadingComponent,
|
|
3563
|
-
errorComponent
|
|
3442
|
+
errorComponent,
|
|
3443
|
+
showFallback,
|
|
3444
|
+
generateFallbackText,
|
|
3445
|
+
fallbackText,
|
|
3446
|
+
fallbackSize
|
|
3564
3447
|
}
|
|
3565
3448
|
);
|
|
3566
3449
|
}
|
|
@@ -3570,12 +3453,15 @@ function FileDisplayAuthenticated({
|
|
|
3570
3453
|
organisation_id,
|
|
3571
3454
|
category,
|
|
3572
3455
|
displayOnly = false,
|
|
3573
|
-
showUpload = false,
|
|
3574
3456
|
showDelete = false,
|
|
3575
3457
|
className = "",
|
|
3576
3458
|
children,
|
|
3577
3459
|
loadingComponent,
|
|
3578
|
-
errorComponent
|
|
3460
|
+
errorComponent,
|
|
3461
|
+
showFallback,
|
|
3462
|
+
generateFallbackText,
|
|
3463
|
+
fallbackText,
|
|
3464
|
+
fallbackSize
|
|
3579
3465
|
}) {
|
|
3580
3466
|
const { supabase } = useUnifiedAuth();
|
|
3581
3467
|
if (!supabase) {
|
|
@@ -3620,7 +3506,6 @@ function FileDisplayAuthenticated({
|
|
|
3620
3506
|
}
|
|
3621
3507
|
}, [displayOnly, category, fileReferences, fileUrls]);
|
|
3622
3508
|
const handleDelete = async () => {
|
|
3623
|
-
console.warn("[FileDisplay] Delete operation needs to be implemented via FileReferenceService");
|
|
3624
3509
|
};
|
|
3625
3510
|
let finalFileReference = fileReference;
|
|
3626
3511
|
let finalFileUrl = fileUrl;
|
|
@@ -3654,46 +3539,32 @@ function FileDisplayAuthenticated({
|
|
|
3654
3539
|
className,
|
|
3655
3540
|
children,
|
|
3656
3541
|
onDelete: showDelete ? handleDelete : void 0,
|
|
3657
|
-
supabase,
|
|
3658
3542
|
organisation_id,
|
|
3659
3543
|
loadingComponent,
|
|
3660
|
-
errorComponent
|
|
3544
|
+
errorComponent,
|
|
3545
|
+
showFallback,
|
|
3546
|
+
generateFallbackText,
|
|
3547
|
+
fallbackText,
|
|
3548
|
+
fallbackSize
|
|
3661
3549
|
}
|
|
3662
3550
|
);
|
|
3663
3551
|
}
|
|
3664
3552
|
function FileDisplay({
|
|
3665
|
-
supabase,
|
|
3666
3553
|
table_name,
|
|
3667
3554
|
record_id,
|
|
3668
3555
|
organisation_id,
|
|
3669
3556
|
category,
|
|
3670
3557
|
displayOnly = false,
|
|
3671
|
-
showUpload = false,
|
|
3672
3558
|
showDelete = false,
|
|
3673
3559
|
className = "",
|
|
3674
3560
|
children,
|
|
3675
3561
|
loadingComponent,
|
|
3676
|
-
errorComponent
|
|
3562
|
+
errorComponent,
|
|
3563
|
+
showFallback,
|
|
3564
|
+
generateFallbackText,
|
|
3565
|
+
fallbackText,
|
|
3566
|
+
fallbackSize
|
|
3677
3567
|
}) {
|
|
3678
|
-
if (supabase) {
|
|
3679
|
-
return /* @__PURE__ */ jsx22(
|
|
3680
|
-
FileDisplayBackwardsCompat,
|
|
3681
|
-
{
|
|
3682
|
-
supabase,
|
|
3683
|
-
table_name,
|
|
3684
|
-
record_id,
|
|
3685
|
-
organisation_id,
|
|
3686
|
-
category,
|
|
3687
|
-
displayOnly,
|
|
3688
|
-
showUpload,
|
|
3689
|
-
showDelete,
|
|
3690
|
-
className,
|
|
3691
|
-
children,
|
|
3692
|
-
loadingComponent,
|
|
3693
|
-
errorComponent
|
|
3694
|
-
}
|
|
3695
|
-
);
|
|
3696
|
-
}
|
|
3697
3568
|
const isPublicPage = useIsPublicPage();
|
|
3698
3569
|
if (isPublicPage) {
|
|
3699
3570
|
return /* @__PURE__ */ jsx22(
|
|
@@ -3704,12 +3575,15 @@ function FileDisplay({
|
|
|
3704
3575
|
organisation_id,
|
|
3705
3576
|
category,
|
|
3706
3577
|
displayOnly,
|
|
3707
|
-
showUpload,
|
|
3708
3578
|
showDelete,
|
|
3709
3579
|
className,
|
|
3710
3580
|
children,
|
|
3711
3581
|
loadingComponent,
|
|
3712
|
-
errorComponent
|
|
3582
|
+
errorComponent,
|
|
3583
|
+
showFallback,
|
|
3584
|
+
generateFallbackText,
|
|
3585
|
+
fallbackText,
|
|
3586
|
+
fallbackSize
|
|
3713
3587
|
}
|
|
3714
3588
|
);
|
|
3715
3589
|
}
|
|
@@ -3721,19 +3595,22 @@ function FileDisplay({
|
|
|
3721
3595
|
organisation_id,
|
|
3722
3596
|
category,
|
|
3723
3597
|
displayOnly,
|
|
3724
|
-
showUpload,
|
|
3725
3598
|
showDelete,
|
|
3726
3599
|
className,
|
|
3727
3600
|
children,
|
|
3728
3601
|
loadingComponent,
|
|
3729
|
-
errorComponent
|
|
3602
|
+
errorComponent,
|
|
3603
|
+
showFallback,
|
|
3604
|
+
generateFallbackText,
|
|
3605
|
+
fallbackText,
|
|
3606
|
+
fallbackSize
|
|
3730
3607
|
}
|
|
3731
3608
|
);
|
|
3732
3609
|
}
|
|
3733
3610
|
|
|
3734
3611
|
// src/hooks/useEventLogo.ts
|
|
3735
3612
|
import { useState as useState13, useEffect as useEffect9, useCallback as useCallback9, useMemo as useMemo10 } from "react";
|
|
3736
|
-
function
|
|
3613
|
+
function defaultGenerateFallbackText2(eventName) {
|
|
3737
3614
|
if (!eventName) return "EV";
|
|
3738
3615
|
return eventName.split(" ").map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
3739
3616
|
}
|
|
@@ -3759,7 +3636,7 @@ function useEventLogo(supabase, eventId, eventName, organisationId, options = {}
|
|
|
3759
3636
|
// 30 minutes
|
|
3760
3637
|
enableCache = true,
|
|
3761
3638
|
validateImage = true,
|
|
3762
|
-
generateFallbackText =
|
|
3639
|
+
generateFallbackText = defaultGenerateFallbackText2
|
|
3763
3640
|
} = options;
|
|
3764
3641
|
const [logoUrl, setLogoUrl] = useState13(null);
|
|
3765
3642
|
const [isLoading, setIsLoading] = useState13(false);
|
|
@@ -3981,8 +3858,7 @@ function PublicPageHeader({
|
|
|
3981
3858
|
className = "",
|
|
3982
3859
|
children,
|
|
3983
3860
|
customAppLogo,
|
|
3984
|
-
customEventLogo
|
|
3985
|
-
supabase
|
|
3861
|
+
customEventLogo
|
|
3986
3862
|
}) {
|
|
3987
3863
|
const { appName } = useAppConfig();
|
|
3988
3864
|
const headerClasses = `bg-white border-b border-gray-200 ${className}`.trim();
|
|
@@ -3999,13 +3875,18 @@ function PublicPageHeader({
|
|
|
3999
3875
|
showEventLogo && event && /* @__PURE__ */ jsx24("div", { className: "flex-shrink-0", children: customEventLogo || /* @__PURE__ */ jsx24(
|
|
4000
3876
|
FileDisplay,
|
|
4001
3877
|
{
|
|
4002
|
-
supabase,
|
|
4003
3878
|
table_name: "event",
|
|
4004
3879
|
record_id: event.event_id,
|
|
4005
3880
|
organisation_id: event.organisation_id,
|
|
4006
3881
|
category: "event_logos" /* EVENT_LOGOS */,
|
|
4007
|
-
|
|
4008
|
-
|
|
3882
|
+
displayOnly: true,
|
|
3883
|
+
showFallback: true,
|
|
3884
|
+
fallbackSize: "md",
|
|
3885
|
+
className: "[&_img]:h-12 [&_img]:w-12 [&_img]:object-contain [&>div]:h-12 [&>div]:w-12",
|
|
3886
|
+
generateFallbackText: (fileName) => {
|
|
3887
|
+
if (!event.event_name) return "EV";
|
|
3888
|
+
return event.event_name.split(/[\s\-_]+/).map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
3889
|
+
}
|
|
4009
3890
|
}
|
|
4010
3891
|
) })
|
|
4011
3892
|
] }),
|
|
@@ -4488,255 +4369,6 @@ function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
|
4488
4369
|
] });
|
|
4489
4370
|
}
|
|
4490
4371
|
|
|
4491
|
-
// src/components/PublicLayout/EventLogo.tsx
|
|
4492
|
-
import { useMemo as useMemo12, useContext as useContext2 } from "react";
|
|
4493
|
-
init_UnifiedAuthProvider();
|
|
4494
|
-
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4495
|
-
var sizeClasses2 = {
|
|
4496
|
-
xs: "h-4 w-4 text-xs",
|
|
4497
|
-
sm: "h-6 w-6 text-sm",
|
|
4498
|
-
md: "h-8 w-8 text-base",
|
|
4499
|
-
lg: "h-12 w-12 text-lg",
|
|
4500
|
-
xl: "h-16 w-16 text-xl",
|
|
4501
|
-
"2xl": "h-20 w-20 text-2xl"
|
|
4502
|
-
};
|
|
4503
|
-
function defaultGenerateFallbackText2(eventName) {
|
|
4504
|
-
if (!eventName) return "EV";
|
|
4505
|
-
return eventName.split(" ").map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
4506
|
-
}
|
|
4507
|
-
function EventLogoPublic({
|
|
4508
|
-
eventId,
|
|
4509
|
-
eventName,
|
|
4510
|
-
organisationId,
|
|
4511
|
-
size,
|
|
4512
|
-
className,
|
|
4513
|
-
showFallback,
|
|
4514
|
-
generateFallbackText,
|
|
4515
|
-
validateImage,
|
|
4516
|
-
LoadingComponent,
|
|
4517
|
-
ErrorComponent
|
|
4518
|
-
}) {
|
|
4519
|
-
const publicPageContext = useContext2(PublicPageContext);
|
|
4520
|
-
const supabase = publicPageContext?.supabase ?? null;
|
|
4521
|
-
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4522
|
-
const hasValidOrganisationId = organisationId && uuidRegex.test(organisationId);
|
|
4523
|
-
if (!supabase) {
|
|
4524
|
-
const effectiveSize = size || "md";
|
|
4525
|
-
return /* @__PURE__ */ jsx31("div", { className: `${sizeClasses2[effectiveSize]} ${className}`.trim(), title: `${eventName} logo (Supabase not configured)`, children: eventName ? defaultGenerateFallbackText2(eventName) : "EV" });
|
|
4526
|
-
}
|
|
4527
|
-
const {
|
|
4528
|
-
logoUrl,
|
|
4529
|
-
fallbackText,
|
|
4530
|
-
isLoading,
|
|
4531
|
-
error
|
|
4532
|
-
} = usePublicEventLogo(
|
|
4533
|
-
eventId,
|
|
4534
|
-
eventName,
|
|
4535
|
-
organisationId,
|
|
4536
|
-
// Always pass organisationId, let the hook handle validation
|
|
4537
|
-
{
|
|
4538
|
-
validateImage,
|
|
4539
|
-
generateFallbackText,
|
|
4540
|
-
supabase
|
|
4541
|
-
}
|
|
4542
|
-
);
|
|
4543
|
-
const sizeClass = useMemo12(() => sizeClasses2[size || "md"], [size]);
|
|
4544
|
-
const combinedClasses = useMemo12(() => {
|
|
4545
|
-
const baseClasses = "flex items-center justify-center bg-gray-100 text-gray-600 font-semibold rounded";
|
|
4546
|
-
return `${baseClasses} ${sizeClass} ${className}`.trim();
|
|
4547
|
-
}, [sizeClass, className]);
|
|
4548
|
-
if (!hasValidOrganisationId && !isLoading && !logoUrl && showFallback) {
|
|
4549
|
-
return /* @__PURE__ */ jsx31("div", { className: combinedClasses, title: `${eventName} logo (invalid organisation ID)`, children: fallbackText });
|
|
4550
|
-
}
|
|
4551
|
-
if (isLoading) {
|
|
4552
|
-
if (LoadingComponent) {
|
|
4553
|
-
return /* @__PURE__ */ jsx31(LoadingComponent, {});
|
|
4554
|
-
}
|
|
4555
|
-
return /* @__PURE__ */ jsx31("div", { className: `${combinedClasses} animate-pulse`, children: /* @__PURE__ */ jsx31("div", { className: "w-3/4 h-3/4 bg-gray-300 rounded" }) });
|
|
4556
|
-
}
|
|
4557
|
-
if (error) {
|
|
4558
|
-
if (ErrorComponent) {
|
|
4559
|
-
return /* @__PURE__ */ jsx31(ErrorComponent, { error });
|
|
4560
|
-
}
|
|
4561
|
-
if (showFallback) {
|
|
4562
|
-
return /* @__PURE__ */ jsx31("div", { className: combinedClasses, title: `${eventName} (logo unavailable)`, children: fallbackText });
|
|
4563
|
-
}
|
|
4564
|
-
return null;
|
|
4565
|
-
}
|
|
4566
|
-
if (!logoUrl) {
|
|
4567
|
-
if (showFallback) {
|
|
4568
|
-
return /* @__PURE__ */ jsx31("div", { className: combinedClasses, title: `${eventName} logo`, children: fallbackText });
|
|
4569
|
-
}
|
|
4570
|
-
return null;
|
|
4571
|
-
}
|
|
4572
|
-
const imageClasses = `${sizeClass} object-contain rounded ${className}`.trim();
|
|
4573
|
-
return /* @__PURE__ */ jsx31(
|
|
4574
|
-
"img",
|
|
4575
|
-
{
|
|
4576
|
-
src: logoUrl,
|
|
4577
|
-
alt: `${eventName} logo`,
|
|
4578
|
-
className: imageClasses,
|
|
4579
|
-
onError: (e) => {
|
|
4580
|
-
const target = e.target;
|
|
4581
|
-
target.style.display = "none";
|
|
4582
|
-
const fallback = document.createElement("div");
|
|
4583
|
-
fallback.className = combinedClasses;
|
|
4584
|
-
fallback.textContent = fallbackText;
|
|
4585
|
-
fallback.title = `${eventName} logo`;
|
|
4586
|
-
target.parentNode?.insertBefore(fallback, target.nextSibling);
|
|
4587
|
-
}
|
|
4588
|
-
}
|
|
4589
|
-
);
|
|
4590
|
-
}
|
|
4591
|
-
function EventLogoAuthenticated({
|
|
4592
|
-
eventId,
|
|
4593
|
-
eventName,
|
|
4594
|
-
organisationId,
|
|
4595
|
-
size,
|
|
4596
|
-
className,
|
|
4597
|
-
showFallback,
|
|
4598
|
-
generateFallbackText,
|
|
4599
|
-
validateImage,
|
|
4600
|
-
LoadingComponent,
|
|
4601
|
-
ErrorComponent
|
|
4602
|
-
}) {
|
|
4603
|
-
const { supabase } = useUnifiedAuth();
|
|
4604
|
-
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4605
|
-
const hasValidOrganisationId = organisationId && uuidRegex.test(organisationId);
|
|
4606
|
-
if (!supabase) {
|
|
4607
|
-
const effectiveSize = size || "md";
|
|
4608
|
-
return /* @__PURE__ */ jsx31("div", { className: `${sizeClasses2[effectiveSize]} ${className}`.trim(), title: `${eventName} logo (Supabase not configured)`, children: eventName ? defaultGenerateFallbackText2(eventName) : "EV" });
|
|
4609
|
-
}
|
|
4610
|
-
const {
|
|
4611
|
-
logoUrl,
|
|
4612
|
-
fallbackText,
|
|
4613
|
-
isLoading,
|
|
4614
|
-
error
|
|
4615
|
-
} = useEventLogo(
|
|
4616
|
-
supabase,
|
|
4617
|
-
eventId,
|
|
4618
|
-
eventName,
|
|
4619
|
-
organisationId,
|
|
4620
|
-
{
|
|
4621
|
-
validateImage,
|
|
4622
|
-
generateFallbackText
|
|
4623
|
-
}
|
|
4624
|
-
);
|
|
4625
|
-
const sizeClass = useMemo12(() => sizeClasses2[size || "md"], [size]);
|
|
4626
|
-
const combinedClasses = useMemo12(() => {
|
|
4627
|
-
const baseClasses = "flex items-center justify-center bg-gray-100 text-gray-600 font-semibold rounded";
|
|
4628
|
-
return `${baseClasses} ${sizeClass} ${className}`.trim();
|
|
4629
|
-
}, [sizeClass, className]);
|
|
4630
|
-
if (!hasValidOrganisationId && !isLoading && !logoUrl && showFallback) {
|
|
4631
|
-
return /* @__PURE__ */ jsx31("div", { className: combinedClasses, title: `${eventName} logo (invalid organisation ID)`, children: fallbackText });
|
|
4632
|
-
}
|
|
4633
|
-
if (isLoading) {
|
|
4634
|
-
if (LoadingComponent) {
|
|
4635
|
-
return /* @__PURE__ */ jsx31(LoadingComponent, {});
|
|
4636
|
-
}
|
|
4637
|
-
return /* @__PURE__ */ jsx31("div", { className: `${combinedClasses} animate-pulse`, children: /* @__PURE__ */ jsx31("div", { className: "w-3/4 h-3/4 bg-gray-300 rounded" }) });
|
|
4638
|
-
}
|
|
4639
|
-
if (error) {
|
|
4640
|
-
if (ErrorComponent) {
|
|
4641
|
-
return /* @__PURE__ */ jsx31(ErrorComponent, { error });
|
|
4642
|
-
}
|
|
4643
|
-
if (showFallback) {
|
|
4644
|
-
return /* @__PURE__ */ jsx31("div", { className: combinedClasses, title: `${eventName} (logo unavailable)`, children: fallbackText });
|
|
4645
|
-
}
|
|
4646
|
-
return null;
|
|
4647
|
-
}
|
|
4648
|
-
if (!logoUrl) {
|
|
4649
|
-
if (showFallback) {
|
|
4650
|
-
return /* @__PURE__ */ jsx31("div", { className: combinedClasses, title: `${eventName} logo`, children: fallbackText });
|
|
4651
|
-
}
|
|
4652
|
-
return null;
|
|
4653
|
-
}
|
|
4654
|
-
const imageClasses = `${sizeClass} object-contain rounded ${className}`.trim();
|
|
4655
|
-
return /* @__PURE__ */ jsx31(
|
|
4656
|
-
"img",
|
|
4657
|
-
{
|
|
4658
|
-
src: logoUrl,
|
|
4659
|
-
alt: `${eventName} logo`,
|
|
4660
|
-
className: imageClasses,
|
|
4661
|
-
onError: (e) => {
|
|
4662
|
-
const target = e.target;
|
|
4663
|
-
target.style.display = "none";
|
|
4664
|
-
const fallback = document.createElement("div");
|
|
4665
|
-
fallback.className = combinedClasses;
|
|
4666
|
-
fallback.textContent = fallbackText;
|
|
4667
|
-
fallback.title = `${eventName} logo`;
|
|
4668
|
-
target.parentNode?.insertBefore(fallback, target.nextSibling);
|
|
4669
|
-
}
|
|
4670
|
-
}
|
|
4671
|
-
);
|
|
4672
|
-
}
|
|
4673
|
-
function EventLogo({
|
|
4674
|
-
eventId,
|
|
4675
|
-
eventName,
|
|
4676
|
-
organisationId,
|
|
4677
|
-
size = "md",
|
|
4678
|
-
className = "",
|
|
4679
|
-
showFallback = true,
|
|
4680
|
-
generateFallbackText = defaultGenerateFallbackText2,
|
|
4681
|
-
validateImage = true,
|
|
4682
|
-
loadingComponent: LoadingComponent,
|
|
4683
|
-
errorComponent: ErrorComponent
|
|
4684
|
-
}) {
|
|
4685
|
-
const isPublicPage = useIsPublicPage();
|
|
4686
|
-
if (isPublicPage) {
|
|
4687
|
-
return /* @__PURE__ */ jsx31(
|
|
4688
|
-
EventLogoPublic,
|
|
4689
|
-
{
|
|
4690
|
-
eventId,
|
|
4691
|
-
eventName,
|
|
4692
|
-
organisationId,
|
|
4693
|
-
size,
|
|
4694
|
-
className,
|
|
4695
|
-
showFallback,
|
|
4696
|
-
generateFallbackText,
|
|
4697
|
-
validateImage,
|
|
4698
|
-
LoadingComponent,
|
|
4699
|
-
ErrorComponent
|
|
4700
|
-
}
|
|
4701
|
-
);
|
|
4702
|
-
}
|
|
4703
|
-
return /* @__PURE__ */ jsx31(
|
|
4704
|
-
EventLogoAuthenticated,
|
|
4705
|
-
{
|
|
4706
|
-
eventId,
|
|
4707
|
-
eventName,
|
|
4708
|
-
organisationId,
|
|
4709
|
-
size,
|
|
4710
|
-
className,
|
|
4711
|
-
showFallback,
|
|
4712
|
-
generateFallbackText,
|
|
4713
|
-
validateImage,
|
|
4714
|
-
LoadingComponent,
|
|
4715
|
-
ErrorComponent
|
|
4716
|
-
}
|
|
4717
|
-
);
|
|
4718
|
-
}
|
|
4719
|
-
function EventLogoCompact(props) {
|
|
4720
|
-
return /* @__PURE__ */ jsx31(
|
|
4721
|
-
EventLogo,
|
|
4722
|
-
{
|
|
4723
|
-
...props,
|
|
4724
|
-
size: "sm",
|
|
4725
|
-
className: `${props.className || ""} rounded-sm`
|
|
4726
|
-
}
|
|
4727
|
-
);
|
|
4728
|
-
}
|
|
4729
|
-
function EventLogoLarge(props) {
|
|
4730
|
-
return /* @__PURE__ */ jsx31(
|
|
4731
|
-
EventLogo,
|
|
4732
|
-
{
|
|
4733
|
-
...props,
|
|
4734
|
-
size: "xl",
|
|
4735
|
-
className: `${props.className || ""} rounded-lg`
|
|
4736
|
-
}
|
|
4737
|
-
);
|
|
4738
|
-
}
|
|
4739
|
-
|
|
4740
4372
|
export {
|
|
4741
4373
|
init_EventProvider,
|
|
4742
4374
|
Label,
|
|
@@ -4794,9 +4426,6 @@ export {
|
|
|
4794
4426
|
usePublicPageContext2 as usePublicPageContext,
|
|
4795
4427
|
PublicPageDebugger,
|
|
4796
4428
|
PublicPageDiagnostic,
|
|
4797
|
-
PublicPageContextChecker
|
|
4798
|
-
EventLogo,
|
|
4799
|
-
EventLogoCompact,
|
|
4800
|
-
EventLogoLarge
|
|
4429
|
+
PublicPageContextChecker
|
|
4801
4430
|
};
|
|
4802
|
-
//# sourceMappingURL=chunk-
|
|
4431
|
+
//# sourceMappingURL=chunk-UDWTCBSH.js.map
|