diff --git a/hifi-src/src/components/PublicLayout.jsx b/hifi-src/src/components/PublicLayout.jsx index 4e21ccf..d227c9c 100644 --- a/hifi-src/src/components/PublicLayout.jsx +++ b/hifi-src/src/components/PublicLayout.jsx @@ -44,7 +44,7 @@ const DEFAULT_SITE_SETTINGS = { package_card_theme: 'graphite', package_card_layout: 'strip', package_wheel_hint_interval: 8, - gallery_card_text_align: 'left', + gallery_card_text_x: 0, }; // Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG diff --git a/hifi-src/src/context/SiteSettingsContext.jsx b/hifi-src/src/context/SiteSettingsContext.jsx index 69db87d..ef5cc82 100644 --- a/hifi-src/src/context/SiteSettingsContext.jsx +++ b/hifi-src/src/context/SiteSettingsContext.jsx @@ -14,7 +14,7 @@ const SiteSettingsContext = createContext({ business_hours: null, hero_image_path: null, ga_measurement_id: null, - gallery_card_text_align: 'left', + gallery_card_text_x: 0, }); export const SiteSettingsProvider = SiteSettingsContext.Provider; diff --git a/hifi-src/src/pages/admin/settings/WebsiteSettings.jsx b/hifi-src/src/pages/admin/settings/WebsiteSettings.jsx index 0ac29a2..c3cc993 100644 --- a/hifi-src/src/pages/admin/settings/WebsiteSettings.jsx +++ b/hifi-src/src/pages/admin/settings/WebsiteSettings.jsx @@ -1,7 +1,7 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { api } from '../../../api/client.js'; import ImageUploadField from '../../../components/ImageUploadField.jsx'; -import { GALLERY_CARD_ALIGN } from '../../../utils/galleryCardAlign.js'; +import { galleryCardLabelStyle } from '../../../utils/galleryCardAlign.js'; const DAYS = [ { key: 'mon', label: 'Montag' }, @@ -32,15 +32,9 @@ const emptyForm = { package_card_theme: 'graphite', package_card_layout: 'strip', package_wheel_hint_interval: 8, - gallery_card_text_align: 'left', + gallery_card_text_x: 0, }; -const GALLERY_CARD_ALIGN_OPTIONS = [ - { value: 'left', label: 'Links' }, - { value: 'center', label: 'Mittig' }, - { value: 'right', label: 'Rechts' }, -]; - const PACKAGE_CARD_THEMES = [ { value: 'graphite', label: 'Graphite Green', description: 'Graphit über Bronze/Silber/Gold/Platin bis zur Onyx-Krönung.' }, { value: 'deep-blue', label: 'Deep Blue Luxury', description: 'Kühles Blau, das sich über Grün zu Gold erwärmt.' }, @@ -59,9 +53,31 @@ export default function WebsiteSettings() { const [busy, setBusy] = useState(false); const [saved, setSaved] = useState(false); const [error, setError] = useState(''); - // Fuer die Live-Vorschau der Bildergalerie-Kachel-Ausrichtung - eine echte, bereits + // Fuer die Live-Vorschau der Bildergalerie-Kachel-Position - eine echte, bereits // hochgeladene Marke (falls vorhanden), damit die Vorschau zeigt, wie es wirklich aussieht. const [previewBrand, setPreviewBrand] = useState(null); + const galleryPreviewRef = useRef(null); + const [galleryDragging, setGalleryDragging] = useState(false); + + const galleryXFromPointer = (clientX) => { + const rect = galleryPreviewRef.current.getBoundingClientRect(); + const pct = ((clientX - rect.left) / rect.width) * 100; + return Math.max(0, Math.min(100, Math.round(pct))); + }; + const handleGalleryDragStart = (e) => { + e.preventDefault(); + e.currentTarget.setPointerCapture(e.pointerId); + setGalleryDragging(true); + update('gallery_card_text_x', galleryXFromPointer(e.clientX)); + }; + const handleGalleryDragMove = (e) => { + if (!galleryDragging) return; + update('gallery_card_text_x', galleryXFromPointer(e.clientX)); + }; + const handleGalleryDragEnd = (e) => { + setGalleryDragging(false); + e.currentTarget.releasePointerCapture(e.pointerId); + }; const [gaPropertyId, setGaPropertyId] = useState(''); const [gaServiceAccountJson, setGaServiceAccountJson] = useState(''); @@ -98,7 +114,7 @@ export default function WebsiteSettings() { package_card_theme: res.package_card_theme || 'graphite', package_card_layout: res.package_card_layout || 'strip', package_wheel_hint_interval: res.package_wheel_hint_interval || 8, - gallery_card_text_align: res.gallery_card_text_align || 'left', + gallery_card_text_x: res.gallery_card_text_x ?? 0, }) ) .finally(() => setLoading(false)); @@ -437,38 +453,58 @@ export default function WebsiteSettings() { Ausrichtung des Marken-/Projekt-Namens auf den Kacheln der Bildergalerie-Übersicht und der Marken-Detailseite.
-Live-Vorschau
+Namen zum Verschieben ziehen
+ Position:{' '} + + {form.gallery_card_text_x}% + +
+Schnellauswahl
+this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(DN.current||A4(),this.shouldReduceMotion=Zp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),rn(this.notifyUpdate),rn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&hN.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:u,duration:d}=n.accelerate,h=new uN({element:this.current,name:e,keyframes:a,times:l,ease:u,duration:Ot(d)}),f=o(h);this.valueSubscriptions.set(e,()=>{f(),h.cancel()});return}const r=co.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&oe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in xu){const n=xu[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Be()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(DN.current||P4(),this.shouldReduceMotion=Xp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),rn(this.notifyUpdate),rn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&hN.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:u,duration:d}=n.accelerate,h=new uN({element:this.current,name:e,keyframes:a,times:l,ease:u,duration:Ot(d)}),f=o(h);this.valueSubscriptions.set(e,()=>{f(),h.cancel()});return}const r=ho.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&oe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in xu){const n=xu[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ve()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r 1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=nqy&&(e.x=1),e.yt*1e3,Xt=t=>t/1e3,zg=(t,e)=>e?t*(1e3/e):0,RS=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,i3=1e-7,o3=12;function a3(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=RS(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>i3&&++a=pu?1/0:e}function H3(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Kg(r),pu);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Xt(s)}}const Ae={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Rp(t,e){return t*Math.sqrt(1-e*e)}const U3=12;function W3(t,e,n){let r=n;for(let s=1;sqy&&(e.x=1),e.y