@jmruthers/pace-core 0.5.94 → 0.5.95
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/{DataTable-CHX2EFO3.js → DataTable-XENXNMCP.js} +2 -2
- package/dist/{PublicLoadingSpinner-BWUD6bLU.d.ts → PublicLoadingSpinner-B84QWsvB.d.ts} +8 -1
- package/dist/{chunk-PRM6EYO3.js → chunk-EPKHU5SS.js} +17 -8
- package/dist/{chunk-PRM6EYO3.js.map → chunk-EPKHU5SS.js.map} +1 -1
- package/dist/{chunk-O6GASC4Q.js → chunk-V5CTX4FR.js} +267 -182
- package/dist/chunk-V5CTX4FR.js.map +1 -0
- package/dist/components.d.ts +1 -1
- package/dist/components.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/utils.js +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 +1 -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/EventLogoProps.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +37 -11
- 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 +1 -1
- 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 +3 -3
- package/package.json +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +27 -9
- package/src/components/FileDisplay/FileDisplay.tsx +189 -147
- package/src/hooks/useFileUrl.ts +130 -0
- package/dist/chunk-O6GASC4Q.js.map +0 -1
- /package/dist/{DataTable-CHX2EFO3.js.map → DataTable-XENXNMCP.js.map} +0 -0
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
CardHeader,
|
|
11
11
|
CardTitle,
|
|
12
12
|
Dialog,
|
|
13
|
+
DialogBody,
|
|
13
14
|
DialogContent,
|
|
15
|
+
DialogFooter,
|
|
14
16
|
DialogHeader,
|
|
15
17
|
DialogOverlay,
|
|
16
18
|
DialogTitle,
|
|
@@ -23,7 +25,7 @@ import {
|
|
|
23
25
|
SelectSeparator,
|
|
24
26
|
SelectTrigger,
|
|
25
27
|
SelectValue
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-EPKHU5SS.js";
|
|
27
29
|
import {
|
|
28
30
|
isPermitted,
|
|
29
31
|
isSuperAdmin
|
|
@@ -3002,9 +3004,81 @@ function FileUpload({
|
|
|
3002
3004
|
}
|
|
3003
3005
|
|
|
3004
3006
|
// src/components/FileDisplay/FileDisplay.tsx
|
|
3005
|
-
import { useState as
|
|
3007
|
+
import { useState as useState12, useEffect as useEffect8, useRef as useRef5, useContext } from "react";
|
|
3008
|
+
|
|
3009
|
+
// src/hooks/useFileUrl.ts
|
|
3010
|
+
import { useState as useState11, useEffect as useEffect7, useCallback as useCallback7, useRef as useRef4 } from "react";
|
|
3011
|
+
function useFileUrl(fileReference, options) {
|
|
3012
|
+
const { organisation_id, supabase, autoLoad = true } = options;
|
|
3013
|
+
const [url, setUrl] = useState11(null);
|
|
3014
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
3015
|
+
const [error, setError] = useState11(null);
|
|
3016
|
+
const fileReferenceIdRef = useRef4(null);
|
|
3017
|
+
const loadUrl = useCallback7(async () => {
|
|
3018
|
+
if (!fileReference) {
|
|
3019
|
+
setUrl(null);
|
|
3020
|
+
setIsLoading(false);
|
|
3021
|
+
setError(null);
|
|
3022
|
+
return;
|
|
3023
|
+
}
|
|
3024
|
+
if (isLoading || url && fileReferenceIdRef.current === fileReference.id) {
|
|
3025
|
+
return;
|
|
3026
|
+
}
|
|
3027
|
+
setIsLoading(true);
|
|
3028
|
+
setError(null);
|
|
3029
|
+
fileReferenceIdRef.current = fileReference.id;
|
|
3030
|
+
try {
|
|
3031
|
+
let generatedUrl = null;
|
|
3032
|
+
if (fileReference.is_public) {
|
|
3033
|
+
generatedUrl = getPublicUrl(supabase, fileReference.file_path, true);
|
|
3034
|
+
} else {
|
|
3035
|
+
const signedUrlResult = await getSignedUrl(supabase, fileReference.file_path, {
|
|
3036
|
+
appName: "file-reference",
|
|
3037
|
+
orgId: organisation_id,
|
|
3038
|
+
expiresIn: 3600
|
|
3039
|
+
});
|
|
3040
|
+
generatedUrl = signedUrlResult?.url || null;
|
|
3041
|
+
}
|
|
3042
|
+
setUrl(generatedUrl);
|
|
3043
|
+
setError(null);
|
|
3044
|
+
} catch (err) {
|
|
3045
|
+
const error2 = err instanceof Error ? err : new Error("Failed to generate file URL");
|
|
3046
|
+
setError(error2);
|
|
3047
|
+
setUrl(null);
|
|
3048
|
+
console.error("[useFileUrl] Error generating URL:", error2);
|
|
3049
|
+
} finally {
|
|
3050
|
+
setIsLoading(false);
|
|
3051
|
+
}
|
|
3052
|
+
}, [fileReference, supabase, organisation_id, isLoading, url]);
|
|
3053
|
+
const clear = useCallback7(() => {
|
|
3054
|
+
setUrl(null);
|
|
3055
|
+
setError(null);
|
|
3056
|
+
setIsLoading(false);
|
|
3057
|
+
fileReferenceIdRef.current = null;
|
|
3058
|
+
}, []);
|
|
3059
|
+
useEffect7(() => {
|
|
3060
|
+
if (autoLoad) {
|
|
3061
|
+
if (fileReferenceIdRef.current !== fileReference?.id) {
|
|
3062
|
+
setUrl(null);
|
|
3063
|
+
setError(null);
|
|
3064
|
+
}
|
|
3065
|
+
if (fileReference && !url && !isLoading) {
|
|
3066
|
+
loadUrl();
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
}, [fileReference?.id, autoLoad, loadUrl, url, isLoading]);
|
|
3070
|
+
return {
|
|
3071
|
+
url,
|
|
3072
|
+
isLoading,
|
|
3073
|
+
error,
|
|
3074
|
+
loadUrl,
|
|
3075
|
+
clear
|
|
3076
|
+
};
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
// src/components/FileDisplay/FileDisplay.tsx
|
|
3006
3080
|
init_UnifiedAuthProvider();
|
|
3007
|
-
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3081
|
+
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3008
3082
|
function FileDisplayContent({
|
|
3009
3083
|
isLoading,
|
|
3010
3084
|
error,
|
|
@@ -3022,17 +3096,20 @@ function FileDisplayContent({
|
|
|
3022
3096
|
clearError,
|
|
3023
3097
|
supabase,
|
|
3024
3098
|
organisation_id,
|
|
3025
|
-
loadingUrls = /* @__PURE__ */ new Set()
|
|
3099
|
+
loadingUrls = /* @__PURE__ */ new Set(),
|
|
3100
|
+
loadingComponent: LoadingComponent,
|
|
3101
|
+
errorComponent: ErrorComponent
|
|
3026
3102
|
}) {
|
|
3027
|
-
const [imageError, setImageError] =
|
|
3028
|
-
const [internalFileUrls, setInternalFileUrls] =
|
|
3029
|
-
const
|
|
3030
|
-
const
|
|
3031
|
-
const
|
|
3032
|
-
|
|
3103
|
+
const [imageError, setImageError] = useState12(false);
|
|
3104
|
+
const [internalFileUrls, setInternalFileUrls] = useState12(new Map(fileUrls));
|
|
3105
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState12(false);
|
|
3106
|
+
const loadedFilesRef = useRef5(/* @__PURE__ */ new Set());
|
|
3107
|
+
const loadingUrlsRef = useRef5(new Set(loadingUrls));
|
|
3108
|
+
const fileReferencesRef = useRef5([]);
|
|
3109
|
+
useEffect8(() => {
|
|
3033
3110
|
setInternalFileUrls(new Map(fileUrls));
|
|
3034
3111
|
}, [fileUrls]);
|
|
3035
|
-
|
|
3112
|
+
useEffect8(() => {
|
|
3036
3113
|
const currentIds = fileReferences.map((f) => f.id).join(",");
|
|
3037
3114
|
const prevIds = fileReferencesRef.current.map((f) => f.id).join(",");
|
|
3038
3115
|
if (currentIds !== prevIds) {
|
|
@@ -3041,7 +3118,7 @@ function FileDisplayContent({
|
|
|
3041
3118
|
setInternalFileUrls(/* @__PURE__ */ new Map());
|
|
3042
3119
|
}
|
|
3043
3120
|
}, [fileReferences]);
|
|
3044
|
-
|
|
3121
|
+
useEffect8(() => {
|
|
3045
3122
|
if (!supabase || category || fileReferences.length === 0) return;
|
|
3046
3123
|
const loadFileUrls = async () => {
|
|
3047
3124
|
const urlsToLoad = fileReferences.filter((fileRef) => {
|
|
@@ -3079,13 +3156,15 @@ function FileDisplayContent({
|
|
|
3079
3156
|
};
|
|
3080
3157
|
loadFileUrls();
|
|
3081
3158
|
}, [category, fileReferences.map((f) => f.id).join(","), supabase, organisation_id]);
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3159
|
+
const handleDeleteClick = () => {
|
|
3160
|
+
setDeleteDialogOpen(true);
|
|
3161
|
+
};
|
|
3162
|
+
const handleDeleteConfirm = async () => {
|
|
3163
|
+
setDeleteDialogOpen(false);
|
|
3164
|
+
if (onDelete) {
|
|
3165
|
+
await onDelete();
|
|
3088
3166
|
}
|
|
3167
|
+
setImageError(false);
|
|
3089
3168
|
};
|
|
3090
3169
|
const handleImageError = () => {
|
|
3091
3170
|
setImageError(true);
|
|
@@ -3108,9 +3187,15 @@ function FileDisplayContent({
|
|
|
3108
3187
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3109
3188
|
};
|
|
3110
3189
|
if (isLoading) {
|
|
3190
|
+
if (LoadingComponent) {
|
|
3191
|
+
return /* @__PURE__ */ jsx22(LoadingComponent, {});
|
|
3192
|
+
}
|
|
3111
3193
|
return /* @__PURE__ */ jsx22("div", { className: `flex items-center justify-center p-4 ${className}`, children: /* @__PURE__ */ jsx22("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) });
|
|
3112
3194
|
}
|
|
3113
3195
|
if (error) {
|
|
3196
|
+
if (ErrorComponent) {
|
|
3197
|
+
return /* @__PURE__ */ jsx22(ErrorComponent, { error, retry: clearError });
|
|
3198
|
+
}
|
|
3114
3199
|
return /* @__PURE__ */ jsxs18("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
|
|
3115
3200
|
/* @__PURE__ */ jsxs18("div", { className: "text-acc-600", children: [
|
|
3116
3201
|
"Error loading file: ",
|
|
@@ -3134,7 +3219,10 @@ function FileDisplayContent({
|
|
|
3134
3219
|
}
|
|
3135
3220
|
if ((category || displayOnly) && fileReference) {
|
|
3136
3221
|
const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
|
|
3137
|
-
if (displayOnly && isImage &&
|
|
3222
|
+
if (displayOnly && isImage && !imageError && !showDelete) {
|
|
3223
|
+
if (!fileUrl) {
|
|
3224
|
+
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
|
+
}
|
|
3138
3226
|
return /* @__PURE__ */ jsx22(
|
|
3139
3227
|
"img",
|
|
3140
3228
|
{
|
|
@@ -3156,16 +3244,26 @@ function FileDisplayContent({
|
|
|
3156
3244
|
onError: handleImageError
|
|
3157
3245
|
}
|
|
3158
3246
|
),
|
|
3159
|
-
showDelete && /* @__PURE__ */
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3247
|
+
showDelete && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3248
|
+
/* @__PURE__ */ jsx22(
|
|
3249
|
+
"button",
|
|
3250
|
+
{
|
|
3251
|
+
onClick: handleDeleteClick,
|
|
3252
|
+
className: "absolute top-2 right-2 bg-acc-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm hover:bg-acc-600",
|
|
3253
|
+
title: "Delete file",
|
|
3254
|
+
"aria-label": "Delete file",
|
|
3255
|
+
children: "\xD7"
|
|
3256
|
+
}
|
|
3257
|
+
),
|
|
3258
|
+
/* @__PURE__ */ jsx22(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs18(DialogContent, { size: "sm", children: [
|
|
3259
|
+
/* @__PURE__ */ jsx22(DialogHeader, { children: /* @__PURE__ */ jsx22(DialogTitle, { children: "Confirm Delete" }) }),
|
|
3260
|
+
/* @__PURE__ */ jsx22(DialogBody, { children: /* @__PURE__ */ jsx22("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
|
|
3261
|
+
/* @__PURE__ */ jsxs18(DialogFooter, { children: [
|
|
3262
|
+
/* @__PURE__ */ jsx22(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
3263
|
+
/* @__PURE__ */ jsx22(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
|
|
3264
|
+
] })
|
|
3265
|
+
] }) })
|
|
3266
|
+
] })
|
|
3169
3267
|
] }) : /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
3170
3268
|
/* @__PURE__ */ jsx22("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
|
|
3171
3269
|
/* @__PURE__ */ jsxs18("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -3175,16 +3273,26 @@ function FileDisplayContent({
|
|
|
3175
3273
|
fileReference.file_metadata.fileType && ` \u2022 ${fileReference.file_metadata.fileType}`
|
|
3176
3274
|
] })
|
|
3177
3275
|
] }),
|
|
3178
|
-
showDelete && /* @__PURE__ */
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3276
|
+
showDelete && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3277
|
+
/* @__PURE__ */ jsx22(
|
|
3278
|
+
"button",
|
|
3279
|
+
{
|
|
3280
|
+
onClick: handleDeleteClick,
|
|
3281
|
+
className: "text-acc-500 hover:text-acc-700 p-1",
|
|
3282
|
+
title: "Delete file",
|
|
3283
|
+
"aria-label": "Delete file",
|
|
3284
|
+
children: "\xD7"
|
|
3285
|
+
}
|
|
3286
|
+
),
|
|
3287
|
+
/* @__PURE__ */ jsx22(Dialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: /* @__PURE__ */ jsxs18(DialogContent, { size: "sm", children: [
|
|
3288
|
+
/* @__PURE__ */ jsx22(DialogHeader, { children: /* @__PURE__ */ jsx22(DialogTitle, { children: "Confirm Delete" }) }),
|
|
3289
|
+
/* @__PURE__ */ jsx22(DialogBody, { children: /* @__PURE__ */ jsx22("p", { children: "Are you sure you want to delete this file? This action cannot be undone." }) }),
|
|
3290
|
+
/* @__PURE__ */ jsxs18(DialogFooter, { children: [
|
|
3291
|
+
/* @__PURE__ */ jsx22(Button, { variant: "outline", onClick: () => setDeleteDialogOpen(false), children: "Cancel" }),
|
|
3292
|
+
/* @__PURE__ */ jsx22(Button, { variant: "destructive", onClick: handleDeleteConfirm, children: "Delete" })
|
|
3293
|
+
] })
|
|
3294
|
+
] }) })
|
|
3295
|
+
] })
|
|
3188
3296
|
] }),
|
|
3189
3297
|
children
|
|
3190
3298
|
] });
|
|
@@ -3196,7 +3304,7 @@ function FileDisplayContent({
|
|
|
3196
3304
|
const isLoadingUrl = loadingUrlsRef.current.has(fileRef.id);
|
|
3197
3305
|
const canDownload = !isImage && fileUrl2;
|
|
3198
3306
|
return /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
|
|
3199
|
-
isLoadingUrl ? /* @__PURE__ */ jsx22("div", { className: "w-12 h-12 flex items-center justify-center", children: /* @__PURE__ */ jsx22("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-main-500" }) }) : isImage && fileUrl2 ? /* @__PURE__ */ jsx22(
|
|
3307
|
+
isLoadingUrl ? /* @__PURE__ */ jsx22("div", { className: "w-12 h-12 flex items-center justify-center bg-sec-100 rounded animate-pulse", children: /* @__PURE__ */ jsx22("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-main-500" }) }) : isImage && fileUrl2 ? /* @__PURE__ */ jsx22(
|
|
3200
3308
|
"img",
|
|
3201
3309
|
{
|
|
3202
3310
|
src: fileUrl2,
|
|
@@ -3227,11 +3335,10 @@ function FileDisplayContent({
|
|
|
3227
3335
|
showDelete && onDelete && /* @__PURE__ */ jsx22(
|
|
3228
3336
|
"button",
|
|
3229
3337
|
{
|
|
3230
|
-
onClick:
|
|
3231
|
-
onDelete();
|
|
3232
|
-
},
|
|
3338
|
+
onClick: handleDeleteClick,
|
|
3233
3339
|
className: "text-acc-500 hover:text-acc-700 p-1",
|
|
3234
3340
|
title: "Delete file",
|
|
3341
|
+
"aria-label": "Delete file",
|
|
3235
3342
|
children: "\xD7"
|
|
3236
3343
|
}
|
|
3237
3344
|
)
|
|
@@ -3251,7 +3358,9 @@ function FileDisplayBackwardsCompat({
|
|
|
3251
3358
|
showUpload = false,
|
|
3252
3359
|
showDelete = false,
|
|
3253
3360
|
className = "",
|
|
3254
|
-
children
|
|
3361
|
+
children,
|
|
3362
|
+
loadingComponent,
|
|
3363
|
+
errorComponent
|
|
3255
3364
|
}) {
|
|
3256
3365
|
const {
|
|
3257
3366
|
isLoading: isLoadingForRecord,
|
|
@@ -3272,35 +3381,27 @@ function FileDisplayBackwardsCompat({
|
|
|
3272
3381
|
isLoading: isLoadingCategory,
|
|
3273
3382
|
error: errorCategory
|
|
3274
3383
|
} = useFileReference(supabase);
|
|
3275
|
-
const [
|
|
3276
|
-
const [
|
|
3277
|
-
const
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
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(() => {
|
|
3281
3398
|
if (category) {
|
|
3282
3399
|
const loadCategoryFiles = async () => {
|
|
3283
3400
|
try {
|
|
3284
3401
|
const files = await getFilesByCategory(table_name, record_id, category, organisation_id);
|
|
3285
3402
|
setCategoryFileReferences(files);
|
|
3286
|
-
if (files.length
|
|
3287
|
-
|
|
3288
|
-
setCategoryFileReference(firstFile);
|
|
3289
|
-
let url = null;
|
|
3290
|
-
if (firstFile.is_public) {
|
|
3291
|
-
url = getPublicUrl(supabase, firstFile.file_path, true);
|
|
3292
|
-
} else {
|
|
3293
|
-
const signedUrlResult = await getSignedUrl(supabase, firstFile.file_path, {
|
|
3294
|
-
appName: "file-reference",
|
|
3295
|
-
orgId: organisation_id,
|
|
3296
|
-
expiresIn: 3600
|
|
3297
|
-
});
|
|
3298
|
-
url = signedUrlResult?.url || null;
|
|
3299
|
-
}
|
|
3300
|
-
setCategoryFileUrl(url);
|
|
3301
|
-
} else {
|
|
3302
|
-
setCategoryFileReference(null);
|
|
3303
|
-
setCategoryFileUrl(null);
|
|
3403
|
+
if (files.length === 0) {
|
|
3404
|
+
setCategoryFileReferences([]);
|
|
3304
3405
|
}
|
|
3305
3406
|
} catch (err) {
|
|
3306
3407
|
console.error("[FileDisplayBackwardsCompat] Error loading files by category:", err);
|
|
@@ -3308,57 +3409,33 @@ function FileDisplayBackwardsCompat({
|
|
|
3308
3409
|
};
|
|
3309
3410
|
loadCategoryFiles();
|
|
3310
3411
|
} else {
|
|
3311
|
-
setCategoryFileReference(null);
|
|
3312
|
-
setCategoryFileUrl(null);
|
|
3313
3412
|
setCategoryFileReferences([]);
|
|
3314
3413
|
}
|
|
3315
3414
|
}, [category, table_name, record_id, organisation_id, supabase, getFilesByCategory]);
|
|
3316
|
-
|
|
3415
|
+
useEffect8(() => {
|
|
3317
3416
|
if (!category) {
|
|
3318
3417
|
loadFileCount();
|
|
3319
3418
|
loadFileReferences();
|
|
3320
3419
|
}
|
|
3321
3420
|
}, [loadFileCount, loadFileReferences, category]);
|
|
3322
|
-
|
|
3421
|
+
useEffect8(() => {
|
|
3323
3422
|
if (!category && fileReference) {
|
|
3324
3423
|
loadFileUrl();
|
|
3325
3424
|
}
|
|
3326
3425
|
}, [category, fileReference, loadFileUrl]);
|
|
3327
|
-
|
|
3426
|
+
useEffect8(() => {
|
|
3328
3427
|
if (displayOnly && !category && fileReferences.length > 0) {
|
|
3329
|
-
const
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
setDisplayOnlyFileReference(targetFile);
|
|
3336
|
-
let url = null;
|
|
3337
|
-
if (targetFile.is_public) {
|
|
3338
|
-
url = getPublicUrl(supabase, targetFile.file_path, true);
|
|
3339
|
-
} else {
|
|
3340
|
-
const signedUrlResult = await getSignedUrl(supabase, targetFile.file_path, {
|
|
3341
|
-
appName: "file-reference",
|
|
3342
|
-
orgId: organisation_id,
|
|
3343
|
-
expiresIn: 3600
|
|
3344
|
-
});
|
|
3345
|
-
url = signedUrlResult?.url || null;
|
|
3346
|
-
}
|
|
3347
|
-
setDisplayOnlyFileUrl(url);
|
|
3348
|
-
} catch (err) {
|
|
3349
|
-
console.error("[FileDisplayBackwardsCompat] Error loading displayOnly file:", err);
|
|
3350
|
-
}
|
|
3351
|
-
};
|
|
3352
|
-
loadDisplayOnlyFile();
|
|
3353
|
-
} else if (!displayOnly || category) {
|
|
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 {
|
|
3354
3434
|
setDisplayOnlyFileReference(null);
|
|
3355
|
-
setDisplayOnlyFileUrl(null);
|
|
3356
3435
|
}
|
|
3357
|
-
}, [displayOnly, category, fileReferences
|
|
3436
|
+
}, [displayOnly, category, fileReferences]);
|
|
3358
3437
|
const handleDelete = async () => {
|
|
3359
|
-
|
|
3360
|
-
await deleteFile(true);
|
|
3361
|
-
}
|
|
3438
|
+
await deleteFile(true);
|
|
3362
3439
|
};
|
|
3363
3440
|
let finalFileReference = null;
|
|
3364
3441
|
let finalFileUrl = null;
|
|
@@ -3368,18 +3445,18 @@ function FileDisplayBackwardsCompat({
|
|
|
3368
3445
|
let finalError = null;
|
|
3369
3446
|
if (category) {
|
|
3370
3447
|
finalFileReference = categoryFileReference;
|
|
3371
|
-
finalFileUrl =
|
|
3448
|
+
finalFileUrl = categoryFileUrlHook.url;
|
|
3372
3449
|
finalFileReferences = categoryFileReferences;
|
|
3373
3450
|
finalFileCount = categoryFileReferences.length;
|
|
3374
|
-
finalIsLoading = isLoadingCategory;
|
|
3375
|
-
finalError = errorCategory;
|
|
3451
|
+
finalIsLoading = isLoadingCategory || categoryFileUrlHook.isLoading;
|
|
3452
|
+
finalError = errorCategory || categoryFileUrlHook.error;
|
|
3376
3453
|
} else if (displayOnly) {
|
|
3377
3454
|
finalFileReference = displayOnlyFileReference;
|
|
3378
|
-
finalFileUrl =
|
|
3455
|
+
finalFileUrl = displayOnlyFileUrlHook.url;
|
|
3379
3456
|
finalFileReferences = displayOnlyFileReference ? [displayOnlyFileReference] : [];
|
|
3380
3457
|
finalFileCount = displayOnlyFileReference ? 1 : 0;
|
|
3381
|
-
finalIsLoading = isLoadingForRecord;
|
|
3382
|
-
finalError = errorForRecord;
|
|
3458
|
+
finalIsLoading = isLoadingForRecord || displayOnlyFileUrlHook.isLoading;
|
|
3459
|
+
finalError = errorForRecord || displayOnlyFileUrlHook.error;
|
|
3383
3460
|
} else {
|
|
3384
3461
|
finalFileReference = fileReference;
|
|
3385
3462
|
finalFileUrl = fileUrl;
|
|
@@ -3407,7 +3484,9 @@ function FileDisplayBackwardsCompat({
|
|
|
3407
3484
|
clearError,
|
|
3408
3485
|
supabase,
|
|
3409
3486
|
organisation_id,
|
|
3410
|
-
loadingUrls: /* @__PURE__ */ new Set()
|
|
3487
|
+
loadingUrls: /* @__PURE__ */ new Set(),
|
|
3488
|
+
loadingComponent,
|
|
3489
|
+
errorComponent
|
|
3411
3490
|
}
|
|
3412
3491
|
);
|
|
3413
3492
|
}
|
|
@@ -3420,7 +3499,9 @@ function FileDisplayPublic({
|
|
|
3420
3499
|
showUpload = false,
|
|
3421
3500
|
showDelete = false,
|
|
3422
3501
|
className = "",
|
|
3423
|
-
children
|
|
3502
|
+
children,
|
|
3503
|
+
loadingComponent,
|
|
3504
|
+
errorComponent
|
|
3424
3505
|
}) {
|
|
3425
3506
|
const publicPageContext = useContext(PublicPageContext);
|
|
3426
3507
|
const supabase = publicPageContext?.supabase ?? null;
|
|
@@ -3477,7 +3558,9 @@ function FileDisplayPublic({
|
|
|
3477
3558
|
children,
|
|
3478
3559
|
onDelete: showDelete ? handleDelete : void 0,
|
|
3479
3560
|
supabase,
|
|
3480
|
-
organisation_id
|
|
3561
|
+
organisation_id,
|
|
3562
|
+
loadingComponent,
|
|
3563
|
+
errorComponent
|
|
3481
3564
|
}
|
|
3482
3565
|
);
|
|
3483
3566
|
}
|
|
@@ -3490,7 +3573,9 @@ function FileDisplayAuthenticated({
|
|
|
3490
3573
|
showUpload = false,
|
|
3491
3574
|
showDelete = false,
|
|
3492
3575
|
className = "",
|
|
3493
|
-
children
|
|
3576
|
+
children,
|
|
3577
|
+
loadingComponent,
|
|
3578
|
+
errorComponent
|
|
3494
3579
|
}) {
|
|
3495
3580
|
const { supabase } = useUnifiedAuth();
|
|
3496
3581
|
if (!supabase) {
|
|
@@ -3512,44 +3597,28 @@ function FileDisplayAuthenticated({
|
|
|
3512
3597
|
category,
|
|
3513
3598
|
{ supabase }
|
|
3514
3599
|
);
|
|
3515
|
-
const [displayOnlyFileReference, setDisplayOnlyFileReference] =
|
|
3516
|
-
const
|
|
3517
|
-
|
|
3600
|
+
const [displayOnlyFileReference, setDisplayOnlyFileReference] = useState12(null);
|
|
3601
|
+
const displayOnlyFileUrlFromMap = displayOnlyFileReference ? fileUrls.get(displayOnlyFileReference.id) : null;
|
|
3602
|
+
const displayOnlyFileUrlHook = useFileUrl(
|
|
3603
|
+
displayOnlyFileReference && !displayOnlyFileUrlFromMap ? displayOnlyFileReference : null,
|
|
3604
|
+
{
|
|
3605
|
+
supabase,
|
|
3606
|
+
organisation_id,
|
|
3607
|
+
autoLoad: !displayOnlyFileUrlFromMap && !!displayOnlyFileReference
|
|
3608
|
+
}
|
|
3609
|
+
);
|
|
3610
|
+
const displayOnlyFileUrl = displayOnlyFileUrlFromMap || displayOnlyFileUrlHook.url;
|
|
3611
|
+
useEffect8(() => {
|
|
3518
3612
|
if (displayOnly && !category && fileReferences.length > 0) {
|
|
3519
|
-
const
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
setDisplayOnlyFileReference(targetFile);
|
|
3526
|
-
const existingUrl = fileUrls.get(targetFile.id);
|
|
3527
|
-
if (existingUrl) {
|
|
3528
|
-
setDisplayOnlyFileUrl(existingUrl);
|
|
3529
|
-
return;
|
|
3530
|
-
}
|
|
3531
|
-
let url = null;
|
|
3532
|
-
if (targetFile.is_public) {
|
|
3533
|
-
url = getPublicUrl(supabase, targetFile.file_path, true);
|
|
3534
|
-
} else {
|
|
3535
|
-
const signedUrlResult = await getSignedUrl(supabase, targetFile.file_path, {
|
|
3536
|
-
appName: "file-reference",
|
|
3537
|
-
orgId: organisation_id,
|
|
3538
|
-
expiresIn: 3600
|
|
3539
|
-
});
|
|
3540
|
-
url = signedUrlResult?.url || null;
|
|
3541
|
-
}
|
|
3542
|
-
setDisplayOnlyFileUrl(url);
|
|
3543
|
-
} catch (err) {
|
|
3544
|
-
console.error("[FileDisplayAuthenticated] Error loading displayOnly file:", err);
|
|
3545
|
-
}
|
|
3546
|
-
};
|
|
3547
|
-
loadDisplayOnlyFile();
|
|
3548
|
-
} else if (!displayOnly || category) {
|
|
3613
|
+
const imageFiles = fileReferences.filter(
|
|
3614
|
+
(f) => f.file_metadata.fileType?.startsWith("image/")
|
|
3615
|
+
);
|
|
3616
|
+
const targetFile = imageFiles.length > 0 ? imageFiles[0] : fileReferences[0];
|
|
3617
|
+
setDisplayOnlyFileReference(targetFile);
|
|
3618
|
+
} else {
|
|
3549
3619
|
setDisplayOnlyFileReference(null);
|
|
3550
|
-
setDisplayOnlyFileUrl(null);
|
|
3551
3620
|
}
|
|
3552
|
-
}, [displayOnly, category, fileReferences, fileUrls
|
|
3621
|
+
}, [displayOnly, category, fileReferences, fileUrls]);
|
|
3553
3622
|
const handleDelete = async () => {
|
|
3554
3623
|
console.warn("[FileDisplay] Delete operation needs to be implemented via FileReferenceService");
|
|
3555
3624
|
};
|
|
@@ -3557,17 +3626,23 @@ function FileDisplayAuthenticated({
|
|
|
3557
3626
|
let finalFileUrl = fileUrl;
|
|
3558
3627
|
let finalFileReferences = fileReferences;
|
|
3559
3628
|
let finalFileCount = fileCount;
|
|
3629
|
+
let finalIsLoading = isLoading;
|
|
3630
|
+
let finalError = error;
|
|
3560
3631
|
if (displayOnly && !category) {
|
|
3561
3632
|
finalFileReference = displayOnlyFileReference;
|
|
3562
3633
|
finalFileUrl = displayOnlyFileUrl;
|
|
3563
3634
|
finalFileReferences = displayOnlyFileReference ? [displayOnlyFileReference] : [];
|
|
3564
3635
|
finalFileCount = displayOnlyFileReference ? 1 : 0;
|
|
3636
|
+
if (!displayOnlyFileUrlFromMap) {
|
|
3637
|
+
finalIsLoading = isLoading || displayOnlyFileUrlHook.isLoading;
|
|
3638
|
+
finalError = error || displayOnlyFileUrlHook.error;
|
|
3639
|
+
}
|
|
3565
3640
|
}
|
|
3566
3641
|
return /* @__PURE__ */ jsx22(
|
|
3567
3642
|
FileDisplayContent,
|
|
3568
3643
|
{
|
|
3569
|
-
isLoading,
|
|
3570
|
-
error,
|
|
3644
|
+
isLoading: finalIsLoading,
|
|
3645
|
+
error: finalError,
|
|
3571
3646
|
fileUrl: finalFileUrl,
|
|
3572
3647
|
fileReference: finalFileReference,
|
|
3573
3648
|
fileReferences: finalFileReferences,
|
|
@@ -3580,7 +3655,9 @@ function FileDisplayAuthenticated({
|
|
|
3580
3655
|
children,
|
|
3581
3656
|
onDelete: showDelete ? handleDelete : void 0,
|
|
3582
3657
|
supabase,
|
|
3583
|
-
organisation_id
|
|
3658
|
+
organisation_id,
|
|
3659
|
+
loadingComponent,
|
|
3660
|
+
errorComponent
|
|
3584
3661
|
}
|
|
3585
3662
|
);
|
|
3586
3663
|
}
|
|
@@ -3594,7 +3671,9 @@ function FileDisplay({
|
|
|
3594
3671
|
showUpload = false,
|
|
3595
3672
|
showDelete = false,
|
|
3596
3673
|
className = "",
|
|
3597
|
-
children
|
|
3674
|
+
children,
|
|
3675
|
+
loadingComponent,
|
|
3676
|
+
errorComponent
|
|
3598
3677
|
}) {
|
|
3599
3678
|
if (supabase) {
|
|
3600
3679
|
return /* @__PURE__ */ jsx22(
|
|
@@ -3609,7 +3688,9 @@ function FileDisplay({
|
|
|
3609
3688
|
showUpload,
|
|
3610
3689
|
showDelete,
|
|
3611
3690
|
className,
|
|
3612
|
-
children
|
|
3691
|
+
children,
|
|
3692
|
+
loadingComponent,
|
|
3693
|
+
errorComponent
|
|
3613
3694
|
}
|
|
3614
3695
|
);
|
|
3615
3696
|
}
|
|
@@ -3626,7 +3707,9 @@ function FileDisplay({
|
|
|
3626
3707
|
showUpload,
|
|
3627
3708
|
showDelete,
|
|
3628
3709
|
className,
|
|
3629
|
-
children
|
|
3710
|
+
children,
|
|
3711
|
+
loadingComponent,
|
|
3712
|
+
errorComponent
|
|
3630
3713
|
}
|
|
3631
3714
|
);
|
|
3632
3715
|
}
|
|
@@ -3641,13 +3724,15 @@ function FileDisplay({
|
|
|
3641
3724
|
showUpload,
|
|
3642
3725
|
showDelete,
|
|
3643
3726
|
className,
|
|
3644
|
-
children
|
|
3727
|
+
children,
|
|
3728
|
+
loadingComponent,
|
|
3729
|
+
errorComponent
|
|
3645
3730
|
}
|
|
3646
3731
|
);
|
|
3647
3732
|
}
|
|
3648
3733
|
|
|
3649
3734
|
// src/hooks/useEventLogo.ts
|
|
3650
|
-
import { useState as
|
|
3735
|
+
import { useState as useState13, useEffect as useEffect9, useCallback as useCallback9, useMemo as useMemo10 } from "react";
|
|
3651
3736
|
function defaultGenerateFallbackText(eventName) {
|
|
3652
3737
|
if (!eventName) return "EV";
|
|
3653
3738
|
return eventName.split(" ").map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
|
|
@@ -3676,13 +3761,13 @@ function useEventLogo(supabase, eventId, eventName, organisationId, options = {}
|
|
|
3676
3761
|
validateImage = true,
|
|
3677
3762
|
generateFallbackText = defaultGenerateFallbackText
|
|
3678
3763
|
} = options;
|
|
3679
|
-
const [logoUrl, setLogoUrl] =
|
|
3680
|
-
const [isLoading, setIsLoading] =
|
|
3681
|
-
const [error, setError] =
|
|
3682
|
-
const fallbackText =
|
|
3764
|
+
const [logoUrl, setLogoUrl] = useState13(null);
|
|
3765
|
+
const [isLoading, setIsLoading] = useState13(false);
|
|
3766
|
+
const [error, setError] = useState13(null);
|
|
3767
|
+
const fallbackText = useMemo10(() => {
|
|
3683
3768
|
return eventName ? generateFallbackText(eventName) : "EV";
|
|
3684
3769
|
}, [eventName, generateFallbackText]);
|
|
3685
|
-
const fetchLogo =
|
|
3770
|
+
const fetchLogo = useCallback9(async () => {
|
|
3686
3771
|
if (!eventId || !organisationId || !supabase) {
|
|
3687
3772
|
setLogoUrl(null);
|
|
3688
3773
|
setIsLoading(false);
|
|
@@ -3766,7 +3851,7 @@ function useEventLogo(supabase, eventId, eventName, organisationId, options = {}
|
|
|
3766
3851
|
setIsLoading(false);
|
|
3767
3852
|
}
|
|
3768
3853
|
}, [eventId, organisationId, supabase, cacheTtl, enableCache, validateImage, generateFallbackText]);
|
|
3769
|
-
|
|
3854
|
+
useEffect9(() => {
|
|
3770
3855
|
if (eventId && organisationId && supabase) {
|
|
3771
3856
|
fetchLogo();
|
|
3772
3857
|
} else {
|
|
@@ -3775,7 +3860,7 @@ function useEventLogo(supabase, eventId, eventName, organisationId, options = {}
|
|
|
3775
3860
|
setError(null);
|
|
3776
3861
|
}
|
|
3777
3862
|
}, [eventId, organisationId, supabase, cacheTtl, enableCache, validateImage, generateFallbackText]);
|
|
3778
|
-
const refetch =
|
|
3863
|
+
const refetch = useCallback9(async () => {
|
|
3779
3864
|
if (!eventId || !organisationId || !supabase) return;
|
|
3780
3865
|
if (enableCache) {
|
|
3781
3866
|
const cacheKey = `event_logo_${eventId}_${organisationId}`;
|
|
@@ -3885,7 +3970,7 @@ var TableCaption = React19.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
3885
3970
|
TableCaption.displayName = "TableCaption";
|
|
3886
3971
|
|
|
3887
3972
|
// src/components/PublicLayout/PublicPageHeader.tsx
|
|
3888
|
-
import { Fragment as
|
|
3973
|
+
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3889
3974
|
function PublicPageHeader({
|
|
3890
3975
|
event,
|
|
3891
3976
|
eventCode,
|
|
@@ -3925,7 +4010,7 @@ function PublicPageHeader({
|
|
|
3925
4010
|
) })
|
|
3926
4011
|
] }),
|
|
3927
4012
|
/* @__PURE__ */ jsx24("div", { className: "pb-4", children: /* @__PURE__ */ jsxs19("div", { className: "text-center", children: [
|
|
3928
|
-
event && /* @__PURE__ */ jsxs19(
|
|
4013
|
+
event && /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
3929
4014
|
/* @__PURE__ */ jsx24("h1", { className: "text-3xl font-bold text-gray-900 mb-2", children: event.event_name }),
|
|
3930
4015
|
event.event_venue && /* @__PURE__ */ jsx24("p", { className: "text-md text-gray-500 mb-4", children: event.event_venue })
|
|
3931
4016
|
] }),
|
|
@@ -3939,7 +4024,7 @@ function PublicPageHeader({
|
|
|
3939
4024
|
}
|
|
3940
4025
|
|
|
3941
4026
|
// src/components/PublicLayout/PublicPageFooter.tsx
|
|
3942
|
-
import { Fragment as
|
|
4027
|
+
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3943
4028
|
function PublicPageFooter({
|
|
3944
4029
|
event,
|
|
3945
4030
|
companyName = "Solvera Solutions Pty Ltd",
|
|
@@ -3953,7 +4038,7 @@ function PublicPageFooter({
|
|
|
3953
4038
|
const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
|
|
3954
4039
|
return /* @__PURE__ */ jsx25("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs20("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
|
|
3955
4040
|
logo && /* @__PURE__ */ jsx25("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
|
|
3956
|
-
children && /* @__PURE__ */ jsx25(
|
|
4041
|
+
children && /* @__PURE__ */ jsx25(Fragment8, { children }),
|
|
3957
4042
|
/* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: copyrightText }),
|
|
3958
4043
|
links && links.length > 0 && /* @__PURE__ */ jsx25("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx25("li", { children: /* @__PURE__ */ jsx25("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
|
|
3959
4044
|
] }) });
|
|
@@ -4049,7 +4134,7 @@ function PublicLoadingSkeleton({
|
|
|
4049
4134
|
}
|
|
4050
4135
|
|
|
4051
4136
|
// src/components/PublicLayout/PublicPageLayout.tsx
|
|
4052
|
-
import { useMemo as
|
|
4137
|
+
import { useMemo as useMemo11 } from "react";
|
|
4053
4138
|
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4054
4139
|
function PublicPageLayout({
|
|
4055
4140
|
eventCode,
|
|
@@ -4067,7 +4152,7 @@ function PublicPageLayout({
|
|
|
4067
4152
|
const error = null;
|
|
4068
4153
|
const refetch = async () => {
|
|
4069
4154
|
};
|
|
4070
|
-
const layoutClasses =
|
|
4155
|
+
const layoutClasses = useMemo11(() => {
|
|
4071
4156
|
const baseClasses = "min-h-screen bg-white flex flex-col";
|
|
4072
4157
|
return `${baseClasses} ${className}`.trim();
|
|
4073
4158
|
}, [className]);
|
|
@@ -4132,10 +4217,10 @@ function usePublicPageContext2() {
|
|
|
4132
4217
|
}
|
|
4133
4218
|
|
|
4134
4219
|
// src/components/PublicLayout/PublicPageDebugger.tsx
|
|
4135
|
-
import { useEffect as
|
|
4220
|
+
import { useEffect as useEffect10 } from "react";
|
|
4136
4221
|
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4137
4222
|
function PublicPageDebugger({ enabled = true, label = "PublicPage" }) {
|
|
4138
|
-
|
|
4223
|
+
useEffect10(() => {
|
|
4139
4224
|
if (!enabled) return;
|
|
4140
4225
|
console.log(`[${label}] Component mounted`);
|
|
4141
4226
|
try {
|
|
@@ -4193,10 +4278,10 @@ function PublicPageDebugger({ enabled = true, label = "PublicPage" }) {
|
|
|
4193
4278
|
}
|
|
4194
4279
|
|
|
4195
4280
|
// src/components/PublicLayout/PublicPageDiagnostic.tsx
|
|
4196
|
-
import { useEffect as
|
|
4281
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
4197
4282
|
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4198
4283
|
function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
4199
|
-
const [diagnostics, setDiagnostics] =
|
|
4284
|
+
const [diagnostics, setDiagnostics] = useState14({
|
|
4200
4285
|
hasPublicPageContext: false,
|
|
4201
4286
|
hasAuthContext: false,
|
|
4202
4287
|
hasOrgContext: false,
|
|
@@ -4204,7 +4289,7 @@ function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
|
4204
4289
|
hasEnvironmentVars: false,
|
|
4205
4290
|
routeParams: null
|
|
4206
4291
|
});
|
|
4207
|
-
|
|
4292
|
+
useEffect11(() => {
|
|
4208
4293
|
if (!enabled) return;
|
|
4209
4294
|
const runDiagnostics = () => {
|
|
4210
4295
|
const newDiagnostics = {
|
|
@@ -4318,10 +4403,10 @@ function PublicPageDiagnostic({ enabled = true, label = "PublicPage" }) {
|
|
|
4318
4403
|
}
|
|
4319
4404
|
|
|
4320
4405
|
// src/components/PublicLayout/PublicPageContextChecker.tsx
|
|
4321
|
-
import { useEffect as
|
|
4406
|
+
import { useEffect as useEffect12 } from "react";
|
|
4322
4407
|
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4323
4408
|
function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
4324
|
-
|
|
4409
|
+
useEffect12(() => {
|
|
4325
4410
|
if (!enabled) return;
|
|
4326
4411
|
console.group(`\u{1F6A8} [${label}] PUBLIC PAGE CONTEXT CHECK`);
|
|
4327
4412
|
try {
|
|
@@ -4404,7 +4489,7 @@ function PublicPageContextChecker({ enabled = true, label = "PublicPage" }) {
|
|
|
4404
4489
|
}
|
|
4405
4490
|
|
|
4406
4491
|
// src/components/PublicLayout/EventLogo.tsx
|
|
4407
|
-
import { useMemo as
|
|
4492
|
+
import { useMemo as useMemo12, useContext as useContext2 } from "react";
|
|
4408
4493
|
init_UnifiedAuthProvider();
|
|
4409
4494
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4410
4495
|
var sizeClasses2 = {
|
|
@@ -4455,8 +4540,8 @@ function EventLogoPublic({
|
|
|
4455
4540
|
supabase
|
|
4456
4541
|
}
|
|
4457
4542
|
);
|
|
4458
|
-
const sizeClass =
|
|
4459
|
-
const combinedClasses =
|
|
4543
|
+
const sizeClass = useMemo12(() => sizeClasses2[size || "md"], [size]);
|
|
4544
|
+
const combinedClasses = useMemo12(() => {
|
|
4460
4545
|
const baseClasses = "flex items-center justify-center bg-gray-100 text-gray-600 font-semibold rounded";
|
|
4461
4546
|
return `${baseClasses} ${sizeClass} ${className}`.trim();
|
|
4462
4547
|
}, [sizeClass, className]);
|
|
@@ -4537,8 +4622,8 @@ function EventLogoAuthenticated({
|
|
|
4537
4622
|
generateFallbackText
|
|
4538
4623
|
}
|
|
4539
4624
|
);
|
|
4540
|
-
const sizeClass =
|
|
4541
|
-
const combinedClasses =
|
|
4625
|
+
const sizeClass = useMemo12(() => sizeClasses2[size || "md"], [size]);
|
|
4626
|
+
const combinedClasses = useMemo12(() => {
|
|
4542
4627
|
const baseClasses = "flex items-center justify-center bg-gray-100 text-gray-600 font-semibold rounded";
|
|
4543
4628
|
return `${baseClasses} ${sizeClass} ${className}`.trim();
|
|
4544
4629
|
}, [sizeClass, className]);
|
|
@@ -4714,4 +4799,4 @@ export {
|
|
|
4714
4799
|
EventLogoCompact,
|
|
4715
4800
|
EventLogoLarge
|
|
4716
4801
|
};
|
|
4717
|
-
//# sourceMappingURL=chunk-
|
|
4802
|
+
//# sourceMappingURL=chunk-V5CTX4FR.js.map
|