From 9815cdf8d294605d0788147d4fcde74b58ec3eae Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Tue, 30 Apr 2024 21:10:27 +0200 Subject: [PATCH] Fix TS errors, combine utils and update share btn text on bps --- .../mobile/MenuMobileNavigationDropdown.vue | 16 +- .../components/sidebar/left/SidebarLeft.vue | 16 +- frontend/pages/events/[id]/about.vue | 27 +- frontend/pages/organizations/[id]/about.vue | 29 +- .../organizations/[id]/groups/[id]/about.vue | 29 +- frontend/utils/pathUtils.ts | 16 - frontend/utils/routeUtils.ts | 17 + frontend/yarn.lock | 343 +++++++++--------- 8 files changed, 296 insertions(+), 197 deletions(-) delete mode 100644 frontend/utils/pathUtils.ts diff --git a/frontend/components/menu/mobile/MenuMobileNavigationDropdown.vue b/frontend/components/menu/mobile/MenuMobileNavigationDropdown.vue index f45dbacf9..eefb65935 100644 --- a/frontend/components/menu/mobile/MenuMobileNavigationDropdown.vue +++ b/frontend/components/menu/mobile/MenuMobileNavigationDropdown.vue @@ -77,15 +77,21 @@ import { import type MenuEntry from "~/types/menu-entry"; import { SidebarType } from "~/types/sidebar-type"; import { - isCurrentRoutePathSubpageOf, currentRoutePathIncludes, -} from "~/utils/pathUtils"; + isCurrentRoutePathSubpageOf, +} from "~/utils/routeUtils"; const { currentRoute } = useRouter(); const routeName = currentRoute.value.name; +let routeToCheck = routeName; +if (routeToCheck) { + routeToCheck = routeToCheck.toString(); +} else { + routeToCheck = ""; +} -const isOrgPage = isCurrentRoutePathSubpageOf("organizations", routeName); -const isEventPage = isCurrentRoutePathSubpageOf("events", routeName); +const isOrgPage = isCurrentRoutePathSubpageOf("organizations", routeToCheck); +const isEventPage = isCurrentRoutePathSubpageOf("events", routeToCheck); const pathToSidebarTypeMap = [ { path: "search", type: SidebarType.SEARCH }, @@ -104,7 +110,7 @@ const pathToSidebarTypeMap = [ const sidebarType = pathToSidebarTypeMap.find((item) => - currentRoutePathIncludes(item.path, routeName) + currentRoutePathIncludes(item.path, routeToCheck) )?.type || SidebarType.MISC; const menuEntryState = useMenuEntriesState(); const selectedMenuItem = ref(undefined); diff --git a/frontend/components/sidebar/left/SidebarLeft.vue b/frontend/components/sidebar/left/SidebarLeft.vue index 4dc4de0a4..0a277406b 100644 --- a/frontend/components/sidebar/left/SidebarLeft.vue +++ b/frontend/components/sidebar/left/SidebarLeft.vue @@ -62,9 +62,9 @@ import type { Filters } from "~/types/filters"; import { SearchBarLocation } from "~/types/location"; import { SidebarType } from "~/types/sidebar-type"; import { - isCurrentRoutePathSubpageOf, currentRoutePathIncludes, -} from "~/utils/pathUtils"; + isCurrentRoutePathSubpageOf, +} from "~/utils/routeUtils"; defineProps<{ name?: string; @@ -74,9 +74,15 @@ const sidebar = useSidebar(); const route = useRoute(); const { currentRoute } = useRouter(); const routeName = currentRoute.value.name; +let routeToCheck = routeName; +if (routeToCheck) { + routeToCheck = routeToCheck.toString(); +} else { + routeToCheck = ""; +} -const isOrgPage = isCurrentRoutePathSubpageOf("organizations", routeName); -const isEventPage = isCurrentRoutePathSubpageOf("events", routeName); +const isOrgPage = isCurrentRoutePathSubpageOf("organizations", routeToCheck); +const isEventPage = isCurrentRoutePathSubpageOf("events", routeToCheck); const pathToSidebarTypeMap = [ { path: "search", type: SidebarType.SEARCH }, @@ -95,7 +101,7 @@ const pathToSidebarTypeMap = [ const sidebarType = pathToSidebarTypeMap.find((item) => - currentRoutePathIncludes(item.path, routeName) + currentRoutePathIncludes(item.path, routeToCheck) )?.type || SidebarType.MISC; // TODO: Use real name of organization / event when available from backend. diff --git a/frontend/pages/events/[id]/about.vue b/frontend/pages/events/[id]/about.vue index 63db87c7f..cb8ecb67a 100644 --- a/frontend/pages/events/[id]/about.vue +++ b/frontend/pages/events/[id]/about.vue @@ -34,8 +34,8 @@ @keydown.enter="openModal()" class="w-max" :cta="true" - :label="$t('components._global.share-event')" - :hideLabelOnMobile="true" + :label="$t(shareButtonLabel)" + :hideLabelOnMobile="false" fontSize="sm" leftIcon="bi:box-arrow-up" iconSize="1.45em" @@ -88,6 +88,7 @@