@mundogamernetwork/shared-ui 1.15.0 → 1.16.2
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.
- package/components/ui/MgHeaderUIUser.vue +82 -4
- package/nuxt.config.ts +24 -0
- package/package.json +1 -1
|
@@ -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) {
|
|
@@ -270,6 +293,61 @@ const handleLogout = async () => {
|
|
|
270
293
|
color: var(--sidebar-menus-fg);
|
|
271
294
|
}
|
|
272
295
|
|
|
296
|
+
// Ported here from jobs-frontend's global _layout.scss (the only host
|
|
297
|
+
// that already had it) — .switch/.slider had no definition of their
|
|
298
|
+
// own in this file at all, so hosts without that exact global class
|
|
299
|
+
// pair fell back to a bare unstyled native checkbox. Self-contained
|
|
300
|
+
// now, using the same accent token the rest of this file already
|
|
301
|
+
// falls through (see .plans-pricing-link above), so every front gets
|
|
302
|
+
// a real toggle instead of only the one host that happened to
|
|
303
|
+
// already define it globally.
|
|
304
|
+
.switch {
|
|
305
|
+
position: relative;
|
|
306
|
+
display: inline-block;
|
|
307
|
+
width: 36px;
|
|
308
|
+
height: 20px;
|
|
309
|
+
flex-shrink: 0;
|
|
310
|
+
|
|
311
|
+
input {
|
|
312
|
+
opacity: 0;
|
|
313
|
+
width: 0;
|
|
314
|
+
height: 0;
|
|
315
|
+
|
|
316
|
+
&:checked + .slider {
|
|
317
|
+
background-color: var(--highlight-color, var(--header-active-fg, var(--ck-highlight-marker-blue)));
|
|
318
|
+
|
|
319
|
+
&:before {
|
|
320
|
+
transform: translateX(16px);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&:focus-visible + .slider {
|
|
325
|
+
box-shadow: 0 0 0 2px var(--ck-highlight-marker-blue);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.slider {
|
|
330
|
+
position: absolute;
|
|
331
|
+
inset: 0;
|
|
332
|
+
cursor: pointer;
|
|
333
|
+
background-color: var(--border-card, rgba(255, 255, 255, 0.2));
|
|
334
|
+
transition: 0.3s;
|
|
335
|
+
border-radius: 999px;
|
|
336
|
+
|
|
337
|
+
&:before {
|
|
338
|
+
position: absolute;
|
|
339
|
+
content: "";
|
|
340
|
+
height: 14px;
|
|
341
|
+
width: 14px;
|
|
342
|
+
left: 3px;
|
|
343
|
+
bottom: 3px;
|
|
344
|
+
background-color: #fff;
|
|
345
|
+
transition: 0.3s;
|
|
346
|
+
border-radius: 50%;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
273
351
|
.btn-primary-outline {
|
|
274
352
|
display: flex;
|
|
275
353
|
align-items: center;
|
package/nuxt.config.ts
CHANGED
|
@@ -72,6 +72,30 @@ export default defineNuxtConfig({
|
|
|
72
72
|
build: {
|
|
73
73
|
transpile: ['@vue-leaflet/vue-leaflet'],
|
|
74
74
|
},
|
|
75
|
+
// pusher-js's browser build is a webpack-bundled UMD file: `module.exports
|
|
76
|
+
// = factory()` where factory() internally does
|
|
77
|
+
// `__webpack_exports__["default"] = Pusher` and returns that object. To a
|
|
78
|
+
// real ES module consumer that looks exactly like "this CJS module wants
|
|
79
|
+
// default-export interop", but esbuild's static CJS/ESM detection doesn't
|
|
80
|
+
// reliably recognize that shape here — on some dep-graph paths (this repo
|
|
81
|
+
// doesn't import pusher-js directly, plugins/echo.client.ts here and in
|
|
82
|
+
// several consuming apps' own copies of the same plugin do) the raw dist
|
|
83
|
+
// file gets served to the browser as-is instead of through Vite's
|
|
84
|
+
// optimized/interop-wrapped dep cache, and `import Pusher from
|
|
85
|
+
// "pusher-js"` throws "does not provide an export named 'default'" at
|
|
86
|
+
// evaluation time — before the plugin's own pusherKey guard ever runs, so
|
|
87
|
+
// it takes the whole plugin down, and on hosts where that happens during
|
|
88
|
+
// app bootstrap it silently breaks ALL click handling on the page (every
|
|
89
|
+
// header dropdown, the sidebar toggle, everything — not just this
|
|
90
|
+
// plugin's own WebSocket setup). needsInterop forces Vite to always
|
|
91
|
+
// treat it as CJS needing the default-export wrapper, which is the fix
|
|
92
|
+
// Vite ships for exactly this class of mismatch.
|
|
93
|
+
vite: {
|
|
94
|
+
optimizeDeps: {
|
|
95
|
+
include: ["pusher-js", "laravel-echo"],
|
|
96
|
+
needsInterop: ["pusher-js"],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
75
99
|
components: [
|
|
76
100
|
{
|
|
77
101
|
path: `${packageRoot}/components`,
|