Update to Angular v17 syntax

This commit is contained in:
Geomitron
2023-12-25 10:43:21 -06:00
parent 199374b2e2
commit f931a1b221
8 changed files with 146 additions and 194 deletions

View File

@@ -1,4 +1,6 @@
<div *ngIf="settingsLoaded" class="flex flex-col h-screen">
@if (settingsLoaded) {
<div class="flex flex-col h-screen">
<app-toolbar></app-toolbar>
<router-outlet></router-outlet>
</div>
}

View File

@@ -16,7 +16,6 @@ import { DownloadsModalComponent } from './components/browse/status-bar/download
import { StatusBarComponent } from './components/browse/status-bar/status-bar.component'
import { SettingsComponent } from './components/settings/settings.component'
import { ToolbarComponent } from './components/toolbar/toolbar.component'
import { CheckboxDirective } from './core/directives/checkbox.directive'
import { RemoveStyleTagsPipe } from './core/pipes/remove-style-tags.pipe'
@NgModule({
@@ -32,7 +31,6 @@ import { RemoveStyleTagsPipe } from './core/pipes/remove-style-tags.pipe'
ChartSidebarMenutComponent,
ResultTableRowComponent,
DownloadsModalComponent,
CheckboxDirective,
RemoveStyleTagsPipe,
SettingsComponent,
],

View File

@@ -113,10 +113,11 @@
<ul>
@for (breadcrumb of getVersionBreadcrumbs(version); track $index) {
<li>
<ng-container *ngIf="breadcrumb.link">
@if (breadcrumb.link) {
<a (click)="openUrl(breadcrumb.link)" class="link link-hover">{{ breadcrumb.name }}</a>
</ng-container>
<ng-container *ngIf="!breadcrumb.link">{{ breadcrumb.name }}</ng-container>
} @else {
{{ breadcrumb.name }}
}
</li>
}
</ul>

View File

@@ -1,4 +1,5 @@
<div class="flex h-full flex-col" *ngIf="selectedChart">
@if (selectedChart) {
<div class="flex h-full flex-col">
<div class="relative">
@if (albumArtMd5) {
@if (hasIcons && icon) {
@@ -132,3 +133,4 @@
</div>
</div>
</div>
}

View File

@@ -1,10 +1,9 @@
import { Component, EventEmitter, HostBinding, OnInit, Output, QueryList, ViewChild, ViewChildren } from '@angular/core'
import { Component, EventEmitter, HostBinding, OnInit, Output, QueryList, ViewChildren } from '@angular/core'
import { sortBy } from 'lodash'
import { SettingsService } from 'src-angular/app/core/services/settings.service'
import { ChartData } from 'src-shared/interfaces/search.interface'
import { CheckboxDirective } from '../../../core/directives/checkbox.directive'
import { SearchService } from '../../../core/services/search.service'
import { SelectionService } from '../../../core/services/selection.service'
import { ResultTableRowComponent } from './result-table-row/result-table-row.component'
@@ -18,7 +17,6 @@ export class ResultTableComponent implements OnInit {
@Output() rowClicked = new EventEmitter<ChartData[]>()
@ViewChild(CheckboxDirective, { static: true }) checkboxColumn: CheckboxDirective
@ViewChildren('tableRow') tableRows: QueryList<ResultTableRowComponent>
activeSong: ChartData[] | null = null

View File

@@ -1,6 +1,6 @@
<div class="flex flex-col gap-4 min-h-0">
<div
class="flex flex-col gap-1 p-1 overflow-y-auto max-h-[75vh] scrollbar scrollbar-w-2 scrollbar-h-2 scrollbar-thumb-neutral scrollbar-thumb-rounded-full">
class="flex flex-col gap-2 p-1 overflow-y-auto max-h-[75vh] scrollbar scrollbar-w-2 scrollbar-h-2 scrollbar-thumb-neutral scrollbar-thumb-rounded-full">
@for (download of downloadService.downloads; track download.md5) {
<div
class="card bg-neutral text-neutral-content shadow-xl"
@@ -46,16 +46,6 @@
</div>
</div>
</div>
<div id="downloadTitle">
<span style="flex-grow: 1"></span>
<i class="inside right close icon" (click)="downloadService.cancelDownload(download.md5)"></i>
</div>
<div id="downloadText">
<span style="flex-grow: 1"></span>
<span *ngIf="!download.isPath" class="description"></span>
<span *ngIf="download.isPath" class="description"> </span>
</div>
<div id="downloadProgressDiv"></div>
}
</div>
<div *ngIf="downloadService.completedCount > 1" class="flex justify-end">

View File

@@ -10,9 +10,9 @@
readonly
type="text"
placeholder="No directory selected!" />
<button *ngIf="settingsService.libraryDirectory !== undefined" (click)="openLibraryDirectory()" class="join-item btn btn-neutral">
Open Folder
</button>
@if (settingsService.libraryDirectory !== undefined) {
<button (click)="openLibraryDirectory()" class="join-item btn btn-neutral">Open Folder</button>
}
<button (click)="getLibraryDirectory()" class="join-item btn btn-primary">Choose</button>
</div>
</label>

View File

@@ -1,39 +0,0 @@
import { Directive, ElementRef, EventEmitter, Output } from '@angular/core'
@Directive({
selector: '[appCheckbox]',
})
export class CheckboxDirective {
@Output() checked = new EventEmitter<boolean>()
_isChecked = false
constructor(private checkbox: ElementRef) { }
// ngAfterViewInit() {
// TODO
// $(this.checkbox.nativeElement).checkbox({
// onChecked: () => {
// this.checked.emit(true)
// this._isChecked = true
// },
// onUnchecked: () => {
// this.checked.emit(false)
// this._isChecked = false
// },
// })
// }
check(isChecked: boolean) {
this._isChecked = isChecked
if (isChecked) {
this.checkbox.nativeElement.checked = true
} else {
this.checkbox.nativeElement.checked = false
}
}
get isChecked() {
return this._isChecked
}
}