From 9aeefcffcd838ac9f5c47a99d22bb6ca3c2dc30c Mon Sep 17 00:00:00 2001 From: pghorpade Date: Fri, 25 Oct 2024 18:07:02 -0700 Subject: [PATCH] feat: add components and connect to libguides widget refavtored function --- nuxt.config.ts | 1 + pages/about/status-updates.vue | 93 +- pnpm-lock.yaml | 16096 ++++++++++++++++++------------- 3 files changed, 9237 insertions(+), 6953 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 31346ad32..d17e799ca 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -91,6 +91,7 @@ export default defineNuxtConfig({ } routes.add('/about/reports') routes.add('/help') + routes.add('/about/status-updates') } console.log('prerender:routes ctx.routes', routes) } diff --git a/pages/about/status-updates.vue b/pages/about/status-updates.vue index d227beb7d..dd9a86712 100644 --- a/pages/about/status-updates.vue +++ b/pages/about/status-updates.vue @@ -2,45 +2,41 @@ // COMPONENTS import { NavBreadcrumb, BannerText, BannerHeader, PageAnchor, SectionWrapper, DividerWayFinder, FlexibleBlocks } from 'ucla-library-website-components' -const iframeContent = ref(null) +const content = ref(null) const page = ref({}) const h2Array = ref([]) // anchor tags const { $getHeaders } = useNuxtApp() useHead({ - title: page.value ? page.value.title : '... loading' -}) -const parseParentPageURL = computed(() => { - if (page.value.parent && page.value.parent.uri) - return `/${page.value.parent.uri}/` - - return '/' -}) - -const parseParentTitle = computed(() => { - if (page.value.parent && page.value.parent.title) - return page.value.parent.title - - return 'Home' -}) - -const parsedButtonText = computed(() => { - return _get(page.value, 'button[0].buttonText', '') + title: '' }) +const bannerSummary = ref("") +// Define options for formatting +const options = { + weekday: 'long', // Full name of the day + year: 'numeric', // Full numeric year + month: 'long', // Full name of the month + day: 'numeric' // Numeric day of the month +} -const parsedButtonTo = computed(() => { - return _get(page.value, 'button[0].buttonUrl', '') -}) onMounted(async () => { // console.log("fetching data in onmounted from libguides proxy service") try { - const response = await $fetch('https://libguides-proxy.library.ucla.edu/api/libguides-proxy') + const response = await $fetch('https://libguides-proxy.library.ucla.edu/api/libguides/library/status/updates/proxy') + + // const response = await $fetch('http://localhost:8888/api/libguides/library/status/updates/proxy') // console.log("Response from libguides proxy:", response) - iframeContent.value = response + content.value = response + page.value.blocks = response + const today = new Date() + // Format the date with options + const formattedDate = today.toLocaleDateString('en-US', options) + bannerSummary.value = `Last updated ${formattedDate}.` + // Call the plugin method to get the .section-header2 and .section-header3 elements h2Array.value = $getHeaders.getHeadersMethod() } catch (error) { - console.error('Error fetching iframe content:', error) + console.error('Error fetching libguides content:', error) } }) @@ -51,34 +47,19 @@ onMounted(async () => { class="page page-general-content" >