Skip to content

Commit f875784

Browse files
committed
feat: Add server subscription state indicator to logo
1 parent d83985d commit f875784

6 files changed

Lines changed: 22 additions & 8 deletions

File tree

src/components/globalTitleBar.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Created Date: 2025-12-28 15:07:43
66
* Author: 3urobeat
77
*
8-
* Last Modified: 2026-04-29 17:48:44
8+
* Last Modified: 2026-04-29 18:10:10
99
* Modified By: 3urobeat
1010
*
1111
* Copyright (c) 2025 - 2026 3urobeat <https://github.com/3urobeat>
@@ -22,12 +22,15 @@
2222
<div class="fixed flex items-center z-40 shrink-0 h-15 min-w-screen dark:text-text-dark border-y border-y-border-primary-light dark:border-y-border-primary-dark border-t-0">
2323

2424
<!-- Left side -->
25-
<div class="fixed h-8 left-12.5 lg:left-7.5 flex gap-4 select-none">
25+
<div class="fixed h-8 left-12.5 lg:left-7.5 flex gap-5 select-none">
2626
<!-- Wardrobe Icon(s) for light/dark mode with cut for expanded search bar on mobile -->
2727
<NuxtLink class="z-20 cursor-pointer transition-opacity duration-500" to="/">
28-
<div :class="globalSearchStr != null ? 'w-10 sm:w-fit' : ''">
29-
<img src="/logo-dark.png" class="h-7.5 object-left object-cover sm:object-contain hidden dark:block">
30-
<img src="/logo-light.png" class="h-7.5 object-left object-cover sm:object-contain block dark:hidden">
28+
<div :class="globalSearchStr != null ? 'w-10 sm:w-fit' : ''" class="relative inline-block">
29+
<img src="/logo-dark.png" class="h-7.5 object-left object-cover sm:object-contain hidden dark:block" />
30+
<img src="/logo-light.png" class="h-7.5 object-left object-cover sm:object-contain block dark:hidden" />
31+
32+
<!-- Server Connection Status dot, positioned to bottom right of logo -->
33+
<div class="absolute bottom-0 right-0 translate-x-1/2 translate-y-1/3 rounded-full size-3 bg-green-500/80 shadow-md" v-if="subscriptionState" :title="$t('serverSubscriptionConnected')"></div>
3134
</div>
3235
</NuxtLink>
3336

@@ -126,6 +129,7 @@
126129
const globalSearchInput = useTemplateRef("globalSearchInput");
127130
const globalSearchBarShown: Ref<boolean> = useState(State.GLOBAL_SEARCH_BAR_SHOWN); // Poor woman's approach at page properties
128131
const globalSearchStr: Ref<string|null> = useState(State.GLOBAL_SEARCH_STRING); // null on page load, set to "" on click to expand input
132+
const subscriptionState: Ref<boolean> = useState(State.SERVER_SUBSCRIPTION_CONNECTED);
129133
130134
const currentWeather: Ref<WeatherData|null> = ref(null);
131135
const weatherLoading: Ref<boolean> = ref(false);

src/composables/state.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Created Date: 2026-04-29 17:32:34
55
* Author: 3urobeat
66
*
7-
* Last Modified: 2026-04-29 17:49:17
7+
* Last Modified: 2026-04-29 17:49:51
88
* Modified By: 3urobeat
99
*
1010
* Copyright (c) 2026 3urobeat <https://github.com/3urobeat>
@@ -16,6 +16,7 @@
1616

1717

1818
export enum State {
19+
SERVER_SUBSCRIPTION_CONNECTED = "serverSubscriptionConnected",
1920
CACHED_IMAGES = "cachedImages",
2021
GLOBAL_SEARCH_STRING = "globalSearchStr",
2122
GLOBAL_SEARCH_BAR_SHOWN = "globalSearchBarShown"
@@ -26,6 +27,7 @@ export enum State {
2627
* Initializes all states with default value
2728
*/
2829
export function initState() {
30+
useState(State.SERVER_SUBSCRIPTION_CONNECTED, () => false);
2931
useState(State.CACHED_IMAGES, () => []);
3032
useState(State.GLOBAL_SEARCH_STRING, () => null);
3133
useState(State.GLOBAL_SEARCH_BAR_SHOWN, () => false);

src/composables/subscription.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Created Date: 2026-04-08 17:59:41
55
* Author: 3urobeat
66
*
7-
* Last Modified: 2026-04-28 21:58:59
7+
* Last Modified: 2026-04-29 17:45:11
88
* Modified By: 3urobeat
99
*
1010
* Copyright (c) 2026 3urobeat <https://github.com/3urobeat>
@@ -18,6 +18,7 @@
1818
import { SubscriptionEventAction, SubscriptionEventType, type SubscriptionEvent } from "../model/api";
1919
import { NotificationLevel, NotificationType, type NotificationData } from "../model/notification";
2020
import { emitSubscriptionEvent } from "./events";
21+
import { State } from "./state";
2122

2223
let serverSubscriptionEventStream: EventSource | undefined;
2324

@@ -29,6 +30,8 @@ let serverSubscriptionEventStream: EventSource | undefined;
2930
function handleServerSubscriptionConnected(event: unknown) { // eslint-disable-line @typescript-eslint/no-unused-vars
3031
console.debug("[DEBUG] Server Subscription: Connected!");
3132

33+
useState(State.SERVER_SUBSCRIPTION_CONNECTED).value = true;
34+
3235
emitNotificationShowEvent({
3336
level: NotificationLevel.DEBUG,
3437
title: "Server Subscription",
@@ -93,6 +96,8 @@ function handleServerSubscriptionError(err: unknown) {
9396
export function establishServerSubscriptionConnection() {
9497
if (serverSubscriptionEventStream) throw("EventStream is not null, close it first");
9598

99+
useState(State.SERVER_SUBSCRIPTION_CONNECTED).value = false;
100+
96101
if (getServerSettingsFromServer().value.document!.serverSubscriptionEnabled) {
97102
console.debug("[DEBUG] establishServerSubscriptionConnection: Attempting to connect...");
98103

@@ -114,4 +119,5 @@ export function closeServerSubscriptionConnection() {
114119
serverSubscriptionEventStream.close();
115120
serverSubscriptionEventStream = undefined;
116121
}
122+
useState(State.SERVER_SUBSCRIPTION_CONNECTED).value = false;
117123
}

src/i18n/locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050

5151
"_dummy3": "-------------- Shared Components Text --------------",
52+
"serverSubscriptionConnected": "Serververbindung aktiv",
5253
"weatherLoadFail": "Wetter konnte nicht geladen werden!",
5354
"weatherForLocation": "Wetter für {location}:",
5455
"weatherTempFeelsLike": "gefühlt",

src/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050

5151
"_dummy3": "-------------- Shared Components Text --------------",
52+
"serverSubscriptionConnected": "Server Connection established",
5253
"weatherLoadFail": "Couldn't load weather!",
5354
"weatherForLocation": "Weather for {location}:",
5455
"weatherTempFeelsLike": "feels like",

src/pages/clothing/view.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
170170
// Refs
171171
const thisClothing: Ref<Clothing> = ref({ id: "", title: "", description: "", imgPath: "", labelIDs: [], addedTimestamp: 0, modifiedTimestamp: 0 });
172-
const thisClothingImgBlob: Ref<string> = ref("")
172+
const thisClothingImgBlob: Ref<string> = ref("");
173173
174174
// Check if edit mode is enabled based on if name of this route is outfits-view or outfits-edit
175175
const editModeEnabled = (useRoute().name == "clothing-edit");

0 commit comments

Comments
 (0)