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

Bug fixes #274

Merged
merged 9 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const routes: Routes = [
import("./modules/account/pages/group-list/group-list.page").then(
(m) => m.GroupListPage,
),
canActivate: [AuthGuard],
},
{
path: "signup",
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/auth-store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class AuthStoreService {
this.successHandler.handleSuccess(
"Successfully signed up! Please verify your email.",
);
this.router.navigate([`/${result.user.uid}`]);
this.router.navigate([`/registration/${result.user.uid}`]);
})
.catch((error) => this.handleError(error))
.finally(() => loading.dismiss());
Expand Down
166 changes: 86 additions & 80 deletions src/app/core/services/error-handler.service.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/app/models/account.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface Address {
country?: Nullable<string>;
formatted?: Nullable<string>;
geopoint?: Nullable<GeoPoint>; // Use Firebase GeoPoint
isPrimaryAddress?: Nullable<boolean>;
}

// PhoneNumber interface with nullable fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class ContactInformationComponent {

formatEmail(email: Email): string {
if (!email.email) return "-";
return `${email.name || "N/A"}: ${email.email}`;
return `${email.name || "-"}: ${email.email}`;
}

getFirstAddress(): string {
Expand All @@ -112,7 +112,8 @@ export class ContactInformationComponent {

formatAddress(address: Address): string {
if (!address.street) return "-";
return `${address.name || ""}\n${address.street}\n${address.city || ""}, ${address.state || ""}, ${address.country || ""} ${address.zipcode || ""}`;
const primary = address.isPrimaryAddress ? "(Primary)" : "";
return `${address.name || ""} ${primary}\n${address.street}\n${address.city || ""}, ${address.state || ""}, ${address.country || ""} ${address.zipcode || ""}`;
}

toggleShow(type: "phone" | "email" | "address") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,20 @@ export class HeroComponent {
this.account?.contactInformation?.addresses &&
this.account?.contactInformation?.addresses?.length > 0
) {
return `${this.account.contactInformation.addresses[0]?.city} /${this.account.contactInformation.addresses[0]?.country}`;
} else {
return "";
if (
this.account.contactInformation.addresses[0]?.city &&
this.account.contactInformation.addresses[0]?.country
) {
return `${this.account.contactInformation.addresses[0]?.city} / ${this.account.contactInformation.addresses[0]?.country}`;
} else {
this.account.contactInformation.addresses[0]?.city ||
this.account.contactInformation.addresses[0]?.country;
}
{
return `${this.account.contactInformation.addresses[0]?.city}${this.account.contactInformation.addresses[0]?.country}`;
}
}
return "";
}

async openImageUploadModal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ <h2>Services Offered</h2>
<h2>Services Needed</h2>
<p>{{ mutualAidCommunityEngagement.servicesNeeded.join(", ") }}</p>
</div>
</ion-col>
<ion-col size="6">
<div class="info-block">
<h2>Community Affiliations</h2>
<p>
Expand All @@ -55,6 +53,8 @@ <h2>Community Affiliations</h2>
}}
</p>
</div>
</ion-col>
<ion-col size="6">
<div class="info-block">
<h2>Willingness to Provide Mentorship</h2>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,37 @@
<ion-grid>
<ion-row>
<ion-col size="6">
<div class="info-block">
<h2>Employer Name</h2>
<p>{{ professionalInfo?.employerName ?? "-" }}</p>
</div>
<div class="info-block">
<h2>Current Title</h2>
<p>{{ professionalInfo?.currentJobTitle ?? "-" }}</p>
</div>
<div class="info-block">
<h2>Occupation</h2>
<p>{{ professionalInfo?.occupation }}</p>
<p>{{ professionalInfo?.occupation ?? "-" }}</p>
</div>
<div class="info-block">
<h2>Employer Name</h2>
<p>{{ professionalInfo?.employerName }}</p>
<h2>Work Experience</h2>
<p>{{ professionalInfo?.workExperience ?? "-" }}</p>
</div>
</ion-col>
<ion-col size="6">
<div class="info-block">
<h2>Skills and Expertise</h2>
<p>{{ professionalInfo?.skillsAndExpertise?.join(", ") }}</p>
<p>{{ professionalInfo?.skillsAndExpertise?.join(", ") ?? "-" }}</p>
</div>
<div class="info-block">
<h2>Educational Background</h2>
<p>{{ professionalInfo?.educationalBackground }}</p>
<p>{{ professionalInfo?.educationalBackground ?? "-" }}</p>
</div>
<div class="info-block">
<h2>LinkedIn Profile</h2>
<a [href]="professionalInfo?.linkedInProfile" target="_blank">{{
professionalInfo?.linkedInProfile
}}</a>
</div>
</ion-col>
</ion-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-->
<ion-card class="profile-info-card">
<ion-card-header>
<ion-card-title>Profile</ion-card-title>
<ion-card-title>{{ getSectionTitle }}</ion-card-title>
</ion-card-header>
<ion-card-content>
<ion-grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ describe("ProfileComponent", () => {
});

it("should return correct section title for non-user type", () => {
component.account = {type: "group"};
component.account = {
type: "group",
groupDetails: {
groupType: "Nonprofit",
},
};
fixture.detectChanges();
expect(component.getSectionTitle).toBe("Details");
expect(component.getSectionTitle).toBe("Organization (Nonprofit)");
});

it("should filter web links by category", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ProfileComponent {
if (this.account.type === "user") {
return "Profile";
}
return "Details";
return "Organization (" + this.account.groupDetails?.groupType + ")";
}

getWebLinks(category: string): WebLink[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
<div class="info-block">
<h2>Areas of Interest</h2>
<p>
{{ volunteerPreferences?.areasOfInterest?.join(", ") || "N/A" }}
{{ volunteerPreferences?.areasOfInterest?.join(", ") || "-" }}
</p>
</div>
<div class="info-block">
<h2>Availability</h2>
<p>{{ volunteerPreferences?.availability || "N/A" }}</p>
<p>{{ volunteerPreferences?.availability || "-" }}</p>
</div>
<div class="info-block">
<h2>Willingness to Travel</h2>
Expand All @@ -45,16 +45,16 @@ <h2>Willingness to Travel</h2>
<ion-col>
<div class="info-block">
<h2>Preferred Volunteer Roles</h2>
<p>{{ preferredVolunteerRolesString || "N/A" }}</p>
<p>{{ preferredVolunteerRolesString || "-" }}</p>
</div>
<div class="info-block">
<h2>Desired Level of Commitment</h2>
<p>{{ volunteerPreferences?.desiredLevelOfCommitment || "N/A" }}</p>
<p>{{ volunteerPreferences?.desiredLevelOfCommitment || "-" }}</p>
</div>
<div class="info-block">
<h2>Previous Volunteer Experience</h2>
<p>
{{ volunteerPreferences?.previousVolunteerExperience || "N/A" }}
{{ volunteerPreferences?.previousVolunteerExperience || "-" }}
</p>
</div>
</ion-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
linkControl.get('url')?.touched
"
>
Please enter a valid URL
Please enter a valid URL including http:// or https://
</ion-note>
</ion-col>
<ion-col size="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class BasicInfoComponent implements OnChanges {
"",
[
Validators.pattern(
/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
/^(https?:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
),
],
],
Expand Down Expand Up @@ -133,7 +133,7 @@ export class BasicInfoComponent implements OnChanges {
webLink.url,
[
Validators.pattern(
/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
/^(https?:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
),
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class ContactInfoComponent implements OnChanges {
state: address?.state ?? null,
zipcode: address?.zipcode ?? null,
country: address?.country ?? null,
isPrimaryAddress: address?.isPrimaryAddress || false,
})),
},
};
Expand Down Expand Up @@ -172,6 +173,7 @@ export class ContactInfoComponent implements OnChanges {
state: [address?.state],
zipcode: [address?.zipcode, Validators.pattern("^[0-9]*$")],
country: [address?.country],
isPrimaryAddress: [address?.isPrimaryAddress],
}),
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,39 @@
</ion-item>
<div slot="content">
<ion-grid>
<!-- Occupation -->
<!-- Employer Name -->
<ion-row>
<ion-col>
<ion-input
formControlName="occupation"
label="Occupation"
formControlName="employerName"
label="Employer Name"
label-placement="floating"
fill="outline"
placeholder="Enter your occupation"
placeholder="Enter your employer's name"
></ion-input>
</ion-col>
</ion-row>
<!-- Employer Name -->
<!-- Current Job Title -->
<ion-row>
<ion-col>
<ion-input
formControlName="employerName"
label="Employer Name"
formControlName="currentJobTitle"
label="Current Job Title"
label-placement="floating"
fill="outline"
placeholder="Enter your employer's name"
placeholder="Enter your current job title"
></ion-input>
</ion-col>
</ion-row>
<!-- Occupation -->
<ion-row>
<ion-col>
<ion-input
formControlName="occupation"
label="Occupation"
label-placement="floating"
fill="outline"
placeholder="Enter your occupation"
></ion-input>
</ion-col>
</ion-row>
Expand Down Expand Up @@ -82,18 +94,6 @@
</ion-select>
</ion-col>
</ion-row>
<!-- Current Job Title -->
<ion-row>
<ion-col>
<ion-input
formControlName="currentJobTitle"
label="Current Job Title"
label-placement="floating"
fill="outline"
placeholder="Enter your current job title"
></ion-input>
</ion-col>
</ion-row>
<!-- LinkedIn Profile -->
<ion-row>
<ion-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
linkControl.get('url')?.touched
"
>
Please enter a valid URL
Please enter a valid URL including http:// or https://
</ion-note>
</ion-col>
<ion-col size="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class GroupRegistrationComponent implements OnChanges {
webLink.url,
[
Validators.pattern(
/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
/^(https?:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
),
],
],
Expand Down Expand Up @@ -348,7 +348,7 @@ export class GroupRegistrationComponent implements OnChanges {
"",
[
Validators.pattern(
/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
/^(https?:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
),
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
linkControl.get('url')?.touched
"
>
Please enter a valid URL
Please enter a valid URL including http:// or https://
</ion-note>
</ion-col>
<ion-col size="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class UserRegistrationComponent implements OnChanges {
webLink.url,
[
Validators.pattern(
/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
/^(https?:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
),
],
],
Expand Down Expand Up @@ -336,7 +336,7 @@ export class UserRegistrationComponent implements OnChanges {
"",
[
Validators.pattern(
/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
/^(https?:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}([\/?].*)?$/,
),
],
],
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/components/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
</ion-item>
</ng-container>
<ion-item
*ngIf="isAuthenticated$ | async"
style="cursor: pointer"
lines="none"
detail="false"
Expand Down
Loading
Loading