fix: fold the activity board picker and its actions into one dropdown
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
|||||||
UiModal,
|
UiModal,
|
||||||
UiPageHeader,
|
UiPageHeader,
|
||||||
UiPagination,
|
UiPagination,
|
||||||
UiSelect,
|
|
||||||
} from '@/components/ui';
|
} from '@/components/ui';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
import UiSegmented from '@/components/ui/UiSegmented.vue';
|
import UiSegmented from '@/components/ui/UiSegmented.vue';
|
||||||
@@ -170,6 +169,7 @@ const board = computed<string>(() => {
|
|||||||
return defaultBoardId.value;
|
return defaultBoardId.value;
|
||||||
});
|
});
|
||||||
const currentBoard = computed(() => boards.value.find((b) => b.id === board.value) ?? null);
|
const currentBoard = computed(() => boards.value.find((b) => b.id === board.value) ?? null);
|
||||||
|
const boardMenuOpen = ref(false);
|
||||||
const boardModal = ref<{ mode: 'create' | 'edit'; name: string } | null>(null);
|
const boardModal = ref<{ mode: 'create' | 'edit'; name: string } | null>(null);
|
||||||
const boardSaving = ref(false);
|
const boardSaving = ref(false);
|
||||||
const boardDeleteOpen = ref(false);
|
const boardDeleteOpen = ref(false);
|
||||||
@@ -410,11 +410,6 @@ function setBoard(next: string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const boardModel = computed<string>({
|
|
||||||
get: () => board.value,
|
|
||||||
set: (v) => setBoard(v),
|
|
||||||
});
|
|
||||||
|
|
||||||
function openCreateBoard() {
|
function openCreateBoard() {
|
||||||
boardModal.value = { mode: 'create', name: '' };
|
boardModal.value = { mode: 'create', name: '' };
|
||||||
}
|
}
|
||||||
@@ -998,32 +993,46 @@ onUnmounted(() => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="view-row-end">
|
<div class="view-row-end">
|
||||||
<div v-if="boards.length" class="board-picker" @click.stop>
|
<UiDropdownMenu
|
||||||
<UiSelect v-model="boardModel" size="sm" aria-label="گروه فعالیت">
|
v-if="boards.length"
|
||||||
<option v-for="b in boards" :key="b.id" :value="b.id">{{ b.name }}</option>
|
:open="boardMenuOpen"
|
||||||
</UiSelect>
|
align="start"
|
||||||
<UiButton
|
@update:open="(v) => (boardMenuOpen = v)"
|
||||||
v-if="canManageStages"
|
>
|
||||||
variant="ghost"
|
<template #trigger="{ toggle }">
|
||||||
size="sm"
|
<button
|
||||||
|
type="button"
|
||||||
|
class="board-trigger"
|
||||||
|
aria-label="گروه فعالیت"
|
||||||
|
:title="currentBoard?.name"
|
||||||
|
@click.stop="toggle"
|
||||||
|
>
|
||||||
|
<UiIcon name="layers" :size="14" />
|
||||||
|
<span>{{ currentBoard?.name ?? 'گروه' }}</span>
|
||||||
|
<UiIcon name="chevron" :size="13" class="board-chev" />
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<button
|
||||||
|
v-for="b in boards"
|
||||||
|
:key="b.id"
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="ویرایش گروه"
|
:class="{ on: b.id === board }"
|
||||||
title="ویرایش گروه"
|
@click="setBoard(b.id)"
|
||||||
@click="openEditBoard"
|
|
||||||
>
|
>
|
||||||
<UiIcon name="pencil" :size="14" />
|
{{ b.name }}
|
||||||
</UiButton>
|
</button>
|
||||||
<UiButton
|
<template v-if="canManageStages">
|
||||||
v-if="canManageStages"
|
<hr class="board-menu-sep" />
|
||||||
variant="ghost"
|
<button type="button" class="board-menu-action" @click="openCreateBoard">
|
||||||
size="sm"
|
<UiIcon name="plus" :size="14" />
|
||||||
type="button"
|
گروه جدید
|
||||||
@click="openCreateBoard"
|
</button>
|
||||||
>
|
<button type="button" class="board-menu-action" @click="openEditBoard">
|
||||||
<UiIcon name="plus" :size="14" />
|
<UiIcon name="pencil" :size="14" />
|
||||||
گروه جدید
|
ویرایش این گروه
|
||||||
</UiButton>
|
</button>
|
||||||
</div>
|
</template>
|
||||||
|
</UiDropdownMenu>
|
||||||
<UiButton
|
<UiButton
|
||||||
v-if="canManageStages"
|
v-if="canManageStages"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -1817,15 +1826,50 @@ h1 {
|
|||||||
margin-inline-start: auto;
|
margin-inline-start: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board-picker {
|
.board-trigger {
|
||||||
display: flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.4rem;
|
||||||
|
height: 30px;
|
||||||
|
max-width: 14rem;
|
||||||
|
padding: 0 0.6rem;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
background: var(--surface, #fff);
|
||||||
|
color: var(--ink, #0f172a);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board-picker .ui-select {
|
.board-trigger:hover {
|
||||||
width: auto;
|
border-color: var(--accent, #0d9488);
|
||||||
min-width: 10rem;
|
}
|
||||||
|
|
||||||
|
.board-trigger span {
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.board-chev {
|
||||||
|
color: var(--muted);
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.board-menu-sep {
|
||||||
|
margin: 0.25rem 0;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid var(--line, #e2e8f0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.board-menu-action {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
color: var(--accent-deep, #0f766e) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board-form {
|
.board-form {
|
||||||
|
|||||||
Reference in New Issue
Block a user