Browse Source

refactor(gui): avoid extra negation by reversing computed var

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3662/head
Pranav C 2 years ago
parent
commit
390ca00758
  1. 16
      packages/nc-gui/components/general/FullScreen.vue

16
packages/nc-gui/components/general/FullScreen.vue

@ -4,11 +4,11 @@ import { useSidebar } from '#imports'
const rightSidebar = useSidebar('nc-right-sidebar')
const leftSidebar = useSidebar('nc-left-sidebar')
const isFullScreen = computed({
get: () => !(rightSidebar.isOpen.value || leftSidebar.isOpen.value),
const isSidebarsOpen = computed({
get: () => rightSidebar.isOpen.value || leftSidebar.isOpen.value,
set: (value) => {
rightSidebar.toggle(!value)
leftSidebar.toggle(!value)
rightSidebar.toggle(value)
leftSidebar.toggle(value)
},
})
</script>
@ -16,14 +16,14 @@ const isFullScreen = computed({
<template>
<a-tooltip>
<!-- todo: i18n -->
<template #title> {{ isFullScreen ? 'Exit full width' : 'Full width' }}</template>
<template #title> {{ isSidebarsOpen ? 'Full width': 'Exit full width' }}</template>
<div
v-e="['c:toolbar:fullscreen']"
class="nc-fullscreen-btn cursor-pointer flex align-center self-center px-2 py-2 mr-2"
@click="isFullScreen = !isFullScreen"
@click="isSidebarsOpen = !isSidebarsOpen"
>
<IcTwotoneWidthNormal v-if="isFullScreen" class="text-gray-300" />
<IcTwotoneWidthFull v-else class="text-gray-300" />
<IcTwotoneWidthFull v-if="isSidebarsOpen" class="text-gray-300" />
<IcTwotoneWidthNormal v-else class="text-gray-300" />
</div>
</a-tooltip>
</template>

Loading…
Cancel
Save