feat(menu): add context menu

Closes #3
This commit is contained in:
Sebastian Lange
2019-05-27 16:38:47 +02:00
parent 3ce3c9ba16
commit 1dbf4515fe
27 changed files with 2261 additions and 767 deletions

View File

@@ -0,0 +1,110 @@
/*
* Copyright (C) 2019, 2020 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 {SCFacet, SCThingType} from '@openstapps/core';
export const facetsMock: SCFacet[] = [
{
'buckets': [
{
'count': 60,
'key': 'academic event',
},
{
'count': 160,
'key': 'message',
},
{
'count': 151,
'key': 'date series',
},
{
'count': 106,
'key': 'dish',
},
{
'count': 20,
'key': 'building',
},
{
'count': 20,
'key': 'semester',
},
],
'field': 'type',
},
{
'buckets': [
{
'count': 12,
'key': 'Max Mustermann',
},
{
'count': 2,
'key': 'Foo Bar',
},
],
'field': 'performers',
'onlyOnType': SCThingType.AcademicEvent,
},
{
'buckets': [
{
'count': 5,
'key': 'colloquium',
},
{
'count': 15,
'key': 'course',
},
],
'field': 'categories',
'onlyOnType': SCThingType.AcademicEvent,
},
{
'buckets': [
{
'count': 5,
'key': 'unipedia',
}],
'field': 'categories',
'onlyOnType': SCThingType.Article,
},
{
'buckets': [
{
'count': 5,
'key': 'employees',
},
{
'count': 15,
'key': 'students',
}],
'field': 'audiences',
'onlyOnType': SCThingType.Message,
},
{
'buckets': [
{
'count': 5,
'key': 'main dish',
},
{
'count': 15,
'key': 'salad',
}],
'field': 'categories',
'onlyOnType': SCThingType.Dish,
},
];

View File

@@ -25,10 +25,11 @@ import {Injectable} from '@angular/core';
import {SCIndexResponse, SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
import {Observable, of} from 'rxjs';
import {delay, map} from 'rxjs/operators';
import {facetsMock} from './data/sample-facets';
import {SampleThings} from './data/sample-things';
// tslint:disable:no-magic-numbers
const sampleIndexResponse: SCIndexResponse = {
export const sampleIndexResponse: SCIndexResponse = {
app: {
campusPolygon: {
coordinates: [
@@ -105,7 +106,7 @@ const sampleIndexResponse: SCIndexResponse = {
},
},
],
name: '',
name: 'main menu',
translations: {
de: {
name: 'Hauptmenü',
@@ -132,21 +133,6 @@ const sampleIndexResponse: SCIndexResponse = {
},
},
},
],
name: 'Your Study-App',
translations: {
de: {
name: 'Deine Studi-App',
},
en: {
name: 'Your Study-App',
},
},
},
{
icon: '',
id: 'meta',
items: [
{
icon: 'information',
route: '/about',
@@ -161,13 +147,13 @@ const sampleIndexResponse: SCIndexResponse = {
},
},
],
name: '',
name: 'Your Study-App',
translations: {
de: {
name: '',
name: 'Deine Studi-App',
},
en: {
name: '',
name: 'Your Study-App',
},
},
},
@@ -178,7 +164,8 @@ const sampleIndexResponse: SCIndexResponse = {
{
categories: ['profile'],
defaultValue: 'student',
description: '',
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,
@@ -216,7 +203,7 @@ const sampleIndexResponse: SCIndexResponse = {
{
categories: ['profile'],
defaultValue: 'en',
description: '',
description: 'The language this app is going to use.',
inputType: SCSettingInputType.SingleChoice,
name: 'language',
order: 0,
@@ -250,7 +237,8 @@ const sampleIndexResponse: SCIndexResponse = {
{
categories: ['privacy'],
defaultValue: false,
description: '',
description: 'Allow the App to use the device location to provide additional information\'s based ' +
'on your actual location.',
inputType: SCSettingInputType.SingleChoice,
name: 'geoLocation',
order: 0,
@@ -393,16 +381,16 @@ export class FakeBackendInterceptor implements HttpInterceptor {
if (request.body.filter.arguments.field === 'uid') {
return this.sampleFetcher.getSampleThing(request.body.filter.arguments.value)
// tslint:disable-next-line:no-any
.pipe(map((sampleData: any) => {
return new HttpResponse({status: 200, body: {data: sampleData}});
}), delay(this.RESPONSE_DELAY)); // add delay for skeleton screens to be seen (see !16)
.pipe(map((sampleData: any) => {
return new HttpResponse({status: 200, body: {data: sampleData}});
}), delay(this.RESPONSE_DELAY)); // add delay for skeleton screens to be seen (see !16)
}
}
return this.sampleFetcher.getSampleThings()
// tslint:disable-next-line:no-any
.pipe(map((sampleData: any) => {
return new HttpResponse({status: 200, body: {data: sampleData}});
return new HttpResponse({status: 200, body: {data: sampleData, facets: facetsMock}});
}), delay(this.RESPONSE_DELAY)); // add delay for skeleton screens to be seen (see !16)
}
}