the first commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<div class="dashboard-container">
|
||||
<h1>Marketplace Backoffice</h1>
|
||||
|
||||
@if (loading()) {
|
||||
<div class="loading-container">
|
||||
<mat-spinner></mat-spinner>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (error()) {
|
||||
<div class="error-message">
|
||||
{{ error() }}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!loading() && !error()) {
|
||||
<div class="projects-grid">
|
||||
@for (project of projects(); track project.id) {
|
||||
<mat-card class="project-card" (click)="openProject(project.id)">
|
||||
<mat-card-header>
|
||||
@if (project.logoUrl) {
|
||||
<img [src]="project.logoUrl" [alt]="project.displayName" class="project-logo">
|
||||
}
|
||||
<mat-card-title>{{ project.displayName }}</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div class="project-status" [class.active]="project.active">
|
||||
{{ project.active ? 'Active' : 'Inactive' }}
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,72 @@
|
||||
.dashboard-container {
|
||||
padding: 2rem;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
|
||||
h1 {
|
||||
margin-bottom: 2rem;
|
||||
font-size: 2rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 4rem;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
padding: 1rem;
|
||||
background: #f44336;
|
||||
color: white;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.projects-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.project-card {
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
mat-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.project-logo {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
mat-card-title {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.project-status {
|
||||
display: inline-block;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
background: #ccc;
|
||||
color: #666;
|
||||
|
||||
&.active {
|
||||
background: #4caf50;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { Component, OnInit, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ApiService } from '../../services';
|
||||
import { Project } from '../../models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-projects-dashboard',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatCardModule, MatProgressSpinnerModule],
|
||||
templateUrl: './projects-dashboard.component.html',
|
||||
styleUrls: ['./projects-dashboard.component.scss']
|
||||
})
|
||||
export class ProjectsDashboardComponent implements OnInit {
|
||||
projects = signal<Project[]>([]);
|
||||
loading = signal(true);
|
||||
error = signal<string | null>(null);
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadProjects();
|
||||
}
|
||||
|
||||
loadProjects() {
|
||||
this.loading.set(true);
|
||||
this.apiService.getProjects().subscribe({
|
||||
next: (projects) => {
|
||||
this.projects.set(projects);
|
||||
this.loading.set(false);
|
||||
},
|
||||
error: (err) => {
|
||||
this.error.set('Failed to load projects');
|
||||
this.loading.set(false);
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openProject(projectId: string) {
|
||||
this.router.navigate(['/project', projectId]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user