responsive task edit overlay
This commit is contained in:
parent
5ec7affaf7
commit
c09a3b7b56
10 changed files with 78 additions and 12 deletions
|
|
@ -8,6 +8,7 @@ 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';
|
import { OverlayComponent } from './shared/components/overlay/overlay.component';
|
||||||
import { TaskOverlayComponent } from './shared/components/overlay/task-overlay/task-overlay.component';
|
import { TaskOverlayComponent } from './shared/components/overlay/task-overlay/task-overlay.component';
|
||||||
|
import { TaskEditOverlayComponent } from './shared/components/overlay/task-edit-overlay/task-edit-overlay.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{ path: '', component: SummaryComponent },
|
{ path: '', component: SummaryComponent },
|
||||||
|
|
@ -15,6 +16,7 @@ export const routes: Routes = [
|
||||||
{ path: 'add-task', component: AddTaskComponent },
|
{ path: 'add-task', component: AddTaskComponent },
|
||||||
{ path: 'board', component: BoardComponent },
|
{ path: 'board', component: BoardComponent },
|
||||||
{ path: 'task/:id', component: TaskOverlayComponent },
|
{ path: 'task/:id', component: TaskOverlayComponent },
|
||||||
|
{ path: 'task-edit/:id', component: TaskEditOverlayComponent },
|
||||||
{ 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 },
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="content"
|
class="content"
|
||||||
[ngClass]="{ 'edit-task-overlay-content': overlayData !== '' }"
|
[ngClass]="{
|
||||||
|
'edit-task-overlay-content': !overlayMobile && overlayData !== '',
|
||||||
|
'edit-task-overlay-content-mobile': overlayMobile && overlayData !== '',
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div class="left-side">
|
<div class="left-side">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
|
@ -264,7 +267,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-buttons">
|
<div
|
||||||
|
class="form-buttons"
|
||||||
|
[ngStyle]="{
|
||||||
|
'background-color': overlayMobile ? 'var(--very-light-gray)' : ''
|
||||||
|
}"
|
||||||
|
>
|
||||||
<app-form-btn
|
<app-form-btn
|
||||||
[class]="'btn-clear'"
|
[class]="'btn-clear'"
|
||||||
[type]="'button'"
|
[type]="'button'"
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,13 @@ section {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit-task-overlay-content-mobile {
|
||||||
|
height: calc(100% - 24px);
|
||||||
|
padding: 0 6px;
|
||||||
|
overflow-y: auto;
|
||||||
|
background-color: var(--very-light-gray);
|
||||||
|
}
|
||||||
|
|
||||||
input,
|
input,
|
||||||
textarea,
|
textarea,
|
||||||
select {
|
select {
|
||||||
|
|
@ -269,7 +276,7 @@ p {
|
||||||
.form-buttons {
|
.form-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
margin-top: 12px;
|
padding-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------- RESPONSIVE -------------*/
|
/*------------- RESPONSIVE -------------*/
|
||||||
|
|
@ -282,7 +289,7 @@ p {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 700px) {
|
@media screen and (max-width: 750px) {
|
||||||
.btn-text {
|
.btn-text {
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ export class AddTaskComponent {
|
||||||
@ViewChild('description', { static: true }) descriptionField!: NgModel;
|
@ViewChild('description', { static: true }) descriptionField!: NgModel;
|
||||||
@ViewChild('category', { static: true }) categoryField!: NgModel;
|
@ViewChild('category', { static: true }) categoryField!: NgModel;
|
||||||
@Input() overlayData: string = '';
|
@Input() overlayData: string = '';
|
||||||
|
@Input() overlayMobile: boolean = false;
|
||||||
|
|
||||||
currentDate: string = new Date().toISOString().split('T')[0];
|
currentDate: string = new Date().toISOString().split('T')[0];
|
||||||
dateInPast: boolean = false;
|
dateInPast: boolean = false;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@if (overlayType) {
|
@if (overlayData) {
|
||||||
<div class="overlay">
|
<div class="overlay">
|
||||||
<div class="overlay-content">
|
<div class="overlay-content">
|
||||||
@if (overlayType === "taskOverlay") {
|
@if (overlayType === "taskOverlay") {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,19 @@
|
||||||
<section>
|
<section
|
||||||
|
[ngClass]="{
|
||||||
|
overlay: !overlayMobile,
|
||||||
|
'overlay-mobile': overlayMobile,
|
||||||
|
}"
|
||||||
|
*ngIf="overlayData !== '' && getTaskData(overlayData).length > 0"
|
||||||
|
>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
@if (overlayMobile) {
|
||||||
|
<app-btn-back></app-btn-back>
|
||||||
|
} @else {
|
||||||
<app-btn-close (click)="closeDialog()"></app-btn-close>
|
<app-btn-close (click)="closeDialog()"></app-btn-close>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<app-add-task [overlayData]="overlayData"></app-add-task>
|
<app-add-task
|
||||||
|
[overlayData]="overlayData"
|
||||||
|
[overlayMobile]="overlayMobile"
|
||||||
|
></app-add-task>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
section {
|
.overlay {
|
||||||
width: 925px;
|
width: 925px;
|
||||||
height: 700px;
|
height: 700px;
|
||||||
padding: 48px 40px 48px 40px;
|
padding: 48px 40px 48px 40px;
|
||||||
|
|
@ -6,6 +6,11 @@ section {
|
||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.overlay-mobile {
|
||||||
|
height: calc(100% - 24px);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: right;
|
justify-content: right;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import { CommonModule } from '@angular/common';
|
||||||
import { User } from '../../../../interfaces/user.interface';
|
import { User } from '../../../../interfaces/user.interface';
|
||||||
import { AssignedComponent } from '../../../../components/add-task/assigned/assigned.component';
|
import { AssignedComponent } from '../../../../components/add-task/assigned/assigned.component';
|
||||||
import { AddTaskComponent } from '../../../../components/add-task/add-task.component';
|
import { AddTaskComponent } from '../../../../components/add-task/add-task.component';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { BtnBackComponent } from '../../buttons/btn-back/btn-back.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-task-edit-overlay',
|
selector: 'app-task-edit-overlay',
|
||||||
|
|
@ -18,6 +20,7 @@ import { AddTaskComponent } from '../../../../components/add-task/add-task.compo
|
||||||
CommonModule,
|
CommonModule,
|
||||||
AssignedComponent,
|
AssignedComponent,
|
||||||
AddTaskComponent,
|
AddTaskComponent,
|
||||||
|
BtnBackComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './task-edit-overlay.component.html',
|
templateUrl: './task-edit-overlay.component.html',
|
||||||
styleUrl: './task-edit-overlay.component.scss',
|
styleUrl: './task-edit-overlay.component.scss',
|
||||||
|
|
@ -26,11 +29,31 @@ export class TaskEditOverlayComponent {
|
||||||
@Input() overlayData: string = '';
|
@Input() overlayData: string = '';
|
||||||
@Output() closeDialogEmitter = new EventEmitter<string>();
|
@Output() closeDialogEmitter = new EventEmitter<string>();
|
||||||
|
|
||||||
|
overlayMobile: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public firebaseService: FirebaseService,
|
public firebaseService: FirebaseService,
|
||||||
private overlayService: OverlayService
|
private overlayService: OverlayService,
|
||||||
|
private route: ActivatedRoute
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
if (this.overlayData == '') {
|
||||||
|
if (this.route.params.subscribe()) {
|
||||||
|
this.route.params.subscribe((params) => {
|
||||||
|
this.overlayData = params['id'];
|
||||||
|
this.overlayMobile = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTaskData(taskId: string) {
|
||||||
|
return this.firebaseService
|
||||||
|
.getAllTasks()
|
||||||
|
.filter((task) => task.id === taskId);
|
||||||
|
}
|
||||||
|
|
||||||
closeDialog() {
|
closeDialog() {
|
||||||
this.closeDialogEmitter.emit('');
|
this.closeDialogEmitter.emit('');
|
||||||
this.removeTaskData();
|
this.removeTaskData();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
.overlay-mobile {
|
.overlay-mobile {
|
||||||
height: calc(100% - 24px);
|
height: calc(100% - 24px);
|
||||||
padding: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { FirebaseService } from '../../../../services/firebase.service';
|
||||||
import { BtnCloseComponent } from '../../buttons/btn-close/btn-close.component';
|
import { BtnCloseComponent } from '../../buttons/btn-close/btn-close.component';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { OverlayService } from '../../../../services/overlay.service';
|
import { OverlayService } from '../../../../services/overlay.service';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { BtnBackComponent } from '../../buttons/btn-back/btn-back.component';
|
import { BtnBackComponent } from '../../buttons/btn-back/btn-back.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -22,6 +22,7 @@ export class TaskOverlayComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
public firebaseService: FirebaseService,
|
public firebaseService: FirebaseService,
|
||||||
private overlayService: OverlayService,
|
private overlayService: OverlayService,
|
||||||
|
private router: Router,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
@ -46,7 +47,14 @@ export class TaskOverlayComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
editTask(overlayData: string) {
|
editTask(overlayData: string) {
|
||||||
this.overlayService.setOverlayData('taskOverlayEdit', overlayData);
|
this.closeDialog();
|
||||||
|
setTimeout(() => {
|
||||||
|
if (window.innerWidth >= 650) {
|
||||||
|
this.overlayService.setOverlayData('taskOverlayEdit', overlayData);
|
||||||
|
} else {
|
||||||
|
this.router.navigate(['/task-edit', overlayData]);
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTask(overlayData: string) {
|
deleteTask(overlayData: string) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue