@mundogamernetwork/shared-ui 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,9 +3,13 @@ import { storeToRefs } from "pinia";
|
|
|
3
3
|
|
|
4
4
|
const emit = defineEmits(["toggleVisible"]);
|
|
5
5
|
|
|
6
|
-
const showOnline = ref(true);
|
|
7
6
|
const authStore = useAuthStore();
|
|
8
|
-
|
|
7
|
+
// showOnline used to be a local ref here — flipped on click, called no
|
|
8
|
+
// endpoint, reset on every reload. The auth store's fetchOnlineStatus /
|
|
9
|
+
// toggleOnlineStatus (see tv-frontend's store, the pattern this now
|
|
10
|
+
// matches everywhere) are what actually persist it; a host whose store
|
|
11
|
+
// doesn't implement them yet just won't expose features.statusOnline.
|
|
12
|
+
const { user, signedIn, showOnline } = storeToRefs(authStore);
|
|
9
13
|
const { performLogout } = useLogout();
|
|
10
14
|
|
|
11
15
|
const runtimeConfig = useRuntimeConfig();
|
|
@@ -31,6 +35,11 @@ onMounted(() => {
|
|
|
31
35
|
document.addEventListener("keydown", ({ key }) => {
|
|
32
36
|
if (key === "Escape") emit("toggleVisible");
|
|
33
37
|
});
|
|
38
|
+
// Guarded: not every host's auth store has adopted this pattern yet
|
|
39
|
+
// (see tv-frontend's store for the reference implementation).
|
|
40
|
+
if (signedIn.value && typeof authStore.fetchOnlineStatus === "function") {
|
|
41
|
+
authStore.fetchOnlineStatus();
|
|
42
|
+
}
|
|
34
43
|
});
|
|
35
44
|
|
|
36
45
|
onUnmounted(() => {
|
|
@@ -40,6 +49,12 @@ onUnmounted(() => {
|
|
|
40
49
|
const handleLogout = async () => {
|
|
41
50
|
await performLogout(`${accountsBaseUrl}/login`);
|
|
42
51
|
};
|
|
52
|
+
|
|
53
|
+
const handleToggleOnline = () => {
|
|
54
|
+
if (typeof authStore.toggleOnlineStatus === "function") {
|
|
55
|
+
authStore.toggleOnlineStatus();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
43
58
|
</script>
|
|
44
59
|
|
|
45
60
|
<template>
|
|
@@ -102,7 +117,7 @@ const handleLogout = async () => {
|
|
|
102
117
|
<div class="status-toggle">
|
|
103
118
|
<span>{{ $t("account_menu.buttons.show_online") }}</span>
|
|
104
119
|
<label class="switch">
|
|
105
|
-
<input
|
|
120
|
+
<input :checked="showOnline" type="checkbox" @change="handleToggleOnline" />
|
|
106
121
|
<span class="slider"></span>
|
|
107
122
|
</label>
|
|
108
123
|
</div>
|
|
@@ -137,7 +152,15 @@ const handleLogout = async () => {
|
|
|
137
152
|
top: 45px;
|
|
138
153
|
right: 0;
|
|
139
154
|
z-index: 999;
|
|
140
|
-
|
|
155
|
+
// Signed-in content is open-ended — hosts add their own extra-menu-items
|
|
156
|
+
// (Jobs alone has 5 nav links plus a CTA button and pricing link on top
|
|
157
|
+
// of the base menu). With no height cap this just grew as tall as its
|
|
158
|
+
// content, unbounded, and once the earlier width:100% bug (see below)
|
|
159
|
+
// stopped collapsing it to an unreadable 32px sliver, the height had
|
|
160
|
+
// nowhere to go but off the bottom of the viewport — no scrollbar, no
|
|
161
|
+
// way to reach whatever content and the page below it that it covered.
|
|
162
|
+
max-height: calc(100vh - 65px);
|
|
163
|
+
overflow-y: auto;
|
|
141
164
|
transition: all ease 0.5s;
|
|
142
165
|
|
|
143
166
|
&:not(.signed-in) {
|