From 5af81f90489b5c5f4e33dc29b0a7e733702b63d1 Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Thu, 29 Dec 2022 07:49:55 +0300 Subject: [PATCH] Move the home and 404 pages to default layout --- .../VContentSwitcher/VSearchTypePopover.vue | 21 +- src/components/VFourOhFour.vue | 25 +- .../VSearchBar/VStandaloneSearchBar.vue | 29 +- .../VSearchBar/VStandaloneSearchBarOld.vue | 97 +++++++ src/components/VHomeGallery/VHomeGallery.vue | 3 + src/components/VHomepageContent.vue | 66 +++++ src/components/VImageCarousel.vue | 96 +++++++ src/components/VOldHomepageContent.vue | 120 ++++++++ src/components/VSourcesTable.vue | 2 +- src/composables/use-match-routes.ts | 7 + src/layouts/default.vue | 86 +++--- src/layouts/error.vue | 6 +- src/pages/index.vue | 265 ++++-------------- src/pages/search-help.vue | 2 +- src/pages/sources.vue | 9 +- tailwind.config.js | 1 + 16 files changed, 557 insertions(+), 278 deletions(-) create mode 100644 src/components/VHeaderOld/VSearchBar/VStandaloneSearchBarOld.vue create mode 100644 src/components/VHomepageContent.vue create mode 100644 src/components/VImageCarousel.vue create mode 100644 src/components/VOldHomepageContent.vue diff --git a/src/components/VContentSwitcher/VSearchTypePopover.vue b/src/components/VContentSwitcher/VSearchTypePopover.vue index 8b68f6675d..10f00cd915 100644 --- a/src/components/VContentSwitcher/VSearchTypePopover.vue +++ b/src/components/VContentSwitcher/VSearchTypePopover.vue @@ -16,14 +16,16 @@ id="content-switcher-popover" class="min-w-[262px] pt-2" size="small" - :use-links="true" - @select="closePopover" + :use-links="placement !== 'searchbar'" + @select="handleSelect" /> + diff --git a/src/components/VHomeGallery/VHomeGallery.vue b/src/components/VHomeGallery/VHomeGallery.vue index 6a2da00cf9..46383b8b61 100644 --- a/src/components/VHomeGallery/VHomeGallery.vue +++ b/src/components/VHomeGallery/VHomeGallery.vue @@ -57,6 +57,8 @@ import { import { useReducedMotion } from "~/composables/use-media-query" import useResizeObserver from "~/composables/use-resize-observer" +import VLink from "~/components/VLink.vue" + import imageInfo from "~/assets/homepage_images/image_info.json" export const GALLERY_SETS = [ @@ -74,6 +76,7 @@ export type GallerySet = typeof GALLERY_SETS[number] */ export default defineComponent({ name: "VHomeGallery", + components: { VLink }, props: { /** * the set of images to use for the gallery grid diff --git a/src/components/VHomepageContent.vue b/src/components/VHomepageContent.vue new file mode 100644 index 0000000000..9afed6c67a --- /dev/null +++ b/src/components/VHomepageContent.vue @@ -0,0 +1,66 @@ + + + diff --git a/src/components/VImageCarousel.vue b/src/components/VImageCarousel.vue new file mode 100644 index 0000000000..50ab1d7ee9 --- /dev/null +++ b/src/components/VImageCarousel.vue @@ -0,0 +1,96 @@ + + + diff --git a/src/components/VOldHomepageContent.vue b/src/components/VOldHomepageContent.vue new file mode 100644 index 0000000000..c794a3cd28 --- /dev/null +++ b/src/components/VOldHomepageContent.vue @@ -0,0 +1,120 @@ + + + diff --git a/src/components/VSourcesTable.vue b/src/components/VSourcesTable.vue index a4af9eaa93..c9b89f8e7d 100644 --- a/src/components/VSourcesTable.vue +++ b/src/components/VSourcesTable.vue @@ -2,7 +2,7 @@ diff --git a/src/composables/use-match-routes.ts b/src/composables/use-match-routes.ts index cbcccaf007..1405bb9bf0 100644 --- a/src/composables/use-match-routes.ts +++ b/src/composables/use-match-routes.ts @@ -7,6 +7,7 @@ import { } from "@nuxtjs/composition-api" import { ALL_MEDIA, searchTypes, supportedSearchTypes } from "~/constants/media" +import usePages from "~/composables/use-pages" /** * Reactive property that returns true only on the matching routes. @@ -63,4 +64,10 @@ export const useMatchSingleResultRoutes = () => { return useMatchRoute(routes) } +export const useMatchContentPageRoutes = () => { + const routes = usePages() + .all.filter((page) => page.link.startsWith("/")) + .map((page) => page.id) + return useMatchRoute(routes) +} export const useMatchHomeRoute = () => useMatchRoute(["index"]) diff --git a/src/layouts/default.vue b/src/layouts/default.vue index a105a755b2..21a219b247 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -1,45 +1,58 @@