Skip to content

Commit

Permalink
chore(fe): code reviews (#1292)
Browse files Browse the repository at this point in the history
* chore(fe): Made code reviews

* chore(fe): Made code reviews

* no message

* chore(fe): Made code reviews
  • Loading branch information
mamartinezmejia authored Oct 31, 2024
1 parent f2021e2 commit 85f6d86
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 160 deletions.
2 changes: 1 addition & 1 deletion frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ declare module 'vue' {
export interface GlobalComponents {
AddressGroupComponent: typeof import('./src/components/grouping/AddressGroupComponent.vue')['default']
AutoCompleteInputComponent: typeof import('./src/components/forms/AutoCompleteInputComponent.vue')['default']
ComboBoxInputComponent: typeof import('./src/components/forms/ComboBoxInputComponent.vue')['default']
ContactGroupComponent: typeof import('./src/components/grouping/ContactGroupComponent.vue')['default']
DataFetcher: typeof import('./src/components/DataFetcher.vue')['default']
DateInputComponent: typeof import('./src/components/forms/DateInputComponent/index.vue')['default']
DateInputPart: typeof import('./src/components/forms/DateInputComponent/DateInputPart.vue')['default']
DropdownInputComponent: typeof import('./src/components/forms/DropdownInputComponent.vue')['default']
ErrorNotificationGroupingComponent: typeof import('./src/components/grouping/ErrorNotificationGroupingComponent.vue')['default']
FuzzyMatchNotificationGroupingComponent: typeof import('./src/components/grouping/FuzzyMatchNotificationGroupingComponent.vue')['default']
LoadingOverlayComponent: typeof import('./src/components/LoadingOverlayComponent.vue')['default']
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/grouping/AddressGroupComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ const section = (index: number, purpose: string) => `section-address-${index} ${
:params="{ method: 'GET' }"
#="{ content }"
>
<dropdown-input-component
<combo-box-input-component
:id="'province_' + id"
:label="provinceNaming"
:autocomplete="section(id, 'address-level1')"
Expand All @@ -337,7 +337,7 @@ const section = (index: number, purpose: string) => `section-address-${index} ${
/>
</data-fetcher>

<dropdown-input-component
<combo-box-input-component
:id="'country_' + id"
label="Country"
:autocomplete="section(id, 'country-name')"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/grouping/ContactGroupComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const contactName = (contact: Contact, contactId: number) => {
@error="validation.phoneNumber = !$event"
/>

<dropdown-input-component
<combo-box-input-component
:id="'role_' + id"
label="Primary role"
tip="Choose the primary role for this contact"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const updateContactType = (value: CodeNameType | undefined) => {
/>
</div>

<dropdown-input-component
<combo-box-input-component
:id="'role_' + id"
label="Contact type"
tip=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const getLocationDescription = (address: Address, index: number): string =>
:params="{ method: 'GET' }"
#="{ content }"
>
<dropdown-input-component
<combo-box-input-component
:id="'province_' + id"
:label="provinceNaming"
autocomplete="off"
Expand All @@ -397,7 +397,7 @@ const getLocationDescription = (address: Address, index: number): string =>
/>
</data-fetcher>

<dropdown-input-component
<combo-box-input-component
:id="'country_' + id"
label="Country"
autocomplete="off"
Expand Down
23 changes: 16 additions & 7 deletions frontend/src/helpers/ForestClientUserSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ class ForestClientUserSession implements SessionProperties {
}
}

// get the token expiration time, minus 10% to refresh the token before it expires
const timeDifference = ((idToken.payload.exp * 1000) - Date.now()) * 0.9;
// get the token expiration time, minus 10% to refresh the token before it expires
const timeDifference = (idToken.payload.exp * 1000 - Date.now()) * 0.9;
// if the refresh interval is not set, set it
if (!this.sessionRefreshIntervalId){
this.sessionRefreshIntervalId = setInterval(() => this.loadUser(), timeDifference);
if (!this.sessionRefreshIntervalId) {
this.sessionRefreshIntervalId = setInterval(
() => this.loadUser(),
timeDifference
);
}
} else {
this.user = undefined;
Expand All @@ -125,7 +128,7 @@ class ForestClientUserSession implements SessionProperties {
additionalInfo.lastName = payload.family_name;
}

if(payload["custom:idp_business_name"]){
if (payload["custom:idp_business_name"]) {
additionalInfo.businessName = payload["custom:idp_business_name"];
}

Expand All @@ -134,12 +137,18 @@ class ForestClientUserSession implements SessionProperties {
(additionalInfo.firstName === "" && additionalInfo.lastName === "")
) {
const name = payload["custom:idp_display_name"];
const nameParts: string[] = name.includes(",") ? name.split(",") : name.split(" ");
const nameParts: string[] = name.includes(",")
? name.split(",")
: name.split(" ");

if (provider === "idir" && nameParts.length >= 2) {
// For IDIR, split by comma and then by space for the first name as the value will be Lastname, Firsname MIN:XX
additionalInfo.lastName = nameParts[0].trim();
additionalInfo.firstName = nameParts[1].trim().split(" ").slice(0, -1).join(" ")
additionalInfo.firstName = nameParts[1]
.trim()
.split(" ")
.slice(0, -1)
.join(" ");
} else if (nameParts.length >= 2) {
// For others, assume space separates the first and last names
additionalInfo.firstName = nameParts[0].trim();
Expand Down
Loading

0 comments on commit 85f6d86

Please sign in to comment.