Address review feedback

This commit is contained in:
Norm 2022-08-08 06:25:35 -04:00 committed by Gitea
parent e6daf45cd7
commit 7f5d7ffd93

View file

@ -3,7 +3,7 @@
<button v-if="$i" v-click-anime class="item _button account" @click="openAccountMenuWrapper"> <button v-if="$i" v-click-anime class="item _button account" @click="openAccountMenuWrapper">
<MkAvatar :user="$i" class="avatar"/><MkAcct class="text" :user="$i"/> <MkAvatar :user="$i" class="avatar"/><MkAcct class="text" :user="$i"/>
</button> </button>
<div class="post" data-cy-open-post-form @click="post"> <div class="post" data-cy-open-post-form @click="() => { os.post(); }">
<MkButton class="button" gradate full rounded> <MkButton class="button" gradate full rounded>
<i class="fas fa-pencil-alt fa-fw"></i><span v-if="!iconOnly" class="text">{{ i18n.ts.note }}</span> <i class="fas fa-pencil-alt fa-fw"></i><span v-if="!iconOnly" class="text">{{ i18n.ts.note }}</span>
</MkButton> </MkButton>
@ -20,7 +20,7 @@
</component> </component>
</template> </template>
<div class="divider"></div> <div class="divider"></div>
<MkA v-if="adminOrModerator" v-click-anime class="item" active-class="active" to="/admin" :behavior="settingsWindowed ? 'modalWindow' : null"> <MkA v-if="iAmModerator" v-click-anime class="item" active-class="active" to="/admin" :behavior="settingsWindowed ? 'modalWindow' : null">
<i class="fas fa-door-open fa-fw"></i><span class="text">{{ i18n.ts.controlPanel }}</span> <i class="fas fa-door-open fa-fw"></i><span class="text">{{ i18n.ts.controlPanel }}</span>
</MkA> </MkA>
<button v-click-anime class="item _button" @click="more"> <button v-click-anime class="item _button" @click="more">
@ -43,7 +43,7 @@
import { defineAsyncComponent, watch, defineEmits, onMounted, nextTick } from 'vue'; import { defineAsyncComponent, watch, defineEmits, onMounted, nextTick } from 'vue';
import * as os from '@/os'; import * as os from '@/os';
import { menuDef } from '@/menu'; import { menuDef } from '@/menu';
import { openAccountMenu, $i } from '@/account'; import { openAccountMenu, $i, iAmModerator } from '@/account';
import MkButton from '@/components/ui/button.vue'; import MkButton from '@/components/ui/button.vue';
import { StickySidebar } from '@/scripts/sticky-sidebar'; import { StickySidebar } from '@/scripts/sticky-sidebar';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
@ -61,15 +61,12 @@ const otherNavItemIndicated = $computed(() => {
} }
return false; return false;
}); });
const adminOrModerator = $computed(() => $i && ($i.isAdmin || $i.isModerator));
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'change-view-mode'): void; (ev: 'change-view-mode'): void;
}>(); }>();
watch(() => defaultStore.reactiveState.menuDisplay.value, () => { watch(defaultStore.reactiveState.menuDisplay, calcViewState);
calcViewState();
});
watch(iconOnly, () => { watch(iconOnly, () => {
nextTick(() => { nextTick(() => {
@ -90,12 +87,10 @@ function calcViewState(): void {
iconOnly = (window.innerWidth <= 1400) || (defaultStore.state.menuDisplay === 'sideIcon'); iconOnly = (window.innerWidth <= 1400) || (defaultStore.state.menuDisplay === 'sideIcon');
settingsWindowed = (window.innerWidth > 1400); settingsWindowed = (window.innerWidth > 1400);
} }
window.addEventListener('resize', calcViewState);
calcViewState();
function post(): void { function more(ev: MouseEvent): void {
os.post();
}
function more(ev: { currentTarget: any; target: any; }): void {
os.popup(defineAsyncComponent(() => import('@/components/launch-pad.vue')), { os.popup(defineAsyncComponent(() => import('@/components/launch-pad.vue')), {
src: ev.currentTarget ?? ev.target, src: ev.currentTarget ?? ev.target,
}, {}, 'closed'); }, {}, 'closed');
@ -106,9 +101,6 @@ function openAccountMenuWrapper(ev: MouseEvent): void {
withExtraOperation: true, withExtraOperation: true,
}, ev); }, ev);
} }
window.addEventListener('resize', calcViewState);
calcViewState();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>