feat(back-end): db connections and other stuff
All checks were successful
Build, Test and Deploy / test-backend (push) Successful in 26s
Build, Test and Deploy / build-and-push (push) Successful in 15s
Build, Test and Deploy / deploy (push) Successful in 3s

This commit is contained in:
2026-02-10 19:07:37 +01:00
parent 3b4ef37e58
commit e5183590c5
42 changed files with 2015 additions and 182 deletions

View File

@@ -12,7 +12,7 @@
@if (isOpen()) {
<div class="color-popup">
@for (category of categories; track category.name) {
@for (category of categories(); track category.name) {
<div class="category">
<div class="category-name">{{ category.name }}</div>
<div class="colors-grid">

View File

@@ -1,7 +1,8 @@
import { Component, input, output, signal } from '@angular/core';
import { Component, input, output, signal, computed } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { PRODUCT_COLORS, getColorHex, ColorCategory, ColorOption } from '../../../core/constants/colors.const';
import { VariantOption } from '../../../features/calculator/services/quote-estimator.service';
@Component({
selector: 'app-color-selector',
@@ -12,11 +13,28 @@ import { PRODUCT_COLORS, getColorHex, ColorCategory, ColorOption } from '../../.
})
export class ColorSelectorComponent {
selectedColor = input<string>('Black');
variants = input<VariantOption[]>([]);
colorSelected = output<string>();
isOpen = signal(false);
categories: ColorCategory[] = PRODUCT_COLORS;
categories = computed(() => {
const vars = this.variants();
if (vars && vars.length > 0) {
// Flatten variants into a single category for now
// We could try to group by extracting words, but "Colors" is fine.
return [{
name: 'Available Colors',
colors: vars.map(v => ({
label: v.colorName, // Display "Red"
value: v.colorName, // Send "Red" to backend
hex: v.hexColor,
outOfStock: v.isOutOfStock
}))
}] as ColorCategory[];
}
return PRODUCT_COLORS;
});
toggleOpen() {
this.isOpen.update(v => !v);
@@ -31,6 +49,13 @@ export class ColorSelectorComponent {
// Helper to find hex for the current selected value
getCurrentHex(): string {
// Check in dynamic variants first
const vars = this.variants();
if (vars && vars.length > 0) {
const found = vars.find(v => v.colorName === this.selectedColor());
if (found) return found.hexColor;
}
return getColorHex(this.selectedColor());
}