@@ -36,7 +36,7 @@ SPDX-License-Identifier: AGPL-3.0-only
36
36
</component>
37
37
</template>
38
38
<div :class="$style.divider"></div>
39
- <MkA v-if="$i.isAdmin || $i.isModerator" v-tooltip.noDelay.right="i18n.ts.controlPanel" :class="$style.item" :activeClass="$style.active" to="/admin">
39
+ <MkA v-if="$i != null && ($i .isAdmin || $i.isModerator) " v-tooltip.noDelay.right="i18n.ts.controlPanel" :class="$style.item" :activeClass="$style.active" to="/admin">
40
40
<i :class="$style.itemIcon" class="ti ti-dashboard ti-fw"></i><span :class="$style.itemText">{{ i18n.ts.controlPanel }}</span>
41
41
</MkA>
42
42
<button class="_button" :class="$style.item" @click="more">
@@ -48,10 +48,10 @@ SPDX-License-Identifier: AGPL-3.0-only
48
48
</MkA>
49
49
</div>
50
50
<div :class="$style.bottom">
51
- <button v-tooltip.noDelay.right="i18n.ts.note" class="_button" :class="[$style.post]" data-cy-open-post-form @click="os.post">
51
+ <button v-tooltip.noDelay.right="i18n.ts.note" class="_button" :class="[$style.post]" data-cy-open-post-form @click="() => { os.post(); } ">
52
52
<i class="ti ti-pencil ti-fw" :class="$style.postIcon"></i><span :class="$style.postText">{{ i18n.ts.note }}</span>
53
53
</button>
54
- <button v-tooltip.noDelay.right="`${i18n.ts.account}: @${$i.username}`" class="_button" :class="[$style.account]" @click="openAccountMenu">
54
+ <button v-if="$i != null" v- tooltip.noDelay.right="`${i18n.ts.account}: @${$i.username}`" class="_button" :class="[$style.account]" @click="openAccountMenu">
55
55
<MkAvatar :user="$i" :class="$style.avatar"/><MkAcct class="_nowrap" :class="$style.acct" :user="$i"/>
56
56
</button>
57
57
</div>
@@ -83,8 +83,12 @@ import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js';
83
83
import { defaultStore } from '@/store.js';
84
84
import { i18n } from '@/i18n.js';
85
85
import { instance } from '@/instance.js';
86
+ import { getHTMLElementOrNull } from '@/scripts/get-dom-node-or-null.js';
86
87
87
- const iconOnly = ref(false);
88
+ const forceIconOnly = ref(window.innerWidth <= 1279);
89
+ const iconOnly = computed(() => {
90
+ return forceIconOnly.value || (defaultStore.reactiveState.menuDisplay.value === 'sideIcon');
91
+ });
88
92
89
93
const menu = computed(() => defaultStore.state.menu);
90
94
const otherMenuItemIndicated = computed(() => {
@@ -95,14 +99,10 @@ const otherMenuItemIndicated = computed(() => {
95
99
return false;
96
100
});
97
101
98
- const forceIconOnly = window.innerWidth <= 1279;
99
-
100
102
function calcViewState() {
101
- iconOnly .value = forceIconOnly || (defaultStore.state.menuDisplay === 'sideIcon') ;
103
+ forceIconOnly .value = window.innerWidth <= 1279 ;
102
104
}
103
105
104
- calcViewState();
105
-
106
106
window.addEventListener('resize', calcViewState);
107
107
108
108
watch(defaultStore.reactiveState.menuDisplay, () => {
@@ -120,8 +120,10 @@ function openAccountMenu(ev: MouseEvent) {
120
120
}
121
121
122
122
function more(ev: MouseEvent) {
123
+ const target = getHTMLElementOrNull(ev.currentTarget ?? ev.target);
124
+ if (!target) return;
123
125
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkLaunchPad.vue')), {
124
- src: ev.currentTarget ?? ev. target,
126
+ src: target,
125
127
}, {
126
128
closed: () => dispose(),
127
129
});
0 commit comments