1
0
mirror of https://github.com/dkmstr/openuds-gui.git synced 2024-10-26 08:55:23 +03:00

Refactor actor CSS class and download logic

This commit is contained in:
Adolfo Gómez García 2024-09-26 16:52:16 +02:00
parent ebb27dad0f
commit 706107e66c
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 4 additions and 5 deletions

View File

@ -9,7 +9,7 @@
</div> </div>
<div class="actors"> <div class="actors">
<div [class]="css(p.name)" *ngFor="let p of actors" (click)="api.download(p.url)"> <div [class]="css(p)" *ngFor="let p of actors" (click)="api.download(p.url)">
<div class="image"> <div class="image">
<img [src]="img(p.name)"> <img [src]="img(p.name)">
</div> </div>
@ -23,7 +23,6 @@
<div class="info"> <div class="info">
<ul> <ul>
<li><uds-translate>Always download the UDS actor matching your platform</uds-translate></li> <li><uds-translate>Always download the UDS actor matching your platform</uds-translate></li>
<li><uds-translate>Legacy actors are only provided for old operating system support. Try to avoid them.</uds-translate></li>
</ul> </ul>
</div> </div>

View File

@ -17,7 +17,7 @@ export class DownloadsComponent implements OnInit {
this.actors = []; // Put legacy at end of downloadables... this.actors = []; // Put legacy at end of downloadables...
const legacy: Downloadable[] = []; const legacy: Downloadable[] = [];
for (const a of this.api.actors) { for (const a of this.api.actors) {
if (a.name.includes('legacy')) { if (a.legacy) {
legacy.push(a); legacy.push(a);
} else { } else {
this.actors.push(a); this.actors.push(a);
@ -41,9 +41,9 @@ export class DownloadsComponent implements OnInit {
return this.api.staticURL('modern/img/' + image + '.png'); return this.api.staticURL('modern/img/' + image + '.png');
} }
css(filename: string): string[] { css(downloadable: Downloadable): string[] {
const styles = ['actor']; const styles = ['actor'];
if (filename.toLowerCase().includes('legacy')) { if (downloadable.legacy) {
styles.push('legacy'); styles.push('legacy');
} }
return styles; return styles;