diff --git a/app/Http/Controllers/PageRender.php b/app/Http/Controllers/PageRender.php index 5c2e37f..c192b70 100644 --- a/app/Http/Controllers/PageRender.php +++ b/app/Http/Controllers/PageRender.php @@ -7,7 +7,6 @@ use Illuminate\Http\Request; use Inertia\Inertia; use App\Helpers\PageBlocksHelper; -use App\Helpers\PageSettingsHelper; use App\Models\Page; use App\Models\PageRevision; diff --git a/resources/js/composables/useAppearance.ts b/resources/js/composables/useAppearance.ts index 8abf354..0f2da05 100644 --- a/resources/js/composables/useAppearance.ts +++ b/resources/js/composables/useAppearance.ts @@ -8,7 +8,7 @@ export function updateTheme(value: Appearance) { } if (value === 'system') { - const mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)'); + const mediaQueryList = window.matchMedia('(prefers-color-scheme: light)'); const systemTheme = mediaQueryList.matches ? 'dark' : 'light'; document.documentElement.classList.toggle('dark', systemTheme === 'dark'); diff --git a/resources/js/pages/Backend/PageBuilder/Preview.vue b/resources/js/pages/Backend/PageBuilder/Preview.vue index 9bd0277..0b39952 100644 --- a/resources/js/pages/Backend/PageBuilder/Preview.vue +++ b/resources/js/pages/Backend/PageBuilder/Preview.vue @@ -5,10 +5,6 @@ import { ScrollTrigger } from 'gsap/ScrollTrigger'; import { ScrollToPlugin } from 'gsap/ScrollToPlugin'; import { on } from '@/Components/EventBus.vue'; - - import MainMenu from '@/Components/FrontPage/MenyComponent.vue'; - import ExternalMainMenu from '@/Components/FrontPage/ExternalMenuComponent.vue'; - import SmallHeader from '@/Components/FrontPage/SmallHeader.vue'; import HeroLogoTextRendered from '@/Components/Blocks/Heroes/HeroLogoTextRendered.vue'; @@ -37,139 +33,12 @@ menuLinks: { type: Object, default: () => ({}) } }); - onMounted(() => { - // Check if the url has the parameter key scrollTo - if (urlParam('scrollTo')) { - // Enable scrolling on the body and html elements - document.body.style.overflow = 'auto'; - document.documentElement.style.overflow = 'auto'; - // Get the value of the parameter - const scrollTo = urlParam('scrollTo'); - - // Scroll to the section with the id that matches the value of the parameter - gsap.to(window, { - duration: 1, - scrollTo: { - y: `#${scrollTo}`, - autoKill: false, - }, - }); - } - }); - gsap.registerPlugin(ScrollToPlugin, ScrollTrigger); const useEventBus = ref(false); const showMainMenu = ref(false); const pageRef = ref(); const page = usePage(); - const smallHeader = ref(null); - - const showErrorModal = ref(false); - const errorStatus = ref(''); - - const closeErrorModal = () => { - showErrorModal.value = false; - }; - - // Lytt etter errorModal event fra Laravel - window.addEventListener('errorModal', (event) => { - showErrorModal.value = true; - errorStatus.value = event.detail.status; - }); - - /** Menu button animations */ - const menuButton = ref(null); - - const handleMenuButtonOver = () => { - gsap.set(menuButton.value, { - borderRadius: '0.375rem', - }); - gsap.to(menuButton.value, { - duration: 0.2, - scale: 1.1, - }); - }; - - const handleMenuButtonOut = () => { - gsap.set(menuButton.value, { - borderRadius: '9999px', - }); - gsap.to(menuButton.value, { - duration: 0.2, - scale: 1, - }); - }; - - const clickMenuButton = () => { - showMainMenu.value = !showMainMenu.value; - - if (showMainMenu.value) { - document.body.style.overflow = 'hidden'; - document.documentElement.style.overflow = 'hidden'; - } else { - document.body.style.overflow = 'auto'; - document.documentElement.style.overflow = 'auto'; - } - }; - - /** Get a node value from json */ - - const extractMetaValue = (node, key) => { - let meta = JSON.parse(node.fs_meta); - - return meta[key]; - }; - - /** - * formatDate - * - * Formats a date string to a Norwegian date format. - * - * @param { - * } dateString - */ - - const formatDate = (dateString) => { - const date = new Date(dateString); - const day = ('0' + date.getDate()).slice(-2); - const month = ('0' + (date.getMonth() + 1)).slice(-2); - const year = date.getFullYear(); - - return `${day}/${month}/${year}`; - }; - - /** - * dateString - * - * Formats a date string to a Norwegian time format. - * @param {*} dateString - */ - - const formatTime = (dateString) => { - const date = new Date(dateString); - return date.toLocaleTimeString('nb-NO', { hour: '2-digit', minute: '2-digit' }); - }; - - /** Get url parameters */ - - const urlParam = (paramKey) => { - const url = new URL(window.location.href); - return url.searchParams.get(paramKey); - }; - - // Denne funksjonen kalles fra lenker på siden for å - // Gi siden en myk fade ut effekt før den nye siden lastes - const loadLink = (url) => { - gsap.to(pageRef.value, { - duration: 1, - opacity: 0, - ease: 'power2.inOut', - onComplete: () => { - router.visit(url); - }, - }); - }; const components = { HeroLogoTextRendered, @@ -188,70 +57,6 @@ PageFooterRendered }; - /** Eventbus listeners */ - - on('linkClicked', (payload) => { - if (payload === 'om' && useEventBus.value) { - clickMenuButton(); - gsap.to(window, { - duration: 1, - scrollTo: { - y: '#content', - autoKill: false, - }, - }); - } else if (payload === 'arrangementer' && useEventBus.value) { - clickMenuButton(); - gsap.to(window, { - duration: 1, - scrollTo: { - y: '#events', - autoKill: false, - }, - }); - } else if (payload === 'nyheter' && useEventBus.value) { - clickMenuButton(); - gsap.to(window, { - duration: 1, - scrollTo: { - y: '#intro', - autoKill: false, - }, - }); - } else if (payload === 'sponsor' && useEventBus.value) { - clickMenuButton(); - gsap.to(window, { - duration: 1, - scrollTo: { - y: '#sponsors-intro', - autoKill: false, - }, - }); - } else if (payload === 'medlem' && useEventBus.value) { - clickMenuButton(); - gsap.to(window, { - duration: 1, - scrollTo: { - y: '#membership', - autoKill: false, - }, - }); - } else if (payload === 'medlemside' && useEventBus.value) { - clickMenuButton(); - loadLink(route('page-builder.index')); - } else if (payload === 'loggpaa' && useEventBus.value) { - clickMenuButton(); - loadLink(route('login')); - } else if (payload === 'registrer' && useEventBus.value) { - clickMenuButton(); - loadLink(route('register')); - } - }); - - on('eventBusActive', (payload) => { - useEventBus.value = payload; - }); -