Skip to content

Commit 36a1b3e

Browse files
committed
feat(profile): add discord
1 parent 7c0f6f8 commit 36a1b3e

File tree

12 files changed

+38
-13
lines changed

12 files changed

+38
-13
lines changed

src/api/backend/model/pickProfileEditExcludeKeyofProfileEditAddrStreetOrAddrCityOrAddrZip_.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface PickProfileEditExcludeKeyofProfileEditAddrStreetOrAddrCityOrAdd
2727
gender: string;
2828
short_info: string;
2929
github: string;
30+
discord: string;
3031
addr_country: string;
3132
school_name: string;
3233
school_street: string;

src/api/backend/model/profile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface Profile {
2424
gender: string;
2525
short_info: string;
2626
github: string | null;
27+
discord: string | null;
2728
addr_country: string;
2829
school_name: string;
2930
school_street: string;

src/api/backend/model/profileEdit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface ProfileEdit {
1818
gender: string;
1919
short_info: string;
2020
github: string | null;
21+
discord: string | null;
2122
addr_street: string;
2223
addr_city: string;
2324
addr_zip: string;

src/api/backend/model/registrationRequest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface RegistrationRequest {
1818
gender: string;
1919
short_info: string;
2020
github: string | null;
21+
discord: string | null;
2122
addr_street: string;
2223
addr_city: string;
2324
addr_zip: string;

src/api/backend/model/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface User {
1818
profile_picture: string;
1919
gender: string;
2020
email?: string;
21+
discord?: string;
2122
role: UserRole;
2223
score: number;
2324
tasks_num: number;

src/app/components/profile/page-profile-my/page-profile-my.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ <h2>{{'profile.my.about-me.title'|translate}}</h2>
129129
[placeholder]="'profile.my.about-me.github'|translate"
130130
>
131131

132+
<label class="form-label">{{'profile.my.about-me.discord'|translate}}</label>
133+
<input type="text"
134+
class="form-control"
135+
formControlName="discord"
136+
[placeholder]="'profile.my.about-me.discord'|translate"
137+
>
138+
132139

133140
<!-- Address -->
134141
<h2>{{'profile.my.address.title'|translate}}</h2>

src/app/components/profile/page-profile-my/page-profile-my.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class PageProfileMyComponent implements OnInit, OnDestroy {
2323
nick: [undefined],
2424
sex: ['', Validators.required],
2525
github: [''],
26+
discord: [''],
2627

2728
address: ['', Validators.required],
2829
city: ['', Validators.required],
@@ -116,7 +117,8 @@ export class PageProfileMyComponent implements OnInit, OnDestroy {
116117
schoolCountry: profile.school_country,
117118
schoolEnd: profile.school_finish,
118119
shirtSize: profile.tshirt_size,
119-
github: profile.github
120+
github: profile.github,
121+
discord: profile.discord
120122
});
121123
this.formProfile.enable();
122124
this.cd.markForCheck();
@@ -148,7 +150,8 @@ export class PageProfileMyComponent implements OnInit, OnDestroy {
148150
school_country: this.formProfile.controls.schoolCountry.value,
149151
school_finish: this.formProfile.controls.schoolEnd.value,
150152
tshirt_size: this.formProfile.controls.shirtSize.value,
151-
github: this.formProfile.controls.github.value
153+
github: this.formProfile.controls.github.value,
154+
discord: this.formProfile.controls.discord.value
152155
};
153156

154157
(this.profileEditRequest$ = this.backend.http.profileEditMy(edit).pipe(mapTo(undefined))).subscribe(() => {

src/app/components/profile/page-profile/page-profile.component.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,27 @@
4545
</ng-template>
4646
</div>
4747

48-
<div class="contact" *ngIf="!user.$isOrg">
48+
<div class="contact">
4949
<table class="contact table table-borderless">
5050
<tbody>
5151
<tr *ngIf="user.email">
5252
<th scope="col">{{icon.EMAIL}}</th>
5353
<td><a [href]="'mailto:' + user.email">{{user.email}}</a></td>
5454
</tr>
55-
<tr>
56-
<th scope="col">{{icon.SCHOOL}}</th>
57-
<td>{{user.school_name}}</td>
58-
</tr>
59-
<tr>
60-
<th scope="col">{{icon.LOCATION}}</th>
61-
<td>{{countries[user.addr_country!] || countries[user.addr_country!.toUpperCase()] || user.addr_country}}</td>
55+
<tr *ngIf="user.discord">
56+
<th scope="col">{{icon.DISCORD}}</th>
57+
<td>{{user.discord}}</td>
6258
</tr>
59+
<ng-container *ngIf="!user.$isOrg">
60+
<tr>
61+
<th scope="col">{{icon.SCHOOL}}</th>
62+
<td>{{user.school_name}}</td>
63+
</tr>
64+
<tr *ngIf="user.addr_country">
65+
<th scope="col">{{icon.LOCATION}}</th>
66+
<td>{{countries[user.addr_country] || countries[user.addr_country.toUpperCase()] || user.addr_country}}</td>
67+
</tr>
68+
</ng-container>
6369
</tbody>
6470
</table>
6571
</div>

src/app/components/shared/modal-register/modal-register.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export class ModalRegisterComponent implements OnInit, OnDestroy, ModalComponent
179179
tshirt_size: this.form.controls.shirtSize.value,
180180
password: this.form.controls.password.value,
181181
referral: '',
182-
github: null
182+
github: null,
183+
discord: null
183184
};
184185

185186
const registration$ = this.backend.http.registerNewUser(req).pipe(shareReplay(1));

src/app/services/shared/icon.service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ export class IconService {
1414
public readonly SCHOOL = '🎓';
1515
public readonly LOCATION = '🖈';
1616
public readonly EDIT = '🖉';
17-
public readonly SUN = '☀️';
18-
public readonly MOON = '🌜';
1917
public readonly CROSS = '☓';
2018
public readonly WARNING = '⚠';
19+
public readonly DISCORD = '💬';
2120
}

0 commit comments

Comments
 (0)