Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added refresh button to all pages except home page #232

Merged
merged 2 commits into from
Jul 3, 2024
Merged
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
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();
}
}