Skip to content

Commit 2db87ff

Browse files
committed
feat(account): adiciona configuração de informações públicas
1 parent 3e57f08 commit 2db87ff

File tree

27 files changed

+312
-66
lines changed

27 files changed

+312
-66
lines changed

apps/devmx/src/scss/component.scss

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@forward './components/stepper.theme';
22
@forward './components/layout.theme';
33
@forward './components/dialog.theme';
4+
@forward './components/links.theme';
45
@forward './components/form.theme';
56
@forward './components/fab.theme';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@use '@angular/material' as mat;
2+
3+
@mixin links-theme($theme) {
4+
body {
5+
a:link:not(.mdc-button):not(.mdc-icon-button):not(.mdc-fab),
6+
a:active:not(.mdc-button):not(.mdc-icon-button):not(.mdc-fab),
7+
a:visited:not(.mdc-button):not(.mdc-icon-button):not(.mdc-fab) {
8+
color: mat.get-theme-color($theme, secondary, 70);
9+
}
10+
11+
.mdc-icon-button:not(.mdc-fab):hover,
12+
.mdc-icon-button:not(.mdc-fab):hover,
13+
.mdc-icon-button:not(.mdc-fab):hover {
14+
color: mat.get-theme-color($theme, secondary, 70);
15+
}
16+
}
17+
}

apps/devmx/src/styles.scss

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@include component.stepper-theme(theme.$light);
1717
@include component.layout-theme(theme.$light);
1818
@include component.dialog-theme(theme.$light);
19+
@include component.links-theme(theme.$light);
1920
@include component.form-theme(theme.$light);
2021
@include component.fab-theme(theme.$light);
2122

packages/account/data-access/src/lib/infrastructure/user.http.service.impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class UserHttpServiceImpl
3737
form.append('photo', data.photo);
3838
form.append('gender', data.gender ?? '');
3939
form.append('minibio', data.minibio ?? '');
40-
form.append('birthday', data.birthday ?? '');
40+
form.append('birthday', data.birthday?.toString() ?? '');
4141

4242
const url = [this.url, id, 'photo'];
4343

packages/account/data-source/src/lib/dtos/update-profile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class UpdateProfileDto implements UpdateProfile {
2222

2323
@IsOptional()
2424
@ApiPropertyOptional()
25-
birthday?: string;
25+
birthday?: Date;
2626

2727
@IsOptional()
2828
@ApiPropertyOptional()

packages/account/data-source/src/lib/dtos/user-profile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class UserProfileDto implements UserProfile {
2525
minibio?: string;
2626

2727
@ApiPropertyOptional()
28-
birthday?: string;
28+
birthday?: Date;
2929

3030
@Type(() => CityDto)
3131
@ApiPropertyOptional({ type: () => [CityDto] })

packages/account/data-source/src/lib/schemas/user-profile.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export class UserProfileCollection implements UserProfile {
2727
@Prop({ default: '' })
2828
minibio?: string;
2929

30-
@Prop({ default: '' })
31-
birthday?: string;
30+
@Prop({ default: '', type: Date })
31+
birthday?: Date;
3232

3333
@Prop({
3434
type: mongoose.Schema.Types.ObjectId,

packages/account/data-source/src/lib/schemas/user.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ import { UserPasswordCollection, UserPasswordSchema } from './user-password';
22
import { UserContactCollection, UserContactSchema } from './user-contact';
33
import { UserProfileCollection, UserProfileSchema } from './user-profile';
44
import { UserSocialCollection, UserSocialSchema } from './user-social';
5+
import { DEFAULT_ROLES, DEFAULT_VISIBILITY } from '@devmx/shared-util-data';
56
import { UserCodeCollection, UserCodeSchema } from './user-code';
6-
import { Roles, User, UserSkill } from '@devmx/shared-api-interfaces';
77
import { createSchema } from '@devmx/shared-data-source';
8-
import { DEFAULT_ROLES } from '@devmx/shared-util-data';
98
import { SkillSchema } from '@devmx/learn-data-source';
109
import { Prop, raw, Schema } from '@nestjs/mongoose';
1110
import { Document } from 'mongoose';
11+
import {
12+
User,
13+
Roles,
14+
UserSkill,
15+
UserVisibility,
16+
} from '@devmx/shared-api-interfaces';
1217

1318
@Schema()
1419
export class UserCollection extends Document implements User {
@@ -26,6 +31,13 @@ export class UserCollection extends Document implements User {
2631
@Prop({ required: true, type: Object, default: DEFAULT_ROLES })
2732
roles: Roles;
2833

34+
@Prop({
35+
type: Object,
36+
required: true,
37+
default: DEFAULT_VISIBILITY,
38+
})
39+
visibility: UserVisibility;
40+
2941
@Prop([
3042
{
3143
type: raw({

packages/account/feature-about/src/lib/containers/about-user/about-user.container.html

+63-24
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,84 @@
22
<header>
33
<h2>{{user.displayName}}</h2>
44
<h3>{{'@' + user.name}}</h3>
5-
</header>
65

7-
@if (user.profile && user.profile.minibio) {
8-
<mat-card>
9-
<mat-card-content>
10-
<devmx-markdown [content]="user.profile.minibio" />
11-
</mat-card-content>
12-
</mat-card>
13-
}
14-
<!-- -->
6+
<div class="user-contact">
7+
@if (user.contact.email && user.visibility?.email) {
8+
<p>
9+
<devmx-icon name="message/mail" />
10+
<span>{{user.contact.email}}</span>
11+
</p>
12+
}
13+
<!-- -->
14+
@if (user.contact.phone && user.visibility?.phone) {
15+
<p>
16+
<devmx-icon name="tech/phone" />
17+
<span>{{user.contact.phone}}</span>
18+
</p>
19+
}
20+
</div>
21+
</header>
1522

16-
@if (user.skills?.length) {
17-
<mat-card>
18-
<mat-card-content>
19-
<ol>
20-
@for (item of user.skills; track item.skill.id) {
21-
<li>
22-
<p>{{item.skill.name}}</p>
23-
<mat-progress-bar [value]="item.weight" />
24-
</li>
25-
}
26-
</ol>
27-
</mat-card-content>
28-
</mat-card>
23+
@if (user.visibility?.roles) {
24+
<div>
25+
<mat-chip-set>
26+
@for (role of user.roles | keyvalue; track role) {
27+
<!-- -->
28+
@if (role.value) {
29+
<mat-chip>{{role.key | role}}</mat-chip>
30+
}
31+
<!-- -->
32+
}
33+
</mat-chip-set>
34+
</div>
2935
}
3036

31-
<!-- -->
32-
}
37+
<section>
38+
@if (user.profile && user.profile.minibio) {
39+
<mat-card>
40+
<mat-card-content>
41+
<devmx-markdown [content]="user.profile.minibio" />
42+
</mat-card-content>
43+
</mat-card>
44+
}
45+
<!-- -->
3346

47+
@if (user.skills?.length && user.visibility?.skills) {
48+
<mat-card>
49+
<mat-card-content>
50+
<ol>
51+
@for (item of user.skills; track item.skill.id) {
52+
<li>
53+
<p>{{item.skill.name}}</p>
54+
<mat-progress-bar [value]="item.weight" />
55+
</li>
56+
}
57+
</ol>
58+
</mat-card-content>
59+
</mat-card>
60+
}
61+
</section>
3462
<!-- -->
3563

3664
<section>
65+
@if (user.visibility?.events) {
66+
<!-- -->
3767
@if (eventFacade.response$ | async; as response) {
3868
<devmx-event-card-list [data]="response.data" />
3969
}
70+
<!-- -->
71+
}
4072

4173
<!-- -->
4274

75+
@if (user.visibility?.presentations) {
76+
<!-- -->
4377
@if (presentationFacade.response$ | async; as response) {
4478
<devmx-presentation-card-list [data]="response.data" />
4579
}
80+
<!-- -->
81+
}
4682
</section>
83+
84+
<!-- -->
85+
}

packages/account/feature-about/src/lib/containers/about-user/about-user.container.scss

+19-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,26 @@
88

99
& > section {
1010
gap: 1em;
11+
display: grid;
12+
grid-auto-flow: dense;
13+
14+
grid-template-columns: repeat(2, 1fr);
15+
16+
@media (max-width: 1278px) {
17+
grid-template-columns: repeat(1, 1fr);
18+
}
19+
}
20+
21+
.user-contact {
22+
gap: 2em;
1123
display: flex;
12-
flex-direction: column;
24+
flex-flow: row wrap;
25+
26+
p {
27+
gap: 0.4em;
28+
display: flex;
29+
align-items: center;
30+
}
1331
}
1432

1533
ol {

packages/account/feature-about/src/lib/containers/about-user/about-user.container.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ import { PresentationFacade } from '@devmx/presentation-data-access';
55
import { MarkdownComponent } from '@devmx/shared-ui-global/editor';
66
import { AuthenticationFacade } from '@devmx/account-data-access';
77
import { EventCardListComponent } from '@devmx/event-ui-shared';
8+
import { IconComponent } from '@devmx/shared-ui-global/icon';
9+
import { AsyncPipe, KeyValuePipe } from '@angular/common';
810
import { markdownToText } from '@devmx/shared-util-data';
911
import { EventFacade } from '@devmx/event-data-access';
1012
import { MatCardModule } from '@angular/material/card';
1113
import { Graph } from '@devmx/shared-ui-global/graph';
1214
import { User } from '@devmx/shared-api-interfaces';
1315
import { ActivatedRoute } from '@angular/router';
14-
import { AsyncPipe } from '@angular/common';
1516
import { filter, map, take } from 'rxjs';
17+
import { MatChipsModule } from '@angular/material/chips';
18+
import { RolePipe } from '@devmx/account-ui-shared';
1619

1720
@Component({
1821
selector: 'devmx-about-user',
@@ -25,7 +28,11 @@ import { filter, map, take } from 'rxjs';
2528
PresentationCardListComponent,
2629
EventCardListComponent,
2730
MatProgressBarModule,
31+
MatChipsModule,
32+
IconComponent,
33+
KeyValuePipe,
2834
AsyncPipe,
35+
RolePipe,
2936
],
3037
standalone: true,
3138
})

packages/account/feature-shell/src/lib/containers/account/account.container.html

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
<devmx-account-skills />
1010

11+
<fieldset>
12+
<legend>Informações públicas</legend>
13+
14+
<devmx-account-visibility />
15+
</fieldset>
16+
1117
<footer>
1218
<button mat-flat-button [disabled]="state()">
1319
{{state() ? state() : 'Salvar'}}

packages/account/feature-shell/src/lib/containers/account/account.container.scss

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
max-width: 980px;
88

99
form {
10-
gap: 2em;
10+
gap: 64px;
1111
display: flex;
1212
flex-direction: row;
1313

@@ -36,7 +36,16 @@
3636
gap: 1em;
3737
display: flex;
3838
flex-direction: column;
39-
margin-right: 2em;
39+
max-width: 580px;
40+
}
41+
42+
fieldset {
43+
border: 1px dashed rgba(0, 0, 0, 0.2);
44+
border-radius: 0.4em;
45+
46+
legend {
47+
padding: 0.4em;
48+
}
4049
}
4150

4251
footer {

packages/account/feature-shell/src/lib/containers/account/account.container.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { VisibilityComponent } from './visibility/visibility.component';
12
import { SelectFileComponent } from '@devmx/shared-ui-global/image';
23
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
34
import { ProfileComponent } from './profile/profile.component';
@@ -24,6 +25,7 @@ import {
2425
AuthenticationFacade,
2526
} from '@devmx/account-data-access';
2627

28+
2729
@Component({
2830
selector: 'devmx-account',
2931
templateUrl: './account.container.html',
@@ -37,6 +39,7 @@ import {
3739
ContactComponent,
3840
SocialComponent,
3941
SkillsComponent,
42+
VisibilityComponent,
4043
SelectFileComponent,
4144
MatButtonModule,
4245
AvatarComponent,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div formGroupName="visibility">
2+
<mat-checkbox formControlName="email">Endereço de e-mail</mat-checkbox>
3+
4+
<mat-checkbox formControlName="phone">Telefone</mat-checkbox>
5+
6+
<mat-checkbox formControlName="gender">Gênero</mat-checkbox>
7+
8+
<mat-checkbox formControlName="birthday">Data de nascimento</mat-checkbox>
9+
10+
<mat-checkbox formControlName="roles">Permissões</mat-checkbox>
11+
12+
<mat-checkbox formControlName="events">Eventos</mat-checkbox>
13+
14+
<mat-checkbox formControlName="presentations">Apresentações</mat-checkbox>
15+
16+
<mat-checkbox formControlName="skills">Habilidades</mat-checkbox>
17+
18+
<mat-checkbox formControlName="photos">Fotos</mat-checkbox>
19+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:host {
2+
display: flex;
3+
flex-direction: column;
4+
5+
div {
6+
display: grid;
7+
grid-auto-flow: dense;
8+
9+
grid-template-columns: repeat(3, 1fr);
10+
11+
@media (max-width: 1278px) {
12+
grid-template-columns: repeat(2, 1fr);
13+
}
14+
15+
@media (max-width: 767px) {
16+
grid-template-columns: repeat(1, 1fr);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)