Skip to content

Commit

Permalink
Merge pull request #232 from amosproj/feat/xd-64
Browse files Browse the repository at this point in the history
feat: added refresh button to all pages except home page
  • Loading branch information
PatrickSchm1dt authored Jul 3, 2024
2 parents 91ddbd4 + ae86222 commit 84aa0be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
alt="Siemens logo"
/>
</button>
<ix-button class="mt-1" variant="secondary" ghost>
<ix-button class="mt-1" variant="secondary">
Powered by Siemens Xcelerator
</ix-button>
<ix-avatar username="John Doe" extra="Administrator"> </ix-avatar>
Expand All @@ -24,6 +24,12 @@
}
</ix-breadcrumb>

@if (!isHomePage()){
<div class="absolute top-10 right-4 !z-[50] flex flex-row-reverse gap-x-4">
<ix-button icon="refresh" (click)="refresh()">Refresh</ix-button>
</div>
}

<ix-menu>
<ix-menu-item icon="home" [routerLink]="['/']">Home</ix-menu-item>
<ix-menu-item icon="building1" [routerLink]="['/facilities']">Facilities</ix-menu-item>
Expand Down
15 changes: 15 additions & 0 deletions apps/frontend/src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export class HeaderComponent {
return breadcrumbs;
});

readonly isHomePage = computed(() => {
this.routerEvents();
return this._activatedRoute.snapshot.firstChild?.routeConfig?.path === '';
});

/**
* from the right cut the current url until a '/' is reached n times
* So for /cases/10/abc, goBack(1) yields /cases/10
Expand All @@ -74,4 +79,14 @@ export class HeaderComponent {
this.themeStorageService.toggleTheme();
}

getCorrectIcon() {
if (this._lightMode) {
return "sun-filled";
}
return "sun";
}

refresh() {
window.location.reload();
}
}

0 comments on commit 84aa0be

Please sign in to comment.