fix: user info card

Closes #305
This commit is contained in:
Jovan Krunić
2022-10-14 21:49:48 +02:00
parent e395e9d270
commit 998edcb5cd
7 changed files with 323 additions and 175 deletions

View File

@@ -13,13 +13,6 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {TestBed} from '@angular/core/testing';
import {
SCAboutPageContentType,
SCIndexResponse,
SCSettingInputType,
SCThingOriginType,
SCThingType,
} from '@openstapps/core';
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
import {StorageProvider} from '../storage/storage.provider';
import {ConfigProvider, STORAGE_KEY_CONFIG} from './config.provider';
@@ -30,7 +23,7 @@ import {
WrongConfigVersionInStorage,
} from './errors';
import {NGXLogger} from 'ngx-logger';
import packageJson from '../../../../package.json';
import {sampleIndexResponse} from '../../_helpers/data/sample-configuration';
describe('ConfigProvider', () => {
let configProvider: ConfigProvider;
@@ -192,161 +185,3 @@ describe('ConfigProvider', () => {
);
});
});
const scVersion = packageJson.dependencies['@openstapps/core'];
const sampleIndexResponse: SCIndexResponse = {
app: {
aboutPages: {
about: {
title: 'About',
content: [
{
value: 'This is the about page',
type: SCAboutPageContentType.MARKDOWN,
translations: {
en: {
value: 'This is the about page',
},
},
},
],
translations: {
en: {
title: 'About',
},
},
},
},
campusPolygon: {
coordinates: [[[1, 2]], [[1, 2]]],
type: 'Polygon',
},
features: {},
menus: [
{
icon: 'icon',
id: 'main',
items: [
{
icon: 'icon',
route: '/index',
title: 'start',
translations: {
de: {
title: 'Start',
},
en: {
title: 'start',
},
},
},
],
name: 'main',
translations: {
de: {
name: 'Haupt',
},
en: {
name: 'main',
},
},
},
],
name: 'StApps',
privacyPolicyUrl: 'foo.bar',
settings: [
{
categories: ['credentials'],
defaultValue: '',
inputType: SCSettingInputType.Text,
name: 'username',
order: 0,
origin: {
indexed: '2018-09-11T12:30:00Z',
name: 'Dummy',
type: SCThingOriginType.Remote,
},
translations: {
de: {
name: 'Benutzername',
},
en: {
name: 'Username',
},
},
type: SCThingType.Setting,
uid: '',
},
],
},
auth: {},
backend: {
SCVersion: scVersion,
externalRequestTimeout: 5000,
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
mappingIgnoredTags: [],
maxMultiSearchRouteQueries: 5,
maxRequestBodySize: 512 * 1024,
name: 'Technische Universität Berlin',
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
sortableFields: [
{
fieldName: 'name',
sortTypes: ['ducet'],
},
{
fieldName: 'type',
sortTypes: ['ducet'],
},
{
fieldName: 'categories',
onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.Building,
SCThingType.Catalog,
SCThingType.Dish,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['ducet'],
},
{
fieldName: 'geo',
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'],
},
{
fieldName: 'geo',
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'],
},
{
fieldName: 'inPlace.geo',
onlyOnTypes: [
SCThingType.DateSeries,
SCThingType.Dish,
SCThingType.Floor,
SCThingType.Organization,
SCThingType.PointOfInterest,
SCThingType.Room,
SCThingType.Ticket,
],
sortTypes: ['distance'],
},
{
fieldName: 'offers',
onlyOnTypes: [SCThingType.Dish],
sortTypes: ['price'],
},
],
},
};

View File

@@ -38,7 +38,9 @@ export const STORAGE_KEY_CONFIG = 'stapps.config';
/**
* Provides configuration
*/
@Injectable()
@Injectable({
providedIn: 'root',
})
export class ConfigProvider {
/**
* Api client