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

Feature/conexion list #7

Merged
merged 6 commits into from
Aug 25, 2023
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
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,8 @@
}
}
}
},
"cli": {
"analytics": "d9961df1-4512-4563-84ac-43b2c6d2e9fc"
}
}
29 changes: 20 additions & 9 deletions src/app/profile/profile-details/profile-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ import { AvatarImagePipe } from './avatar-image.pipe';
import { AuthService } from '../../core/services/auth.service';
import { CurrentUserState } from '../../core/states/current-user.state';

import { MatExpansionModule } from '@angular/material/expansion';
import { ProfileFriendsComponent } from '../profile-friends/profile-friends.component';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Los imports de angular ponlos en el bloque de imports externos, arriba


@Component({
selector: 'io-profile-details',
standalone: true,
imports: [
AsyncPipe,
AvatarImagePipe,
MatCardModule,
MatButtonModule,
NgIf,
QRCodeModule,
],
template: `
<ng-container *ngIf="signOut$ | async"></ng-container>

Expand Down Expand Up @@ -48,12 +43,13 @@ import { CurrentUserState } from '../../core/states/current-user.state';
</div>
</mat-card-content>

<mat-card-actions>
<mat-card-actions class="buttons">
<button mat-button (click)="signOutSubject$.next()">
Cerrar Sesión
</button>
</mat-card-actions>
</mat-card>
<io-profile-friends></io-profile-friends>
`,
styles: [
`
Expand All @@ -65,8 +61,23 @@ import { CurrentUserState } from '../../core/states/current-user.state';
text-align: center;
width: 100%;
}

.buttons {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aplica la metodología BEM para definir estilos. Esto debería llamarse: profile-details__actions o algo parecido

justify-content: center;
margin-bottom: 0.5rem;
}
`,
],
imports: [
AsyncPipe,
AvatarImagePipe,
MatCardModule,
MatButtonModule,
NgIf,
QRCodeModule,
MatExpansionModule,
ProfileFriendsComponent,
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El haber movido todo este bloque abajo, hace que no sea evidente qué imports específicos fueron agregados. Recomendaría que lo vuelvas a colocar donde estaba.

})
export default class ProfileDetailsComponent {
user = inject(CurrentUserState).currentUser;
Expand Down
81 changes: 81 additions & 0 deletions src/app/profile/profile-friends/profile-friends.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { CommonModule, NgFor, NgIf } from '@angular/common';
import { Component, inject } from '@angular/core';
import { CurrentUserState } from 'src/app/core/states/current-user.state';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { UserService } from 'src/app/core/services/user.service';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acomoda tus imports de acuerdo a como indiqué en el grupo, externos primero, locales después


@Component({
selector: 'io-profile-friends',
standalone: true,
template: `
<h1>Amigos</h1>
<ng-container *ngFor="let item$ of friends">
<mat-accordion class="headers-align">
<mat-expansion-panel
(opened)="panelOpenState = true"
(closed)="panelOpenState = false"
class="box"
>
<mat-expansion-panel-header>
<mat-panel-title class="title">
{{ (item$ | async)?.displayName }}
</mat-panel-title>

<mat-panel-description>
<ng-container *ngIf="(item$ | async)?.photoURL; else noPhoto">
<img
class="imagen"
[src]="(item$ | async)?.photoURL"
alt="Foto"
/>
</ng-container>

<ng-template #noPhoto>
<mat-icon>account_circle</mat-icon>
</ng-template>
</mat-panel-description>
</mat-expansion-panel-header>
<p>{{ (item$ | async)?.email }}</p>
</mat-expansion-panel>
</mat-accordion>
</ng-container>
`,
styles: [
`
.box {
margin-bottom: 12px;
}

h1 {
margin-top: 2rem;
margin-left: 0.5rem;
}

.title {
display: flex;
flex-grow: 15;
flex-basis: 0;
margin-right: 16px;
align-items: center;
}

.imagen {
border-radius: 50%;
width: 35px;
height: 35px;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aplica BEM para nombrar tus estilos

`,
],
imports: [CommonModule, MatExpansionModule, MatIconModule, NgFor, NgIf],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creo que no estás usando el CommonModule, eliminalo

})
export class ProfileFriendsComponent {
private userService = inject(UserService);

user = inject(CurrentUserState).currentUser;
friends = this.user()?.friends?.map((email) =>
this.userService.getUser(email),
);

panelOpenState = false;
}