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
23 changes: 14 additions & 9 deletions src/app/components/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,20 @@
@topAnimation
>

<app-top-component
class="top-content-position"
[darkMode]="settingsButtons['darkMode'].toggled"
[fileString]="currentClickedItemName"
[folderString]="currentPlayingFolder"
(onFileWordClicked)="handleFileWordClicked($event)"
(onFolderWordClicked)="handleFolderWordClicked($event)"
(onOpenInExplorer)="openInExplorer()"
></app-top-component>
<!-- Modified app-top-component to include thumbnail inputs and event bindings -->
<app-top-component
[folderString]="currentPlayingFolder"
[fileString]="currentClickedItemName"
[currentClickedItem]="currentClickedItem"
[hubName]="appState.hubName"
[selectedOutputFolder]="appState.selectedOutputFolder"
[darkMode]="settingsButtons.darkMode.toggled"
(onFileWordClicked)="handleFileWordClicked($event)"
(onFolderWordClicked)="handleFolderIconClicked($event)"
(onOpenInExplorer)="openInExplorer()"
*ngIf="currentClickedItemName !== '' && !settingsModalOpen && !wizard.showWizard"
[@topAnimation]="currentClickedItemName !== '' ? 'show' : 'hide'"
></app-top-component>

</header>

Expand Down
40 changes: 12 additions & 28 deletions src/app/components/top/top.component.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
<div
*ngIf="_file !== ''"
class="folder-container"
[ngClass]="{ 'dark-mode-override': darkMode }"
>
<app-icon class="icon" [icon]="'icon-folder-blank'" (click)="openInExplorer()"></app-icon>
<span
*ngFor="let item of folderNameArray"
(click)="folderWordClicked(item)"
class="folder-word"
>
{{ item }}
</span>
</div>

<div
*ngIf="_file !== ''"
class="file-container"
[ngClass]="{ 'dark-mode-override': darkMode }"
>
<app-icon class="icon" [icon]="'icon-video-blank'" (click)="openInExplorer()"></app-icon>
<span
*ngFor="let item of fileNameArray"
(click)="fileWordClicked(item)"
class="file-word"
>
{{ item }}
</span>
<div class="top-container">
<img *ngIf="getThumbnailPath()" [src]="getThumbnailPath()" class="thumbnail" alt="Thumbnail" />
<div class="text-container">
<div class="folder-container" *ngIf="folderString">
<span class="icon icon-folder"></span>
<span class="folder-word" *ngFor="let item of folderNameArray" (click)="folderWordClicked(item)">{{ item }}</span>
</div>
<div class="file-container" *ngIf="fileString">
<span class="icon icon-video-blank"></span>
<span class="file-word" *ngFor="let item of fileNameArray" (click)="fileWordClicked(item)">{{ item }}</span>
</div>
</div>
</div>
26 changes: 24 additions & 2 deletions src/app/components/top/top.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
@import "../variables";

.top-container {
display: flex;
align-items: flex-start;
}

.thumbnail {
width: 30px;
height: 20px;
object-fit: cover;
margin-right: 5px;
margin-top: 2px;
}

.text-container {
display: flex;
flex-direction: column;
}

.icon {
cursor: pointer;
display: inline-block;
Expand All @@ -23,7 +41,7 @@
overflow: hidden;

:nth-child(2) {
margin-left: 23px;
margin-left: 23px; // Space for icon
}

.folder-word {
Expand Down Expand Up @@ -59,7 +77,7 @@
}

:nth-child(2) {
margin-left: 23px;
margin-left: 23px; // Space for icon
}

.file-word {
Expand Down Expand Up @@ -105,4 +123,8 @@
fill: $light-blue;
}
}

& .thumbnail {
filter: brightness(0.8); // Slightly dim thumbnail in dark mode for better contrast
}
}
24 changes: 18 additions & 6 deletions src/app/components/top/top.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import type { ImageElement } from '../../../../interfaces/final-object.interface';

@Component({
selector: 'app-top-component',
templateUrl: './top.component.html',
styleUrls: ['./top.component.scss',
'../../fonts/icons.scss']
styleUrls: ['./top.component.scss', '../../fonts/icons.scss']
})
export class TopComponent {

Expand All @@ -16,8 +16,7 @@ export class TopComponent {
this._folder = (folderString && folderString.trim()) || '';
this.folderNameArray = this._folder.split('/');
this.folderNameArray = this.folderNameArray.filter((element, index) => {
// TODO -- fix this up:
return index === 0 || element !== ''; // ATROCIOUS hack! -- simply to prevent ["", ""]
return index === 0 || element !== '';
});
}
get folderString(): string { return this._folder; }
Expand All @@ -30,19 +29,33 @@ export class TopComponent {
}
get fileString(): string { return this._file; }

// Inputs for thumbnail
@Input() currentClickedItem: ImageElement;
@Input() hubName: string;
@Input() selectedOutputFolder: string;

@Output() onFileWordClicked = new EventEmitter<string>();
@Output() onFolderWordClicked = new EventEmitter<string>();
@Output() onOpenInExplorer = new EventEmitter<boolean>();

public folderNameArray: string[];
public fileNameArray: string[];

/**
* Compute the thumbnail path for the selected file
*/
getThumbnailPath(): string {
if (this.currentClickedItem && this.hubName && this.selectedOutputFolder && this.currentClickedItem.cleanName !== '*FOLDER*') {
return `file://${this.selectedOutputFolder}/vha-${this.hubName}/thumbnails/${this.currentClickedItem.hash}.jpg`;
}
return '';
}

public folderWordClicked(item: string): void {
this.onFolderWordClicked.emit(item.trim());
}

public fileWordClicked(item: string): void {
// Strip away any of: {}()[].,
const regex = /{|}|\(|\)|\[|\]|\.|\,/g;
item = item.replace(regex, '');
this.onFileWordClicked.emit(item.trim());
Expand All @@ -51,5 +64,4 @@ export class TopComponent {
public openInExplorer(): void {
this.onOpenInExplorer.emit(true);
}

}