Browse Source

refactor: cy class marker, move viewTypes string to utility

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3343/head
Raju Udava 2 years ago
parent
commit
f5cea069f1
  1. 10
      packages/nc-gui-v2/components/smartsheet/sidebar/MenuBottom.vue
  2. 10
      packages/nc-gui-v2/components/smartsheet/sidebar/MenuTop.vue
  3. 6
      packages/nc-gui-v2/utils/viewUtils.ts

10
packages/nc-gui-v2/components/smartsheet/sidebar/MenuBottom.vue

@ -26,7 +26,7 @@ function onOpenModal(type: ViewTypes, title = '') {
<a-menu-item
key="grid"
class="group !flex !items-center !my-0 !h-[30px] nc-create-3-view"
class="group !flex !items-center !my-0 !h-[30px] nc-create-grid-view"
@click="onOpenModal(ViewTypes.GRID)"
>
<a-tooltip :mouse-enter-delay="1" placement="left">
@ -46,7 +46,11 @@ function onOpenModal(type: ViewTypes, title = '') {
</a-tooltip>
</a-menu-item>
<a-menu-item key="gallery" class="group !flex !items-center !my-0 nc-create-2-view" @click="onOpenModal(ViewTypes.GALLERY)">
<a-menu-item
key="gallery"
class="group !flex !items-center !my-0 nc-create-gallery-view"
@click="onOpenModal(ViewTypes.GALLERY)"
>
<a-tooltip :mouse-enter-delay="1" placement="left">
<template #title>
{{ $t('msg.info.addView.gallery') }}
@ -67,7 +71,7 @@ function onOpenModal(type: ViewTypes, title = '') {
<a-menu-item
v-if="!isView"
key="form"
class="group !flex !items-center !my-0 !h-[30px] nc-create-1-view"
class="group !flex !items-center !my-0 !h-[30px] nc-create-form-view"
@click="onOpenModal(ViewTypes.FORM)"
>
<a-tooltip :mouse-enter-delay="1" placement="left">

10
packages/nc-gui-v2/components/smartsheet/sidebar/MenuTop.vue

@ -1,6 +1,5 @@
<script lang="ts" setup>
import type { ViewType } from 'nocodb-sdk'
import { ViewTypes } from 'nocodb-sdk'
import type { ViewType, ViewTypes } from 'nocodb-sdk'
import type { SortableEvent } from 'sortablejs'
import type { Menu as AntMenu } from 'ant-design-vue'
import { message } from 'ant-design-vue'
@ -18,6 +17,7 @@ import {
useDialog,
useRoute,
useRouter,
viewTypeAlias,
watch,
} from '#imports'
import DlgViewDelete from '~/components/dlg/ViewDelete.vue'
@ -30,12 +30,6 @@ interface Emits {
const emits = defineEmits<Emits>()
const viewTypeAlias = {
[ViewTypes.GRID as any]: 'grid',
[ViewTypes.FORM as any]: 'form',
[ViewTypes.GALLERY as any]: 'gallery',
}
const activeView = inject(ActiveViewInj, ref())
const views = inject<Ref<any[]>>(ViewListInj, ref([]))

6
packages/nc-gui-v2/utils/viewUtils.ts

@ -16,3 +16,9 @@ export const viewIcons = {
[ViewTypes.KANBAN]: { icon: MdiKanbanIcon, color: 'green' },
view: { icon: MdiEyeIcon, color: 'blue' },
}
export const viewTypeAlias = {
[ViewTypes.GRID as any]: 'grid',
[ViewTypes.FORM as any]: 'form',
[ViewTypes.GALLERY as any]: 'gallery',
}

Loading…
Cancel
Save