2020-10-17 06:12:00 -05:00
|
|
|
<template>
|
2022-07-17 07:06:33 -05:00
|
|
|
<component
|
|
|
|
:is="popup.component"
|
2021-11-19 04:36:12 -06:00
|
|
|
v-for="popup in popups"
|
2020-10-17 06:12:00 -05:00
|
|
|
:key="popup.id"
|
|
|
|
v-bind="popup.props"
|
|
|
|
v-on="popup.events"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<XUpload v-if="uploads.length > 0"/>
|
|
|
|
|
2020-10-24 11:21:41 -05:00
|
|
|
<XStreamIndicator/>
|
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-if="pendingApiRequestsCount > 0" id="wait"></div>
|
2022-03-02 10:17:37 -06:00
|
|
|
|
|
|
|
<div v-if="dev" id="devTicker"><span>DEV BUILD</span></div>
|
2022-12-23 02:13:43 -06:00
|
|
|
|
|
|
|
<div v-if="$i && $i.isBot" id="botWarn"><span>{{ i18n.ts.loggedInAsBot }}</span></div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</template>
|
|
|
|
|
2022-07-17 07:06:33 -05:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { defineAsyncComponent } from 'vue';
|
|
|
|
import { swInject } from './sw-inject';
|
2022-04-27 21:14:03 -05:00
|
|
|
import { popup, popups, pendingApiRequestsCount } from '@/os';
|
|
|
|
import { uploads } from '@/scripts/upload';
|
2021-11-11 11:02:25 -06:00
|
|
|
import * as sound from '@/scripts/sound';
|
|
|
|
import { $i } from '@/account';
|
2021-12-29 07:13:09 -06:00
|
|
|
import { stream } from '@/stream';
|
2022-12-23 02:13:43 -06:00
|
|
|
import { i18n } from '@/i18n';
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-07-17 07:06:33 -05:00
|
|
|
const XStreamIndicator = defineAsyncComponent(() => import('./stream-indicator.vue'));
|
|
|
|
const XUpload = defineAsyncComponent(() => import('./upload.vue'));
|
|
|
|
|
|
|
|
const dev = _DEV_;
|
|
|
|
|
|
|
|
const onNotification = notification => {
|
|
|
|
if ($i.mutingNotificationTypes.includes(notification.type)) return;
|
|
|
|
|
|
|
|
if (document.visibilityState === 'visible') {
|
|
|
|
stream.send('readNotification', {
|
|
|
|
id: notification.id,
|
|
|
|
});
|
|
|
|
|
2022-08-30 10:24:33 -05:00
|
|
|
popup(defineAsyncComponent(() => import('@/components/MkNotificationToast.vue')), {
|
2022-07-17 07:06:33 -05:00
|
|
|
notification,
|
|
|
|
}, {}, 'closed');
|
|
|
|
}
|
|
|
|
|
|
|
|
sound.play('notification');
|
|
|
|
};
|
|
|
|
|
|
|
|
if ($i) {
|
|
|
|
const connection = stream.useChannel('main', null, 'UI');
|
|
|
|
connection.on('notification', onNotification);
|
|
|
|
|
|
|
|
//#region Listen message from SW
|
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
swInject();
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2022-03-02 10:17:37 -06:00
|
|
|
@keyframes dev-ticker-blink {
|
|
|
|
0% { opacity: 1; }
|
|
|
|
50% { opacity: 0; }
|
|
|
|
100% { opacity: 1; }
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes progress-spinner {
|
|
|
|
0% {
|
|
|
|
transform: rotate(0deg);
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
transform: rotate(360deg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
#wait {
|
|
|
|
display: block;
|
|
|
|
position: fixed;
|
2021-12-17 21:12:47 -06:00
|
|
|
z-index: 4000000;
|
2020-10-17 06:12:00 -05:00
|
|
|
top: 15px;
|
|
|
|
right: 15px;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
width: 18px;
|
|
|
|
height: 18px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border: solid 2px transparent;
|
|
|
|
border-top-color: var(--accent);
|
|
|
|
border-left-color: var(--accent);
|
|
|
|
border-radius: 50%;
|
|
|
|
animation: progress-spinner 400ms linear infinite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-23 02:13:43 -06:00
|
|
|
#botWarn {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
margin: auto;
|
|
|
|
width: 100%;
|
|
|
|
height: max-content;
|
|
|
|
text-align: center;
|
|
|
|
z-index: 2147483647;
|
|
|
|
color: #ff0;
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
padding: 4px 7px;
|
|
|
|
font-size: 14px;
|
|
|
|
pointer-events: none;
|
|
|
|
user-select: none;
|
|
|
|
|
|
|
|
> span {
|
|
|
|
animation: dev-ticker-blink 2s infinite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-02 10:17:37 -06:00
|
|
|
#devTicker {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 2147483647;
|
|
|
|
color: #ff0;
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
padding: 4px 5px;
|
|
|
|
font-size: 14px;
|
|
|
|
pointer-events: none;
|
2022-03-06 08:21:25 -06:00
|
|
|
user-select: none;
|
2022-03-02 10:17:37 -06:00
|
|
|
|
|
|
|
> span {
|
|
|
|
animation: dev-ticker-blink 2s infinite;
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|