feat: add about module

This commit is contained in:
Jovan Krunić
2021-10-27 08:25:41 +00:00
committed by Rainer Killinger
parent 7d449b43d0
commit d420008926
32 changed files with 999 additions and 65 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {SCAboutPageContent} from '@openstapps/core';
@Component({
selector: 'about-page-content',
templateUrl: 'about-page-content.html',
styleUrls: ['about-page-content.scss'],
})
export class AboutPageContentComponent {
@Input() content: SCAboutPageContent;
isSimpleTextContent(content: unknown | string): content is string {
return typeof content === 'string';
}
}

View File

@@ -0,0 +1,52 @@
<!--
~ Copyright (C) 2021 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<div [ngSwitch]="content.type">
<markdown
[data]="'value' | translateSimple: content"
*ngSwitchCase="'markdown'"
></markdown>
<div *ngSwitchCase="'section'">
<ion-card *ngIf="content.card; else noCard">
<ion-card-header>
<ion-card-title>{{
'title' | translateSimple: content
}}</ion-card-title>
</ion-card-header>
<ion-card-content>
<about-page-content [content]="content.content"></about-page-content>
</ion-card-content>
</ion-card>
<ng-template #noCard>
<h2>{{ 'title' | translateSimple: content }}</h2>
<about-page-content [content]="content.content"></about-page-content>
</ng-template>
</div>
<ion-grid *ngSwitchCase="'table'">
<ion-row *ngFor="let row of content.rows">
<ion-col *ngFor="let col of row">
<about-page-content [content]="col"></about-page-content>
</ion-col>
</ion-row>
</ion-grid>
<ion-item *ngSwitchCase="'router link'" [routerLink]="content.link">
<ion-icon
*ngIf="content.icon"
[name]="content.icon"
slot="start"
></ion-icon>
<ion-label>{{ 'title' | translateSimple: content }}</ion-label>
</ion-item>
</div>

View File

@@ -0,0 +1,14 @@
/*!
* Copyright (C) 2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {SCAboutPage, SCAppConfiguration} from '@openstapps/core';
import {ConfigProvider} from '../../config/config.provider';
@Component({
selector: 'about-page',
templateUrl: 'about-page.html',
styleUrls: ['about-page.scss'],
})
export class AboutPageComponent implements OnInit {
content: Promise<SCAboutPage>;
constructor(
private readonly route: ActivatedRoute,
private readonly configProvider: ConfigProvider,
) {}
async ngOnInit() {
const route = this.route.snapshot.url.map(it => it.path).join('/');
this.content = new Promise(resolve => {
this.configProvider
.getValue('aboutPages')
.then(value =>
resolve((value as SCAppConfiguration['aboutPages'])[route] ?? {}),
);
});
}
}

View File

@@ -0,0 +1,37 @@
<!--
~ Copyright (C) 2021 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title *ngIf="content | async as content; else titleLoading">{{
'title' | translateSimple: content
}}</ion-title>
<ng-template #titleLoading>
<ion-title
><ion-skeleton-text animated="true"></ion-skeleton-text
></ion-title>
</ng-template>
</ion-toolbar>
</ion-header>
<ion-content *ngIf="content | async as content">
<about-page-content
*ngFor="let element of content.content"
[content]="element"
></about-page-content>
</ion-content>

View File

@@ -0,0 +1,19 @@
/*!
* Copyright (C) 2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
ion-content {
--padding-start: 8px;
--padding-top: 8px;
}