Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard: Add accordion Layout for smaller screens #7111

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Prev Previous commit
Update to use the device-info service
  • Loading branch information
Mutugiii committed Jul 6, 2023
commit 42aee1f4c8ad2c807a02a5eaf86e5c0eae683797
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mat-accordion>
<mat-expansion-panel (opened)="isMobile = true" (closed)="isMobile = false">
<mat-expansion-panel (opened)="deviceType === deviceTypes.MOBILE" (closed)="deviceType !== deviceTypes.MOBILE">
<mat-expansion-panel-header class="accent-color">
<mat-panel-title class="accent-color">
<planet-dashboard-left-tile [cardTitle]="cardTitle" [cardType]="cardType" [link]="link" [emptyLink]="emptyLink">
Expand Down
4 changes: 2 additions & 2 deletions src/app/dashboard/dashboard-tile.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<mat-card class="dashboard-card">
<planet-dashboard-row-layout [cardTitle]="cardTitle" [cardType]="cardType" [link]="link" [emptyLink]="emptyLink" [itemData]="itemData"
(droppedEvent)="drop($event)" (removeEvent)="removeFromShelf($event)" *ngIf="!isMobile">
(droppedEvent)="drop($event)" (removeEvent)="removeFromShelf($event)" *ngIf="deviceType !== deviceTypes.MOBILE">
</planet-dashboard-row-layout>
<planet-dashboard-accordion-layout [cardTitle]="cardTitle" [cardType]="cardType" [link]="link" [emptyLink]="emptyLink" [itemData]="itemData"
(droppedEvent)="drop($event)" (removeEvent)="removeFromShelf($event)" *ngIf="isMobile">
(droppedEvent)="drop($event)" (removeEvent)="removeFromShelf($event)" *ngIf="deviceType === deviceTypes.MOBILE">
</planet-dashboard-accordion-layout>
</mat-card>
17 changes: 10 additions & 7 deletions src/app/dashboard/dashboard-tile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TeamsService } from '../teams/teams.service';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { DialogsPromptComponent } from '../shared/dialogs/dialogs-prompt.component';
import { CheckMobileService } from '../shared/checkMobile.service';
import { DeviceInfoService, DeviceType } from '../shared/device-info.service';

// Main page once logged in. At this stage is more of a placeholder.
@Component({
Expand All @@ -26,16 +26,19 @@ export class DashboardTileComponent {
// @ViewChild('items') itemDiv: ElementRef;
dialogPrompt: MatDialogRef<DialogsPromptComponent>;
// tileLines = 2;
isMobile: boolean = this.checkMobileService.checkIsMobile();
deviceType: DeviceType;
deviceTypes: typeof DeviceType = DeviceType;

constructor(
private planetMessageService: PlanetMessageService,
private userService: UserService,
private teamsService: TeamsService,
private dialog: MatDialog,
private checkMobileService: CheckMobileService
private deviceInfoService: DeviceInfoService
// private cd: ChangeDetectorRef
) { }
) {
this.deviceType = this.deviceInfoService.getDeviceType();
}

// ngAfterViewChecked() {
// const divHeight = this.itemDiv.nativeElement.offsetHeight;
Expand Down Expand Up @@ -99,8 +102,7 @@ export class DashboardTileComponent {
}

@HostListener('window:resize') onResize() {
this.isMobile = this.checkMobileService.checkIsMobile();
console.log(this.isMobile);
this.deviceType = this.deviceInfoService.getDeviceType();
}
}

Expand Down Expand Up @@ -151,7 +153,8 @@ export class DashboardTileRowLayoutComponent {
})
export class DashboardTileAccordionLayoutComponent {

@Input() isMobile;
@Input() deviceType;
@Input() deviceTypes;
@Input() cardTitle;
@Input() cardType;
@Input() link;
Expand Down
Loading