Skip to content

Commit

Permalink
Add a revert to ngax theme button
Browse files Browse the repository at this point in the history
  • Loading branch information
sp90 committed Dec 17, 2024
1 parent 5251cc5 commit c12c86e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/layout/layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
<div class="spacer"></div>

<spk-list class="base-level-20 primary">
<button action (click)="changeDefaultClientTo('ngax')" i18n>
<spk-icon>skip-back</spk-icon>
Revert to NGAX client
</button>

<spk-divider />

<button action routerLink="/about" routerLinkActive="active" i18n>
<spk-icon>info</spk-icon>
About duplicati
Expand Down
14 changes: 14 additions & 0 deletions src/app/layout/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import {
SparkleButtonComponent,
SparkleDividerComponent,
SparkleIconComponent,
SparkleListComponent,
SparkleSidenavComponent,
Expand All @@ -21,6 +22,7 @@ import { LayoutState } from './layout.state';
SparkleIconComponent,
SparkleListComponent,
SparkleButtonComponent,
SparkleDividerComponent,
ServiceHubComponent,
LogoComponent,
],
Expand All @@ -41,4 +43,16 @@ export default class LayoutComponent {
toggleBodyClass() {
this.#layoutState.toggleBodyClass();
}

changeDefaultClientTo(client: 'ngclient' | 'ngax') {
this.#setClientDefault(client);
window.location.replace(`/${client}`);
}

#setClientDefault(client: 'ngclient' | 'ngax') {
var d = new Date();
d.setTime(d.getTime() + 90 * 24 * 60 * 60 * 1000);

document.cookie = 'default-theme=' + client + '; expires=' + d.toUTCString() + '; path=/';
}
}
Binary file modified src/assets/spk.woff2
Binary file not shown.

0 comments on commit c12c86e

Please sign in to comment.