Skip to content

Commit f7a5859

Browse files
committed
feat: introduce card with dominant border color
* put search into its own field * rework navigation to be a card CU-86c32zqk0
1 parent 04fb42f commit f7a5859

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+803
-297
lines changed

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@typescript-eslint/eslint-plugin": "7",
3232
"@typescript-eslint/parser": "7",
3333
"bootstrap": "^5.3.3",
34+
"colorthief": "^2.6.0",
3435
"eslint-plugin-import": "^2.31.0",
3536
"eslint-plugin-jsdoc": "^50.6.8",
3637
"express": "^4.18.2",
6.74 KB
Loading

website/src/app/app.routes.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
import { Routes } from '@angular/router';
22

3+
const loadTemplateGallery = () => import('./features/template-gallery').then(m => m.TemplateGalleryComponent);
4+
const loadTemplateDetails = () => import('./features/template-details').then(m => m.TemplateDetailsComponent);
5+
const loadPlatformView = () => import('./features/platform-view').then(m => m.PlatformViewComponent);
6+
37
export const routes: Routes = [
4-
{ path: 'template/:id', loadComponent: () => import('./features/template-details').then(m => m.TemplateDetailsComponent) },
5-
{ path: ':type', loadComponent: () => import('./features/template-gallery').then(m => m.TemplateGalleryComponent) },
6-
{ path: '', redirectTo: '/all', pathMatch: 'full' }
8+
{
9+
path: 'all',
10+
loadComponent: loadTemplateGallery
11+
},
12+
{
13+
path: 'platforms/:type',
14+
loadComponent: loadPlatformView,
15+
},
16+
{
17+
path: 'platforms/:type/definitions/:id',
18+
loadComponent: loadTemplateDetails
19+
},
20+
{
21+
path: 'definitions/:id',
22+
loadComponent: loadTemplateDetails
23+
},
24+
{ path: '', redirectTo: '/all', pathMatch: 'full' },
725
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './platform-view.component';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<div class="pt-5 ps-5 pe-5" >
2+
<div class="pb-5" *ngIf="platform$ | async as platform">
3+
<mst-card [label]="platform.title" [borderColorSourceImage]="platform.logo">
4+
<div class="card-body d-flex" card-body>
5+
<mst-logo-circle [title]="platform.title" [sourceImage]="platform.logo" [size]="'md'"></mst-logo-circle>
6+
<h5 class="ms-3 card-title fw-bold align-self-center">
7+
{{ platform.title }}
8+
</h5>
9+
</div>
10+
</mst-card>
11+
</div>
12+
13+
<h2>Platform building block definitions</h2>
14+
These building block definitions provide pre-configured Terraform modules for automating common cloud tasks
15+
16+
<div class="row mt-4">
17+
<ng-container *ngIf="templates$ | async as templates">
18+
<ng-container *ngIf="templates.length > 0; else noTemplates">
19+
<div class="col-sm-3 mb-3" *ngFor="let template of templates">
20+
<mst-definition-card [card]="template"></mst-definition-card>
21+
</div>
22+
</ng-container>
23+
<ng-template #noTemplates>
24+
<p class="p-2">No building block definitions</p>
25+
</ng-template>
26+
</ng-container>
27+
</div>
28+
</div>

website/src/app/features/platform-view/platform-view.component.scss

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { PlatformViewComponent } from './platform-view.component';
4+
5+
describe('PlatformViewComponent', () => {
6+
let component: PlatformViewComponent;
7+
let fixture: ComponentFixture<PlatformViewComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [PlatformViewComponent]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(PlatformViewComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component)
22+
.toBeTruthy();
23+
});
24+
});
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { CommonModule } from '@angular/common';
2+
import { Component, OnDestroy, OnInit } from '@angular/core';
3+
import { ActivatedRoute, Router } from '@angular/router';
4+
import { Observable, Subscription, forkJoin, map } from 'rxjs';
5+
6+
import { PlatformType } from 'app/core';
7+
import { CardComponent } from 'app/shared/card';
8+
import { DefinitionCard } from 'app/shared/definition-card/definition-card';
9+
import { DefinitionCardComponent } from 'app/shared/definition-card/definition-card.component';
10+
import { LogoCircleComponent } from 'app/shared/logo-circle/logo-circle.component';
11+
import { PlatformData, PlatformService } from 'app/shared/platform-logo';
12+
import { TemplateService } from 'app/shared/template';
13+
14+
interface PlatformVM {
15+
logo: string | null;
16+
title: string;
17+
}
18+
19+
@Component({
20+
selector: 'mst-platform-view',
21+
imports: [CommonModule, DefinitionCardComponent, CardComponent, LogoCircleComponent],
22+
templateUrl: './platform-view.component.html',
23+
styleUrl: './platform-view.component.scss',
24+
standalone: true
25+
})
26+
export class PlatformViewComponent implements OnInit, OnDestroy {
27+
public platform$!: Observable<PlatformVM>;
28+
29+
public templates$!: Observable<DefinitionCard[]>;
30+
31+
private paramSubscription!: Subscription;
32+
33+
private platformData$!: Observable<PlatformData>;
34+
35+
constructor(
36+
private router: Router,
37+
private route: ActivatedRoute,
38+
private templateService: TemplateService,
39+
private platformLogoService: PlatformService
40+
) { }
41+
42+
public ngOnInit(): void {
43+
this.subscribeToRouteParams();
44+
}
45+
46+
public ngOnDestroy(): void {
47+
this.paramSubscription.unsubscribe();
48+
}
49+
50+
private subscribeToRouteParams(): void {
51+
this.paramSubscription = this.route.paramMap.subscribe(params => {
52+
const type = params.get('type');
53+
54+
if (type) {
55+
const templateObs$ = this.templateService.filterTemplatesByPlatformType(type as PlatformType);
56+
this.platformData$ = this.platformLogoService.getAllPlatformData();
57+
this.platform$ = this.platformData$.pipe(
58+
map(platformData => ({
59+
logo: platformData[type]?.logo ?? null,
60+
title: platformData[type]?.name ?? ''
61+
}),
62+
63+
)
64+
);
65+
this.templates$ = this.getTemplatesWithLogos(templateObs$, type);
66+
67+
} else {
68+
this.router.navigate(['/all']);
69+
}
70+
});
71+
}
72+
73+
private getTemplatesWithLogos(templateObs$: Observable<any>, type: string): Observable<DefinitionCard[]> {
74+
return forkJoin({
75+
templates: templateObs$,
76+
platforms: this.platformData$
77+
})
78+
.pipe(
79+
map(({ templates, platforms }) =>
80+
templates.map(item => ({
81+
cardLogo: item.logo,
82+
title: item.name,
83+
description: item.description,
84+
routePath: `/platforms/${type}/definitions/${item.id}`,
85+
supportedPlatforms: item.supportedPlatforms.map(platform => ({
86+
platformType: platform,
87+
imageUrl: platforms[item.platformType].logo ?? null
88+
}))
89+
}))
90+
)
91+
);
92+
}
93+
}

website/src/app/features/template-details/import-dialog/import-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h5 class="card-text mt-3">to continue using this building block template</h5>
5050
<p>Check it out and how it can help your platform team</p>
5151
<a href="https://www.meshcloud.io/en/book-demo" class="btn btn-outline-primary mt-2">
5252
Discover meshStack
53-
<img src="assets/meshstack-logo.png" alt="meshStack Logo" class="button-image" />
53+
<img src="assets/meshstack-logo-black-white.png" alt="meshStack Logo" class="button-image" />
5454
</a>
5555
</div>
5656
</div>

website/src/app/features/template-details/import-dialog/import-dialog.component.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,3 @@
22
width: 5rem;
33
object-fit: contain;
44
}
5-
6-
.button-image {
7-
width: 2rem;
8-
object-fit: contain;
9-
}

0 commit comments

Comments
 (0)