-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a file command bar and show file picker conditionally
- Loading branch information
Showing
9 changed files
with
172 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
<div class="container"> | ||
<div class="leftbar"> | ||
<checklist-command-bar | ||
(newFile)="onNewFile()" | ||
(openFile)="onOpenFile()" | ||
(uploadFile)="onUploadFile()" | ||
(downloadFile)="onDownloadFile()" | ||
/> | ||
<checklist-file-picker | ||
(fileSelected)="onFileSelected($event)" /> | ||
#filePicker | ||
(fileSelected)="onFileSelected($event)" | ||
(cancel)="onOpenFileCancel()" | ||
[fileNames]="store.listChecklistFiles()" | ||
[style.display]="showFilePicker ? '' : 'none'" | ||
/> | ||
<checklist-tree | ||
#tree | ||
class="checklist-tree" | ||
(checklistSelected)="items.checklist = $event" | ||
(checklistStructureChanged)="onStructureChanged($event)" | ||
/> | ||
#tree | ||
class="checklist-tree" | ||
(checklistSelected)="items.checklist = $event" | ||
(checklistStructureChanged)="onStructureChanged($event)" | ||
/> | ||
</div> | ||
<checklist-items | ||
#items | ||
class="checklist-items" | ||
(checklistChanged)="onChecklistChanged($event)" | ||
#items | ||
class="checklist-items" | ||
(checklistChanged)="onChecklistChanged($event)" | ||
/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="command-bar"> | ||
<button | ||
mat-icon-button | ||
aria-label="New file" | ||
(click)="newFile.emit(true)"> | ||
<mat-icon fontIcon="note_add" /> | ||
</button> | ||
<button | ||
mat-icon-button | ||
aria-label="Open file" | ||
(click)="openFile.emit(true)"> | ||
<mat-icon fontIcon="folder_open" /> | ||
</button> | ||
<!-- TODO: Rename, delete file? --> | ||
<button | ||
mat-icon-button | ||
aria-label="Upload file" | ||
(click)="uploadFile.emit(true)"> | ||
<mat-icon fontIcon="upload" /> | ||
</button> | ||
<button | ||
mat-icon-button | ||
aria-label="Download file" | ||
(click)="downloadFile.emit(true)"> | ||
<mat-icon fontIcon="download" /> | ||
</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.command-bar { | ||
padding: 10px; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/checklists/command-bar/command-bar.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ChecklistCommandBarComponent } from './command-bar.component'; | ||
|
||
describe('ChecklistCommandBarComponent', () => { | ||
let component: ChecklistCommandBarComponent; | ||
let fixture: ComponentFixture<ChecklistCommandBarComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ChecklistCommandBarComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ChecklistCommandBarComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, EventEmitter, Output } from '@angular/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
|
||
@Component({ | ||
selector: 'checklist-command-bar', | ||
standalone: true, | ||
imports: [ | ||
MatButtonModule, | ||
MatIconModule, | ||
], | ||
templateUrl: './command-bar.component.html', | ||
styleUrl: './command-bar.component.scss' | ||
}) | ||
export class ChecklistCommandBarComponent { | ||
@Output() newFile = new EventEmitter<boolean>(); | ||
@Output() openFile = new EventEmitter<boolean>(); | ||
@Output() uploadFile = new EventEmitter<boolean>(); | ||
@Output() downloadFile = new EventEmitter<boolean>(); | ||
} |
35 changes: 15 additions & 20 deletions
35
src/app/checklists/file-picker/file-picker.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
<mat-form-field class="container"> | ||
<mat-label>Select checklist file</mat-label> | ||
<mat-select | ||
[(value)]="selectedFile" | ||
(selectionChange)="onFileSelected()"> | ||
<mat-option | ||
*ngFor="let file of store.listChecklistFiles()" | ||
value="{{file}}"> | ||
{{file}} | ||
</mat-option> | ||
<mat-option value="new"> | ||
<mat-icon fontIcon="library_add" /> | ||
Create new file | ||
</mat-option> | ||
<mat-option value="upload"> | ||
<mat-icon fontIcon="upload" /> | ||
Upload new file | ||
</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
<div class="container"> | ||
<mat-form-field class="dropdown"> | ||
<mat-label>Select checklist file</mat-label> | ||
<mat-select | ||
[(value)]="selectedFile" | ||
(selectionChange)="fileSelected.emit(selectedFile)"> | ||
<mat-option | ||
*ngFor="let file of fileNames" | ||
value="{{file}}"> | ||
{{file}} | ||
</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
<!-- TODO: Cancel button --> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
.container { | ||
width: 300px; | ||
padding-top: 20px; | ||
width: 100%; | ||
display: flex; | ||
} | ||
|
||
.dropdown { | ||
flex-grow: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters