diff --git a/backend/src/db/api/ui_elements.js b/backend/src/db/api/ui_elements.js index 46f2d70..d42b59e 100644 --- a/backend/src/db/api/ui_elements.js +++ b/backend/src/db/api/ui_elements.js @@ -93,8 +93,11 @@ class Ui_elementsDBApi extends GenericDBApi { sort_order: 4, default_settings_json: { label: 'Description', - descriptionTitle: 'Description title', - descriptionText: 'Description text', + descriptionTitle: 'TITLE', + descriptionText: '', + descriptionTitleFontSize: '48px', + descriptionTextFontSize: '36px', + descriptionBackgroundColor: 'transparent', appearDelaySec: 0, appearDurationSec: null, }, diff --git a/frontend/src/pages/constructor.tsx b/frontend/src/pages/constructor.tsx index f31f35d..0aa1bfc 100644 --- a/frontend/src/pages/constructor.tsx +++ b/frontend/src/pages/constructor.tsx @@ -31,6 +31,8 @@ type TourPage = { slug?: string; sort_order?: number; environment?: string; + source_key?: string; + requires_auth?: boolean; ui_schema_json?: string; background_image_url?: string; background_video_url?: string; @@ -117,6 +119,9 @@ type CanvasElement = { tooltipText?: string; descriptionTitle?: string; descriptionText?: string; + descriptionTitleFontSize?: string; + descriptionTextFontSize?: string; + descriptionBackgroundColor?: string; navLabel?: string; navType?: NavigationButtonKind; targetPageId?: string; @@ -479,8 +484,11 @@ const createDefaultElement = ( return { ...base, iconUrl: '', - descriptionTitle: 'Description title', - descriptionText: 'Description text', + descriptionTitle: 'TITLE', + descriptionText: '', + descriptionTitleFontSize: '48px', + descriptionTextFontSize: '36px', + descriptionBackgroundColor: 'transparent', }; } @@ -515,11 +523,16 @@ const mergeElementWithDefaults = ( if (!defaults) return element; const preferElementValues = Boolean(options?.preferElementValues); + const base = preferElementValues ? defaults : element; + const override = preferElementValues ? element : defaults; const merged: CanvasElement = { - ...(preferElementValues ? defaults : element), - ...(preferElementValues ? element : defaults), + ...base, + ...override, id: element.id, type: element.type, + label: element.label || defaults.label || element.type, + xPercent: element.xPercent ?? defaults.xPercent ?? 50, + yPercent: element.yPercent ?? defaults.yPercent ?? 50, }; merged.xPercent = clamp(Number(merged.xPercent ?? element.xPercent), 0, 100); @@ -691,7 +704,7 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => { useState('none'); const [transitionPreview, setTransitionPreview] = useState(null); - const [pendingNavigationPageId, setPendingNavigationPageId] = useState(''); + const [_pendingNavigationPageId, setPendingNavigationPageId] = useState(''); const [isLoading, setIsLoading] = useState(true); const [isSaving, setIsSaving] = useState(false); @@ -2094,14 +2107,34 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => { ); } + const bgColor = element.descriptionBackgroundColor || 'transparent'; return ( -
-

- {element.descriptionTitle} -

-

- {element.descriptionText || 'Description text'} +

+

+ {element.descriptionTitle || 'TITLE'}

+ {element.descriptionText && ( +

+ {element.descriptionText} +

+ )}
); } @@ -3414,6 +3447,51 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => { } />
+
+ + + updateSelectedElement({ + descriptionTitleFontSize: event.target.value, + }) + } + placeholder='e.g. 48px' + /> +
+
+ + + updateSelectedElement({ + descriptionTextFontSize: event.target.value, + }) + } + placeholder='e.g. 36px' + /> +
+
+ + + updateSelectedElement({ + descriptionBackgroundColor: event.target.value, + }) + } + placeholder='e.g. transparent, #ffffff, rgba(0,0,0,0.5)' + /> +
)}