From 7f849189d471b0b0635a8c2202ed2a59aa63db55 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 18 Aug 2022 19:29:29 +0530 Subject: [PATCH 01/11] refactor(gui-v2): new layout Signed-off-by: Pranav C --- packages/nc-gui-v2/assets/style-v2.scss | 7 +- packages/nc-gui-v2/components.d.ts | 3 + .../components/dashboard/TreeView.vue | 128 ++++++++++-- .../components/general/ShareBaseButton.vue | 4 +- .../components/smartsheet/Toolbar.vue | 2 +- .../components/smartsheet/sidebar/index.vue | 6 +- .../sidebar/toolbar/ToggleDrawer.vue | 18 ++ .../smartsheet/sidebar/toolbar/index.vue | 7 + .../nc-gui-v2/components/tabs/Smartsheet.vue | 6 +- packages/nc-gui-v2/layouts/base.vue | 2 +- .../pages/[projectType]/[projectId]/index.vue | 41 +++- .../[projectType]/[projectId]/index/index.vue | 183 ++++-------------- 12 files changed, 233 insertions(+), 174 deletions(-) create mode 100644 packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/ToggleDrawer.vue diff --git a/packages/nc-gui-v2/assets/style-v2.scss b/packages/nc-gui-v2/assets/style-v2.scss index 3bf9cc04bb..5484cc31da 100644 --- a/packages/nc-gui-v2/assets/style-v2.scss +++ b/packages/nc-gui-v2/assets/style-v2.scss @@ -3,6 +3,7 @@ :root { --header-height: 50px; + --toolbar-height: 48px; } .ant-layout-header { @@ -51,7 +52,7 @@ h1, h2, h3, h4, h5, h6, p, label, button, textarea, select { .nc-menu-item { @apply cursor-pointer text-xs flex items-center gap-2 px-4 py-3 relative after:(content-[''] absolute top-0 left-0 bottom-0 w-full h-full right-0 bg-current opacity-0 transition transition-opactity duration-100) hover:(after:(opacity-5)); - &.disabled { + &.disabled { @apply text-black text-opacity-25 bg-[#f5f5f5] cursor-not-allowed text-shadow-none box-shadow-none border-[#d9d9d9]; } } @@ -85,7 +86,7 @@ h1, h2, h3, h4, h5, h6, p, label, button, textarea, select { svg { @apply z-1 text-xl p-1 text-gray-500; } - + .disabled { @apply cursor-not-allowed border-none; } @@ -209,4 +210,4 @@ h1, h2, h3, h4, h5, h6, p, label, button, textarea, select { &:active::after { @apply ring ring-pink-500; } -} \ No newline at end of file +} diff --git a/packages/nc-gui-v2/components.d.ts b/packages/nc-gui-v2/components.d.ts index c738bd809c..964f674e2e 100644 --- a/packages/nc-gui-v2/components.d.ts +++ b/packages/nc-gui-v2/components.d.ts @@ -97,6 +97,7 @@ declare module '@vue/runtime-core' { MdiArrowExpand: typeof import('~icons/mdi/arrow-expand')['default'] MdiArrowLeftBold: typeof import('~icons/mdi/arrow-left-bold')['default'] MdiAt: typeof import('~icons/mdi/at')['default'] + MdiBackburger: typeof import('~icons/mdi/backburger')['default'] MdiBugOutline: typeof import('~icons/mdi/bug-outline')['default'] MdiCalculator: typeof import('~icons/mdi/calculator')['default'] MdiCalendarMonth: typeof import('~icons/mdi/calendar-month')['default'] @@ -104,6 +105,7 @@ declare module '@vue/runtime-core' { MdiCellphoneMessage: typeof import('~icons/mdi/cellphone-message')['default'] MdiChat: typeof import('~icons/mdi/chat')['default'] MdiCheck: typeof import('~icons/mdi/check')['default'] + MdiChevronDoubleLeft: typeof import('~icons/mdi/chevron-double-left')['default'] MdiChevronDown: typeof import('~icons/mdi/chevron-down')['default'] MdiClose: typeof import('~icons/mdi/close')['default'] MdiCloseBox: typeof import('~icons/mdi/close-box')['default'] @@ -158,6 +160,7 @@ declare module '@vue/runtime-core' { MdiLogin: typeof import('~icons/mdi/login')['default'] MdiLogout: typeof import('~icons/mdi/logout')['default'] MdiMagnify: typeof import('~icons/mdi/magnify')['default'] + MdiMenu: typeof import('~icons/mdi/menu')['default'] MdiMenuDown: typeof import('~icons/mdi/menu-down')['default'] MdiMicrosoftTeams: typeof import('~icons/mdi/microsoft-teams')['default'] MdiMinusCircleOutline: typeof import('~icons/mdi/minus-circle-outline')['default'] diff --git a/packages/nc-gui-v2/components/dashboard/TreeView.vue b/packages/nc-gui-v2/components/dashboard/TreeView.vue index c23e290851..c3ef99e034 100644 --- a/packages/nc-gui-v2/components/dashboard/TreeView.vue +++ b/packages/nc-gui-v2/components/dashboard/TreeView.vue @@ -4,12 +4,14 @@ import Sortable from 'sortablejs' import { Empty } from 'ant-design-vue' import { useNuxtApp } from '#app' import { computed, useProject, useTable, useTabs, useUIPermission, watchEffect } from '#imports' +import DlgAirtableImport from '~/components/dlg/AirtableImport.vue' +import DlgQuickImport from '~/components/dlg/QuickImport.vue' +import DlgTableCreate from '~/components/dlg/TableCreate.vue' import { TabType } from '~/composables' import MdiView from '~icons/mdi/eye-circle-outline' import MdiTableLarge from '~icons/mdi/table-large' import MdiMenuIcon from '~icons/mdi/dots-vertical' import MdiDrag from '~icons/mdi/drag-vertical' -import GithubStarButton from '~/components/dashboard/GithubStarButton.vue' const { addTab } = useTabs() @@ -135,21 +137,45 @@ const addTableTab = (table: TableType) => { const activeTable = computed(() => { return [TabType.TABLE, TabType.VIEW].includes(activeTab.value?.type) ? activeTab.value.title : null }) + +function openQuickImportDialog(type: string) { + $e(`a:actions:import-${type}`) + + const isOpen = ref(true) + + const { close } = useDialog(DlgQuickImport, { + 'modelValue': isOpen, + 'importType': type, + 'onUpdate:modelValue': closeDialog, + }) + + function closeDialog() { + isOpen.value = false + + close(1000) + } +} + +function openAirtableImportDialog() { + $e('a:actions:import-airtable') + + const isOpen = ref(true) + + const { close } = useDialog(DlgAirtableImport, { + 'modelValue': isOpen, + 'onUpdate:modelValue': closeDialog, + }) + + function closeDialog() { + isOpen.value = false + + close(1000) + } +}