Compare commits

..

9 Commits

Author SHA1 Message Date
bd09b36620 refactor: use observable chains in rating component 2023-08-29 10:20:35 +00:00
ca146b7761 refactor: separate dashboard schedule nav e2e tests 2023-08-28 13:48:34 +02:00
Thea Schöbl
001f978bf9 feat: cleanup profile page 2023-08-25 14:43:25 +00:00
Thea Schöbl
57a5b6061b fix: type errors in easy-ast when generating docs 2023-08-23 08:45:47 +00:00
Rainer Killinger
4fb5941c56 ci: prepare e2e jobs for non nonexistent cache 2023-08-22 17:09:14 +02:00
Rainer Killinger
314e6a6e86 ci: move most pipelines to GitLab OSS large runner 2023-08-08 17:31:14 +02:00
Thea Schöbl
e1cc33bba2 refactor: rename "recurring" to "week overview"
refactor: replace dashboard calendar icon
resolves #128

refactor: route dashboard "next unit" to date series instead of events
resolves #126
2023-08-07 15:51:23 +00:00
Rainer Killinger
9abd397578 refactor: update changelog
ci: publish release
2023-08-03 16:30:40 +02:00
Rainer Killinger
69fe8c6ac8 ci: polish publishing via ci pipelines 2023-08-03 16:30:35 +02:00
44 changed files with 607 additions and 463 deletions

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': patch
---
Use observable chains instead of change detection in the rating component

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Added the ability to remove and add date series from their detail page

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': patch
---
Add a way to hide action chips on list items

View File

@@ -0,0 +1,9 @@
---
'@openstapps/app': minor
---
Improved calendar descriptions
- The dashboard quick link now has a more intuitive icon
- "Recurring" has been renamed to "Week Overview"
- Long words in calendar tabs will now break instead of overflowing

View File

@@ -0,0 +1,13 @@
---
'@openstapps/app': minor
---
Revamp "My Courses" section on profile page
The "My Courses" section on the profile page has been improved
- It will now show the upcoming courses for the next five days
- The section header is now consistent with the other sections
- The section now uses standard list items instead of the custom solution
Additionally, the profile page component has been cleaned up.

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Replaced simple links with list items in date-series detail

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Use event title for date series instead of the generic date series title

View File

@@ -32,7 +32,7 @@ variables:
default: default:
image: registry.gitlab.com/openstapps/openstapps/node-builder image: registry.gitlab.com/openstapps/openstapps/node-builder
tags: tags:
- performance - saas-linux-xlarge-amd64
interruptible: true interruptible: true
before_script: before_script:
- corepack enable - corepack enable

View File

@@ -1,6 +1,6 @@
.limit_publish_pipelines: .limit_publish_pipelines:
rules: rules:
- if: '($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop") && $CI_COMMIT_MESSAGE =~ /^ci: publish release/ && $CI_PIPELINE_SOURCE != "schedule"' - if: '($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop") && $CI_COMMIT_MESSAGE =~ /ci: publish release/ && $CI_PIPELINE_SOURCE != "schedule"'
deploy: deploy:
stage: publish stage: publish

View File

@@ -18,7 +18,7 @@ base image:
docker build docker build
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)" -t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" "${CI_PROJECT_DIR}/${DEPLOY_DIR}" && -t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" "${CI_PROJECT_DIR}/${DEPLOY_DIR}" &&
docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}" docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}" --all-tags
cache: {} # disable irrelevant cache for this job cache: {} # disable irrelevant cache for this job
before_script: [] # do not run irrelevant before script for this job before_script: [] # do not run irrelevant before script for this job
parallel: parallel:
@@ -29,5 +29,7 @@ base image:
DEPLOY_DIR: images/node-builder DEPLOY_DIR: images/node-builder
- IMAGE_NAME: app-builder - IMAGE_NAME: app-builder
DEPLOY_DIR: images/app-builder DEPLOY_DIR: images/app-builder
- IMAGE_NAME: app-cypress
DEPLOY_DIR: images/app-cypress
rules: rules:
- !reference [.limit_scheduled_pipelines, rules] - !reference [.limit_scheduled_pipelines, rules]

View File

@@ -1,9 +1,12 @@
e2e: e2e:
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/ image: registry.gitlab.com/openstapps/openstapps/app-cypress:node-18
stage: test stage: test
script: script:
- pnpm --filter=@openstapps/app install - pnpm --filter=@openstapps/app install
- pnpm --filter=@openstapps/app exec cypress install - pnpm --filter=@openstapps/app exec cypress install
- cd node_modules/.pnpm/re2*/node_modules/re2
- npm run install
- cd $CI_PROJECT_DIR
- pnpm test:integration:app - pnpm test:integration:app
artifacts: artifacts:
when: on_failure when: on_failure

View File

@@ -42,3 +42,17 @@ The command `ionic cordova run ios` runs into the error `/platforms/ios/build/em
- Either use the command: `ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"` - Either use the command: `ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"`
- Or open the iOS project in Xcode and change build system in workspace settings to `Lagacy Build System`. Then the normal run command works also. - Or open the iOS project in Xcode and change build system in workspace settings to `Lagacy Build System`. Then the normal run command works also.
## Cypress
#### Problem
The browser doesn't open or the tests don't connect to a browser
#### Solution
Delete the Cypress config file
```shell
rm -rf ~/.config/Cypress
```

View File

@@ -18,14 +18,18 @@
describe('dashboard', async function () { describe('dashboard', async function () {
describe('schedule section', function () { describe('schedule section', function () {
it('should lead to the schedule', function () { it('should lead to the week overview', function () {
cy.visit('/overview'); cy.visit('/overview');
cy.get('.schedule').contains('a', 'Stundenplan').click(); cy.get('.schedule')
cy.url().should('include', '/schedule/recurring'); .contains('a', /Wochen.*übersicht/)
.click();
cy.url().should('include', '/schedule/week-overview');
});
it('should lead to the calendar', function () {
cy.visit('/overview'); cy.visit('/overview');
cy.get('.schedule').contains('a', 'Kein Eintrag gefunden').click(); cy.get('.schedule').contains('a', 'Kein Eintrag gefunden').click();
cy.url().should('include', '/schedule/recurring'); cy.url().should('include', '/schedule/calendar');
}); });
// TODO: Reenable and stabilize tests // TODO: Reenable and stabilize tests

View File

@@ -19,19 +19,19 @@
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<div #schedule class="schedule"> <div #schedule class="schedule">
<a [routerLink]="['/schedule/recurring']"> <a [routerLink]="['/schedule/week-overview']">
<ion-icon size="40" weight="300" name="grid_view"></ion-icon> <ion-icon size="36" weight="300" name="calendar_month"></ion-icon>
<ion-label>{{ 'schedule.recurring' | translate }}</ion-label> <ion-label [innerHTML]="'schedule.recurring' | translate"></ion-label>
</a> </a>
<!-- Avoid structural directives here, they might interfere with the collapse animation --> <!-- Avoid structural directives here, they might interfere with the collapse animation -->
<a <a
[routerLink]="nextEvent?.event ? ['/data-detail', nextEvent!.event.uid] : ['/schedule/recurring']" [routerLink]="nextEvent ? ['/data-detail', nextEvent!.uid] : ['/schedule/calendar']"
class="schedule-item-button" class="schedule-item-button"
> >
<ion-label>{{ 'dashboard.schedule.title' | translate }}</ion-label> <ion-label>{{ 'dashboard.schedule.title' | translate }}</ion-label>
<ion-label> <ion-label>
{{ {{
nextEvent?.event nextEvent
? (nextEvent!.dates | nextDateInList | amDateFormat : 'll, HH:mm') ? (nextEvent!.dates | nextDateInList | amDateFormat : 'll, HH:mm')
: ('dashboard.schedule.noEvent' | translate) : ('dashboard.schedule.noEvent' | translate)
}} }}

View File

@@ -117,6 +117,7 @@ ion-content {
ion-label { ion-label {
font-size: var(--font-size-xxs); font-size: var(--font-size-xxs);
font-weight: var(--font-weight-semi-bold); font-weight: var(--font-weight-semi-bold);
word-break: break-word;
} }
&:hover ::ng-deep stapps-icon { &:hover ::ng-deep stapps-icon {

View File

@@ -1,3 +1,4 @@
/* eslint-disable unicorn/no-useless-undefined */
/* /*
* Copyright (C) 2023 StApps * Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -12,60 +13,51 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Component, ElementRef, HostListener, Input} from '@angular/core'; import {ChangeDetectionStrategy, Component, ElementRef, HostListener, Input} from '@angular/core';
import {SCDish, SCRatingRequest, SCUuid} from '@openstapps/core'; import {SCDish, SCRatingRequest} from '@openstapps/core';
import {RatingProvider} from '../rating.provider'; import {RatingProvider} from '../rating.provider';
import {ratingAnimation} from './rating.animation'; import {ratingAnimation} from './rating.animation';
import {BehaviorSubject, filter, merge, mergeMap, of, ReplaySubject, withLatestFrom} from 'rxjs';
import {catchError, map} from 'rxjs/operators';
@Component({ @Component({
selector: 'stapps-rating', selector: 'stapps-rating',
templateUrl: 'rating.html', templateUrl: 'rating.html',
styleUrls: ['rating.scss'], styleUrls: ['rating.scss'],
animations: [ratingAnimation], animations: [ratingAnimation],
changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class StappsRatingComponent { export class StappsRatingComponent {
rate = false; performRating = new BehaviorSubject(false);
rated = false; userRating = new BehaviorSubject<number | undefined>(undefined);
canBeRated = false; dish = new ReplaySubject<SCDish>(1);
uid: SCUuid; wasAlreadyRated = merge(
this.dish.pipe(mergeMap(({uid}) => this.ratingProvider.hasRated(uid))),
this.userRating.pipe(
filter(it => it !== undefined),
withLatestFrom(this.dish),
mergeMap(([rating, {uid}]) => this.ratingProvider.rate(uid, rating as SCRatingRequest['rating'])),
map(() => true),
catchError(() => of(false)),
),
);
rating?: number; canBeRated = this.dish.pipe(mergeMap(dish => this.ratingProvider.canRate(dish)));
@Input() set item(value: SCDish) { @Input({required: true}) set item(value: SCDish) {
this.uid = value.uid; this.dish.next(value);
Promise.all([this.ratingProvider.canRate(value), this.ratingProvider.hasRated(this.uid)] as const).then(
([canRate, hasRated]) => {
this.canBeRated = canRate;
this.rated = hasRated;
},
);
} }
constructor(readonly elementRef: ElementRef, readonly ratingProvider: RatingProvider) {} constructor(readonly elementRef: ElementRef, readonly ratingProvider: RatingProvider) {}
async submitRating(rating: number) {
this.rating = rating;
try {
await this.ratingProvider.rate(this.uid, rating as SCRatingRequest['rating']);
this.rated = true;
} catch {
this.rating = undefined;
// allow change detection to catch up first
setTimeout(() => {
this.rate = false;
});
}
}
@HostListener('document:mousedown', ['$event']) @HostListener('document:mousedown', ['$event'])
clickOutside(event: MouseEvent) { clickOutside(event: MouseEvent) {
if (this.rating) return; if (this.userRating.value) return;
if (!this.elementRef.nativeElement.contains(event.target)) { if (!this.elementRef.nativeElement.contains(event.target)) {
this.rate = false; this.performRating.next(false);
} }
} }
} }

View File

@@ -14,19 +14,23 @@
--> -->
<ion-button <ion-button
*ngIf="canBeRated" *ngIf="canBeRated | async"
fill="clear" fill="clear"
(click)="$event.stopPropagation(); rate = true" (click)="$event.stopPropagation(); performRating.next(true)"
[disabled]="rated" [disabled]="wasAlreadyRated | async"
> >
<ion-icon slot="icon-only" color="medium" name="thumbs_up_down"></ion-icon> <ion-icon slot="icon-only" color="medium" name="thumbs_up_down"></ion-icon>
</ion-button> </ion-button>
<div class="rating-stars" *ngIf="rate && !rated" [@rating]="rating ? 'rated' : 'abandoned'"> <div
class="rating-stars"
*ngIf="(performRating | async) && (wasAlreadyRated | async) !== true"
[@rating]="(userRating | async) === undefined ? 'abandoned' : 'rated'"
>
<ion-icon <ion-icon
[class.rated-value]="rating === i" [class.rated-value]="(userRating | async) === i"
*ngFor="let i of [5, 4, 3, 2, 1]" *ngFor="let i of [5, 4, 3, 2, 1]"
(click)="$event.stopPropagation(); submitRating(i)" (click)="$event.stopPropagation(); userRating.next(i)"
slot="icon-only" slot="icon-only"
size="32" size="32"
color="medium" color="medium"

View File

@@ -38,6 +38,8 @@ export class DataListItemComponent {
@Input() listItemEndInteraction = true; @Input() listItemEndInteraction = true;
@Input() listItemChipInteraction = true;
@Input() lines = 'inset'; @Input() lines = 'inset';
@Input() forceHeight = false; @Input() forceHeight = false;

View File

@@ -43,7 +43,7 @@
<div> <div>
<ng-template [dataListItemHost]="item"></ng-template> <ng-template [dataListItemHost]="item"></ng-template>
<stapps-action-chip-list <stapps-action-chip-list
*ngIf="appearance !== 'square'" *ngIf="listItemChipInteraction && appearance !== 'square'"
slot="end" slot="end"
[item]="item" [item]="item"
></stapps-action-chip-list> ></stapps-action-chip-list>

View File

@@ -12,19 +12,49 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Component, Input} from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import {SCDateSeries} from '@openstapps/core'; import {SCDateSeries} from '@openstapps/core';
import {ScheduleProvider, toDateSeriesRelevantData} from '../../../calendar/schedule.provider';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';
import {DataRoutingService} from '../../data-routing.service';
import {Router} from '@angular/router';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
/**
* TODO
*/
@Component({ @Component({
selector: 'stapps-date-series-detail-content', selector: 'stapps-date-series-detail-content',
templateUrl: 'date-series-detail-content.html', templateUrl: 'date-series-detail-content.html',
styleUrls: ['date-series-detail-content.scss'],
}) })
export class DateSeriesDetailContentComponent { export class DateSeriesDetailContentComponent implements OnInit {
/**
* TODO
*/
@Input() item: SCDateSeries; @Input() item: SCDateSeries;
isInCalendar: Observable<boolean>;
constructor(
readonly scheduleProvider: ScheduleProvider,
dataRoutingService: DataRoutingService,
router: Router,
) {
dataRoutingService
.itemSelectListener()
.pipe(takeUntilDestroyed())
.subscribe(item => {
void router.navigate(['/data-detail', item.uid]);
});
}
ngOnInit() {
this.isInCalendar = this.scheduleProvider.uuids$.pipe(map(it => it.includes(this.item.uid)));
}
addToCalendar() {
const current = this.scheduleProvider.partialEvents$.value;
this.scheduleProvider.partialEvents$.next([...current, toDateSeriesRelevantData(this.item)]);
}
removeFromCalendar() {
const filtered = this.scheduleProvider.partialEvents$.value.filter(it => it.uid !== this.item.uid);
this.scheduleProvider.partialEvents$.next(filtered);
}
} }

View File

@@ -12,23 +12,18 @@
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
<ion-card> <ng-container *ngIf="isInCalendar | async; else add">
<ion-card-header> {{ 'event' | propertyNameTranslate : item | titlecase }} </ion-card-header> <ion-chip outline="true" color="success" (click)="removeFromCalendar()">
<ion-card-content> <ion-icon name="event_available" fill="true"></ion-icon>
<a [routerLink]="['/data-detail', item.event.uid]">{{ 'name' | thingTranslate : item.event }}</a> <ion-label>{{'chips.addEvent.addedToEvents' | translate}}</ion-label>
</ion-card-content> </ion-chip>
</ion-card> </ng-container>
<ion-card *ngIf="item.inPlace"> <ng-template #add>
<ion-card-header> {{ 'inPlace' | propertyNameTranslate : item | titlecase }} </ion-card-header> <ion-chip outline="true" color="primary" (click)="addToCalendar()">
<ion-card-content> <ion-icon name="calendar_today"></ion-icon>
<ion-icon name="pin_drop"> </ion-icon> <ion-label>{{'chips.addEvent.addEvent' | translate}}</ion-label>
<a [routerLink]="['/data-detail', item.inPlace.uid]">{{ 'name' | thingTranslate : item.inPlace }}</a> </ion-chip>
<stapps-address-detail </ng-template>
*ngIf="item.inPlace.address"
[address]="item.inPlace.address"
></stapps-address-detail>
</ion-card-content>
</ion-card>
<stapps-simple-card <stapps-simple-card
title="{{ 'duration' | propertyNameTranslate : item | titlecase }}" title="{{ 'duration' | propertyNameTranslate : item | titlecase }}"
[content]="[item.duration | amDuration : 'minutes']" [content]="[item.duration | amDuration : 'minutes']"
@@ -56,3 +51,15 @@
[content]="item.performers" [content]="item.performers"
></stapps-simple-card> ></stapps-simple-card>
<stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail> <stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail>
<ion-card>
<ion-card-header> {{ 'event' | propertyNameTranslate : item | titlecase }} </ion-card-header>
<ion-card-content>
<stapps-data-list-item [item]="$any(item.event)"></stapps-data-list-item>
</ion-card-content>
</ion-card>
<ion-card *ngIf="item.inPlace">
<ion-card-header> {{ 'inPlace' | propertyNameTranslate : item | titlecase }} </ion-card-header>
<ion-card-content>
<stapps-data-list-item [item]="$any(item.inPlace)"></stapps-data-list-item>
</ion-card-content>
</ion-card>

View File

@@ -0,0 +1,6 @@
ion-chip {
position: absolute;
z-index: 1;
top: 0;
right: 0;
}

View File

@@ -17,7 +17,7 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<div class="ion-text-wrap"> <div class="ion-text-wrap">
<ion-label class="title">{{ 'name' | thingTranslate : item }}</ion-label> <ion-label class="title">{{ 'event.name' | thingTranslate : item }}</ion-label>
<p> <p>
<ion-icon name="calendar_today"></ion-icon> <ion-icon name="calendar_today"></ion-icon>
<span *ngIf="item.dates[0] && item.dates[item.dates.length - 1]"> <span *ngIf="item.dates[0] && item.dates[item.dates.length - 1]">

View File

@@ -0,0 +1,70 @@
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
import {mergeMap, ReplaySubject} from 'rxjs';
import {map} from 'rxjs/operators';
import {SCDateSeries, SCISO8601Date} from '@openstapps/core';
import moment from 'moment/moment';
import {ScheduleProvider} from '../../calendar/schedule.provider';
interface MyCoursesTodayInterface {
startTime: string;
endTime: string;
course: SCDateSeries;
}
type MyCoursesGroup = [SCISO8601Date, MyCoursesTodayInterface[]][];
/**
* Groups date series into a list of events happening in the next days
* @param dateSeries the date series to group
* @param visibleDays the number of days ahead to group
*/
function groupDays(dateSeries: SCDateSeries[], visibleDays: number): MyCoursesGroup {
const courses: [SCISO8601Date, MyCoursesTodayInterface[]][] = [];
const dates = Array.from({length: visibleDays}, (_, i) => moment().startOf('day').add(i, 'days'));
for (const day of dates) {
const dayCourses: MyCoursesTodayInterface[] = [];
for (const course of dateSeries) {
for (const date of course.dates) {
if (moment(date).isSame(day, 'day')) {
dayCourses.push({
startTime: moment(date).toISOString(),
endTime: moment(date).add(course.duration).toISOString(),
course,
});
}
}
}
courses.push([day.toISOString(), dayCourses]);
}
return courses;
}
@Component({
selector: 'my-courses',
templateUrl: 'my-courses.html',
styleUrls: ['my-courses.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MyCoursesComponent {
/**
* The number of days from today to display
*/
@Input({required: true}) set visibleDays(value: number) {
this.visibleDays$.next(value);
}
readonly visibleDays$ = new ReplaySubject<number>();
myCourses = this.visibleDays$.pipe(
mergeMap(visibleDays =>
this.scheduleProvider.uuids$.pipe(
mergeMap(uuids => this.scheduleProvider.getDateSeries(uuids)),
map(dateSeries => groupDays(dateSeries.dates, visibleDays)),
),
),
);
constructor(private scheduleProvider: ScheduleProvider) {}
}

View File

@@ -0,0 +1,35 @@
<ion-accordion-group *ngIf="myCourses | async as myCourses" [value]="myCourses[0][0]">
<ion-accordion
*ngFor="let myCoursesDay of myCourses"
[value]="myCoursesDay[0]"
[disabled]="myCoursesDay[1].length === 0"
>
<ion-item slot="header">
<!-- TODO: when using date-fns, use https://date-fns.org/v2.30.0/docs/formatRelative -->
<ion-label
>{{ myCoursesDay[0] | amDateFormat: 'dddd, ll' }} - {{ ('profile.courses.' + (myCoursesDay[1].length
=== 0 ? 'NO' : myCoursesDay[1].length === 1 ? 'ONE' : 'MANY' ) + '_EVENT') | translate: {count:
myCoursesDay[1].length} }}</ion-label
>
<ion-icon class="ion-accordion-toggle-icon" name="expand_more"></ion-icon>
</ion-item>
<ion-list class="ion-padding" slot="content">
<ng-container *ngIf="myCoursesDay[1].length === 0">
<div class="no-course">{{ 'profile.courses.no_courses' | translate }}</div>
</ng-container>
<ng-container *ngFor="let myCourse of myCoursesDay[1]">
<ion-item-group>
<ion-item-divider
>{{myCourse.startTime | amDateFormat: 'LT'}} - {{myCourse.endTime | amDateFormat:
'LT'}}</ion-item-divider
>
<stapps-data-list-item
[listItemChipInteraction]="false"
[hideThumbnail]="true"
[item]="myCourse.course"
></stapps-data-list-item>
</ion-item-group>
</ng-container>
</ion-list>
</ion-accordion>
</ion-accordion-group>

View File

@@ -0,0 +1,9 @@
ion-accordion-group {
overflow: hidden;
border-radius: var(--border-radius-default);
}
ion-item-divider {
--background: transparent;
--color: inherit;
}

View File

@@ -12,41 +12,20 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Component, OnInit} from '@angular/core'; import {Component} from '@angular/core';
import {firstValueFrom, Observable, of, Subscription} from 'rxjs';
import {AuthHelperService} from '../../auth/auth-helper.service'; import {AuthHelperService} from '../../auth/auth-helper.service';
import {SCAuthorizationProviderType, SCDateSeries, SCUserConfiguration} from '@openstapps/core'; import {SCAuthorizationProviderType, SCUserConfiguration} from '@openstapps/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {ScheduleProvider} from '../../calendar/schedule.provider'; import {ScheduleProvider} from '../../calendar/schedule.provider';
import moment from 'moment';
import {SCIcon} from '../../../util/ion-icon/icon';
import {profilePageSections} from '../../../../config/profile-page-sections'; import {profilePageSections} from '../../../../config/profile-page-sections';
import {filter, map} from 'rxjs/operators'; import {filter, map} from 'rxjs/operators';
const CourseCard = {
collapsed: SCIcon`expand_more`,
expanded: SCIcon`expand_less`,
};
interface MyCoursesTodayInterface {
startTime: string;
endTime: string;
course: SCDateSeries;
}
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
templateUrl: 'profile-page.html', templateUrl: 'profile-page.html',
styleUrls: ['profile-page.scss'], styleUrls: ['profile-page.scss'],
}) })
export class ProfilePageComponent implements OnInit { export class ProfilePageComponent {
data: {
[key in SCAuthorizationProviderType]: {loggedIn$: Observable<boolean>};
} = {
default: {loggedIn$: of(false)},
paia: {loggedIn$: of(false)},
};
user$ = this.authHelper.getProvider('default').user$.pipe( user$ = this.authHelper.getProvider('default').user$.pipe(
filter(user => user !== undefined), filter(user => user !== undefined),
map(userInfo => { map(userInfo => {
@@ -58,59 +37,18 @@ export class ProfilePageComponent implements OnInit {
logins: SCAuthorizationProviderType[] = []; logins: SCAuthorizationProviderType[] = [];
originPath: string | null;
userInfo?: SCUserConfiguration; userInfo?: SCUserConfiguration;
courseCardEnum = CourseCard;
courseCardState = CourseCard.expanded;
todayDate = moment().startOf('day').add(0, 'day').format(); // moment().startOf('day').format(); '2022-05-03T00:00:00+02:00'
myCoursesToday: MyCoursesTodayInterface[] = [];
subscriptions: Subscription[] = [];
constructor( constructor(
private authHelper: AuthHelperService, readonly authHelper: AuthHelperService,
private route: ActivatedRoute, readonly activatedRoute: ActivatedRoute,
protected readonly scheduleProvider: ScheduleProvider, readonly scheduleProvider: ScheduleProvider,
) {} ) {}
ngOnInit() {
this.data.default.loggedIn$ = this.authHelper.getProvider('default').isAuthenticated$;
this.data.paia.loggedIn$ = this.authHelper.getProvider('paia').isAuthenticated$;
this.subscriptions.push(
this.route.queryParamMap.subscribe(queryParameters => {
this.originPath = queryParameters.get('origin_path');
}),
);
this.getMyCourses();
}
async getMyCourses() {
const result = await firstValueFrom(this.scheduleProvider.uuids$);
const courses = await this.scheduleProvider.getDateSeries(result);
for (const course of courses.dates) {
for (const date of course.dates) {
if (moment(date).startOf('day').format() === this.todayDate) {
this.myCoursesToday[this.myCoursesToday.length] = {
startTime: moment(date).format('LT'),
endTime: moment(date).add(course.duration).format('LT'),
course,
};
}
}
}
}
async signIn(providerType: SCAuthorizationProviderType) { async signIn(providerType: SCAuthorizationProviderType) {
await this.handleOriginPath(); const originPath = this.activatedRoute.snapshot.queryParamMap.get('origin_path');
this.authHelper.getProvider(providerType).signIn(); await (originPath ? this.authHelper.setOriginPath(originPath) : this.authHelper.deleteOriginPath());
await this.authHelper.getProvider(providerType).signIn();
} }
async signOut(providerType: SCAuthorizationProviderType) { async signOut(providerType: SCAuthorizationProviderType) {
@@ -118,25 +56,6 @@ export class ProfilePageComponent implements OnInit {
this.userInfo = undefined; this.userInfo = undefined;
} }
toggleCourseCardState() {
if (this.courseCardState === CourseCard.expanded) {
const card: HTMLElement | null = document.querySelector('.course-card');
const height = card?.scrollHeight;
if (card && height) {
card.style.setProperty('--max-height', height + 'px');
}
}
this.courseCardState =
this.courseCardState === CourseCard.expanded ? CourseCard.collapsed : CourseCard.expanded;
}
private async handleOriginPath() {
this.originPath
? await this.authHelper.setOriginPath(this.originPath)
: await this.authHelper.deleteOriginPath();
}
ionViewWillEnter() { ionViewWillEnter() {
this.authHelper this.authHelper
.getProvider('default') .getProvider('default')

View File

@@ -23,76 +23,53 @@
</ion-header> </ion-header>
<ion-content color="light" parallax [parallaxSize]="130"> <ion-content color="light" parallax [parallaxSize]="130">
<section class="user-card-wrapper"> <ion-card class="user-card">
<ion-card class="user-card"> <ion-card-header>
<ion-card-header> <ion-img src="assets/imgs/header.svg"></ion-img>
<ion-img src="assets/imgs/header.svg"></ion-img> <span *ngIf="user$ | async as userInfo">
<span *ngIf="user$ | async as userInfo"> {{ userInfo.role ? (userInfo?.role | titlecase) : ('profile.role_guest' | translate | titlecase) }}
{{ userInfo.role ? (userInfo?.role | titlecase) : ('profile.role_guest' | translate | titlecase) }} </span>
</span> </ion-card-header>
</ion-card-header> <ion-card-content>
<ion-card-content> <ion-img class="profile-card-img" src="assets/imgs/profile-card-head.svg"></ion-img>
<ion-img class="profile-card-img" src="assets/imgs/profile-card-head.svg"></ion-img> <ion-grid>
<ion-grid> <ion-row>
<ion-row> <ion-col size="3"></ion-col>
<ion-col size="3"></ion-col> <ion-col
<ion-col *ngIf="authHelper.getProvider('default').isAuthenticated$ | async as loggedIn; else logInPrompt"
*ngIf="data.default.loggedIn$ | async as loggedIn; else logInPrompt" size="9"
size="9" class="main-info"
class="main-info" >
> <ng-container *ngIf="user$ | async as userInfo">
<ng-container *ngIf="user$ | async as userInfo"> <ion-text class="full-name"> {{ userInfo?.name }} </ion-text>
<ion-text class="full-name"> {{ userInfo?.name }} </ion-text> <div class="matriculation-number">
<div class="matriculation-number"> <ion-label> {{ 'profile.userInfo.studentId' | translate | uppercase }} </ion-label>
<ion-label> {{ 'profile.userInfo.studentId' | translate | uppercase }} </ion-label> <ion-text> {{ userInfo?.studentId }} </ion-text>
<ion-text> {{ userInfo?.studentId }} </ion-text> </div>
</div> <div class="user-name">
<div class="user-name"> <ion-label> {{ 'profile.userInfo.username' | translate | uppercase }} </ion-label>
<ion-label> {{ 'profile.userInfo.username' | translate | uppercase }} </ion-label> <ion-text>{{ userInfo?.id }}</ion-text>
<ion-text>{{ userInfo?.id }}</ion-text> </div>
</div> <div class="email">
<div class="email"> <ion-label> {{ 'profile.userInfo.email' | translate | uppercase }} </ion-label>
<ion-label> {{ 'profile.userInfo.email' | translate | uppercase }} </ion-label> <ion-text> {{ userInfo?.email }} </ion-text>
<ion-text> {{ userInfo?.email }} </ion-text> </div>
</div> </ng-container>
</ng-container> </ion-col>
<ng-template #logInPrompt>
<ion-col size="9">
<ion-text class="log-in-prompt"> {{ 'profile.userInfo.logInPrompt' | translate }} </ion-text>
</ion-col> </ion-col>
<ng-template #logInPrompt> </ng-template>
<ion-col size="9"> </ion-row>
<ion-text class="log-in-prompt"> {{ 'profile.userInfo.logInPrompt' | translate }} </ion-text> </ion-grid>
</ion-col> </ion-card-content>
</ng-template> </ion-card>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
</section>
<stapps-profile-page-section <stapps-profile-page-section
*ngFor="let section of sections" *ngFor="let section of sections"
[item]="section" [item]="section"
></stapps-profile-page-section> ></stapps-profile-page-section>
<section class="courses"> <stapps-section [title]="'profile.titleCourses' | translate">
<ion-label class="section-headline"> {{ 'profile.titleCourses' | translate | uppercase }} </ion-label> <my-courses [visibleDays]="5"></my-courses>
<ion-card class="courses-card"> </stapps-section>
<ion-card-header (click)="toggleCourseCardState()">
<span>{{ 'profile.courses.today' | translate | uppercase }}</span>
<ion-icon [name]="courseCardState" color="dark" size="20"></ion-icon>
</ion-card-header>
<ion-card-content class="course-card" [class.show-card]="courseCardState === courseCardEnum.expanded">
<ng-container *ngIf="myCoursesToday.length === 0">
<div class="no-course">{{ 'profile.courses.no_courses' | translate }}</div>
</ng-container>
<ng-container *ngFor="let myCourse of myCoursesToday">
<div class="clickable" [routerLink]="['/data-detail', myCourse.course.event.uid]">
<div>{{ myCourse?.startTime }} - {{ myCourse?.endTime }}</div>
<div>{{ myCourse?.course.event?.originalCategory }}</div>
<div [class.last]="!myCourse?.course.inPlace?.name">{{ myCourse.course?.event?.name }}</div>
<div *ngIf="myCourse.course?.inPlace?.name" [class.last]="myCourse.course?.inPlace?.name">
{{ myCourse.course?.inPlace.name }}
</div>
</div>
</ng-container>
</ion-card-content>
</ion-card>
</section>
</ion-content> </ion-content>

View File

@@ -12,216 +12,106 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
:host { // TODO: clean up this mess
section { .user-card {
margin-bottom: calc(2 * var(--spacing-lg) - var(--spacing-md)); position: relative;
padding: var(--spacing-md);
&:last-of-type { max-width: 400px;
margin-bottom: 0; margin: var(--spacing-xl);
}
}
.section-headline { border-radius: var(--border-radius-default);
margin-bottom: var(--spacing-md); box-shadow: var(--shadow-profile-card);
}
.user-card-wrapper { ion-card-header {
margin-bottom: 0; --background: var(--ion-color-tertiary);
.user-card { display: flex;
position: relative;
max-width: 400px;
margin: 0;
border-radius: var(--border-radius-default);
box-shadow: var(--shadow-profile-card);
ion-card-header {
--background: var(--ion-color-tertiary);
display: flex;
align-items: center;
padding-top: var(--spacing-sm);
padding-bottom: var(--spacing-sm);
ion-img {
display: block;
height: 36px;
margin-right: auto;
object-position: left 50%;
}
span {
padding-top: 3px;
font-size: var(--font-size-lg);
font-weight: var(--font-weight-bold);
line-height: 1;
color: var(--ion-color-light);
}
}
ion-card-content {
min-height: 15vh;
.profile-card-img {
position: absolute;
width: 50%;
height: 100%;
margin-left: calc(var(--spacing-md) * -4);
opacity: 0.13;
object-position: left bottom;
}
.main-info {
display: grid;
grid-template-areas:
'fullName fullName'
'matriculationNumber userName'
'email email';
ion-label {
display: block;
font-size: var(--font-size-sm);
font-weight: var(--font-weight-bold);
color: var(--ion-color-medium-shade);
}
ion-text {
display: block;
font-size: var(--font-size-md);
font-weight: var(--font-weight-bold);
color: var(--ion-color-text);
}
.full-name {
display: block;
grid-area: fullName;
margin-bottom: var(--spacing-sm);
font-size: var(--font-size-lg);
font-weight: var(--font-weight-bold);
}
.matriculation-number {
grid-area: matriculationNumber;
margin-bottom: var(--spacing-sm);
}
.user-name {
grid-area: userName;
margin-bottom: var(--spacing-sm);
}
.email {
grid-area: email;
}
}
.log-in-prompt {
margin: auto 0;
font-size: var(--font-size-lg);
font-weight: var(--font-weight-semi-bold);
color: var(--ion-color-text);
}
}
}
}
ion-thumbnail {
align-items: center; align-items: center;
padding-top: var(--spacing-sm);
padding-bottom: var(--spacing-sm);
width: 80%; ion-img {
height: 80%;
margin: 0;
padding: 10px;
background: var(--placeholder-gray);
border-radius: var(--border-radius-default);
ion-icon {
display: block; display: block;
width: 100%; height: 36px;
height: 100%; margin-right: auto;
color: white; object-position: left 50%;
}
span {
padding-top: 3px;
font-size: var(--font-size-lg);
font-weight: var(--font-weight-bold);
line-height: 1;
color: var(--ion-color-light);
} }
} }
ion-row.main-info { ion-card-content {
margin-bottom: 2px; min-height: 15vh;
font-weight: bold;
}
.courses { .profile-card-img {
.courses-card { position: absolute;
max-width: 800px;
margin: 0;
background-color: unset; width: 50%;
border-radius: var(--border-radius-default) var(--border-radius-default) 0 0; height: 100%;
box-shadow: none; margin-left: calc(var(--spacing-md) * -4);
ion-card-header { opacity: 0.13;
display: flex; object-position: left bottom;
align-items: center; }
justify-content: space-between;
background-color: var(--ion-item-background); .main-info {
border-radius: var(--border-radius-default) var(--border-radius-default) 0 0; display: grid;
grid-template-areas:
'fullName fullName'
'matriculationNumber userName'
'email email';
span { ion-label {
font-size: var(--font-size-lg); display: block;
font-weight: var(--font-weight-bold); font-size: var(--font-size-sm);
color: var(--ion-item-background-color-contrast); font-weight: var(--font-weight-bold);
} color: var(--ion-color-medium-shade);
ion-icon {
cursor: pointer;
color: var(--ion-color-light);
}
} }
ion-card-content { ion-text {
overflow: hidden; display: block;
font-size: var(--font-size-md);
max-height: 0; font-weight: var(--font-weight-bold);
margin: 0; color: var(--ion-color-text);
padding: 0;
background-color: var(--ion-item-background);
border-radius: var(--border-radius-default);
transition: max-height 250ms ease-in-out, padding 250ms ease-in-out, margin 250ms ease-in-out;
&.show-card {
display: block;
height: 100%;
max-height: var(--max-height);
margin: var(--spacing-xxl);
padding: var(--spacing-md);
}
div {
font-size: var(--font-size-md);
font-weight: var(--font-weight-black);
color: var(--ion-item-background-color-contrast);
text-align: center;
&.no-course {
padding: var(--spacing-xxl) var(--spacing-lg);
}
&.last {
margin-bottom: var(--spacing-xl);
}
}
} }
.full-name {
display: block;
grid-area: fullName;
margin-bottom: var(--spacing-sm);
font-size: var(--font-size-lg);
font-weight: var(--font-weight-bold);
}
.matriculation-number {
grid-area: matriculationNumber;
margin-bottom: var(--spacing-sm);
}
.user-name {
grid-area: userName;
margin-bottom: var(--spacing-sm);
}
.email {
grid-area: email;
}
}
.log-in-prompt {
margin: auto 0;
font-size: var(--font-size-lg);
font-weight: var(--font-weight-semi-bold);
color: var(--ion-color-text);
} }
} }
} }

View File

@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
@@ -25,6 +24,9 @@ import {UtilModule} from '../../util/util.module';
import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module';
import {ProfilePageSectionComponent} from './page/profile-page-section.component'; import {ProfilePageSectionComponent} from './page/profile-page-section.component';
import {ThingTranslateModule} from '../../translation/thing-translate.module'; import {ThingTranslateModule} from '../../translation/thing-translate.module';
import {DataModule} from '../data/data.module';
import {MyCoursesComponent} from './page/my-courses.component';
import {MomentModule} from 'ngx-moment';
const routes: Routes = [ const routes: Routes = [
{ {
@@ -34,7 +36,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
declarations: [ProfilePageComponent, ProfilePageSectionComponent], declarations: [MyCoursesComponent, ProfilePageComponent, ProfilePageSectionComponent],
imports: [ imports: [
CommonModule, CommonModule,
FormsModule, FormsModule,
@@ -45,6 +47,8 @@ const routes: Routes = [
SwiperModule, SwiperModule,
UtilModule, UtilModule,
ThingTranslateModule, ThingTranslateModule,
DataModule,
MomentModule,
], ],
}) })
export class ProfilePageModule {} export class ProfilePageModule {}

View File

@@ -136,7 +136,7 @@ export class SchedulePageComponent implements OnInit, AfterViewInit {
onInit() { onInit() {
this.tabChoreographer = new SharedAxisChoreographer(this.activatedRoute.snapshot.paramMap.get('mode'), [ this.tabChoreographer = new SharedAxisChoreographer(this.activatedRoute.snapshot.paramMap.get('mode'), [
'calendar', 'calendar',
'recurring', 'week-overview',
'single', 'single',
]); ]);
} }

View File

@@ -18,15 +18,18 @@
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button></ion-back-button> <ion-back-button></ion-back-button>
</ion-buttons> </ion-buttons>
<ion-title *ngIf="tabChoreographer.currentValue === 'calendar'" <ion-title
>{{ 'schedule.calendar' | translate | titlecase }}</ion-title *ngIf="tabChoreographer.currentValue === 'calendar'"
> [innerHTML]="'schedule.calendar' | translate | titlecase"
<ion-title *ngIf="tabChoreographer.currentValue === 'recurring'" ></ion-title>
>{{ 'schedule.recurring' | translate | titlecase }}</ion-title <ion-title
> *ngIf="tabChoreographer.currentValue === 'week-overview'"
<ion-title *ngIf="tabChoreographer.currentValue === 'single'" [innerHTML]="'schedule.recurring' | translate | titlecase"
>{{ 'schedule.single' | translate | titlecase }}</ion-title ></ion-title>
> <ion-title
*ngIf="tabChoreographer.currentValue === 'single'"
[innerHTML]="'schedule.single' | translate | titlecase"
></ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button (click)="onTodayClick()"> <ion-button (click)="onTodayClick()">
<ion-icon name="today" slot="icon-only"></ion-icon> <ion-icon name="today" slot="icon-only"></ion-icon>
@@ -36,15 +39,15 @@
<ion-toolbar color="primary" mode="md" class="tabs-toolbar"> <ion-toolbar color="primary" mode="md" class="tabs-toolbar">
<ion-segment #segment value="calendar" (ionChange)="onSegmentChange()"> <ion-segment #segment value="calendar" (ionChange)="onSegmentChange()">
<ion-segment-button value="calendar" layout="icon-start"> <ion-segment-button value="calendar" layout="icon-start">
<ion-label>{{ 'schedule.calendar' | translate }}</ion-label> <ion-label class="ion-text-wrap" [innerHTML]="'schedule.calendar' | translate"></ion-label>
<ion-icon name="calendar_today"></ion-icon> <ion-icon name="calendar_today"></ion-icon>
</ion-segment-button> </ion-segment-button>
<ion-segment-button value="recurring" layout="icon-start"> <ion-segment-button value="week-overview" layout="icon-start">
<ion-label>{{ 'schedule.recurring' | translate }}</ion-label> <ion-label class="ion-text-wrap" [innerHTML]="'schedule.recurring' | translate"></ion-label>
<ion-icon name="event_repeat"></ion-icon> <ion-icon name="event_repeat"></ion-icon>
</ion-segment-button> </ion-segment-button>
<ion-segment-button value="single" layout="icon-start"> <ion-segment-button value="single" layout="icon-start">
<ion-label>{{ 'schedule.single' | translate }}</ion-label> <ion-label class="ion-text-wrap" [innerHTML]="'schedule.single' | translate"></ion-label>
<ion-icon name="event_upcoming"></ion-icon> <ion-icon name="event_upcoming"></ion-icon>
</ion-segment-button> </ion-segment-button>
</ion-segment> </ion-segment>
@@ -59,7 +62,7 @@
> >
<stapps-calendar-view *ngSwitchCase="'calendar'" [layout]="layout"></stapps-calendar-view> <stapps-calendar-view *ngSwitchCase="'calendar'" [layout]="layout"></stapps-calendar-view>
<!-- Schedule view needs full week --> <!-- Schedule view needs full week -->
<stapps-schedule-view *ngSwitchCase="'recurring'" [layout]="layout"></stapps-schedule-view> <stapps-schedule-view *ngSwitchCase="'week-overview'" [layout]="layout"></stapps-schedule-view>
<stapps-single-events *ngSwitchCase="'single'"></stapps-single-events> <stapps-single-events *ngSwitchCase="'single'"></stapps-single-events>
</div> </div>

View File

@@ -41,7 +41,7 @@ import {ChooseEventsPageComponent} from './page/choose-events-page.component';
const settingsRoutes: Routes = [ const settingsRoutes: Routes = [
{path: 'schedule', redirectTo: 'schedule/calendar/now'}, {path: 'schedule', redirectTo: 'schedule/calendar/now'},
{path: 'schedule/calendar', redirectTo: 'schedule/calendar/now'}, {path: 'schedule/calendar', redirectTo: 'schedule/calendar/now'},
{path: 'schedule/recurring', redirectTo: 'schedule/recurring/now'}, {path: 'schedule/week-overview', redirectTo: 'schedule/week-overview/now'},
{path: 'schedule/single', redirectTo: 'schedule/single/now'}, {path: 'schedule/single', redirectTo: 'schedule/single/now'},
// calendar | recurring | single // calendar | recurring | single
{path: 'schedule/:mode/:date', component: SchedulePageComponent}, {path: 'schedule/:mode/:date', component: SchedulePageComponent},

View File

@@ -459,9 +459,9 @@
"view": { "view": {
"today": "Heute" "today": "Heute"
}, },
"recurring": "Stundenplan", "recurring": "Wochen&shy;übersicht",
"calendar": "Kalender", "calendar": "Kalender",
"single": "Einzeltermine", "single": "Einzel&shy;termine",
"addEventPage": { "addEventPage": {
"TITLE": "Termine Hinzufügen", "TITLE": "Termine Hinzufügen",
"PLACEHOLDER": "Termine", "PLACEHOLDER": "Termine",
@@ -501,8 +501,10 @@
"logInPrompt": "Bitte loggen Sie sich ein, um Ihre Nutzerdaten sehen zu können." "logInPrompt": "Bitte loggen Sie sich ein, um Ihre Nutzerdaten sehen zu können."
}, },
"courses": { "courses": {
"today": "Heute", "no_courses": "Heute stehen keine Termine mehr an.",
"no_courses": "Heute stehen keine Termine mehr an." "NO_EVENT": "Keine Termine",
"ONE_EVENT": "Ein Termin",
"MANY_EVENT": "{{count}} Termine"
} }
}, },
"settings": { "settings": {

View File

@@ -459,7 +459,7 @@
"view": { "view": {
"today": "Today" "today": "Today"
}, },
"recurring": "Recurring", "recurring": "Week Overview",
"calendar": "Calendar", "calendar": "Calendar",
"single": "Single Events", "single": "Single Events",
"addEventPage": { "addEventPage": {
@@ -501,8 +501,10 @@
"logInPrompt": "Please log in to view your user data." "logInPrompt": "Please log in to view your user data."
}, },
"courses": { "courses": {
"today": "Today", "no_courses": "There are no more appointments scheduled today.",
"no_courses": "There are no more appointments scheduled today." "NO_EVENT": "no events",
"ONE_EVENT": "one event",
"MANY_EVENT": "{{count}} events"
} }
}, },
"settings": { "settings": {

View File

@@ -0,0 +1,103 @@
### Set base image
FROM cypress/base:18.16.1
USER root
RUN node --version
# Install dependencies
RUN apt-get update && \
apt-get install -y \
fonts-liberation \
git \
libcurl4 \
libcurl3-gnutls \
libcurl3-nss \
xdg-utils \
wget \
curl \
# firefox dependencies
bzip2 \
firefox-esr \
# add codecs needed for video playback in firefox
# https://github.com/cypress-io/cypress-docker-images/issues/150
mplayer \
# edge dependencies
gnupg \
dirmngr \
# ci dependencies
build-essential \
jq \
musl-dev \
# clean up
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#funky alpine linux compatibility
RUN ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
# install libappindicator3-1 - not included with Debian 11
RUN wget --no-verbose -O /usr/src/libappindicator3-1_0.4.92-7_amd64.deb "http://ftp.us.debian.org/debian/pool/main/liba/libappindicator/libappindicator3-1_0.4.92-7_amd64.deb" && \
dpkg -i /usr/src/libappindicator3-1_0.4.92-7_amd64.deb ; \
apt update && \
apt --fix-broken install -y && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
rm -f /usr/src/libappindicator3-1_0.4.92-7_amd64.deb
# install Chrome browser
RUN export CHROME_VERSION=$(curl -fsSL https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions | jq -r '.versions[0].version') && \
wget --no-verbose -O /usr/src/google-chrome-stable_current_amd64.deb "http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb" && \
dpkg -i /usr/src/google-chrome-stable_current_amd64.deb ; \
apt update && \
apt --fix-broken install -y && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
rm -f /usr/src/google-chrome-stable_current_amd64.deb
# "fake" dbus address to prevent errors
# https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
# install Firefox browser
RUN export FIREFOX_VERSION=$(curl -fsSL https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r '.LATEST_FIREFOX_VERSION') && \
wget --no-verbose -O /tmp/firefox.tar.bz2 "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2" && \
tar -C /opt -xjf /tmp/firefox.tar.bz2 && \
rm /tmp/firefox.tar.bz2 && \
ln -fs /opt/firefox/firefox /usr/bin/firefox
RUN echo "Downloading Latest Edge version..."
## Setup Edge
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
RUN install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
RUN rm microsoft.gpg
## Install Edge
RUN apt-get update && \
apt-get install -y microsoft-edge-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Add a link to the browser that allows Cypress to find it
RUN ln -s /usr/bin/microsoft-edge /usr/bin/edge
# versions of local tools
RUN echo " node version: $(node -v) \n" \
"npm version: $(npm -v) \n" \
"yarn version: $(yarn -v) \n" \
"debian version: $(cat /etc/debian_version) \n" \
"Chrome version: $(google-chrome --version) \n" \
"Firefox version: $(firefox --version) \n" \
"Edge version: $(edge --version) \n" \
"git version: $(git --version) \n" \
"whoami: $(whoami) \n"
# a few environment variables to make NPM installs easier
# good colors for most applications
ENV TERM=xterm
# avoid million NPM install messages
ENV npm_config_loglevel=warn
# allow installing when the main user is root
ENV npm_config_unsafe_perm=true

View File

@@ -0,0 +1,14 @@
{
"name": "@openstapps/app-cypress",
"version": "node-18",
"private": true,
"type": "module",
"license": "GPL-3.0-only",
"author": "Rainer Killinger <mail-openstapps@killinger.co>",
"contributors": [
],
"files": [
"Dockerfile",
"CHANGELOG.md"
]
}

View File

@@ -17,7 +17,7 @@
"format:fix": "dotenv -c -- turbo run format:fix", "format:fix": "dotenv -c -- turbo run format:fix",
"lint": "dotenv -c -- turbo run lint", "lint": "dotenv -c -- turbo run lint",
"lint:fix": "dotenv -c -- turbo run lint:fix", "lint:fix": "dotenv -c -- turbo run lint:fix",
"publish-packages": "pnpm changeset version && pnpm syncpack:fix && pnpm install && git add . && git commit -m \"refactor: update changelog\n\nci: publish release\" && git push && pnpm changeset tag && git push --follow-tags", "publish-packages": "pnpm changeset version && pnpm syncpack:fix && pnpm install && git add . && git commit -m \"docs: update changelogs for release\n\nci: publish release\" && git push && pnpm changeset tag && git push --follow-tags",
"syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges --types dev,peer,prod", "syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges --types dev,peer,prod",
"syncpack:fix": "syncpack format && syncpack fix-mismatches", "syncpack:fix": "syncpack format && syncpack fix-mismatches",
"test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test", "test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test",

View File

@@ -4,8 +4,9 @@
<title>OpenStApps API</title> <title>OpenStApps API</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.bunny.net" />
<link <link
href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" href="https://fonts.bunny.net/css?family=montserrat:300,400,700|roboto:300,400,700"
rel="stylesheet" rel="stylesheet"
/> />
<!-- Redoc doesn't change outer page styles --> <!-- Redoc doesn't change outer page styles -->
@@ -17,7 +18,7 @@
</style> </style>
</head> </head>
<body> <body>
<redoc spec-url="openapi.json"></redoc> <redoc spec-url="./openapi.json"></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script> <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
</body> </body>
</html> </html>

View File

@@ -15,6 +15,7 @@
*/ */
import {EasyAstSpecType} from '../easy-ast-spec-type.js'; import {EasyAstSpecType} from '../easy-ast-spec-type.js';
import {LightweightDefinitionKind} from '../../src/index.js'; import {LightweightDefinitionKind} from '../../src/index.js';
import {TypeFlags} from 'typescript';
// @ts-expect-error unused type // @ts-expect-error unused type
type TestTypeAlias = number | string; type TestTypeAlias = number | string;
@@ -56,12 +57,12 @@ export const testConfig: EasyAstSpecType = {
{ {
referenceName: 'Foo', referenceName: 'Foo',
value: 0, value: 0,
flags: 1280, flags: 1280 as TypeFlags,
}, },
{ {
referenceName: 'Bar', referenceName: 'Bar',
value: 1, value: 1,
flags: 1280, flags: 1280 as TypeFlags,
}, },
], ],
}, },

View File

@@ -15,6 +15,7 @@
*/ */
import {EasyAstSpecType} from '../easy-ast-spec-type.js'; import {EasyAstSpecType} from '../easy-ast-spec-type.js';
import {LightweightDefinitionKind} from '../../src/index.js'; import {LightweightDefinitionKind} from '../../src/index.js';
import {TypeFlags} from 'typescript';
// @ts-expect-error unused type // @ts-expect-error unused type
enum TestAuto { enum TestAuto {
@@ -41,12 +42,12 @@ export const testConfig: EasyAstSpecType = {
{ {
referenceName: 'Foo', referenceName: 'Foo',
value: 0, value: 0,
flags: 1280, flags: 1280 as TypeFlags,
}, },
{ {
referenceName: 'Bar', referenceName: 'Bar',
value: 1, value: 1,
flags: 1280, flags: 1280 as TypeFlags,
}, },
], ],
}, },
@@ -61,12 +62,12 @@ export const testConfig: EasyAstSpecType = {
{ {
referenceName: 'YES', referenceName: 'YES',
value: 'yes', value: 'yes',
flags: 1152, flags: 1152 as TypeFlags,
}, },
{ {
referenceName: 'NO', referenceName: 'NO',
value: 'no', value: 'no',
flags: 1152, flags: 1152 as TypeFlags,
}, },
], ],
}, },

View File

@@ -15,6 +15,7 @@
*/ */
import {EasyAstSpecType} from '../easy-ast-spec-type.js'; import {EasyAstSpecType} from '../easy-ast-spec-type.js';
import {LightweightDefinitionKind} from '../../src/index.js'; import {LightweightDefinitionKind} from '../../src/index.js';
import {TypeFlags} from 'typescript';
// @ts-expect-error unused // @ts-expect-error unused
interface Test { interface Test {
@@ -53,7 +54,7 @@ export const testConfig: EasyAstSpecType = {
name: 'boolean_type', name: 'boolean_type',
type: { type: {
value: 'boolean', value: 'boolean',
flags: 1_048_592, flags: 1_048_592 as TypeFlags,
specificationTypes: [ specificationTypes: [
{ {
value: 'false', value: 'false',

View File

@@ -3,7 +3,7 @@
"entryPoints": ["packages/**/docs/docs.json"], "entryPoints": ["packages/**/docs/docs.json"],
"out": "./docs", "out": "./docs",
"navigationLinks": { "navigationLinks": {
"API": "api", "API": "./api/",
"GitLab": "https://gitlab.com/openstapps/openstapps/", "GitLab": "https://gitlab.com/openstapps/openstapps/",
"Wiki": "https://gitlab.com/openstapps/openstapps/-/wikis/home" "Wiki": "https://gitlab.com/openstapps/openstapps/-/wikis/home"
}, },