* wip * wip * wip * test * wip rollup pluginでsearchIndexの情報生成 * wip * SPDX * wip: markerIdを自動付与 * rollupでビルド時・devモード時に毎回uuidを生成するように * 開発サーバーでだけ必要な挙動は開発サーバーのみで * 条件が逆 * wip: childrenの生成 * update comment * update comment * rename auto generated file * hashをパスと行数から決定 * Update privacy.vue * Update privacy.vue * wip * Update general.vue * Update general.vue * wip * wip * Update SearchMarker.vue * wip * Update profile.vue * Update mute-block.vue * Update mute-block.vue * Update general.vue * Update general.vue * childrenがduplicate key errorを吐く問題をいったん解決 * マーカーの形を成形 * loggerを置きかえ * とりあえず省略記法に対応 * Refactor and Format codes * wip * Update settings-search-index.ts * wip * wip * とりあえず不確定要因の仮置きidを削除 * hashの生成を正規化(絶対パスになっていたのを緩和) * pathの入力を省略可能に * adminでもパス生成できるように * Update settings-search-index.ts * Update privacy.vue * wip * build searchIndex * wip * build * Update general.vue * build * Update sounds.vue * build * build * Update sounds.vue * 🎨 * 🎨 * Update privacy.vue * Update privacy.vue * Update security.vue * create-search-indexを多少改善 * build * Update 2fa.vue * wip * 必ずtransformCodeCacheを利用するように, キャッシュの明確な受け渡しを定義 * キャッシュはdevServerでなくても更新 * Revert "wip" This reverts commit 41bffd3a13f55618bf939dc1c9acb2a77ead4054. * inlining * wip * Update theme.vue * 🎨 * wip normalize * Update theme.vue * キャッシュのパス変換 * build * wip * wip * Update SearchMarker.vue * i18n.ts['key'] の形式が取り出せない問題のFix * build * 仮でpath入れ * 必ず絶対パスが使われるように * wip * 🎨 * storybookビルド時はcreateSearchIndexをしない * inliningの構造化 * format code * Update index.vue * wip * wip * 🎨 * wip * wip * wip * wip * wip * wip * wip * wip * clean up * wip * wip * wip * Update rollup-plugin-unwind-css-module-class-name.test.ts * Update navbar.vue * clean up * wip * wip * wip * wip * wip * Update preferences-backups.vue * Update common.ts * Update preferences.ts * wip * wip * wip * wip * Update MkPreferenceContainer.vue * Update MkPreferenceContainer.vue * Update MkPreferenceContainer.vue * enhance: 検索で上下矢印を使用することで検索結果を移動できるように * Update main-boot.ts * refactor * wip * Update sounds.vue * fix(frontend): PageWindowでSearchMarkerが動作するように * enhance(frontend): SearchMarkerの点滅を一定時間で止める * wip * lint fix * fix: 子要素監視が抜けていたのを修正 * アニメーションの回数はCSSで制御するように * refactor * enhance(frontend): 検索インデックス作成時のログを削減 * revert * fix * fix * Update preferences.ts * Update preferences.ts * wip * Update preferences.ts * wip * 🎨 * wip * Update MkPreferenceContainer.vue * wip * Update preferences.ts * wip * Update preferences.ts * Update preferences.ts * wip * wip * Update preferences.ts * wip * wip * Update preferences.ts * Update CHANGELOG.md * Update preferences.ts * Update deck-store.ts * deckStoreをdefaultStoreに統合 * wip * defaultStore -> store * Update profile.ts * wip * refactor * wip: plugin * plugin * plugin * plugin * Update plugin.ts * wip * Update plugin.vue * Update preferences.ts * Update main-boot.ts * wip * fix test * Update plugin.vue * Update plugin.vue * Update utility.ts * wip * wip * Update utility.ts * wip * wip * clean up * Update utility.ts --------- Co-authored-by: tai-cha <dev@taichan.site> Co-authored-by: taichan <40626578+tai-cha@users.noreply.github.com> Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
275 lines
6.5 KiB
Vue
275 lines
6.5 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<component
|
|
:is="popup.component"
|
|
v-for="popup in popups"
|
|
:key="popup.id"
|
|
v-bind="popup.props"
|
|
v-on="popup.events"
|
|
/>
|
|
|
|
<XUpload v-if="uploads.length > 0"/>
|
|
|
|
<TransitionGroup
|
|
tag="div"
|
|
:class="[$style.notifications, {
|
|
[$style.notificationsPosition_leftTop]: prefer.s.notificationPosition === 'leftTop',
|
|
[$style.notificationsPosition_leftBottom]: prefer.s.notificationPosition === 'leftBottom',
|
|
[$style.notificationsPosition_rightTop]: prefer.s.notificationPosition === 'rightTop',
|
|
[$style.notificationsPosition_rightBottom]: prefer.s.notificationPosition === 'rightBottom',
|
|
[$style.notificationsStackAxis_vertical]: prefer.s.notificationStackAxis === 'vertical',
|
|
[$style.notificationsStackAxis_horizontal]: prefer.s.notificationStackAxis === 'horizontal',
|
|
}]"
|
|
:moveClass="prefer.s.animation ? $style.transition_notification_move : ''"
|
|
:enterActiveClass="prefer.s.animation ? $style.transition_notification_enterActive : ''"
|
|
:leaveActiveClass="prefer.s.animation ? $style.transition_notification_leaveActive : ''"
|
|
:enterFromClass="prefer.s.animation ? $style.transition_notification_enterFrom : ''"
|
|
:leaveToClass="prefer.s.animation ? $style.transition_notification_leaveTo : ''"
|
|
>
|
|
<div v-for="notification in notifications" :key="notification.id" :class="$style.notification">
|
|
<XNotification :notification="notification"/>
|
|
</div>
|
|
</TransitionGroup>
|
|
|
|
<XStreamIndicator/>
|
|
|
|
<div v-if="pendingApiRequestsCount > 0" id="wait"></div>
|
|
|
|
<div v-if="dev" id="devTicker"><span style="animation: dev-ticker-blink 2s infinite;">DEV BUILD</span></div>
|
|
|
|
<div v-if="$i && $i.isBot" id="botWarn"><span style="animation: dev-ticker-blink 2s infinite;">{{ i18n.ts.loggedInAsBot }}</span></div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { defineAsyncComponent, ref } from 'vue';
|
|
import * as Misskey from 'misskey-js';
|
|
import { swInject } from './sw-inject.js';
|
|
import XNotification from './notification.vue';
|
|
import { popups } from '@/os.js';
|
|
import { pendingApiRequestsCount } from '@/scripts/misskey-api.js';
|
|
import { uploads } from '@/scripts/upload.js';
|
|
import * as sound from '@/scripts/sound.js';
|
|
import { $i } from '@/account.js';
|
|
import { useStream } from '@/stream.js';
|
|
import { i18n } from '@/i18n.js';
|
|
import { prefer } from '@/preferences.js';
|
|
import { globalEvents } from '@/events.js';
|
|
|
|
const XStreamIndicator = defineAsyncComponent(() => import('./stream-indicator.vue'));
|
|
const XUpload = defineAsyncComponent(() => import('./upload.vue'));
|
|
|
|
const dev = _DEV_;
|
|
|
|
const notifications = ref<Misskey.entities.Notification[]>([]);
|
|
|
|
function onNotification(notification: Misskey.entities.Notification, isClient = false) {
|
|
if (document.visibilityState === 'visible') {
|
|
if (!isClient && notification.type !== 'test') {
|
|
// サーバーサイドのテスト通知の際は自動で既読をつけない(テストできないので)
|
|
useStream().send('readNotification');
|
|
}
|
|
|
|
notifications.value.unshift(notification);
|
|
window.setTimeout(() => {
|
|
if (notifications.value.length > 3) notifications.value.pop();
|
|
}, 500);
|
|
|
|
window.setTimeout(() => {
|
|
notifications.value = notifications.value.filter(x => x.id !== notification.id);
|
|
}, 6000);
|
|
}
|
|
|
|
sound.playMisskeySfx('notification');
|
|
}
|
|
|
|
if ($i) {
|
|
const connection = useStream().useChannel('main', null, 'UI');
|
|
connection.on('notification', onNotification);
|
|
globalEvents.on('clientNotification', notification => onNotification(notification, true));
|
|
|
|
//#region Listen message from SW
|
|
if ('serviceWorker' in navigator) {
|
|
swInject();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.transition_notification_move,
|
|
.transition_notification_enterActive,
|
|
.transition_notification_leaveActive {
|
|
transition: opacity 0.3s, transform 0.3s !important;
|
|
}
|
|
.transition_notification_enterFrom {
|
|
opacity: 0;
|
|
transform: translateX(250px);
|
|
}
|
|
.transition_notification_leaveTo {
|
|
opacity: 0;
|
|
transform: translateX(-250px);
|
|
}
|
|
|
|
.notifications {
|
|
position: fixed;
|
|
z-index: 3900000;
|
|
padding: 0 var(--MI-margin);
|
|
pointer-events: none;
|
|
display: flex;
|
|
|
|
&.notificationsPosition_leftTop {
|
|
top: var(--MI-margin);
|
|
left: 0;
|
|
}
|
|
|
|
&.notificationsPosition_rightTop {
|
|
top: var(--MI-margin);
|
|
right: 0;
|
|
}
|
|
|
|
&.notificationsPosition_leftBottom {
|
|
bottom: calc(var(--MI-minBottomSpacing) + var(--MI-margin));
|
|
left: 0;
|
|
}
|
|
|
|
&.notificationsPosition_rightBottom {
|
|
bottom: calc(var(--MI-minBottomSpacing) + var(--MI-margin));
|
|
right: 0;
|
|
}
|
|
|
|
&.notificationsStackAxis_vertical {
|
|
width: 250px;
|
|
|
|
&.notificationsPosition_leftTop,
|
|
&.notificationsPosition_rightTop {
|
|
flex-direction: column;
|
|
|
|
.notification {
|
|
& + .notification {
|
|
margin-top: 8px;
|
|
}
|
|
}
|
|
}
|
|
|
|
&.notificationsPosition_leftBottom,
|
|
&.notificationsPosition_rightBottom {
|
|
flex-direction: column-reverse;
|
|
|
|
.notification {
|
|
& + .notification {
|
|
margin-bottom: 8px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&.notificationsStackAxis_horizontal {
|
|
width: 100%;
|
|
|
|
&.notificationsPosition_leftTop,
|
|
&.notificationsPosition_leftBottom {
|
|
flex-direction: row;
|
|
|
|
.notification {
|
|
& + .notification {
|
|
margin-left: 8px;
|
|
}
|
|
}
|
|
}
|
|
|
|
&.notificationsPosition_rightTop,
|
|
&.notificationsPosition_rightBottom {
|
|
flex-direction: row-reverse;
|
|
|
|
.notification {
|
|
& + .notification {
|
|
margin-right: 8px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.notification {
|
|
width: 250px;
|
|
flex-shrink: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.notification {
|
|
container-type: inline-size;
|
|
}
|
|
</style>
|
|
|
|
<style lang="scss">
|
|
@keyframes dev-ticker-blink {
|
|
0% { opacity: 1; }
|
|
50% { opacity: 0; }
|
|
100% { opacity: 1; }
|
|
}
|
|
|
|
@keyframes progress-spinner {
|
|
0% {
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
#wait {
|
|
display: block;
|
|
position: fixed;
|
|
z-index: 4000000;
|
|
top: 15px;
|
|
right: 15px;
|
|
pointer-events: none;
|
|
|
|
&::before {
|
|
content: "";
|
|
display: block;
|
|
width: 18px;
|
|
height: 18px;
|
|
box-sizing: border-box;
|
|
border: solid 2px transparent;
|
|
border-top-color: var(--MI_THEME-accent);
|
|
border-left-color: var(--MI_THEME-accent);
|
|
border-radius: 50%;
|
|
animation: progress-spinner 400ms linear infinite;
|
|
}
|
|
}
|
|
|
|
#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;
|
|
}
|
|
|
|
#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;
|
|
user-select: none;
|
|
}
|
|
</style>
|