From 8e5ae8beb2d94f031da9629d548b03b331ece527 Mon Sep 17 00:00:00 2001 From: Polyterative Date: Sun, 10 Nov 2024 15:15:39 +0100 Subject: [PATCH] feat(module-details): statistics card in page --- .../module-details.component.html | 25 +------ .../lib-showcase-grid.component.html | 6 +- .../lib-showcase-grid.component.ts | 13 +++- .../rack-editor/rack-editor.component.html | 17 +++-- src/app/components/rack-parts/rack.module.ts | 4 +- .../module-browser-detail.component.html | 69 ++++++++++++++++--- .../module-browser/module-browser.module.ts | 2 + 7 files changed, 87 insertions(+), 49 deletions(-) diff --git a/src/app/components/module-parts/module-details/module-details.component.html b/src/app/components/module-parts/module-details/module-details.component.html index 608ecfe8..e37cd80d 100644 --- a/src/app/components/module-parts/module-details/module-details.component.html +++ b/src/app/components/module-parts/module-details/module-details.component.html @@ -57,27 +57,6 @@ > Abstract module, used for educational patches.

- -
- {{ data?.name }} - is a {{ data?.hp }}HP - {{ data?.standard?.name }} module made by - {{ data?.manufacturer?.name }} - -
- Module has {{ data?.isComplete ? 'been' : 'not been' }} completed - and {{ data?.isApproved ? 'has' : 'has not' }} been approved. -
- - Module has {{ data?.panels?.length }} panel(s). -
- Provides {{ data?.ins?.length }} in(s) - and {{ data?.outs?.length }} out(s). - -
- -
- First seen on {{ data?.created | date: 'mediumDate' }} - and last updated on {{ data?.updated | date: 'mediumDate' }}. -
+ + \ No newline at end of file diff --git a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html index 878f4890..5eaaf88f 100644 --- a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html +++ b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html @@ -1,7 +1,7 @@ -
- + diff --git a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts index 235b7045..b08e9350 100644 --- a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts +++ b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts @@ -3,8 +3,10 @@ import { Component, Input } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; import { LabelValueShowcaseModule } from "src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module"; import { + AsyncPipe, NgForOf, NgIf } from "@angular/common"; @@ -15,6 +17,8 @@ interface LabelValueData { label: string; value: string; icon?: string; + hidden?: boolean; + size?: string; } @Component({ @@ -24,15 +28,18 @@ interface LabelValueData { LabelValueShowcaseModule, NgForOf, MatIcon, - NgIf + NgIf, + AsyncPipe ], templateUrl: './lib-showcase-grid.component.html', styleUrl: './lib-showcase-grid.component.scss', changeDetection: ChangeDetectionStrategy.OnPush }) export class LibShowcaseGridComponent { + public data$ = new BehaviorSubject([]); - @Input() data: LabelValueData[] = []; - @Input() minSize: string = '6rem'; // Default size is 12rem + @Input() set data(values: LabelValueData[]) { + this.data$.next(values.filter(v => !v.hidden)); + } } diff --git a/src/app/components/rack-parts/rack-editor/rack-editor.component.html b/src/app/components/rack-parts/rack-editor/rack-editor.component.html index a5041dbc..c8ba43e1 100644 --- a/src/app/components/rack-parts/rack-editor/rack-editor.component.html +++ b/src/app/components/rack-parts/rack-editor/rack-editor.component.html @@ -43,16 +43,15 @@ This rack private. It won't be listed in search but will be accessible to anyone who has the URLm - + diff --git a/src/app/components/rack-parts/rack.module.ts b/src/app/components/rack-parts/rack.module.ts index 5879def5..51f79d7e 100644 --- a/src/app/components/rack-parts/rack.module.ts +++ b/src/app/components/rack-parts/rack.module.ts @@ -46,7 +46,7 @@ import { MatBadge } from "@angular/material/badge"; import { CalculateRowInformationPipe } from "src/app/components/rack-parts/rack-editor/calculate-row-information.pipe"; import { RackImageComponent } from "src/app/components/rack-parts/rack-image/rack-image.component"; import { LabelValueShowcaseModule } from "src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module"; -import { LibShowcaseGridComponent } from "src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component"; +import { LibShowcaseGridComponent, } from "src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component"; @NgModule({ @@ -109,7 +109,7 @@ import { LibShowcaseGridComponent } from "src/app/components/rack-parts/rack-edi CalculateRowInformationPipe, RackImageComponent, LabelValueShowcaseModule, - LibShowcaseGridComponent + LibShowcaseGridComponent, ] }) export class RackModule { diff --git a/src/app/features/module-browser/module-browser-detail/module-browser-detail.component.html b/src/app/features/module-browser/module-browser-detail/module-browser-detail.component.html index c934fe15..7a4e951a 100644 --- a/src/app/features/module-browser/module-browser-detail/module-browser-detail.component.html +++ b/src/app/features/module-browser/module-browser-detail/module-browser-detail.component.html @@ -33,8 +33,64 @@ -
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + +
+
@@ -84,14 +140,6 @@
-

- Do you know about this module? - Please help the community by adding the module's ins and outs. - Contributors' patches DO sound better! -

@@ -184,6 +232,9 @@ > diff --git a/src/app/features/module-browser/module-browser.module.ts b/src/app/features/module-browser/module-browser.module.ts index 1f4719a9..97512574 100644 --- a/src/app/features/module-browser/module-browser.module.ts +++ b/src/app/features/module-browser/module-browser.module.ts @@ -51,6 +51,7 @@ import { } from "@angular/material/menu"; import { CommentsModule } from "src/app/components/shared-atoms/comments/comments.module"; import { CopyableDirective } from "src/app/shared-interproject/app-copy-on-click.directive"; +import { LibShowcaseGridComponent, } from "src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component"; const parentPrefix = 'modules'; @@ -135,6 +136,7 @@ const parentPrefix = 'modules'; MatMenuTrigger, CommentsModule, CopyableDirective, + LibShowcaseGridComponent, ], exports: [ ModuleListComponent,