Skip to content

Commit

Permalink
updated profile ui
Browse files Browse the repository at this point in the history
  • Loading branch information
albindavidc committed Feb 6, 2025
1 parent c30311d commit f619a1b
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.profile-container {
background-color: #f8f9fa;
}

.profile-card {
max-width: 400px;
width: 100%;
border: none;
border-radius: 15px;
overflow: hidden;
}

.profile-image-container {
width: 120px;
height: 120px;
margin: 0 auto;
border: 4px solid #fff;
border-radius: 50%;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.profile-image {
width: 100%;
height: 100%;
object-fit: cover;
}

.card-title {
font-size: 1.75rem;
font-weight: 600;
color: #333;
}

.card-text {
font-size: 0.95rem;
}

.btn-primary {
background-color: #007bff;
border: none;
padding: 8px 20px;
border-radius: 25px;
font-size: 0.9rem;
transition: background-color 0.3s ease;

&:hover {
background-color: darken(#007bff, 10%);
}
}

.alert-danger {
max-width: 400px;
width: 100%;
text-align: center;
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
<div class="container-fluid">
<div *ngIf="loading$ | async; else content">
<p>Loading profile data...</p>
<div class="container-fluid profile-container">
<!-- Loading State -->
<div *ngIf="loading$ | async; else content" class="d-flex justify-content-center align-items-center vh-100">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<p class="ms-3 mb-0">Loading profile data...</p>
</div>

<!-- Profile Content -->
<ng-template #content>
<!-- <pre>{{ admin$ | async | json }}</pre> -->
<div *ngIf="admin$ | async as admin; else error" class="d-flex justify-content-center align-items-center vh-100">
<div class="card profile-card shadow-lg">
<div class="card-body text-center p-4">
<!-- Profile Image -->
<div class="profile-image-container mb-4">
<img [src]="admin.photo || 'assets/default-profile.png'" alt="Admin Profile" class="profile-image rounded-circle">
</div>

<!-- Profile Details -->
<h2 class="card-title mb-3">{{ admin.first_name }} {{ admin.last_name }}</h2>
<p class="card-text text-muted mb-1"><strong>Email:</strong> {{ admin.username }}</p>
<p class="card-text text-muted mb-3"><strong>Role:</strong> {{ admin.role || 'Administrator' }}</p>

<div *ngIf="admin$ | async as admin; else error">
<h2>Admin Profile</h2>
<p><strong>Name:</strong> {{ admin.first_name }} {{ admin.last_name }}</p>
<p><strong>Email:</strong> {{ admin.username }}</p>
<!-- Edit Profile Button -->
<button class="btn btn-primary btn-sm">
<i class="fas fa-edit me-2"></i>Edit Profile
</button>
</div>
</div>
</div>

<!-- Error Handling -->
<ng-template #error>
<div *ngIf="error$ | async as error">
<p>Error loading profile: {{ error }}</p>
<div *ngIf="error$ | async as error" class="d-flex justify-content-center align-items-center vh-100">
<div class="alert alert-danger" role="alert">
<i class="fas fa-exclamation-circle me-2"></i>Error loading profile: {{ error }}
</div>
</div>
</ng-template>
</ng-template>
</div>
</div>

0 comments on commit f619a1b

Please sign in to comment.