overlay mobile view
This commit is contained in:
parent
94ac068855
commit
fc3fff0977
10 changed files with 90 additions and 14 deletions
|
|
@ -6,12 +6,14 @@ import { PrivacyPolicyComponent } from './shared/components/privacy-policy/priva
|
||||||
import { AddTaskComponent } from './components/add-task/add-task.component';
|
import { AddTaskComponent } from './components/add-task/add-task.component';
|
||||||
import { BoardComponent } from './components/board/board.component';
|
import { BoardComponent } from './components/board/board.component';
|
||||||
import { ContactsComponent } from './components/contacts/contacts.component';
|
import { ContactsComponent } from './components/contacts/contacts.component';
|
||||||
|
import { OverlayComponent } from './shared/components/overlay/overlay.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{ path: '', component: SummaryComponent },
|
{ path: '', component: SummaryComponent },
|
||||||
{ path: 'summary', component: SummaryComponent },
|
{ path: 'summary', component: SummaryComponent },
|
||||||
{ path: 'add-task', component: AddTaskComponent },
|
{ path: 'add-task', component: AddTaskComponent },
|
||||||
{ path: 'board', component: BoardComponent },
|
{ path: 'board', component: BoardComponent },
|
||||||
|
{ path: 'board/:id', component: BoardComponent },
|
||||||
{ path: 'contacts', component: ContactsComponent },
|
{ path: 'contacts', component: ContactsComponent },
|
||||||
{ path: 'contacts/:id', component: ContactsComponent },
|
{ path: 'contacts/:id', component: ContactsComponent },
|
||||||
{ path: 'help', component: HelpComponent },
|
{ path: 'help', component: HelpComponent },
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ export class AddTaskComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
closeOverlay() {
|
closeOverlay() {
|
||||||
this.overlayService.setOverlayData('', '');
|
this.overlayService.setOverlayData('', '', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
untouchedFormFields() {
|
untouchedFormFields() {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { DragDropService } from '../../../services/drag-drop.service';
|
||||||
import { Task } from '../../../interfaces/task.interface';
|
import { Task } from '../../../interfaces/task.interface';
|
||||||
import { FirebaseService } from '../../../services/firebase.service';
|
import { FirebaseService } from '../../../services/firebase.service';
|
||||||
import { OverlayService } from '../../../services/overlay.service';
|
import { OverlayService } from '../../../services/overlay.service';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-task',
|
selector: 'app-task',
|
||||||
|
|
@ -23,11 +24,16 @@ export class TaskComponent {
|
||||||
constructor(
|
constructor(
|
||||||
public dragDropService: DragDropService,
|
public dragDropService: DragDropService,
|
||||||
private firebaseService: FirebaseService,
|
private firebaseService: FirebaseService,
|
||||||
public overlayService: OverlayService
|
public overlayService: OverlayService,
|
||||||
|
private router: Router
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
openTaskDetailsOverlay(taskId: string | undefined) {
|
openTaskDetailsOverlay(taskId: string | undefined) {
|
||||||
this.overlayService.setOverlayData('taskOverlay', taskId);
|
if (window.innerWidth >= 650) {
|
||||||
|
this.overlayService.setOverlayData('taskOverlay', taskId, false);
|
||||||
|
} else {
|
||||||
|
this.overlayService.setOverlayData('taskOverlay', taskId, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subtasks
|
// Subtasks
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export class OverlayService {
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
setOverlayData(overlay: string, data: any) {
|
setOverlayData(overlay: string, data: any, mobile: boolean) {
|
||||||
this.overlayDataSubject.next({ overlay, data });
|
this.overlayDataSubject.next({ overlay, data, mobile });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
<div *ngIf="overlayData" class="overlay">
|
<div
|
||||||
|
*ngIf="overlayData"
|
||||||
|
[ngClass]="{ overlay: isOverlay, 'overlay-mobile': isOverlayMobile }"
|
||||||
|
>
|
||||||
<div class="overlay-content">
|
<div class="overlay-content">
|
||||||
@if (overlayType === "taskOverlay") {
|
@if (overlayType === "taskOverlay") {
|
||||||
<app-task-overlay
|
<app-task-overlay
|
||||||
[overlayData]="overlayData"
|
[overlayData]="overlayData"
|
||||||
|
[overlayMobile]="overlayMobile"
|
||||||
(closeDialogEmitter)="onCloseOverlay($event)"
|
(closeDialogEmitter)="onCloseOverlay($event)"
|
||||||
></app-task-overlay>
|
></app-task-overlay>
|
||||||
} @if (overlayType === "taskOverlayEdit") {
|
} @if (overlayType === "taskOverlayEdit") {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,16 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
.overlay-mobile {
|
||||||
|
position: fixed;
|
||||||
|
top: 96px;
|
||||||
|
bottom: 80px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
.overlay-content {
|
.overlay-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
import {
|
import {
|
||||||
|
AfterViewInit,
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
|
HostBinding,
|
||||||
HostListener,
|
HostListener,
|
||||||
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
@ -10,6 +13,7 @@ import { CommonModule } from '@angular/common';
|
||||||
import { TaskOverlayComponent } from './task-overlay/task-overlay.component';
|
import { TaskOverlayComponent } from './task-overlay/task-overlay.component';
|
||||||
import { FirebaseService } from '../../../services/firebase.service';
|
import { FirebaseService } from '../../../services/firebase.service';
|
||||||
import { TaskEditOverlayComponent } from './task-edit-overlay/task-edit-overlay.component';
|
import { TaskEditOverlayComponent } from './task-edit-overlay/task-edit-overlay.component';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-overlay',
|
selector: 'app-overlay',
|
||||||
|
|
@ -18,21 +22,44 @@ import { TaskEditOverlayComponent } from './task-edit-overlay/task-edit-overlay.
|
||||||
templateUrl: './overlay.component.html',
|
templateUrl: './overlay.component.html',
|
||||||
styleUrl: './overlay.component.scss',
|
styleUrl: './overlay.component.scss',
|
||||||
})
|
})
|
||||||
export class OverlayComponent implements OnInit {
|
export class OverlayComponent implements OnInit, OnDestroy {
|
||||||
|
@HostBinding('class.overlay') isOverlay = window.innerWidth >= 650;
|
||||||
|
@HostBinding('class.overlay-mobile') isOverlayMobile =
|
||||||
|
window.innerWidth < 650;
|
||||||
|
private resizeListener!: () => void;
|
||||||
|
|
||||||
overlayType: any;
|
overlayType: any;
|
||||||
overlayData: any;
|
overlayData: any;
|
||||||
|
overlayMobile: boolean = false;
|
||||||
|
|
||||||
constructor(private overlayService: OverlayService) {}
|
constructor(
|
||||||
|
private overlayService: OverlayService,
|
||||||
|
private route: ActivatedRoute
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.checkOverlayData();
|
||||||
|
this.checkWindowWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkOverlayData() {
|
||||||
this.overlayService.overlayData$.subscribe((data) => {
|
this.overlayService.overlayData$.subscribe((data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
this.overlayType = data.overlay;
|
this.overlayType = data.overlay;
|
||||||
this.overlayData = data.data;
|
this.overlayData = data.data;
|
||||||
|
this.overlayMobile = data.mobile;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkWindowWidth() {
|
||||||
|
this.resizeListener = () => {
|
||||||
|
this.isOverlay = window.innerWidth >= 650;
|
||||||
|
this.isOverlayMobile = window.innerWidth < 650;
|
||||||
|
};
|
||||||
|
window.addEventListener('resize', this.resizeListener);
|
||||||
|
}
|
||||||
|
|
||||||
onCloseOverlay(emitter: string) {
|
onCloseOverlay(emitter: string) {
|
||||||
this.overlayData = emitter;
|
this.overlayData = emitter;
|
||||||
}
|
}
|
||||||
|
|
@ -47,4 +74,8 @@ export class OverlayComponent implements OnInit {
|
||||||
this.onCloseOverlay('');
|
this.onCloseOverlay('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
window.removeEventListener('resize', this.resizeListener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
<section>
|
<section
|
||||||
|
[ngClass]="{
|
||||||
|
overlay: !overlayMobile,
|
||||||
|
'overlay-mobile': overlayMobile,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div
|
<div
|
||||||
class="category"
|
class="category"
|
||||||
|
|
@ -10,7 +15,12 @@
|
||||||
</div>
|
</div>
|
||||||
<app-btn-close (click)="closeDialog()"></app-btn-close>
|
<app-btn-close (click)="closeDialog()"></app-btn-close>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div
|
||||||
|
[ngClass]="{
|
||||||
|
content: !overlayMobile,
|
||||||
|
'content-mobile': overlayMobile,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<div class="headline">{{ getTaskData(overlayData)[0].title }}</div>
|
<div class="headline">{{ getTaskData(overlayData)[0].title }}</div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
{{ getTaskData(overlayData)[0].description }}
|
{{ getTaskData(overlayData)[0].description }}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
section {
|
.overlay {
|
||||||
width: 525px;
|
width: 525px;
|
||||||
height: 700px;
|
height: 700px;
|
||||||
padding: 48px 40px 48px 40px;
|
padding: 48px 40px 48px 40px;
|
||||||
|
|
@ -6,6 +6,13 @@ section {
|
||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.overlay-mobile {
|
||||||
|
background-color: var(--white);
|
||||||
|
width: calc(100vw - 24px);
|
||||||
|
height: calc(100vh - 200px);
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
@ -25,7 +32,12 @@ section {
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
height: calc(700px - 104px);
|
height: calc(700px - 114px);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-mobile {
|
||||||
|
height: calc(700px - 159px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,7 +216,7 @@ section {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: right;
|
justify-content: right;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 12px;
|
margin: 12px 0;
|
||||||
img {
|
img {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import { OverlayService } from '../../../../services/overlay.service';
|
||||||
})
|
})
|
||||||
export class TaskOverlayComponent {
|
export class TaskOverlayComponent {
|
||||||
@Input() overlayData: string = '';
|
@Input() overlayData: string = '';
|
||||||
|
@Input() overlayMobile: boolean = false;
|
||||||
@Output() closeDialogEmitter = new EventEmitter<string>();
|
@Output() closeDialogEmitter = new EventEmitter<string>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
@ -30,7 +31,7 @@ export class TaskOverlayComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
editTask(overlayData: string) {
|
editTask(overlayData: string) {
|
||||||
this.overlayService.setOverlayData('taskOverlayEdit', overlayData);
|
this.overlayService.setOverlayData('taskOverlayEdit', overlayData, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTask(overlayData: string) {
|
deleteTask(overlayData: string) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue