-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
235 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { type Routes, RouterModule } from '@angular/router'; | ||
|
||
import { FaqPage } from './faq.page'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: FaqPage, | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule], | ||
}) | ||
export class FaqPageRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
|
||
import { IonicModule } from '@ionic/angular'; | ||
|
||
import { FaqPageRoutingModule } from './faq-routing.module'; | ||
|
||
import { SharedModule } from '../_shared/shared.module'; | ||
import { FaqPage } from './faq.page'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
IonicModule, | ||
FaqPageRoutingModule, | ||
SharedModule, | ||
], | ||
declarations: [FaqPage], | ||
}) | ||
export class FaqPageModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<ion-header> | ||
<app-topbar (enter)="search($event)"></app-topbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<div class="page-container"> | ||
|
||
@if(currentFAQ(); as faq) { | ||
<ion-grid> | ||
<ion-row> | ||
<ion-col> | ||
<ion-list> | ||
@for(entry of faq; track $index) { | ||
<ion-item-group> | ||
<ion-item-divider> | ||
<ion-label>{{ entry.card }}</ion-label> | ||
</ion-item-divider> | ||
|
||
@for(faqEntry of entry.faq; track $index) { | ||
<ion-item> | ||
<ion-label text-wrap> | ||
<h3>Q: {{ faqEntry.q }}</h3> | ||
<p>A: {{ faqEntry.a }}</p> | ||
</ion-label> | ||
</ion-item> | ||
} | ||
</ion-item-group> | ||
} | ||
</ion-list> | ||
</ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
} | ||
|
||
@else { | ||
<ion-grid> | ||
<ion-row> | ||
@for(faq of faqs(); track $index) { | ||
<ion-col size-lg="3" size-md="4" size-sm="6" size-xs="12"> | ||
<ion-card class="faq-tile" (click)="loadFAQ(faq)"> | ||
<ion-card-header> | ||
<ion-card-title>{{ metaService.getProductNameByProductId(faq.productId) }}</ion-card-title> | ||
</ion-card-header> | ||
|
||
<ion-card-content> | ||
{{ faq.faq.length | number }} FAQs | ||
</ion-card-content> | ||
</ion-card> | ||
</ion-col> | ||
} | ||
</ion-row> | ||
</ion-grid> | ||
} | ||
</div> | ||
|
||
<app-below-the-fold></app-below-the-fold> | ||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.faq-tile { | ||
min-height: 200px; | ||
padding: 4px; | ||
|
||
border: 2px solid #000; | ||
|
||
cursor: pointer; | ||
user-select: none; | ||
|
||
&:hover { | ||
border: 2px solid var(--ion-color-primary); | ||
} | ||
|
||
ion-card-content { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
font-size: 2em; | ||
padding: 1em; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Component, computed, inject, signal } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import type { ICardFAQ } from '../../../interfaces'; | ||
import { FAQService } from '../faq.service'; | ||
import { MetaService } from '../meta.service'; | ||
|
||
@Component({ | ||
selector: 'app-faq', | ||
templateUrl: './faq.page.html', | ||
styleUrls: ['./faq.page.scss'], | ||
}) | ||
export class FaqPage { | ||
private router = inject(Router); | ||
private route = inject(ActivatedRoute); | ||
private faqService = inject(FAQService); | ||
public metaService = inject(MetaService); | ||
|
||
private locale = signal<string>(''); | ||
private productId = signal<string>(''); | ||
|
||
public faqs = computed(() => this.faqService.getFAQs()); | ||
public currentFAQ = computed(() => | ||
this.faqService.getProductFAQ(this.productId(), this.locale()) | ||
); | ||
|
||
constructor() {} | ||
|
||
ionViewDidEnter() { | ||
this.locale.set(this.route.snapshot.queryParamMap.get('locale') ?? ''); | ||
this.productId.set( | ||
this.route.snapshot.queryParamMap.get('productId') ?? '' | ||
); | ||
|
||
if (!this.locale() || !this.productId()) { | ||
this.router.navigate(['/faq']); | ||
return; | ||
} | ||
} | ||
|
||
loadFAQ(faq: { productId: string; locale: string; faq: ICardFAQ[] }) { | ||
this.router.navigate([], { | ||
relativeTo: this.route, | ||
queryParams: { locale: faq.locale, productId: faq.productId }, | ||
queryParamsHandling: 'merge', | ||
}); | ||
|
||
this.locale.set(faq.locale); | ||
this.productId.set(faq.productId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters