refactor: use material symbols for menu

This commit is contained in:
Jovan Krunić
2022-08-22 15:25:00 +00:00
committed by Thea Schöbl
parent 557d050b36
commit 9e1017edfb
2 changed files with 85 additions and 152 deletions

View File

@@ -18,31 +18,29 @@ import {resolve} from 'path';
* @param num The number that should be checked
* @param range Array of two numbers representing a range (inclusive interval)
*/
export function inRangeInclusive(num: number, range: number[]): boolean {
return num >= range[0] && num <= range[1];
export function inRangeInclusive(number_: number, range: number[]): boolean {
return number_ >= range[0] && number_ <= range[1];
}
const sommerRange = [4, 9];
const winterRange = [10, 3];
const month = new Date().getMonth();
const year = new Date().getFullYear();
const winterYearOffset = (month < winterRange[0] ? -1 : 0);
const winterYearOffset = month < winterRange[0] ? -1 : 0;
const sommerYear = year + (month <= winterRange[1] ? -1 : 0);
const winterYear = `${year + winterYearOffset}/${(year + 1 + winterYearOffset)
.toString()
.slice(-2)}`;
const winterYear = `${year + winterYearOffset}/${(year + 1 + winterYearOffset).toString().slice(-2)}`;
const wsAcronymShort = `WS ${winterYear}`;
const ssAcronymShort = `SS ${sommerYear}`;
const wsAcronymLong = `WiSe ${winterYear}`;
const ssAcronymLong = `SoSe ${sommerYear}`;
const userGroupSetting: SCUserGroupSetting = {
categories: ['profile'],
defaultValue: 'students',
description: 'The user group the app is going to be used.'
+ 'This settings for example is getting used for the predefined price category of mensa meals.',
description:
'The user group the app is going to be used.' +
'This settings for example is getting used for the predefined price category of mensa meals.',
inputType: SCSettingInputType.SingleChoice,
name: 'group',
order: 1,
@@ -53,24 +51,17 @@ const userGroupSetting: SCUserGroupSetting = {
},
translations: {
de: {
description: 'Mit welcher Benutzergruppe soll die App verwendet werden?'
+ ' Die Einstellung wird beispielsweise für die Vorauswahl der Preiskategorie der Mensa verwendet.',
description:
'Mit welcher Benutzergruppe soll die App verwendet werden?' +
' Die Einstellung wird beispielsweise für die Vorauswahl der Preiskategorie der Mensa verwendet.',
name: 'Gruppe',
values: [
'Student',
'Angestellter',
'Gast',
],
values: ['Student', 'Angestellter', 'Gast'],
},
en: {
description: `The user group the app is going to be used.'
+ ' This settings for example is getting used for the predefined price category of mensa meals.`,
name: 'Group',
values: [
'student',
'employee',
'guest',
],
values: ['student', 'employee', 'guest'],
},
},
type: SCThingType.Setting,
@@ -94,18 +85,12 @@ const languageSetting: SCLanguageSetting = {
de: {
description: 'Die Sprache in der die App angezeigt wird.',
name: 'Sprache',
values: [
'Deutsch',
'English',
],
values: ['Deutsch', 'English'],
},
en: {
description: 'The language this app is going to use.',
name: 'Language',
values: [
'Deutsch',
'English',
],
values: ['Deutsch', 'English'],
},
},
type: SCThingType.Setting,
@@ -132,8 +117,7 @@ const config: Partial<SCConfigFile> = {
title: 'Über das StApps Projekt',
content: [
{
title:
'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
title: 'Verbundprojekt mehrerer Hochschulen für eine generische Studierenden-App',
content: {
type: SCAboutPageContentType.MARKDOWN,
value: `
@@ -154,8 +138,7 @@ const config: Partial<SCConfigFile> = {
},
translations: {
en: {
title:
'Collaborative project of multiple universities for a single generic study app',
title: 'Collaborative project of multiple universities for a single generic study app',
},
},
type: SCAboutPageContentType.SECTION,
@@ -200,10 +183,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.MARKDOWN,
},
{
value:
'[mail]()<br>' +
'[+49 12 345 67890]()<br>' +
'[https://localhost/]()',
value: '[mail]()<br>' + '[+49 12 345 67890]()<br>' + '[https://localhost/]()',
translations: {
en: {
value: 'This would be the english contact information',
@@ -223,7 +203,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.SECTION,
},
{
icon: 'newspaper',
icon: 'campaign',
title: 'Neue Funktionen / Gelöste Probleme',
link: 'changelog',
translations: {
@@ -234,7 +214,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'document',
icon: 'description',
title: 'Impressum',
link: 'imprint',
translations: {
@@ -245,7 +225,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'shield-half',
icon: 'policy',
title: 'Datenschutz',
link: 'privacy',
translations: {
@@ -256,7 +236,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'reader',
icon: 'text_snippet',
title: 'Allgemeine Geschäftsbedingungen',
link: 'terms',
translations: {
@@ -267,7 +247,7 @@ const config: Partial<SCConfigFile> = {
type: SCAboutPageContentType.ROUTER_LINK,
},
{
icon: 'library',
icon: 'copyright',
title: 'Bibliotheken und Lizenzen',
link: 'licenses',
translations: {
@@ -363,26 +343,11 @@ const config: Partial<SCConfigFile> = {
campusPolygon: {
coordinates: [
[
[
8.660432999690723,
50.123027017044436,
],
[
8.675496285518358,
50.123027017044436,
],
[
8.675496285518358,
50.13066176448642,
],
[
8.660432999690723,
50.13066176448642,
],
[
8.660432999690723,
50.123027017044436,
],
[8.660_432_999_690_723, 50.123_027_017_044_436],
[8.675_496_285_518_358, 50.123_027_017_044_436],
[8.675_496_285_518_358, 50.130_661_764_486_42],
[8.660_432_999_690_723, 50.130_661_764_486_42],
[8.660_432_999_690_723, 50.123_027_017_044_436],
],
],
type: 'Polygon',
@@ -397,6 +362,7 @@ const config: Partial<SCConfigFile> = {
},
menus: [
{
// unused
icon: 'menu',
id: 'main',
items: [
@@ -427,7 +393,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'calendar',
icon: 'calendar_month',
route: '/schedule',
title: 'schedule',
translations: {
@@ -440,7 +406,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'cafe',
icon: 'local_cafe',
route: '/canteen',
title: 'canteen',
translations: {
@@ -453,7 +419,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'search',
icon: 'local_library',
route: '/hebis-search',
title: 'library catalog',
translations: {
@@ -466,7 +432,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'folder',
icon: 'inventory_2',
route: '/catalog',
title: 'course catalog',
translations: {
@@ -503,11 +469,12 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'person',
// unused
icon: 'account_circle',
id: 'personal',
items: [
{
icon: 'library',
icon: 'account_circle',
route: '/library-account',
title: 'library account',
translations: {
@@ -520,7 +487,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'star',
icon: 'grade',
route: '/favorites',
title: 'favorites',
translations: {
@@ -533,7 +500,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'person',
icon: 'account_circle',
route: '/profile',
title: 'profile',
translations: {
@@ -559,7 +526,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'information',
icon: 'info',
route: '/about',
title: 'about',
translations: {
@@ -572,7 +539,7 @@ const config: Partial<SCConfigFile> = {
},
},
{
icon: 'chatbubbles',
icon: 'rate_review',
route: '/feedback',
title: 'feedback',
translations: {
@@ -598,10 +565,7 @@ const config: Partial<SCConfigFile> = {
],
name: 'Goethe-Uni',
privacyPolicyUrl: 'https://mobile.server.uni-frankfurt.de/_static/privacy.md',
settings: [
userGroupSetting,
languageSetting,
],
settings: [userGroupSetting, languageSetting],
},
auth: {
paia: {
@@ -611,7 +575,8 @@ const config: Partial<SCConfigFile> = {
url: 'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
},
endpoints: {
authorization: 'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
authorization:
'https://hds.hebis.de/Shibboleth.sso/UBFFM?target=https://hds.hebis.de/ubffm/paia_login_stub.php',
mapping: {
id: '$.email',
name: '$.name',
@@ -623,14 +588,11 @@ const config: Partial<SCConfigFile> = {
},
},
backend: {
SCVersion: JSON.parse((readFileSync(resolve('.', '.', 'package.json'), 'utf-8')).toString())
.dependencies['@openstapps/core'],
externalRequestTimeout: 5000,
hiddenTypes: [
SCThingType.DateSeries,
SCThingType.Diff,
SCThingType.Floor,
SCVersion: JSON.parse(readFileSync(resolve('.', '.', 'package.json'), 'utf-8').toString()).dependencies[
'@openstapps/core'
],
externalRequestTimeout: 5000,
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'],
maxMultiSearchRouteQueries: 5,
maxRequestBodySize: 512 * 1024,
@@ -659,20 +621,12 @@ const config: Partial<SCConfigFile> = {
},
{
fieldName: 'geo',
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
onlyOnTypes: [SCThingType.Building, SCThingType.PointOfInterest, SCThingType.Room],
sortTypes: ['distance'],
},
{
fieldName: 'geo',
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
onlyOnTypes: [SCThingType.Building, SCThingType.PointOfInterest, SCThingType.Room],
sortTypes: ['distance'],
},
{
@@ -690,9 +644,7 @@ const config: Partial<SCConfigFile> = {
},
{
fieldName: 'offers',
onlyOnTypes: [
SCThingType.Dish,
],
onlyOnTypes: [SCThingType.Dish],
sortTypes: ['price'],
},
],
@@ -725,31 +677,19 @@ const config: Partial<SCConfigFile> = {
},
{
fieldName: 'academicTerms.acronym',
onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.SportCourse,
],
onlyOnTypes: [SCThingType.AcademicEvent, SCThingType.SportCourse],
},
{
fieldName: 'academicTerm.acronym',
onlyOnTypes: [
SCThingType.Catalog,
],
onlyOnTypes: [SCThingType.Catalog],
},
{
fieldName: 'majors',
onlyOnTypes: [
SCThingType.AcademicEvent,
],
onlyOnTypes: [SCThingType.AcademicEvent],
},
{
fieldName: 'keywords',
onlyOnTypes: [
SCThingType.Article,
SCThingType.Book,
SCThingType.Message,
SCThingType.Video,
],
onlyOnTypes: [SCThingType.Article, SCThingType.Book, SCThingType.Message, SCThingType.Video],
},
{
fieldName: 'type',
@@ -772,7 +712,7 @@ const config: Partial<SCConfigFile> = {
{
factor: 1,
fields: {
'categories': {
categories: {
'course': 1.08,
'integrated course': 1.08,
'introductory class': 1.05,
@@ -790,11 +730,11 @@ const config: Partial<SCConfigFile> = {
{
factor: 1,
fields: {
'categories': {
'cafe': 1.1,
'learn': 1.1,
'library': 1.2,
'restaurant': 1.1,
categories: {
cafe: 1.1,
learn: 1.1,
library: 1.2,
restaurant: 1.1,
},
},
type: SCThingType.PointOfInterest,
@@ -802,7 +742,7 @@ const config: Partial<SCConfigFile> = {
{
factor: 1,
fields: {
'categories': {
categories: {
'main dish': 2,
},
},
@@ -813,7 +753,7 @@ const config: Partial<SCConfigFile> = {
{
factor: 1,
fields: {
'categories': {
categories: {
'cafe': 2,
'canteen': 2,
'restaurant': 2,