-
Notifications
You must be signed in to change notification settings - Fork 13
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
Strata - UI: Strata dashboard list #285
Merged
+304
−89
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,3 +1,14 @@ | ||
export default defineAppConfig({ | ||
strrBaseLayer: { | ||
page: { | ||
login: { | ||
redirectPath: '/auth/account/choose-existing' | ||
// options: { // allow all options? | ||
// createAccount: false, | ||
// idps: () => ['bceid', 'bcsc'] // function required to overwrite default value, will merge if no function | ||
// } | ||
} | ||
} | ||
}, | ||
ui: {} | ||
}) |
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,24 @@ | ||
// https://ui.nuxt.com/components/modal#control-programmatically | ||
import { ModalBase } from '#components' | ||
|
||
export const useStrataModals = () => { | ||
const modal = useModal() | ||
const { t } = useI18n() | ||
|
||
function openhelpRegisteringStrataModal () { | ||
modal.open(ModalBase, { | ||
title: t('modal.helpRegisteringStrata.title'), | ||
content: t('modal.helpRegisteringStrata.content'), | ||
actions: [{ label: t('btn.close'), handler: () => close() }] | ||
}) | ||
} | ||
|
||
function close () { | ||
modal.close() | ||
} | ||
|
||
return { | ||
openhelpRegisteringStrataModal, | ||
close | ||
} | ||
} |
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,8 @@ | ||
export default defineNuxtRouteMiddleware((to) => { | ||
const accountStore = useConnectAccountStore() | ||
const localePath = useLocalePath() | ||
|
||
if (!accountStore.currentAccount.id) { | ||
return navigateTo({ path: localePath('/auth/account/choose-existing'), query: { return: to.fullPath } }) | ||
} | ||
}) |
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
146 changes: 146 additions & 0 deletions
146
strr-strata-web/app/pages/auth/account/choose-existing.vue
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,146 @@ | ||
<script setup lang="ts"> | ||
// import { isoCountriesList } from '~/utils/isoCountriesList' | ||
const localePath = useLocalePath() | ||
const { t } = useI18n() | ||
const isSmallScreen = useMediaQuery('(max-width: 640px)') | ||
const strrModal = useStrrModals() | ||
const accountStore = useConnectAccountStore() | ||
|
||
useHead({ | ||
title: t('strr.title.chooseAccount') | ||
}) | ||
|
||
definePageMeta({ | ||
middleware: ['auth', 'check-tos'] | ||
}) | ||
|
||
function handleAccountSwitch (id: string) { | ||
const route = useRoute() | ||
accountStore.switchCurrentAccount(id) | ||
|
||
if (route.query.return) { | ||
return navigateTo(route.query.return as string) | ||
} else { | ||
return navigateTo(localePath('/strata-hotel/dashboard')) | ||
} | ||
} | ||
</script> | ||
<template> | ||
<div class="space-y-8 py-8 sm:py-10"> | ||
<ConnectTypographyH1 :text="$t('label.selectAccount')" /> | ||
|
||
<p>What subtitle/text should go here?</p> | ||
<!-- <p>{{ $t('strr.text.selectAccountForStrr') }}</p> --> | ||
|
||
<UAlert | ||
color="yellow" | ||
icon="i-mdi-alert" | ||
:close-button="null" | ||
variant="subtle" | ||
:ui="{ | ||
inner: 'pt-0', | ||
}" | ||
> | ||
<template #description> | ||
<span class="text-gray-900">Some warning here maybe</span> | ||
<!-- eslint-disable-next-line --> | ||
<!-- <ConnectI18nBold class="text-bcGovColor-darkGray" translation-path="strr.text.onlyPremiumAccountWarning" /> --> | ||
</template> | ||
</UAlert> | ||
|
||
<ConnectTypographyH2 | ||
:text="$t('label.yourExistingAccounts', { count: accountStore.userAccounts.length })" | ||
/> | ||
|
||
<section | ||
:aria-label="$t('label.yourExistingAccounts', { count: accountStore.userAccounts.length })" | ||
class="max-h-96 w-full overflow-y-auto rounded bg-white px-8 shadow" | ||
> | ||
<div | ||
v-if="accountStore.userAccounts.length === 0" | ||
class="flex h-36 flex-col items-center justify-center gap-4 text-center sm:h-48" | ||
> | ||
<UIcon name="i-mdi-database" class="size-6" /> | ||
<span>{{ $t('text.noAccountsFound') }}</span> | ||
</div> | ||
|
||
<ul | ||
v-else | ||
class="flex flex-col divide-y" | ||
> | ||
<li | ||
v-for="account in accountStore.userAccounts" | ||
:key="account.id" | ||
class="flex flex-col items-start justify-between gap-4 py-8 sm:flex-row sm:items-center" | ||
> | ||
<div | ||
class="flex flex-row items-center gap-4 sm:gap-6" | ||
:class="(account.accountStatus !== AccountStatus.ACTIVE) | ||
? 'opacity-50' : ''" | ||
> | ||
<UAvatar | ||
:alt="account.label[0]" | ||
:ui="{ | ||
background: 'bg-blue-300 dark:bg-[#E0E7ED]', | ||
text: 'font-semibold leading-none text-white dark:text-bcGovColor-darkGray truncate', | ||
placeholder: 'font-semibold leading-none text-white truncate dark:text-bcGovColor-darkGray text-xl', | ||
rounded: 'rounded-sm' | ||
}" | ||
/> | ||
<div class="flex w-full flex-col text-left"> | ||
<span class="text-lg font-semibold text-bcGovColor-darkGray"> | ||
{{ account.label }} | ||
</span> | ||
<!-- TODO: Add mailing address ? --> | ||
<!-- <span | ||
v-if="Array.isArray(account.contacts) && account.contacts.length !== 0 && | ||
'street' in account.contacts[0]" | ||
:id="`account-address-${account.id}`" | ||
class="text-bcGovColor-midGray dark:text-gray-300" | ||
> | ||
{{ account.contacts[0].street }}, | ||
{{ account.contacts[0].city }}, | ||
{{ account.contacts[0].region }} | ||
{{ account.contacts[0].postalCode }}, | ||
{{ isoCountriesList.find((country: SbcCountry) => country.alpha_2 === | ||
account.contacts[0].country)?.name || account.contacts[0].country }} | ||
</span> --> | ||
</div> | ||
</div> | ||
<div class="flex w-full flex-col gap-4 sm:w-fit sm:flex-row"> | ||
<div class="my-auto flex gap-2"> | ||
<UBadge | ||
v-if="account.accountStatus !== AccountStatus.ACTIVE" | ||
:label="$t('badge.inactiveAccount')" | ||
class="bg-[#fff7e3] px-3 text-center font-bold text-bcGovColor-midGray" | ||
/> | ||
</div> | ||
|
||
<UButton | ||
:label="$t('btn.useThisAccount.main')" | ||
:aria-label="$t('btn.useThisAccount.aria', { name: account.label })" | ||
:icon="'i-mdi-chevron-right'" | ||
trailing | ||
size="bcGov" | ||
:block="isSmallScreen" | ||
:disabled="account.accountStatus !== AccountStatus.ACTIVE" | ||
data-testid="choose-existing-account-button" | ||
@click="handleAccountSwitch(account.id)" | ||
/> | ||
</div> | ||
</li> | ||
</ul> | ||
</section> | ||
<div class="flex justify-center"> | ||
<UButton | ||
variant="outline" | ||
size="bcGov" | ||
:label="$t('btn.createNewAccount')" | ||
icon="i-mdi-chevron-right" | ||
trailing | ||
:block="isSmallScreen" | ||
@click="strrModal.openCreateAccountModal()" | ||
/> | ||
</div> | ||
</div> | ||
</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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question I think we should allow everything for now