feat: add content to empty catalogs

This commit is contained in:
Thea Schöbl
2023-02-24 10:50:38 +00:00
committed by Rainer Killinger
parent 6270a93151
commit 982fb1653b
13 changed files with 155 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
<!--
~ Copyright (C) 2022 StApps
~ Copyright (C) 2023 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.
@@ -28,7 +28,7 @@
<stapps-origin-detail [origin]="item.origin"></stapps-origin-detail>
<ng-template #defaultContent>
<div [ngSwitch]="item.type">
<div [ngSwitch]="item.type" class="content-switch">
<stapps-article-detail-content
[item]="$any(item)"
*ngSwitchCase="'article'"

View File

@@ -1,5 +1,5 @@
/*!
* Copyright (C) 2022 StApps
* Copyright (C) 2023 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.
@@ -14,6 +14,48 @@
*/
@import 'src/theme/util/_mixins.scss';
stapps-origin-detail {
// css hack to make the element stick to the bottom of the scroll container even
// when the content is not filling it
position: sticky;
top: 100vh;
}
.content-switch {
// prevent a scrollbar from appearing in some cases
margin-block-start: -1px !important;
flex: 1;
display: flex;
padding: 0 var(--spacing-md);
::ng-deep > * {
display: flex;
height: fit-content;
width: 100%;
flex-direction: column;
@include border-radius-in-parallax(var(--border-radius-default));
overflow: hidden;
position: relative;
margin-block-start: calc((var(--header-spacing-bottom) - var(--spacing-xl)) * -1);
margin-block-end: var(--spacing-xl);
background-color: var(--ion-color-primary-contrast);
@include content-padding();
& > ion-thumbnail {
background: var(--ion-color-primary);
}
// Firefox doesn't support this yet...
@supports selector(:has(*)) {
& > .expand-when-space,
&:has(> .expand-when-space) {
height: unset;
flex: 1;
}
}
}
}
:host ::ng-deep {
ion-slides.work-locations {
ion-slide {
@@ -49,21 +91,4 @@
padding-top: 0;
padding-bottom: 0;
}
> div {
padding: 0 var(--spacing-md);
& > * {
display: block;
@include border-radius-in-parallax(var(--border-radius-default));
overflow: hidden;
position: relative;
top: calc((var(--header-spacing-bottom) - var(--spacing-xl)) * -1);
background-color: var(--ion-color-primary-contrast);
& > ion-thumbnail {
background: var(--ion-color-primary);
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*!
* Copyright (C) 2022 StApps
* Copyright (C) 2023 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.
@@ -25,6 +25,14 @@
}
}
ion-content > div > stapps-data-detail-content,
ion-content > div {
min-height: 100%;
display: flex;
flex-direction: column;
flex: 1;
}
::ng-deep {
ion-slides.work-locations {
ion-slide {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 StApps
* Copyright (C) 2023 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.
@@ -28,9 +28,6 @@ import {DataListContext} from './data-list.component';
styleUrls: ['simple-data-list.scss'],
})
export class SimpleDataListComponent implements OnInit, OnDestroy {
/**
* All SCThings to display
*/
@Input() items?: Promise<SCThings[] | undefined>;
/**
@@ -45,6 +42,8 @@ export class SimpleDataListComponent implements OnInit, OnDestroy {
*/
@Input() listHeader?: string;
@Input() emptyListMessage?: string;
@ContentChild(TemplateRef) listItemTemplateRef: TemplateRef<DataListContext<SCThings>>;
/**

View File

@@ -1,5 +1,5 @@
<!--
~ Copyright (C) 2022 StApps
~ Copyright (C) 2023 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.
@@ -22,6 +22,9 @@
></ng-container>
</ng-container>
</ion-list>
<ion-label class="empty-list-message" *ngIf="emptyListMessage && (items | async)?.length === 0">{{
emptyListMessage
}}</ion-label>
</ng-container>
<ng-template #loading>
<ion-list>

View File

@@ -0,0 +1,22 @@
/*!
* Copyright (C) 2023 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/>.
*/
.empty-list-message {
display: flex;
justify-content: center;
align-items: center;
color: var(--ion-color-medium);
min-height: 300px;
}

View File

@@ -1,6 +1,22 @@
<!--
~ Copyright (C) 2023 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/>.
-->
<stapps-simple-data-list
id="simple-data-list"
[items]="items"
[singleType]="true"
[listHeader]="'type' | thingTranslate: item | titlecase"
[emptyListMessage]="'catalog.detail.EMPTY_CATALOG' | translate"
></stapps-simple-data-list>

View File

@@ -0,0 +1,14 @@
/*!
* Copyright (C) 2023 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/>.
*/

View File

@@ -1,5 +1,5 @@
<!--
~ Copyright (C) 2022 StApps
~ Copyright (C) 2023 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.
@@ -41,7 +41,9 @@
</ion-card>
</ng-container>
<ng-container *ngIf="hasValidLocation">
<ion-card class="map-widget">
<stapps-map-widget [place]="item" expandable="true"></stapps-map-widget>
</ion-card>
<stapps-map-widget
class="map-widget expand-when-space"
[place]="item"
expandable="true"
></stapps-map-widget>
</ng-container>

View File

@@ -1,4 +1,21 @@
ion-card.map-widget {
/*!
* Copyright (C) 2023 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/>.
*/
.map-widget {
position: relative;
height: 300px;
min-height: 300px;
width: auto;
}

View File

@@ -252,7 +252,8 @@
"catalog": {
"title": "Vorlesungsverzeichnis",
"detail": {
"EMPTY_SEMESTER": "Keine Verzeichnisdaten für das ausgewählte Semester vorhanden"
"EMPTY_SEMESTER": "Keine Verzeichnisdaten für das ausgewählte Semester vorhanden",
"EMPTY_CATALOG": "Keine Veranstaltung in diesem Bereich gefunden"
}
},
"library": {

View File

@@ -252,7 +252,8 @@
"catalog": {
"title": "course catalog",
"detail": {
"EMPTY_SEMESTER": "No catalog data available for selected semester"
"EMPTY_SEMESTER": "No catalog data available for selected semester",
"EMPTY_CATALOG": "No events were found in this area"
}
},
"library": {

View File

@@ -1,5 +1,5 @@
/*!
* Copyright (C) 2022 StApps
* Copyright (C) 2023 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.
@@ -22,36 +22,43 @@
@content;
}
}
@mixin ion-sm-down {
@media (max-width: 575.98px) {
@content;
}
}
@mixin ion-md-up {
@media (min-width: 768px) {
@content;
}
}
@mixin ion-md-down {
@media (max-width: 767.98px) {
@content;
}
}
@mixin ion-lg-up {
@media (min-width: 992px) {
@content;
}
}
@mixin ion-lg-down {
@media (max-width: 991.98px) {
@content;
}
}
@mixin ion-xl-up {
@media (min-width: 1200px) {
@content;
}
}
@mixin ion-xl-down {
@media (max-width: 1199.98px) {
@content;
@@ -83,3 +90,9 @@
// and disregard border radius in some cases
transform: translateZ(0);
}
@mixin content-padding {
margin-inline-start: calc(
clamp(0px, (100% - var(--preferred-content-width)) / 2, var(--content-inline-start-padding-bias))
);
}