From be813ffbf0b0ae6da6aa49778dddc7e76bace035 Mon Sep 17 00:00:00 2001 From: jafreli Date: Sat, 31 Jan 2026 17:12:45 +0100 Subject: [PATCH] fix: kachel spacing & /admin --- frontend/src/app/components/home/home.html | 30 +++++++------- frontend/src/app/components/home/home.scss | 39 +++++++++++-------- frontend/src/app/components/home/home.ts | 4 +- .../src/app/components/item-form/item-form.ts | 6 +-- .../src/app/components/item-list/item-list.ts | 4 +- frontend/src/app/services/api.ts | 2 +- 6 files changed, 45 insertions(+), 40 deletions(-) diff --git a/frontend/src/app/components/home/home.html b/frontend/src/app/components/home/home.html index e7a902f..031d089 100644 --- a/frontend/src/app/components/home/home.html +++ b/frontend/src/app/components/home/home.html @@ -1,17 +1,15 @@ -
-
- - - -
- - - dashboard - - {{ item.displayName }} -
-
-
-
-
+ diff --git a/frontend/src/app/components/home/home.scss b/frontend/src/app/components/home/home.scss index af22917..492909d 100644 --- a/frontend/src/app/components/home/home.scss +++ b/frontend/src/app/components/home/home.scss @@ -1,45 +1,52 @@ .card-container { display: grid; - grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); - gap: 20px; - padding: 20px; + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); + gap: 32px; + padding: 32px; } .card-link { text-decoration: none; color: inherit; + display: block; } .item-card { cursor: pointer; transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; + height: 100%; } .item-card:hover { transform: translateY(-5px); - box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); } -// Custom flex container inside the header -.card-header-content { +.card-content { display: flex; - align-items: center; // Revert to center alignment - width: 100%; - height: 64px; // Give the container a fixed height + align-items: center; + gap: 16px; + padding: 8px 0; } -// Remove margin from the title and add padding for spacing -.card-header-content .mat-card-title { - margin: 0; - padding-left: 16px; +.card-icon { + width: 48px; + height: 48px; + border-radius: 8px; + object-fit: cover; + flex-shrink: 0; } +.card-title { + font-size: 1.1rem; + font-weight: 500; + line-height: 1.4; +} .default-avatar-icon { - // Vertically align the icon in the avatar space display: flex; justify-content: center; align-items: center; - width: 40px; - height: 40px; + font-size: 32px; + color: #666; } diff --git a/frontend/src/app/components/home/home.ts b/frontend/src/app/components/home/home.ts index 48029ee..6e1fcd6 100644 --- a/frontend/src/app/components/home/home.ts +++ b/frontend/src/app/components/home/home.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { CommonModule } from '@angular/common'; import { MaterialModule } from '../../material.module'; -import { ApiService } from '../../services/api'; +import { Api } from '../../services/api'; import { Item } from '../../models/item'; import { Observable } from 'rxjs'; @@ -16,7 +16,7 @@ export class HomeComponent implements OnInit { items$!: Observable; imgErrorMap = new Map(); - constructor(private apiService: ApiService) {} + constructor(private apiService: Api) {} ngOnInit(): void { this.items$ = this.apiService.getItems(); diff --git a/frontend/src/app/components/item-form/item-form.ts b/frontend/src/app/components/item-form/item-form.ts index 2e85980..66b9d45 100644 --- a/frontend/src/app/components/item-form/item-form.ts +++ b/frontend/src/app/components/item-form/item-form.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { FormBuilder, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms'; -import { ApiService } from '../../services/api'; +import { Api } from '../../services/api'; import { Item } from '../../models/item'; import { MaterialModule } from '../../material.module'; import { CommonModule } from '@angular/common'; @@ -20,7 +20,7 @@ export class ItemFormComponent implements OnInit { constructor( private fb: FormBuilder, - private apiService: ApiService, + private apiService: Api, private router: Router, private route: ActivatedRoute ) { @@ -52,7 +52,7 @@ export class ItemFormComponent implements OnInit { }); } else { this.apiService.createItem(itemData).subscribe(() => { - this.router.navigate(['/']); + this.router.navigate(['/admin']); }); } } diff --git a/frontend/src/app/components/item-list/item-list.ts b/frontend/src/app/components/item-list/item-list.ts index a1a29f6..18f8f79 100644 --- a/frontend/src/app/components/item-list/item-list.ts +++ b/frontend/src/app/components/item-list/item-list.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { ApiService } from '../../services/api'; +import { Api } from '../../services/api'; import { Item } from '../../models/item'; import { Router } from '@angular/router'; import { MaterialModule } from '../../material.module'; @@ -17,7 +17,7 @@ export class ItemListComponent implements OnInit { displayedColumns: string[] = ['id', 'name', 'displayName', 'target', 'actions']; dataSource = new MatTableDataSource(); - constructor(private apiService: ApiService, private router: Router) { } + constructor(private apiService: Api, private router: Router) { } ngOnInit(): void { this.loadItems(); diff --git a/frontend/src/app/services/api.ts b/frontend/src/app/services/api.ts index cb7f356..2c80d97 100644 --- a/frontend/src/app/services/api.ts +++ b/frontend/src/app/services/api.ts @@ -6,7 +6,7 @@ import { Item } from '../models/item'; @Injectable({ providedIn: 'root' }) -export class ApiService { +export class Api { private apiUrl = '/api/items'; constructor(private http: HttpClient) { }