mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
feat: add about module
This commit is contained in:
committed by
Rainer Killinger
parent
7d449b43d0
commit
d420008926
@@ -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';
|
||||
}
|
||||
}
|
||||
52
src/app/modules/about/about-page/about-page-content.html
Normal file
52
src/app/modules/about/about-page/about-page-content.html
Normal 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>
|
||||
14
src/app/modules/about/about-page/about-page-content.scss
Normal file
14
src/app/modules/about/about-page/about-page-content.scss
Normal 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/>.
|
||||
*/
|
||||
44
src/app/modules/about/about-page/about-page.component.ts
Normal file
44
src/app/modules/about/about-page/about-page.component.ts
Normal 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] ?? {}),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
37
src/app/modules/about/about-page/about-page.html
Normal file
37
src/app/modules/about/about-page/about-page.html
Normal 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>
|
||||
19
src/app/modules/about/about-page/about-page.scss
Normal file
19
src/app/modules/about/about-page/about-page.scss
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user