From 25cfdd7764ac39e8b971d061b02e9b5a7a0dd393 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Thu, 9 May 2024 09:11:19 -0500 Subject: [PATCH] closes #45 --- .../below-the-fold.component.html | 29 +++++++++++++++++-- .../below-the-fold.component.scss | 3 +- .../below-the-fold.component.ts | 2 ++ .../components/topbar/topbar.component.html | 18 +++++++++--- .../components/topbar/topbar.component.ts | 3 ++ src/app/advanced/advanced.page.html | 27 +++++++++++++---- src/app/meta.service.ts | 10 +++++++ 7 files changed, 79 insertions(+), 13 deletions(-) diff --git a/src/app/_shared/components/below-the-fold/below-the-fold.component.html b/src/app/_shared/components/below-the-fold/below-the-fold.component.html index 82a73ff..347022e 100644 --- a/src/app/_shared/components/below-the-fold/below-the-fold.component.html +++ b/src/app/_shared/components/below-the-fold/below-the-fold.component.html @@ -40,12 +40,15 @@
{{ 'Components.BelowTheFold.CategoryCards' | translate }}

+ + + @@ -54,29 +57,42 @@
{{ 'Components.BelowTheFold.CategorySupport' | translate }}

+ + + + @if(metaService.getSiteConfigProperty('features.askaquestion')) { + }
{{ 'Components.BelowTheFold.CategoryMore' | translate }}

+ + @if(metaService.getSiteConfigProperty('features.github')) { + } + + @if(metaService.getSiteConfigProperty('features.discord')) { + }
@@ -85,4 +101,11 @@ + +
+
+ {{ 'Components.BelowTheFold.CreatedText' | translate }} {{ 'Components.BelowTheFold.CreatedBy' | translate + }}. +
\ No newline at end of file diff --git a/src/app/_shared/components/below-the-fold/below-the-fold.component.scss b/src/app/_shared/components/below-the-fold/below-the-fold.component.scss index 0af93d2..eacdec7 100644 --- a/src/app/_shared/components/below-the-fold/below-the-fold.component.scss +++ b/src/app/_shared/components/below-the-fold/below-the-fold.component.scss @@ -34,7 +34,8 @@ } } - .legal { + .legal, + .creator { color: #444; font-size: 0.75em; } diff --git a/src/app/_shared/components/below-the-fold/below-the-fold.component.ts b/src/app/_shared/components/below-the-fold/below-the-fold.component.ts index 26cc2ea..dbc2dac 100644 --- a/src/app/_shared/components/below-the-fold/below-the-fold.component.ts +++ b/src/app/_shared/components/below-the-fold/below-the-fold.component.ts @@ -1,6 +1,7 @@ import { Component, inject, type OnInit } from '@angular/core'; import { LocalStorage } from 'ngx-webstorage'; import { LocaleService } from '../../../locale.service'; +import { MetaService } from '../../../meta.service'; @Component({ selector: 'app-below-the-fold', @@ -8,6 +9,7 @@ import { LocaleService } from '../../../locale.service'; styleUrls: ['./below-the-fold.component.scss'], }) export class BelowTheFoldComponent implements OnInit { + public metaService = inject(MetaService); public localeService = inject(LocaleService); @LocalStorage() visualMode!: string; diff --git a/src/app/_shared/components/topbar/topbar.component.html b/src/app/_shared/components/topbar/topbar.component.html index 27c3198..cb1f20f 100644 --- a/src/app/_shared/components/topbar/topbar.component.html +++ b/src/app/_shared/components/topbar/topbar.component.html @@ -36,18 +36,28 @@ @if(!buttonsMobile.hasChildNodes()) { - - + @if(metaService.getSiteConfigProperty('icons.topbar.advanced')) { + + } {{ 'Common.Actions.AdvancedShort' | translate }} - + @if(metaService.getSiteConfigProperty('icons.topbar.syntax')) { + + } {{ 'Common.Actions.SyntaxShort' | translate }} - + + @if(metaService.getSiteConfigProperty('icons.topbar.products')) { + + } {{ 'Common.Actions.ProductsShort' | translate }} diff --git a/src/app/_shared/components/topbar/topbar.component.ts b/src/app/_shared/components/topbar/topbar.component.ts index cb37b2d..98bd2c3 100644 --- a/src/app/_shared/components/topbar/topbar.component.ts +++ b/src/app/_shared/components/topbar/topbar.component.ts @@ -1,5 +1,6 @@ import { Component, inject, input } from '@angular/core'; import { Router } from '@angular/router'; +import { MetaService } from '../../../meta.service'; import { SearchService } from '../../../search.service'; @Component({ @@ -8,6 +9,8 @@ import { SearchService } from '../../../search.service'; styleUrls: ['./topbar.component.scss'], }) export class TopbarComponent { + public metaService = inject(MetaService); + private router = inject(Router); private searchService = inject(SearchService); diff --git a/src/app/advanced/advanced.page.html b/src/app/advanced/advanced.page.html index 0dbb24e..90533bd 100644 --- a/src/app/advanced/advanced.page.html +++ b/src/app/advanced/advanced.page.html @@ -10,7 +10,10 @@ - + + @if(metaService.getSiteConfigProperty('icons.advanced.CardName')) { + + } {{ 'Pages.AdvancedSearch.CardNameLabel' | translate }} @@ -23,7 +26,10 @@ - + + @if(metaService.getSiteConfigProperty('icons.advanced.Product')) { + + } {{ 'Pages.AdvancedSearch.ProductLabel' | translate }} @@ -39,7 +45,11 @@ - + + @if(metaService.getSiteConfigProperty('icons.advanced.Subproducts')) { + + } + {{ 'Pages.AdvancedSearch.SubproductsLabel' | translate }} @@ -54,7 +64,10 @@ - + + @if(metaService.getSiteConfigProperty('icons.advanced.Tags')) { + + } {{ 'Pages.AdvancedSearch.TagsLabel' | translate }} @@ -99,7 +112,11 @@ - + + @if(metaService.getSiteConfigProperty('icons.advanced.' + filter.name | stripspaces)) { + + } {{ 'Pages.AdvancedSearch.' + (filter.name | stripspaces) + 'Label' | translate }} diff --git a/src/app/meta.service.ts b/src/app/meta.service.ts index 25edc28..3b66d81 100644 --- a/src/app/meta.service.ts +++ b/src/app/meta.service.ts @@ -1,5 +1,6 @@ import { inject, Injectable } from '@angular/core'; +import { get } from 'lodash'; import type { IProduct, IProductFilter } from '../../interfaces'; import { environment } from '../environments/environment'; import { LocaleService } from './locale.service'; @@ -10,6 +11,9 @@ import { LocaleService } from './locale.service'; export class MetaService { private localeService = inject(LocaleService); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private siteConfig: any = {}; + private allProducts: IProduct[] = []; private productNamesByProductId: Record = {}; @@ -26,6 +30,8 @@ export class MetaService { const metaData = await fetch(`${environment.baseUrl}/meta.json`); const realData = await metaData.json(); + this.siteConfig = realData.config; + this.allProducts = realData.products; this.localeService.setLocales(realData.locales); @@ -67,4 +73,8 @@ export class MetaService { public getAllFilters(): IProductFilter[] { return Object.values(this.filtersByProductId).flat(); } + + public getSiteConfigProperty(prop: string): string | undefined { + return get(this.siteConfig, prop); + } }