-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* done dashboard page layout * add loading state and fix hydration errors * add i18n and minor fixes
- Loading branch information
Showing
15 changed files
with
552 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script setup lang="ts"> | ||
const isSmallScreen = useMediaQuery('(max-width: 640px)') | ||
const props = defineProps<{ | ||
product: Product | ||
}>() | ||
function goToItem () { | ||
return navigateTo(props.product.link, { external: true }) | ||
} | ||
</script> | ||
<template> | ||
<UCard | ||
as="li" | ||
:ui="{ base: 'border-l-[3px] border-transparent hover:border-blue-500 focus-within:border-blue-500 cursor-pointer' }" | ||
@click="goToItem" | ||
> | ||
<div class="flex flex-col gap-6 sm:flex-row sm:gap-8"> | ||
<img | ||
v-if="product.image" | ||
class="mx-auto h-[183px] w-[244px]" | ||
:src="`/${product.image}`" | ||
> | ||
<div class="flex flex-col justify-between"> | ||
<div class="space-y-4 pb-4"> | ||
<a | ||
:href="product.link" | ||
:aria-describedby="product.text" | ||
class="text-2xl font-semibold text-bcGovColor-darkGray no-underline focus:outline-none" | ||
> | ||
{{ product.title }} | ||
</a> | ||
<p class="text-lg text-bcGovColor-midGray"> | ||
{{ product.text }} | ||
</p> | ||
</div> | ||
<UButton | ||
tabindex="-1" | ||
label="Open" | ||
class="pointer-events-none self-start px-5 py-3" | ||
trailing | ||
:block="isSmallScreen" | ||
icon="i-mdi-chevron-right" | ||
/> | ||
</div> | ||
</div> | ||
</UCard> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
export function useProductInfo () { | ||
const config = useRuntimeConfig().public | ||
const accountStore = useConnectAccountStore() | ||
const { t } = useI18n() | ||
|
||
function appendAccountId (url: string): string { | ||
return url ? `${url}?accountid=${accountStore.currentAccount.id}` : 'link_not_configured' | ||
} | ||
|
||
/** | ||
* Returns product info object for specified type. | ||
*/ | ||
function getProductInfo (type: ProductCode): Product { | ||
switch (type) { | ||
case ProductCode.BUSINESS: | ||
return { | ||
image: 'img/BCRS_dashboard_thumbnail_image.jpg', | ||
link: config.myBusinessRegistryDashboard.replace('{accountId}', accountStore.currentAccount.id) || 'link_not_configured', | ||
text: t('page.dashboard.products.business.text'), | ||
title: t('page.dashboard.products.business.title') | ||
} as Product | ||
case ProductCode.BUSINESS_SEARCH: | ||
return { | ||
image: 'img/business_search_product_image.jpg', | ||
link: appendAccountId(config.businessSearchUrl), | ||
text: t('page.dashboard.products.busSearch.text'), | ||
title: t('page.dashboard.products.busSearch.title') | ||
} as Product | ||
case ProductCode.BCA: | ||
return { | ||
image: 'img/BCA_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.bcaURL), | ||
text: t('page.dashboard.products.bca.text'), | ||
title: t('page.dashboard.products.bca.title') | ||
} as Product | ||
case ProductCode.CSO: | ||
return { | ||
image: 'img/CSO_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.csoURL), | ||
text: t('page.dashboard.products.cso.text'), | ||
title: t('page.dashboard.products.cso.title') | ||
} as Product | ||
case ProductCode.MHR: | ||
return { | ||
image: 'img/MHR_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.pprDashboard), | ||
text: t('page.dashboard.products.mhr.text'), | ||
title: t('page.dashboard.products.mhr.title') | ||
} as Product | ||
case ProductCode.NDS: | ||
return { | ||
image: 'img/NDS_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.ndsUrl), | ||
text: t('page.dashboard.products.nds.text'), | ||
title: t('page.dashboard.products.nds.title') | ||
} as Product | ||
case ProductCode.PPR: | ||
return { | ||
image: 'img/PPR_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.pprDashboard), | ||
text: t('page.dashboard.products.ppr.text'), | ||
title: t('page.dashboard.products.ppr.title') | ||
} as Product | ||
case ProductCode.RPT: | ||
return { | ||
image: 'img/RPT_dashboard_thumbnail_image.jpg', | ||
link: config.rptURL, | ||
text: t('page.dashboard.products.rpt.text'), | ||
title: t('page.dashboard.products.rpt.title') | ||
} as Product | ||
case ProductCode.ESRA: | ||
return { | ||
image: 'img/ESRA_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.siteRegistryURL), | ||
text: t('page.dashboard.products.esra.text'), | ||
title: t('page.dashboard.products.esra.title') | ||
} as Product | ||
case ProductCode.VS: | ||
return { | ||
image: 'img/VS_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.willsURL), | ||
text: t('page.dashboard.products.vs.text'), | ||
title: t('page.dashboard.products.vs.title') | ||
} as Product | ||
default: | ||
return { | ||
image: 'placeholder_image', | ||
link: 'placeholder_link', | ||
text: 'placeholder_text', | ||
title: 'placeholder_title' | ||
} as Product | ||
} | ||
} | ||
|
||
/** | ||
* Get info for My Asset Registries tile (that replaces MHR and PPR products) | ||
*/ | ||
function getMhrPprTileInfo (): Product { | ||
return { | ||
image: 'img/My_Asset_Registries_dashboard_thumbnail_image.jpg', | ||
link: appendAccountId(config.pprDashboard) || 'link_not_configured', | ||
text: t('page.dashboard.products.mar.text'), | ||
title: t('page.dashboard.products.mar.title') | ||
} | ||
} | ||
|
||
/** | ||
* Check if products array has MHR and PPR | ||
*/ | ||
function hasMhrAndPprProducts (products: Array<APIProduct>): boolean { | ||
return products | ||
.filter(product => product.code === ProductCode.MHR || product.code === ProductCode.PPR) | ||
.length === 2 | ||
} | ||
|
||
return { | ||
getProductInfo, | ||
getMhrPprTileInfo, | ||
hasMhrAndPprProducts | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export enum ProductCode { | ||
BUSINESS = 'BUSINESS', | ||
BUSINESS_SEARCH = 'BUSINESS_SEARCH', | ||
CSO = 'CSO', | ||
PPR = 'PPR', | ||
MHR = 'MHR', | ||
RPT = 'RPT', | ||
VS = 'VS', | ||
BCA = 'BCA', | ||
ESRA = 'ESRA', | ||
NDS = 'NDS' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum ProductStatus { | ||
ACTIVE = 'ACTIVE', | ||
NOT_SUBSCRIBED = 'NOT_SUBSCRIBED' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface APIProduct { | ||
code: ProductCode | ||
subscriptionStatus: ProductStatus | ||
// more unused vars in api response that we don't use | ||
} | ||
|
||
export interface Product { | ||
image: string | ||
link: string | ||
text: string | ||
title: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.