Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"node_modules"
]
},
"allowedCommonJsDependencies": [
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this prevents the commonJS warning in the console. it doesn't "solve" anything

"localforage"
],
"tsConfig": "tsconfig.app.json"
},
"configurations": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
<div class="row">
<div class="col-md-6" *ngFor="let bookmark of settings.bookmarks; let index = index">
<mat-card class="card">
<button class="remove" mat-icon-button (click)="onRemoveClick(index)">
<mat-icon>close</mat-icon>
</button>
<div class="row align-items-center">
<div class="col-8">
<mat-form-field>
<mat-label>{{ 'bookmark.url' | translate }}</mat-label>
<input matInput [(ngModel)]="bookmark.url" />
</mat-form-field>
</div>
<div class="col-4 text-center">
<mat-slide-toggle [checked]="bookmark.external"
(change)="bookmark.external = $event.checked">
{{ 'bookmark.external' | translate }}
</mat-slide-toggle>
</div>
</div>
<div class="row">
<div class="col">
<app-accelerator [label]="'app.shortcut' | translate" [(value)]="bookmark.shortcut">
</app-accelerator>
</div>
</div>
</mat-card>
</div>
<div class="col-md-6">
<button mat-raised-button (click)="onAddClick()" class="card-button">
{{ 'bookmark.add' | translate }}
</button>
<button mat-raised-button (click)="onAddFileClick()" class="card-button">
{{ 'bookmark.add-file' | translate }}
</button>
<input style="display: none;" #ghostInput type="file" (change)="onFileSelected($event)" />
</div>
<mat-card *ngFor="let bookmark of settings.bookmarks; let index = index">
<mat-card-content>
<div class="url-toggle">
<mat-form-field>
<mat-label>{{ 'bookmark.url' | translate }}</mat-label>
<input matInput [(ngModel)]="bookmark.url" />
</mat-form-field>
<mat-slide-toggle [checked]="bookmark.external" (change)="bookmark.external = $event.checked">
{{ 'bookmark.external' | translate }}
</mat-slide-toggle>
</div>
<app-accelerator [label]="'app.shortcut' | translate" [(value)]="bookmark.shortcut">
</app-accelerator>
</mat-card-content>
<mat-card-actions>
<button mat-button (click)="onRemoveClick(index)">Remove</button>
</mat-card-actions>
</mat-card>
<div class="bookmark-actions">
<button mat-raised-button (click)="onAddClick()">
{{ 'bookmark.add' | translate }}
</button>
<button mat-raised-button (click)="ghostInput.click()">
{{ 'bookmark.add-file' | translate }}
</button>
<input hidden #ghostInput type="file" (change)="onFileSelected($event)" />
</div>
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
.card {
position: relative;

.remove {
position: absolute;
top: 0;
right: 0;
z-index: 1;
}
:host {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}

.card-button {
padding: 16px;
width: 100%;
.url-toggle {
display: flex;
gap: 32px;
align-items: center;
}

+ .card-button {
margin-top: 8px;
}
.bookmark-actions {
display: flex;
flex-direction: column;
gap: 8px;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, ElementRef, Input, ViewChild } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { BookmarkUserSettings } from '@feature/bookmark/type/bookmark.type';
import { UserSettingsComponent } from '@shared/type';

Expand All @@ -17,9 +17,6 @@ export class BookmarkSettingsComponent implements UserSettingsComponent {
@Input()
public defaultSettings!: BookmarkUserSettings;

@ViewChild('ghostInput')
public input!: ElementRef;

public load(): void {
// stub
}
Expand All @@ -28,10 +25,6 @@ export class BookmarkSettingsComponent implements UserSettingsComponent {
this.addBookmark();
}

public onAddFileClick(): void {
(this.input.nativeElement as HTMLInputElement).click();
}

public onFileSelected(event: Event): void {
const path = (event.target as HTMLInputElement)?.files?.item(0)?.path;
this.settings.bookmarks.push({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
<div class="row">
<div class="col-md-6 col-lg-4" *ngFor="let command of settings.commands; let index = index">
<mat-card class="card">
<button class="remove" mat-icon-button (click)="onRemoveClick(index)">
<mat-icon>close</mat-icon>
</button>
<div class="row">
<div class="col-12">
<mat-form-field matTooltip="{{ 'command.text-description' | translate }}" matTooltipClass="mat-tooltip width-500">
<mat-label>{{ 'command.text' | translate }}</mat-label>
<input matInput [(ngModel)]="command.text" />
</mat-form-field>
</div>
<div class="col-12">
<app-accelerator [label]="'app.shortcut' | translate" [(value)]="command.shortcut">
</app-accelerator>
</div>
</div>
</mat-card>
</div>
<div class="col-md-6 col-lg-4">
<button mat-raised-button (click)="onAddCommandClick()" class="card-button">
{{ 'command.add' | translate }}
<mat-card *ngFor="let command of settings.commands; let index = index">
<mat-card-content>
<mat-form-field matTooltip="{{ 'command.text-description' | translate }}"
matTooltipClass="width-450">
<mat-label>{{ 'command.text' | translate }}</mat-label>
<input matInput [(ngModel)]="command.text" />
</mat-form-field>
<app-accelerator [label]="'app.shortcut' | translate" [(value)]="command.shortcut">
</app-accelerator>
</mat-card-content>
<mat-card-actions>
<button mat-button (click)="onRemoveClick(index)">
Remove
</button>
</div>
</div>
</mat-card-actions>
</mat-card>
<button mat-raised-button (click)="onAddCommandClick()">
{{ 'command.add' | translate }}
</button>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.card {
position: relative;

.remove {
position: absolute;
top: 0;
right: 0;
z-index: 1;
}
:host {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}

.card-button {
padding: 16px;
width: 100%;
::ng-deep {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't like this but i didn't think of a better solution at the time. i will do a pass on a lot of nit picky stuff when we get near the end of 1.0

.mat-mdc-tooltip {
white-space: pre-line;

&.width-450 .mat-mdc-tooltip-surface {
max-width: 450px;
}
}
}
Loading