mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
83 lines
2.4 KiB
TypeScript
83 lines
2.4 KiB
TypeScript
/*
|
|
* Copyright (C) 2018, 2019 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 {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
|
import {
|
|
SCAppConfigurationMenuCategory,
|
|
SCLanguage,
|
|
SCThingTranslator,
|
|
SCTranslations,
|
|
} from '@openstapps/core';
|
|
import {NavigationService} from './navigation.service';
|
|
import config from 'capacitor.config';
|
|
|
|
/**
|
|
* Generated class for the MenuPage page.
|
|
*
|
|
* See https://ionicframework.com/docs/components/#navigation for more info on
|
|
* Ionic pages and navigation.
|
|
*/
|
|
@Component({
|
|
selector: 'stapps-navigation',
|
|
styleUrls: ['navigation.scss'],
|
|
templateUrl: 'navigation.html',
|
|
})
|
|
export class NavigationComponent implements OnInit {
|
|
/**
|
|
* Name of the app
|
|
*/
|
|
appName = config.appName;
|
|
|
|
/**
|
|
* Possible languages to be used for translation
|
|
*/
|
|
language: keyof SCTranslations<SCLanguage> = 'en';
|
|
|
|
/**
|
|
* Menu entries from config module
|
|
*/
|
|
menu: SCAppConfigurationMenuCategory[];
|
|
|
|
/**
|
|
* Possible languages to be used for translation
|
|
*/
|
|
public pages = [
|
|
{title: 'Search', url: '/search', icon: 'search'},
|
|
{title: 'Hebis Search', url: '/hebis-search', icon: 'search'},
|
|
{title: 'Schedule', url: '/schedule', icon: 'calendar'},
|
|
{title: 'Settings', url: '/settings', icon: 'settings'},
|
|
];
|
|
|
|
/**
|
|
* Core translator
|
|
*/
|
|
translator: SCThingTranslator;
|
|
|
|
constructor(
|
|
public translateService: TranslateService,
|
|
private navigationService: NavigationService,
|
|
) {
|
|
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
|
|
this.language = event.lang as keyof SCTranslations<SCLanguage>;
|
|
this.translator = new SCThingTranslator(this.language);
|
|
});
|
|
this.translator = new SCThingTranslator('en');
|
|
}
|
|
|
|
async ngOnInit() {
|
|
this.menu = await this.navigationService.getMenu();
|
|
}
|
|
}
|