Skip to content

Commit

Permalink
feedback: responsive toolbar (fixes #7456) (#7457)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Mutugiii and dogi authored May 8, 2024
1 parent bd78edc commit bebc210
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 26 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.14.29",
"version": "0.14.30",
"myplanet": {
"latest": "v0.15.10",
"min": "v0.14.10"
"latest": "v0.15.15",
"min": "v0.14.15"
},
"scripts": {
"ng": "ng",
Expand Down
74 changes: 54 additions & 20 deletions src/app/feedback/feedback.component.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,59 @@
<!-- Feedback Template -->
<mat-toolbar>
<button class="btnBack" mat-icon-button (click)="goBack()"><mat-icon>arrow_back</mat-icon></button>
<span i18n>Feedback List</span>
<span class="toolbar-fill"></span>
<mat-form-field class="font-size-1 margin-lr-3">
<mat-select i18n-placeholder placeholder="Feedback Type" [value]="filter.type || 'All'" (selectionChange)="onFilterChange($event.value, 'type')">
<mat-option i18n value="All">All</mat-option>
<mat-option *ngFor="let option of typeOptions" value={{option}}>{{option}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="font-size-1 margin-lr-3">
<mat-select i18n-placeholder placeholder="Feedback Status" [value]="filter.status || 'All'" (selectionChange)="onFilterChange($event.value, 'status')">
<mat-option i18n value="All">All</mat-option>
<mat-option *ngFor="let option of statusOptions" [value]="option.value">{{option.text}}</mat-option>
</mat-select>
</mat-form-field>
<mat-icon class="input-icon">search</mat-icon>
<mat-form-field class="font-size-1">
<input matInput i18n-placeholder placeholder="Type title to search..." [(ngModel)]="titleSearch">
</mat-form-field>
<button mat-button (click)="resetSearch()"><span i18n>Reset</span></button>
<ng-container *ngIf="deviceType === deviceTypes.DESKTOP; else mobileorTabletView">
<mat-toolbar-row>
<button class="btnBack" mat-icon-button (click)="goBack()"><mat-icon>arrow_back</mat-icon></button>
<span i18n>Feedback List</span>
<span class="toolbar-fill"></span>
<ng-container *ngTemplateOutlet="filterOptions"></ng-container>
<ng-container *ngTemplateOutlet="searchOptions"></ng-container>
</mat-toolbar-row>
</ng-container>

<ng-template #mobileorTabletView>
<mat-toolbar-row>
<button class="btnBack" mat-icon-button (click)="goBack()"><mat-icon>arrow_back</mat-icon></button>
<span i18n>Feedback List</span>
<span class="toolbar-fill"></span>
<button mat-icon-button (click)="this.showFiltersRow = !this.showFiltersRow" ><mat-icon>filter_list</mat-icon></button>
</mat-toolbar-row>
<ng-container *ngIf="deviceType === deviceTypes.TABLET">
<mat-toolbar-row *ngIf="showFiltersRow">
<ng-container *ngTemplateOutlet="filterOptions"></ng-container>
<ng-container *ngTemplateOutlet="searchOptions"></ng-container>
</mat-toolbar-row>
</ng-container>
<ng-container *ngIf="deviceType === deviceTypes.MOBILE">
<mat-toolbar-row *ngIf="showFiltersRow">
<ng-container *ngTemplateOutlet="filterOptions"></ng-container>
</mat-toolbar-row>
<mat-toolbar-row *ngIf="showFiltersRow">
<ng-container *ngTemplateOutlet="searchOptions"></ng-container>
</mat-toolbar-row>
</ng-container>
</ng-template>

<ng-template #filterOptions>
<mat-form-field class="font-size-1 margin-lr-3">
<mat-select i18n-placeholder placeholder="Feedback Type" [value]="filter.type || 'All'" (selectionChange)="onFilterChange($event.value, 'type')">
<mat-option i18n value="All">All</mat-option>
<mat-option *ngFor="let option of typeOptions" value={{option}}>{{option}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="font-size-1 margin-lr-3">
<mat-select i18n-placeholder placeholder="Feedback Status" [value]="filter.status || 'All'" (selectionChange)="onFilterChange($event.value, 'status')">
<mat-option i18n value="All">All</mat-option>
<mat-option *ngFor="let option of statusOptions" [value]="option.value">{{option.text}}</mat-option>
</mat-select>
</mat-form-field>
</ng-template>
<ng-template #searchOptions>
<mat-icon class="input-icon">search</mat-icon>
<mat-form-field class="font-size-1">
<input matInput i18n-placeholder placeholder="Type title to search..." [(ngModel)]="titleSearch">
</mat-form-field>
<button mat-button (click)="resetSearch()"><span i18n>Reset</span></button>
</ng-template>
</mat-toolbar>
<div class="space-container">
<mat-toolbar>
Expand Down
17 changes: 14 additions & 3 deletions src/app/feedback/feedback.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
import { Component, OnInit, ViewChild, AfterViewInit, OnDestroy, HostListener } from '@angular/core';
import { CouchService } from '../shared/couchdb.service';
import { combineLatest } from 'rxjs';
import { MatDialog } from '@angular/material/dialog';
Expand All @@ -18,6 +18,7 @@ import { Router } from '@angular/router';
import { StateService } from '../shared/state.service';
import { DialogsLoadingService } from '../shared/dialogs/dialogs-loading.service';
import { UsersService } from '../users/users.service';
import { DeviceInfoService, DeviceType } from '../shared/device-info.service';


@Component({
Expand Down Expand Up @@ -54,6 +55,9 @@ export class FeedbackComponent implements OnInit, AfterViewInit, OnDestroy {
private onDestroy$ = new Subject<void>();
emptyData = false;
users = [];
deviceType: DeviceType;
deviceTypes: typeof DeviceType = DeviceType;
showFiltersRow = false;

constructor(
private couchService: CouchService,
Expand All @@ -64,8 +68,15 @@ export class FeedbackComponent implements OnInit, AfterViewInit, OnDestroy {
private router: Router,
private stateService: StateService,
private dialogsLoadingService: DialogsLoadingService,
private usersService: UsersService
) {}
private usersService: UsersService,
private deviceInfoService: DeviceInfoService
) {
this.deviceType = this.deviceInfoService.getDeviceType();
}

@HostListener('window:resize') OnResize() {
this.deviceType = this.deviceInfoService.getDeviceType();
}

ngOnInit() {
if (this.stateService.configuration.planetType === 'community') {
Expand Down

0 comments on commit bebc210

Please sign in to comment.