Browse Source

feat(gui-v2): use useSidebar with storageKey

pull/3174/head
Wing-Kam Wong 2 years ago
parent
commit
497c87c94c
  1. 8
      packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/AddRow.vue
  2. 7
      packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/DeleteTable.vue
  3. 7
      packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/Reload.vue

8
packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/AddRow.vue

@ -1,14 +1,10 @@
<script setup lang="ts">
import { inject, ref } from '#imports'
import { RightSidebarInj } from '~/context'
const emits = defineEmits(['addRow'])
const sidebarOpen = inject(RightSidebarInj, ref(true))
const { isOpen } = useSidebar({ storageKey: 'nc-right-sidebar' })
</script>
<template>
<a-tooltip :placement="sidebarOpen ? 'bottomRight' : 'left'">
<a-tooltip :placement="isOpen ? 'bottomRight' : 'left'">
<template #title> {{ $t('activity.addRow') }} </template>
<div class="nc-sidebar-right-item hover:after:bg-primary/75 group">

7
packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/DeleteTable.vue

@ -1,16 +1,15 @@
<script setup lang="ts">
import { inject, ref, useTable } from '#imports'
import { MetaInj, RightSidebarInj } from '~/context'
import { MetaInj, inject, useTable } from '#imports'
const meta = inject(MetaInj)!
const { deleteTable } = useTable()
const sidebarOpen = inject(RightSidebarInj, ref(true))
const { isOpen } = useSidebar({ storageKey: 'nc-right-sidebar' })
</script>
<template>
<a-tooltip :placement="sidebarOpen ? 'bottomRight' : 'left'">
<a-tooltip :placement="isOpen ? 'bottomRight' : 'left'">
<template #title> {{ $t('activity.deleteTable') }} </template>
<div class="nc-sidebar-right-item hover:after:bg-red-500 group">

7
packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/Reload.vue

@ -1,16 +1,15 @@
<script setup lang="ts">
import { ReloadViewDataHookInj, RightSidebarInj } from '~/context'
import { inject, ref } from '#imports'
import { ReloadViewDataHookInj, inject } from '#imports'
const reloadHook = inject(ReloadViewDataHookInj)!
const sidebarOpen = inject(RightSidebarInj, ref(true))
const { isOpen } = useSidebar({ storageKey: 'nc-right-sidebar' })
const onClick = () => reloadHook.trigger()
</script>
<template>
<a-tooltip :placement="sidebarOpen ? 'bottomRight' : 'left'">
<a-tooltip :placement="isOpen ? 'bottomRight' : 'left'">
<template #title> {{ $t('general.reload') }} </template>
<div class="nc-sidebar-right-item hover:after:bg-green-500 group">

Loading…
Cancel
Save