Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: APPS-2904 #857

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLayoutState } from './composables/useLayoutState'

provide('theme', computed(() => ''))
const { enabled, state } = usePreviewMode()
// console.log('App.vue', enabled.value, state.token)
console.log('App.vue', enabled.value, state.token)
const route = useRoute()

const globalStore = useGlobalStore()
Expand Down Expand Up @@ -40,6 +40,7 @@ const { $alerts } = useNuxtApp()
const { $layoutData } = useNuxtApp()
watch(globalStore.header, (newVal, oldVal) => {
console.log('Global store changed for draft previews', newVal, oldVal)
setLayoutData(globalStore)
})

onMounted(async () => {
Expand All @@ -48,8 +49,6 @@ onMounted(async () => {
if (process.env.NODE_ENV !== 'development' && (route.query?.preview === 'true' || enabled.value) && (route.query?.token !== undefined || state?.token !== undefined)) {
await $layoutData()
}
classes.value.push({ 'has-scrolled': globalStore.sTop })
classes.value.push({ 'has-scrolled-past-header': globalStore.sTop >= 150 })
await $alerts()
})

Expand Down
7 changes: 3 additions & 4 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// components need to be imported for nitro crawling in static mode
import { HeaderSmart, SectionWrapper, SiteNotificationAlert, FooterPrimary, FooterSock } from 'ucla-library-website-components'

provide('theme', computed(() => ''))
const shouldIncludeExtraScript = computed(() => {
if (useRuntimeConfig().public.hostName.includes('stage'))
return true
Expand Down Expand Up @@ -40,7 +41,7 @@ useHead({
: [])
]
})

const { enabled, state } = usePreviewMode()
const layoutCustomProps = useAttrs()
const globalStore = useGlobalStore()
// console.log('In default layout:', globalStore.header)
Expand Down Expand Up @@ -80,7 +81,7 @@ watch(globalStore.header, (newVal, oldVal) => {
})

onMounted(async () => {
// console.log('onMounted in Default layout')
console.log('In default layout', enabled.value, state?.token)
/* document.addEventListener('visibilitychange', async () => {
if (document.visibilityState === 'visible') {
const data = await $graphql.default.request(Globals)
Expand All @@ -102,8 +103,6 @@ onMounted(async () => {
console.log('In SSG refresh layout data as state is not maintained after an error response')
await $layoutData()
}
classes.value.push({ 'has-scrolled': globalStore.sTop })
classes.value.push({ 'has-scrolled-past-header': globalStore.sTop >= 150 })
await $alerts()
})
</script>
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"lint": "eslint . --ext .vue,.js,.ts --ignore-path .gitignore",
"lint:fix": "eslint --fix . --ext .vue,.js,.ts --ignore-path .gitignore",
"typecheck": "nuxi typecheck",
"test": "pnpm lint && pnpm typecheck",
"library": ""
"test": "pnpm lint && pnpm typecheck"
},
"dependencies": {
"@nuxtjs/sitemap": "^5.1.1",
Expand All @@ -41,6 +40,6 @@
"nuxt-graphql-request": "^7.0.5",
"sass": "^1.66.1",
"ucla-library-design-tokens": "^5.22.0",
"ucla-library-website-components": "^3.14.1"
"ucla-library-website-components": "^3.24.0"
}
}
27 changes: 0 additions & 27 deletions plugins/browser-events.client.js

This file was deleted.

23 changes: 0 additions & 23 deletions plugins/getScrollInfo.client.js

This file was deleted.

Loading
Loading