Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions app/components/board/BoardSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const props = defineProps<{
section: BoardSection
}>()

const { isEditing, markDirty } = useEditMode()
const { isEditing, showWidgetPicker, markDirty } = useEditMode()
const store = useBoardStore()

const showSettings = ref(false)
Expand Down Expand Up @@ -104,6 +104,11 @@ function toggleCollapse() {
group="widgets"
:animation="150"
ghost-class="opacity-30"
:force-fallback="true"
:fallback-on-body="true"
:fallback-tolerance="3"
filter=".no-drag"
:prevent-on-filter="false"
class="grid gap-4"
:class="gridClass"
@change="onDragChange"
Expand All @@ -118,9 +123,10 @@ function toggleCollapse() {
</VueDraggable>
<!-- eslint-enable vue/no-mutating-props -->

<div
<button
v-if="section.widgets.length === 0 && isEditing"
class="border-2 border-dashed border-default rounded-lg p-8 text-center text-dimmed"
class="w-full border-2 border-dashed border-default rounded-lg p-8 text-center text-dimmed hover:border-primary hover:text-muted transition-colors cursor-pointer"
@click="showWidgetPicker = true"
>
<UIcon
name="i-lucide-plus"
Expand All @@ -129,7 +135,7 @@ function toggleCollapse() {
<p class="text-sm">
Drag widgets here or add from the widget picker
</p>
</div>
</button>
</div>

<EditorSectionSettings
Expand Down
4 changes: 1 addition & 3 deletions app/components/board/BoardToolbar.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script setup lang="ts">
const store = useBoardStore()
const { isEditing, hasUnsavedChanges, enterEditMode, exitEditMode, markDirty } = useEditMode()

const showWidgetPicker = ref(false)
const { isEditing, hasUnsavedChanges, showWidgetPicker, enterEditMode, exitEditMode, markDirty } = useEditMode()
const showBoardSettings = ref(false)

const toast = useToast()
Expand Down
3 changes: 3 additions & 0 deletions app/components/board/BoardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const { isEditing, markDirty } = useEditMode()
handle=".section-handle"
:animation="150"
ghost-class="opacity-30"
:force-fallback="true"
:fallback-on-body="true"
:fallback-tolerance="3"
class="flex flex-col gap-6"
@change="markDirty"
>
Expand Down
11 changes: 4 additions & 7 deletions app/components/editor/EditorContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const store = useBoardStore()
const { markDirty } = useEditMode()

const showSettings = ref(false)
const menuOpen = ref(false)

const items = computed(() => {
if (props.disabled) return []
Expand Down Expand Up @@ -113,18 +114,14 @@ const items = computed(() => {

<template>
<div class="relative">
<UContextMenu
:items="items"
:disabled="disabled"
>
<slot />
</UContextMenu>
<slot />

<div
v-if="!disabled"
class="absolute top-1.5 right-1.5 z-10"
class="no-drag absolute top-1.5 right-1.5 z-10"
>
<UDropdownMenu
v-model:open="menuOpen"
:items="items"
:content="{ align: 'end' }"
>
Expand Down
2 changes: 1 addition & 1 deletion app/components/widgets/WidgetWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function pluginsAt(position: string) {
:color="cardColor"
class="relative h-full transition-all duration-200"
:class="{
'ring-2 ring-primary/30 hover:ring-primary/50': isEditing,
'ring-2 ring-primary/30 hover:ring-primary/50 select-none': isEditing,
'ring-2 ring-primary/30': isAccent && !isEditing,
'hover:ring-1 hover:ring-accented cursor-pointer': isLinkable && !isEditing
}"
Expand Down
2 changes: 2 additions & 0 deletions app/composables/useEditMode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export function useEditMode() {
const isEditing = useState('editMode', () => false)
const hasUnsavedChanges = useState('unsavedChanges', () => false)
const showWidgetPicker = useState('showWidgetPicker', () => false)

function enterEditMode() {
isEditing.value = true
Expand All @@ -20,6 +21,7 @@ export function useEditMode() {
return {
isEditing,
hasUnsavedChanges,
showWidgetPicker,
enterEditMode,
exitEditMode,
markDirty
Expand Down
Loading