-
+
@@ -52,30 +69,31 @@ watch(platformBrandRef, (val) => {
@@ -93,7 +111,7 @@ watch(platformBrandRef, (val) => {
-
+
{
:ui-radio="{ inner: 'space-y-2' }"
/>
-
+
diff --git a/strr-pm-web/app/composables/useScreenSize.ts b/strr-pm-web/app/composables/useScreenSize.ts
deleted file mode 100644
index 315a25f9..00000000
--- a/strr-pm-web/app/composables/useScreenSize.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { ref, onMounted, onUnmounted } from 'vue'
-
-const useScreenSize = () => {
- const width = ref(window.innerWidth)
- const height = ref(window.innerHeight)
-
- const handler = () => {
- width.value = window.innerWidth
- height.value = window.innerHeight
- }
-
- onMounted(() => window.addEventListener('resize', handler))
- onUnmounted(() => window.removeEventListener('resize', handler))
-
- return { width, height }
-}
-
-export default useScreenSize
diff --git a/strr-pm-web/app/interfaces/platform-brand.ts b/strr-pm-web/app/interfaces/platform-brand.ts
index a24794fe..44bcf44a 100644
--- a/strr-pm-web/app/interfaces/platform-brand.ts
+++ b/strr-pm-web/app/interfaces/platform-brand.ts
@@ -1,4 +1,8 @@
export interface PlatBrand {
name: string
- website: string
+ website: string,
+ errors?: {
+ name?: string
+ website?: string
+ }
}
diff --git a/strr-pm-web/app/layouts/connect-form.vue b/strr-pm-web/app/layouts/connect-form.vue
index caead599..c6eef111 100644
--- a/strr-pm-web/app/layouts/connect-form.vue
+++ b/strr-pm-web/app/layouts/connect-form.vue
@@ -14,7 +14,7 @@
-
diff --git a/strr-pm-web/app/locales/en-CA.ts b/strr-pm-web/app/locales/en-CA.ts
index 5fe7b03b..7dc886a2 100644
--- a/strr-pm-web/app/locales/en-CA.ts
+++ b/strr-pm-web/app/locales/en-CA.ts
@@ -246,6 +246,10 @@ export default {
country: 'Please enter a BC, Canada address'
}
},
+ brand: {
+ name: 'Please enter a brand name',
+ site: 'Please enter a valid full url for this brand (i.e. https://www.bcregistry.gov.bc.ca)'
+ },
business: {
legalName: 'Please enter the business legal name',
jurisdiction: 'Please enter the business home jusrisdiction',
@@ -333,7 +337,7 @@ export default {
rentalUnitDetails: 'Rental Unit Details',
internetListingDetails: 'Internet Listing Details',
rentalUnitAddress: 'Rental Unit Address',
- platformUrl: 'Paltform URL',
+ platformUrl: 'Platform URL',
primaryDwelling: 'All or part of primary dwelling',
secondarySuite: 'Secondary suite',
accessory: 'Accessory dwelling unit',
@@ -478,7 +482,7 @@ export default {
},
hint: {
brandName: 'The brand name for the platform',
- brandSite: 'The URL for this brand name',
+ brandSite: 'The full URL for this brand (i.e. https://www.bcregistry.gov.bc.ca)',
businessLegalName: 'The full legal name of the business that is operating the platform. Include corporate designations (e.g., "Ltd.", "Inc.", "LLC")',
businessNumber: 'Canada Revenue Agency (CRA) Business Number',
humeJurisdiction: 'The regional or federal jurisdiction where the business was incorporated or registered',
diff --git a/strr-pm-web/app/stores/platformDetails.ts b/strr-pm-web/app/stores/platformDetails.ts
index 42e08b2f..e75de27a 100644
--- a/strr-pm-web/app/stores/platformDetails.ts
+++ b/strr-pm-web/app/stores/platformDetails.ts
@@ -1,15 +1,13 @@
import { z } from 'zod'
-import { getRequiredNonEmptyString } from '~/utils/connect-validation'
+import { getRequiredNonEmptyString, getRequiredUrl } from '~/utils/connect-validation'
export const useStrrPlatformDetails = defineStore('strr/platformDetails', () => {
const { t } = useI18n()
- const platformDetailsSchema = z.object({
- brands: z.array(z.object({
- name: getRequiredNonEmptyString(t('validation.brand.name')),
- website: getRequiredNonEmptyString(t('validation.brand.site'))
- })).min(1),
- listingSize: getRequiredNonEmptyString(t('validation.listingSize'))
+ const getPlatformBrandSchema = () => z.object({
+ name: getRequiredNonEmptyString(t('validation.brand.name')),
+ website: getRequiredUrl(t('validation.brand.site'))
})
+
const platformDetails = ref<{ brands: PlatBrand[], listingSize: ListingSize | undefined }>({
brands: [{ name: '', website: '' }],
listingSize: undefined
@@ -23,7 +21,7 @@ export const useStrrPlatformDetails = defineStore('strr/platformDetails', () =>
}
return {
platformDetails,
- platformDetailsSchema,
+ getPlatformBrandSchema,
addNewEmptyBrand,
removeBrandAtIndex
}
diff --git a/strr-pm-web/app/utils/connect-validation/index.ts b/strr-pm-web/app/utils/connect-validation/index.ts
index 2ce40584..88f295d3 100644
--- a/strr-pm-web/app/utils/connect-validation/index.ts
+++ b/strr-pm-web/app/utils/connect-validation/index.ts
@@ -17,6 +17,9 @@ export const optionalOrEmptyString = z
export const getRequiredNonEmptyString = (message: string) => z.string().refine(e => e.trim() !== '', message)
+export const getRequiredUrl = (message: string) =>
+ z.string().refine(e => e.trim() !== '' && httpRegex.test(e), message)
+
/**
* Normalizes a string.
* If the input is provided, it removes leading, trailing, and extra spaces within the name.