Skip to content
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

All - UI: radio group position #410

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions strr-base-web/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export default defineAppConfig({
label: '-mt-[2px] pl-3 text-base cursor-pointer'
},
radioGroup: {
wrapper: 'max-w-bcGovInput',
fieldset: 'space-y-4 -mt-4',
wrapper: 'max-w-bcGovInput group',
thorwolpert marked this conversation as resolved.
Show resolved Hide resolved
fieldset: 'space-y-4 group-has-[legend]:-mt-4 [&:not(:has(legend))]:mt-1',
legend: 'text-sm font-medium text-gray-700 dark:text-gray-200 mb-0'
},
select: {
Expand Down
17 changes: 6 additions & 11 deletions strr-base-web/app/composables/useStrrModals.ts
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new route meta option allows to abort the account change, so in this case we don't have to reset the old account if the user clicks cancel, but if they click continue we need to set the account id to the new one so that 'handleExternalRedirect' appends the correct account id

Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,22 @@ export const useStrrModals = () => {
})
}

function openConfirmSwitchAccountModal (oldAccountId: string) {
function openConfirmSwitchAccountModal (newAccountId: string) {
modal.open(ModalBase, {
title: t('modal.changeAccountConfirm.title'),
content: t('modal.changeAccountConfirm.content'),
persist: true,
closeFn: () => {
accountStore.switchCurrentAccount(oldAccountId)
modal.close()
},
actions: [
{
label: t('modal.changeAccountConfirm.leaveBtn'),
handler: () => handleExternalRedirect(config.registryHomeURL + 'dashboard')
handler: () => {
accountStore.switchCurrentAccount(newAccountId)
handleExternalRedirect(config.registryHomeURL + 'dashboard')
}
},
{
label: t('btn.cancel'),
variant: 'outline',
handler: () => {
accountStore.switchCurrentAccount(oldAccountId)
modal.close()
}
handler: () => modal.close()
}
]
})
Expand Down
2 changes: 1 addition & 1 deletion strr-base-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"vitest": "^1.6.0"
},
"dependencies": {
"@daxiom/nuxt-core-layer-test": "^0.0.15",
"@daxiom/nuxt-core-layer-test": "^0.0.17",
"@vuepic/vue-datepicker": "^9.0.3",
"country-codes-list": "^1.6.11",
"luxon": "^3.5.0",
Expand Down
8 changes: 4 additions & 4 deletions strr-base-web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion strr-host-pm-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-host-pm-web",
"private": true,
"type": "module",
"version": "0.0.16",
"version": "0.0.17",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
8 changes: 4 additions & 4 deletions strr-host-pm-web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions strr-platform-web/app/pages/platform/application.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ConnectStepper, FormPlatformReviewConfirm } from '#components'
const { t } = useI18n()
const localePath = useLocalePath()
const strrModal = useStrrModals()
const accountStore = useConnectAccountStore()

const { validateContact } = useStrrContactStore()
const { validatePlatformBusiness } = useStrrPlatformBusiness()
Expand Down Expand Up @@ -214,24 +213,15 @@ watch(activeStepIndex, (val) => {
setButtonControl({ leftButtons: [], rightButtons: buttons })
}, { immediate: true })

// manage account changes mid-application
const originalAccountId = accountStore.currentAccount.id // TODO: find better solution than this
watch(() => accountStore.currentAccount.id,
(newVal, oldVal) => {
if (newVal !== undefined && newVal !== originalAccountId) {
strrModal.openConfirmSwitchAccountModal(oldVal)
}
}
)

// page stuff
useHead({
title: t('strr.title.application')
})

definePageMeta({
layout: 'connect-form',
middleware: ['auth', 'check-tos', 'require-premium-account', 'application-page']
middleware: ['auth', 'check-tos', 'require-premium-account', 'application-page'],
onAccountChange: (oldAccount: Account, newAccount: Account) => manageAccountChangeApplication(oldAccount, newAccount)
})

setBreadcrumbs([
Expand Down
13 changes: 2 additions & 11 deletions strr-platform-web/app/pages/platform/dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
const { t } = useI18n()
const config = useRuntimeConfig().public
const accountStore = useConnectAccountStore()

const { loading, title, subtitles } = storeToRefs(useConnectDetailsHeaderStore())
const { downloadApplicationReceipt, loadPlatform } = useStrrPlatformStore()
Expand All @@ -20,15 +19,6 @@ const addresses = ref<ConnectAccordionItem[]>([])
const representatives = ref<ConnectAccordionItem[]>([])
const completingParty = ref<ConnectAccordionItem | undefined>(undefined)

watch(() => accountStore.currentAccount.id,
(newVal) => {
if (newVal !== undefined) {
const { handleExternalRedirect } = useConnectNav()
handleExternalRedirect(config.registryHomeURL + 'dashboard')
}
}
)

onMounted(async () => {
loading.value = true
await loadPlatform()
Expand Down Expand Up @@ -119,7 +109,8 @@ useHead({

definePageMeta({
layout: 'connect-dashboard',
middleware: ['auth', 'check-tos', 'require-premium-account']
middleware: ['auth', 'check-tos', 'require-premium-account'],
onAccountChange: (oldAccount: Account, newAccount: Account) => manageAccountChangeDashboard(oldAccount, newAccount)
})

setBreadcrumbs([
Expand Down
14 changes: 14 additions & 0 deletions strr-platform-web/app/utils/account-change.ts
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using functions in definePageMeta must be imported from outside the file as of now. I think nuxt 3.15.0 will allow inline functions.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// warning modal to prevent account change
export function manageAccountChangeApplication (oldAccount: Account, newAccount: Account) {
const strrModal = useStrrModals()
strrModal.openConfirmSwitchAccountModal(newAccount.id)
return false // return false to abort account change
}

// change accounts and send user to reg dashboard
export function manageAccountChangeDashboard (oldAccount: Account, newAccount: Account) {
useConnectAccountStore().switchCurrentAccount(newAccount.id)
const { handleExternalRedirect } = useConnectNav()
handleExternalRedirect(useRuntimeConfig().public.registryHomeURL + 'dashboard')
return true
}
4 changes: 2 additions & 2 deletions strr-platform-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-platform-web",
"private": true,
"type": "module",
"version": "0.0.28",
"version": "0.0.29",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down Expand Up @@ -41,7 +41,7 @@
"vitest": "^1.6.0"
},
"dependencies": {
"@daxiom/nuxt-core-layer-test": "^0.0.15",
"@daxiom/nuxt-core-layer-test": "^0.0.17",
"@vuepic/vue-datepicker": "^9.0.3",
"country-codes-list": "^1.6.11",
"nuxt": "3.12.4",
Expand Down
8 changes: 4 additions & 4 deletions strr-platform-web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion strr-strata-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-strata-web",
"private": true,
"type": "module",
"version": "0.0.26",
"version": "0.0.27",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
8 changes: 4 additions & 4 deletions strr-strata-web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading