Skip to content

Commit ce612f6

Browse files
authored
UX: Improve menu bar (#2575)
* Fix uneven height of right menu bar entries, add tooltips, replace sun icon to make it easier to recognoise * Fix cs * Update changelog * Cleanup, fix tests * Code cleanup * Code cleanup * Code cleanup, fix icon size * Fix tests
1 parent c22b02e commit ce612f6

File tree

5 files changed

+72
-15
lines changed

5 files changed

+72
-15
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Storage space to metrics ([#2345], [#2604])
13+
- Tooltips for icon-only menu bar items ([#2575])
14+
15+
### Changed
16+
17+
- Sun & moon icon in the menu bar ([#2575])
18+
19+
### Fixed
20+
21+
- Uneven height of right menu bar items ([#2575])
1322

1423
## [v4.8.0] - 2025-10-27
1524

@@ -590,6 +599,7 @@ You can find the changelog for older versions there [here](https://github.com/TH
590599
[#2551]: https://github.com/THM-Health/PILOS/pull/2551
591600
[#2553]: https://github.com/THM-Health/PILOS/pull/2553
592601
[#2554]: https://github.com/THM-Health/PILOS/issues/2554
602+
[#2575]: https://github.com/THM-Health/PILOS/pull/2575
593603
[#2604]: https://github.com/THM-Health/PILOS/pull/2604
594604
[unreleased]: https://github.com/THM-Health/PILOS/compare/v4.8.0...develop
595605
[v3.0.0]: https://github.com/THM-Health/PILOS/releases/tag/v3.0.0

resources/css/app/_navigation.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
justify-content: space-between;
33
width: 100%;
44
}
5+
6+
.user-avatar {
7+
.p-menubar-item-link {
8+
@apply py-1;
9+
}
10+
}

resources/js/components/MainNav.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
</router-link>
108108
<a
109109
v-else
110+
v-tooltip.bottom="item.tooltip"
110111
:href="item.url"
111112
:target="item.target"
112113
v-bind="props.action"
@@ -278,8 +279,9 @@ const userMenuItems = computed(() => {
278279
279280
if (settingsStore.getSetting("general.help_url")) {
280281
items.push({
281-
icon: "fa-solid fa-circle-question text-xl",
282+
icon: "fa-solid fa-circle-question text-2xl",
282283
label: t("app.help"),
284+
tooltip: t("app.help"),
283285
target: "_blank",
284286
dataTest: "navbar-help",
285287
url: settingsStore.getSetting("general.help_url"),
@@ -298,8 +300,9 @@ const userMenuItems = computed(() => {
298300
// Only show the locale menu if more than one locale is enabled
299301
if (locales.value.length > 1) {
300302
const localeItem = {
301-
icon: "fa-solid fa-language text-xl",
303+
icon: "fa-solid fa-language text-2xl",
302304
label: t("app.change_locale"),
305+
tooltip: t("app.change_locale"),
303306
dataTest: "navbar-locale",
304307
items: [],
305308
};

resources/js/components/MainNavDarkModeToggle.vue

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,52 @@ import { useDark } from "@vueuse/core";
33
const isDark = useDark();
44
</script>
55
<template>
6-
<div class="relative h-[1em] w-[1.25em] text-xl">
7-
<Transition name="dark">
8-
<i v-if="isDark" class="fa-solid fa-moon absolute w-full text-center" />
9-
</Transition>
10-
<Transition name="light">
11-
<i v-if="!isDark" class="fa-solid fa-sun absolute w-full text-center" />
12-
</Transition>
6+
<div class="flex items-center">
7+
<div class="relative h-[1.5em] w-[1.5em]">
8+
<Transition name="dark">
9+
<svg
10+
v-if="isDark"
11+
xmlns="http://www.w3.org/2000/svg"
12+
viewBox="0 0 24 24"
13+
fill="currentColor"
14+
class="absolute"
15+
aria-hidden="true"
16+
data-test="navbar-dark-mode-enabled-icon"
17+
>
18+
<path
19+
fill-rule="evenodd"
20+
d="M9.528 1.718a.75.75 0 0 1 .162.819A8.97 8.97 0 0 0 9 6a9 9 0 0 0 9 9 8.97 8.97 0 0 0 3.463-.69.75.75 0 0 1 .981.98 10.503 10.503 0 0 1-9.694 6.46c-5.799 0-10.5-4.7-10.5-10.5 0-4.368 2.667-8.112 6.46-9.694a.75.75 0 0 1 .818.162Z"
21+
clip-rule="evenodd"
22+
/>
23+
</svg>
24+
</Transition>
25+
<Transition name="light">
26+
<svg
27+
v-if="!isDark"
28+
xmlns="http://www.w3.org/2000/svg"
29+
viewBox="0 0 24 24"
30+
fill="currentColor"
31+
class="absolute"
32+
aria-hidden="true"
33+
data-test="navbar-dark-mode-disabled-icon"
34+
>
35+
<path
36+
d="M12 2.25a.75.75 0 0 1 .75.75v2.25a.75.75 0 0 1-1.5 0V3a.75.75 0 0 1 .75-.75ZM7.5 12a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM18.894 6.166a.75.75 0 0 0-1.06-1.06l-1.591 1.59a.75.75 0 1 0 1.06 1.061l1.591-1.59ZM21.75 12a.75.75 0 0 1-.75.75h-2.25a.75.75 0 0 1 0-1.5H21a.75.75 0 0 1 .75.75ZM17.834 18.894a.75.75 0 0 0 1.06-1.06l-1.59-1.591a.75.75 0 1 0-1.061 1.06l1.59 1.591ZM12 18a.75.75 0 0 1 .75.75V21a.75.75 0 0 1-1.5 0v-2.25A.75.75 0 0 1 12 18ZM7.758 17.303a.75.75 0 0 0-1.061-1.06l-1.591 1.59a.75.75 0 0 0 1.06 1.061l1.591-1.59ZM6 12a.75.75 0 0 1-.75.75H3a.75.75 0 0 1 0-1.5h2.25A.75.75 0 0 1 6 12ZM6.697 7.757a.75.75 0 0 0 1.06-1.06l-1.59-1.591a.75.75 0 0 0-1.061 1.06l1.59 1.591Z"
37+
/>
38+
</svg>
39+
</Transition>
40+
</div>
1341
</div>
42+
<div
43+
v-if="isDark"
44+
v-tooltip.bottom="$t('app.dark_mode_disable')"
45+
class="absolute inset-0 h-full w-full"
46+
/>
47+
<div
48+
v-else
49+
v-tooltip.bottom="$t('app.dark_mode_enable')"
50+
class="absolute inset-0 h-full w-full"
51+
/>
1452
</template>
1553
<style scoped>
1654
.light-enter-active,

tests/Frontend/e2e/GeneralApplication.cy.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,25 @@ describe("General", function () {
242242
// Check if light mode is enabled by default
243243
cy.get("html").should("not.have.class", "dark");
244244
cy.get('[data-test="navbar-dark-mode"]')
245-
.find("i")
246-
.should("have.class", "fa-sun");
245+
.find("svg")
246+
.should("have.attr", "data-test", "navbar-dark-mode-disabled-icon");
247247

248248
// Toggle dark mode
249249
cy.get('[data-test="navbar-dark-mode"]').click();
250250

251251
// Check if dark mode is enabled
252252
cy.get("html").should("have.class", "dark");
253253
cy.get('[data-test="navbar-dark-mode"]')
254-
.find("i")
255-
.should("have.class", "fa-moon");
254+
.find("svg")
255+
.should("have.attr", "data-test", "navbar-dark-mode-enabled-icon");
256256

257257
// Toggle dark mode again
258258
cy.get('[data-test="navbar-dark-mode"]').click();
259259

260260
// Check if light mode is enabled again
261261
cy.get("html").should("not.have.class", "dark");
262262
cy.get('[data-test="navbar-dark-mode"]')
263-
.find("i")
264-
.should("have.class", "fa-sun");
263+
.find("svg")
264+
.should("have.attr", "data-test", "navbar-dark-mode-disabled-icon");
265265
});
266266
});

0 commit comments

Comments
 (0)