Skip to content

Commit 2a93562

Browse files
fix: update styles and move components
1 parent 2ea04f1 commit 2a93562

File tree

5 files changed

+54
-82
lines changed

5 files changed

+54
-82
lines changed

packages/nc-gui/components/smartsheet/Toolbar.vue

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,18 @@ const { isGrid, isGallery, isKanban, isMap, isCalendar } = useSmartsheetStoreOrT
1414
1515
const isPublic = inject(IsPublicInj, ref(false))
1616
17-
const { isViewsLoading } = storeToRefs(useViewsStore())
18-
1917
const { isMobileMode } = useGlobal()
18+
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
2019
21-
const containerRef = ref<HTMLElement>()
22-
23-
const isTab = ref(true)
20+
const { isViewsLoading } = storeToRefs(useViewsStore())
2421
25-
const handleResize = () => {
26-
isTab.value = !!containerRef.value && containerRef.value.offsetWidth > 970
27-
}
22+
const containerRef = ref<HTMLElement>()
2823
29-
onMounted(() => {
30-
window.addEventListener('resize', handleResize)
31-
})
24+
const { width } = useElementSize(containerRef)
3225
33-
onUnmounted(() => {
34-
window.removeEventListener('resize', handleResize)
26+
const isTab = computed(() => {
27+
if (!isCalendar.value) return false
28+
return width.value > 1200
3529
})
3630
3731
const { allowCSVDownload } = useSharedView()
@@ -47,24 +41,33 @@ const { allowCSVDownload } = useSharedView()
4741
<a-skeleton-input :active="true" class="!w-44 !h-4 ml-2 !rounded overflow-hidden" />
4842
</template>
4943
<template v-else>
50-
<LazySmartsheetToolbarMappedBy v-if="isMap" />
51-
<LazySmartsheetToolbarCalendarHeader v-if="isCalendar" />
52-
<LazySmartsheetToolbarCalendarRange v-if="isCalendar" />
44+
<div
45+
:class="{
46+
'min-w-34/100 max-w-34/100': !isMobileMode && isLeftSidebarOpen && isCalendar,
47+
'min-w-39/100 max-w-39/100': !isMobileMode && !isLeftSidebarOpen && isCalendar,
48+
}"
49+
class="flex gap-2"
50+
>
51+
<LazySmartsheetToolbarMappedBy v-if="isMap" />
52+
<LazySmartsheetToolbarCalendarHeader v-if="isCalendar" />
53+
<LazySmartsheetToolbarCalendarRange v-if="isCalendar" />
5354

54-
<LazySmartsheetToolbarFieldsMenu
55-
v-if="isGrid || isGallery || isKanban || isMap || isCalendar"
56-
:show-system-fields="false"
57-
/>
55+
<LazySmartsheetToolbarFieldsMenu
56+
v-if="isGrid || isGallery || isKanban || isMap || isCalendar"
57+
:show-system-fields="false"
58+
/>
5859

59-
<LazySmartsheetToolbarStackedBy v-if="isKanban" />
60+
<LazySmartsheetToolbarStackedBy v-if="isKanban" />
6061

61-
<LazySmartsheetToolbarColumnFilterMenu v-if="isGrid || isGallery || isKanban || isMap" />
62+
<LazySmartsheetToolbarColumnFilterMenu v-if="isGrid || isGallery || isKanban || isMap || isCalendar" />
6263

63-
<LazySmartsheetToolbarGroupByMenu v-if="isGrid" />
64+
<LazySmartsheetToolbarGroupByMenu v-if="isGrid" />
6465

65-
<LazySmartsheetToolbarSortListMenu v-if="isGrid || isGallery || isKanban" />
66+
<LazySmartsheetToolbarSortListMenu v-if="isGrid || isGallery || isKanban || isCalendar" />
67+
<LazySmartsheetToolbarCalendarMode v-if="isCalendar && !isTab" :tab="isTab" />
68+
</div>
6669

67-
<LazySmartsheetToolbarCalendarMode v-if="isCalendar" v-model:tab="isTab" />
70+
<LazySmartsheetToolbarCalendarMode v-if="isCalendar && isTab" :tab="isTab" />
6871

6972
<template v-if="!isMobileMode">
7073
<LazySmartsheetToolbarRowHeight v-if="isGrid" />

packages/nc-gui/components/smartsheet/calendar/SideMenu.vue

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,22 @@ onUnmounted(() => {
314314
'min-w-[288px]': width <= 1440 && props.visible,
315315
'nc-calendar-side-menu-open': props.visible,
316316
}"
317-
class="h-full border-l-1 border-gray-200 transition-all"
317+
class="h-full relative border-l-1 border-gray-200 transition-all"
318318
data-testid="nc-calendar-side-menu"
319319
>
320+
<NcButton
321+
v-if="isUIAllowed('dataEdit') && props.visible"
322+
v-e="['c:calendar:calendar-sidemenu-new-record-btn']"
323+
class="!absolute right-5 !border-brand-500 bottom-5 !h-12 !w-12"
324+
data-testid="nc-calendar-side-menu-new-btn"
325+
type="secondary"
326+
@click="newRecord"
327+
>
328+
<div class="px-4 flex items-center gap-2 justify-center">
329+
<component :is="iconMap.plus" class="h-6 w-6 text-lg text-brand-500" />
330+
</div>
331+
</NcButton>
332+
320333
<div class="flex flex-col">
321334
<NcDateWeekSelector
322335
v-if="activeCalendarView === ('day' as const)"
@@ -390,25 +403,6 @@ onUnmounted(() => {
390403
</template>
391404
</a-input>
392405
</div>
393-
<div class="flex px-4 justify-between items-center">
394-
<div class="flex">
395-
<LazySmartsheetToolbarColumnFilterMenu />
396-
397-
<LazySmartsheetToolbarSortListMenu />
398-
</div>
399-
400-
<NcButton
401-
v-if="isUIAllowed('dataEdit') && props.visible"
402-
v-e="['c:calendar:calendar-sidemenu-new-record-btn']"
403-
data-testid="nc-calendar-side-menu-new-btn"
404-
size="small"
405-
type="secondary"
406-
@click="newRecord"
407-
>
408-
New
409-
<component :is="iconMap.plus" class="flex mx-auto" />
410-
</NcButton>
411-
</div>
412406

413407
<div
414408
v-if="calendarRange?.length && !isCalendarMetaLoading"

packages/nc-gui/components/smartsheet/toolbar/Calendar/Mode.vue

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,19 @@ watch(activeCalendarView, () => {
3333
<template>
3434
<div
3535
v-if="props.tab"
36-
:class="{
37-
'absolute mx-auto pointer-events-none inset-x-0': props.tab,
38-
}"
39-
class="flex items-center justify-center"
36+
class="flex flex-row px-1 pointer-events-auto mx-3 mt-3 rounded-lg gap-x-0.5 nc-calendar-mode-tab"
37+
data-testid="nc-calendar-view-mode"
4038
>
39+
<div :style="highlightStyle" class="highlight"></div>
4140
<div
42-
class="flex flex-row px-1 pointer-events-auto mx-3 mt-3 rounded-lg gap-x-0.5 nc-calendar-mode-tab"
43-
data-testid="nc-calendar-view-mode"
41+
v-for="mode in ['day', 'week', 'month', 'year']"
42+
:key="mode"
43+
:class="{ active: activeCalendarView === mode }"
44+
:data-testid="`nc-calendar-view-mode-${mode}`"
45+
class="tab"
46+
@click="setActiveCalendarMode(mode, $event)"
4447
>
45-
<div :style="highlightStyle" class="highlight"></div>
46-
<div
47-
v-for="mode in ['day', 'week', 'month', 'year']"
48-
:key="mode"
49-
:class="{ active: activeCalendarView === mode }"
50-
:data-testid="`nc-calendar-view-mode-${mode}`"
51-
class="tab"
52-
@click="setActiveCalendarMode(mode, $event)"
53-
>
54-
<div class="tab-title nc-tab">{{ $t(`objects.${mode}`) }}</div>
55-
</div>
48+
<div class="tab-title nc-tab">{{ $t(`objects.${mode}`) }}</div>
5649
</div>
5750
</div>
5851

packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ watch(
5151
5252
const open = ref(false)
5353
54-
const isCalendar = inject(IsCalendarInj, ref(false))
55-
5654
const allFilters = ref({})
5755
5856
provide(AllFiltersInj, allFilters)
@@ -79,14 +77,7 @@ eventBus.on(async (event, column: ColumnType) => {
7977
class="!xs:hidden"
8078
>
8179
<div :class="{ 'nc-active-btn': filtersLength }">
82-
<a-button
83-
v-e="['c:filter']"
84-
:class="{
85-
'!border-y-1 !border-x-1 !rounded-lg !rounded-r-none': isCalendar,
86-
}"
87-
:disabled="isLocked"
88-
class="nc-filter-menu-btn nc-toolbar-btn text-sm"
89-
>
80+
<a-button v-e="['c:filter']" :disabled="isLocked" class="nc-filter-menu-btn nc-toolbar-btn text-sm">
9081
<div class="flex items-center gap-2">
9182
<component :is="iconMap.filter" class="h-4 w-4" />
9283
<!-- Filter -->

packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ const { isMobileMode } = useGlobal()
3636
3737
const { getPlanLimit } = useWorkspace()
3838
39-
const isCalendar = inject(IsCalendarInj, ref(false))
40-
4139
eventBus.on((event) => {
4240
if (event === SmartsheetStoreEvents.SORT_RELOAD) {
4341
loadSorts()
@@ -128,14 +126,7 @@ onMounted(() => {
128126
overlay-class-name="nc-dropdown-sort-menu nc-toolbar-dropdown"
129127
>
130128
<div :class="{ 'nc-active-btn': sorts?.length }">
131-
<a-button
132-
v-e="['c:sort']"
133-
:class="{
134-
'!border-y-1 !border-r-1 !rounded-lg !rounded-l-none': isCalendar,
135-
}"
136-
:disabled="isLocked"
137-
class="nc-sort-menu-btn nc-toolbar-btn"
138-
>
129+
<a-button v-e="['c:sort']" :disabled="isLocked" class="nc-sort-menu-btn nc-toolbar-btn">
139130
<div class="flex items-center gap-2">
140131
<component :is="iconMap.sort" class="h-4 w-4 text-inherit" />
141132

0 commit comments

Comments
 (0)