Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Start new Kanban view system

Smaug6739ec5510d901fe
diff --git a/frontend/app/components/Kanban/DeleteColumnModal.vue b/frontend/app/components/Kanban/DeleteColumnModal.vue
new file mode 100644
index 00000000..999a1a77
--- /dev/null
+++ b/frontend/app/components/Kanban/DeleteColumnModal.vue
@@ -0,0 +1,43 @@
+<template>
+ <div class="modal">
+ <h3>Delete column</h3>
+ <p>Are you sure you want to delete the column "{{ columnTitle }}" ?</p>
+ <p v-if="cardCount > 0" class="warn">
+ This column contains {{ cardCount }} document{{ cardCount > 1 ? 's' : '' }}. They will be moved to the first column.
+ </p>
+ <p v-else class="info">This column is empty.</p>
+ <div class="footer">
+ <AppButton type="secondary" @click="emit('close')">Cancel</AppButton>
+ <AppButton type="danger" @click="confirmDelete">Delete</AppButton>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+const props = defineProps<{
+ columnTitle: string;
+ cardCount: number;
+ onConfirm: () => void;
+}>();
+
+const emit = defineEmits<{
+ close: [];
+}>();
+
+const confirmDelete = () => {
+ props.onConfirm();
+ emit('close');
+};
+</script>
+
+<style scoped lang="scss">
+.warn {
+ color: var(--red-dark);
+ opacity: 0.8;
+}
+
+.info {
+ color: var(--font-color-light);
+ font-style: italic;
+}
+</style>
diff --git a/frontend/app/components/Kanban/KanbanBoard.vue b/frontend/app/components/Kanban/KanbanBoard.vue
new file mode 100644
index 00000000..87a4fc83
--- /dev/null
+++ b/frontend/app/components/Kanban/KanbanBoard.vue
@@ -0,0 +1,255 @@
+<template>
+ <div class="kanban-board">
+ <div ref="boardContent" class="board-content">
+ <TransitionGroup name="column-list" tag="div" class="columns-wrapper">
+ <KanbanColumn
+ v-for="column in sortedColumns"
+ :key="column.id"
+ :column="column"
+ :parent="props.workspace"
+ :cards="getCardsForColumn(column.id)"
+ @drop="handleCardDrop"
+ @delete="deleteColumn"
+ @update="updateColumn"
+ @add-card="$emit('createDocument', $event)"
+ @card-drag-start="draggedNode = $event"
+ @card-drag-end="draggedNode = null"
+ />
+ </TransitionGroup>
+
+ <!-- Add Column Button -->
+ <button class="add-column-btn" @click="addColumn">
+ <Icon name="plus" />
+ <span>Add column</span>
+ </button>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import KanbanColumn, { type KanbanColumnData } from './KanbanColumn.vue';
+import type { Node } from '~/stores';
+
+export interface KanbanMetadata {
+ kanban?: {
+ columns: KanbanColumnData[];
+ cardColumns: Record<string, string>; // nodeId -> columnId
+ };
+}
+
+const props = defineProps<{
+ workspace: Node;
+ documents: Node[];
+}>();
+
+const emit = defineEmits<{
+ updateMetadata: [metadata: KanbanMetadata];
+ createDocument: [columnId: string];
+}>();
+
+const draggedNode = ref<Node | null>(null);
+const boardContent = ref<HTMLElement | null>(null);
+
+// Get kanban data from workspace metadata
+const kanbanData = computed(() => {
+ const meta = props.workspace.metadata as KanbanMetadata | undefined;
+ return (
+ meta?.kanban ?? {
+ columns: getDefaultColumns(),
+ cardColumns: {},
+ }
+ );
+});
+
+const sortedColumns = computed(() => [...kanbanData.value.columns].sort((a, b) => a.order - b.order));
+
+// Default columns
+function getDefaultColumns(): KanbanColumnData[] {
+ return [
+ { id: 'backlog', title: 'Backlog', color: 1, order: 0 },
+ { id: 'todo', title: 'To Do', color: 6, order: 1 },
+ { id: 'in-progress', title: 'In Progress', color: 3, order: 2 },
+ { id: 'done', title: 'Done', color: 5, order: 3 },
+ ];
+}
+
+// Get cards for a specific column
+function getCardsForColumn(columnId: string): Node[] {
+ const cardColumns = kanbanData.value.cardColumns;
+
+ return props.documents.filter(doc => {
+ const assignedColumn = cardColumns[String(doc.id)];
+ // If no column assigned, put in first column
+ if (!assignedColumn) {
+ return columnId === sortedColumns.value[0]?.id;
+ }
+ return assignedColumn === columnId;
+ });
+}
+
+// Handle card drop
+function handleCardDrop(columnId: string, nodeId: string) {
+ const newCardColumns = { ...kanbanData.value.cardColumns };
+ newCardColumns[nodeId] = columnId;
+
+ emit('updateMetadata', {
+ kanban: {
+ columns: kanbanData.value.columns,
+ cardColumns: newCardColumns,
+ },
+ });
+}
+
+// Add new column
+function addColumn() {
+ const newColumn: KanbanColumnData = {
+ id: `column-${Date.now()}`,
+ title: 'New Column',
+ color: -2,
+ order: sortedColumns.value.length,
+ };
+
+ emit('updateMetadata', {
+ kanban: {
+ columns: [...kanbanData.value.columns, newColumn],
+ cardColumns: kanbanData.value.cardColumns,
+ },
+ });
+
+ // Scroll to the right to show new column
+ nextTick(() => {
+ if (boardContent.value) {
+ boardContent.value.scrollLeft = boardContent.value.scrollWidth;
+ }
+ });
+}
+
+// Delete column
+function deleteColumn(columnId: string) {
+ if (sortedColumns.value.length <= 1) {
+ return; // Keep at least one column
+ }
+
+ // Move cards to first remaining column
+ const newCardColumns = { ...kanbanData.value.cardColumns };
+ const remainingColumns = kanbanData.value.columns.filter(c => c.id !== columnId);
+ const firstColumnId = remainingColumns.sort((a, b) => a.order - b.order)[0]?.id;
+
+ if (firstColumnId) {
+ Object.keys(newCardColumns).forEach(nodeId => {
+ if (newCardColumns[nodeId] === columnId) {
+ newCardColumns[nodeId] = firstColumnId;
+ }
+ });
+ }
+
+ emit('updateMetadata', {
+ kanban: {
+ columns: remainingColumns,
+ cardColumns: newCardColumns,
+ },
+ });
+}
+
+// Update column
+function updateColumn(column: KanbanColumnData) {
+ const columns = kanbanData.value.columns.map(c => (c.id === column.id ? column : c));
+
+ emit('updateMetadata', {
+ kanban: {
+ columns,
+ cardColumns: kanbanData.value.cardColumns,
+ },
+ });
+}
+</script>
+
+<style scoped lang="scss">
+.kanban-board {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-height: 0;
+ flex: 1;
+}
+
+.board-content {
+ flex: 1;
+ display: flex;
+ gap: 16px;
+ overflow-x: auto;
+ overflow-y: hidden;
+ padding: 8px 4px 16px;
+
+ &::-webkit-scrollbar {
+ height: 6px;
+ }
+
+ &::-webkit-scrollbar-track {
+ background: transparent;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ background: transparent;
+ border-radius: 3px;
+ }
+
+ &:hover::-webkit-scrollbar-thumb {
+ background: var(--border-color);
+ }
+}
+
+.columns-wrapper {
+ display: flex;
+ gap: 16px;
+}
+
+.add-column-btn {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ min-width: 200px;
+ height: 120px;
+ margin-top: auto;
+ margin-bottom: auto;
+ padding: 20px;
+ background: transparent;
+ border: 2px dashed var(--border-color);
+ border-radius: 12px;
+ color: var(--font-color-light);
+ font-size: 13px;
+ font-weight: 500;
+ cursor: pointer;
+ transition: all $transition-duration $transition-duration;
+
+ &:hover {
+ border-color: var(--primary);
+ color: var(--primary);
+ background: rgba(57, 86, 231, 0.04);
+ }
+
+ :deep(svg) {
+ width: 24px;
+ height: 24px;
+ fill: currentColor;
+ }
+}
+
+// Transitions
+.column-list-enter-active,
+.column-list-leave-active {
+ transition: all 0.3s ease;
+}
+
+.column-list-enter-from,
+.column-list-leave-to {
+ opacity: 0;
+ transform: translateX(30px);
+}
+
+.column-list-move {
+ transition: transform 0.3s ease;
+}
+</style>
diff --git a/frontend/app/components/Kanban/KanbanCard.vue b/frontend/app/components/Kanban/KanbanCard.vue
new file mode 100644
index 00000000..19731a45
--- /dev/null
+++ b/frontend/app/components/Kanban/KanbanCard.vue
@@ -0,0 +1,166 @@
+<template>
+ <div class="kanban-card" draggable="true" @dragstart="onDragStart" @dragend="onDragEnd">
+ <div class="card-header">
+ <span class="card-icon" :class="getAppColor(node.color as number || props.parent.color as number, true)">
+ <Icon :name="node.icon || 'file'" display="sm" />
+ </span>
+ <span v-if="node.order === -1" class="pin-badge" title="Pinned">
+ <Icon name="pin" />
+ </span>
+ </div>
+ <NuxtLink :to="`/dashboard/docs/${node.id}`" class="card-title">
+ {{ node.name }}
+ </NuxtLink>
+ <p v-if="node.description" class="card-description">{{ node.description }}</p>
+ <div class="card-footer">
+ <div v-if="node.tags" class="card-tags">
+ <span v-for="tag in parsedTags" :key="tag" class="tag">{{ tag }}</span>
+ </div>
+ <span class="card-date">{{ formatDate(node.updated_timestamp) }}</span>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import type { Node } from '~/stores';
+
+const props = defineProps<{ node: Node; parent: Node }>();
+const emit = defineEmits<{
+ dragStart: [node: Node];
+ dragEnd: [];
+}>();
+
+const parsedTags = computed(() => {
+ if (!props.node.tags) return [];
+ return props.node.tags
+ .split(',')
+ .slice(0, 2)
+ .map(t => t.trim());
+});
+
+const onDragStart = (e: DragEvent) => {
+ e.dataTransfer?.setData('text/plain', String(props.node.id));
+ emit('dragStart', props.node);
+};
+
+const onDragEnd = () => {
+ emit('dragEnd');
+};
+</script>
+
+<style scoped lang="scss">
+.kanban-card {
+ background: var(--bg-color);
+ border: 1px solid var(--border-color);
+ border-radius: 8px;
+ padding: 12px;
+ cursor: grab;
+ transition: all $transition-duration $transition-duration;
+
+ &:hover {
+ border-color: var(--primary);
+ box-shadow: var(--shadow-md);
+ transform: translateY(-2px);
+ }
+
+ &:active {
+ cursor: grabbing;
+ transform: scale(0.98);
+ box-shadow: var(--shadow-sm);
+ }
+}
+
+.card-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 8px;
+}
+
+.card-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 22px;
+ height: 22px;
+ border-radius: 6px;
+
+ :deep(svg) {
+ width: 16px;
+ height: 16px;
+ fill: currentColor;
+ }
+}
+
+.pin-badge {
+ display: flex;
+ align-items: center;
+
+ :deep(svg) {
+ width: 14px;
+ height: 14px;
+ fill: var(--font-color-light);
+ }
+}
+
+.card-title {
+ display: block;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--font-color-dark);
+ margin-bottom: 4px;
+ text-decoration: none;
+ line-height: 1.3;
+ transition: color $transition-duration;
+
+ &:hover {
+ color: var(--primary);
+ }
+}
+
+.card-description {
+ font-size: 12px;
+ color: var(--font-color-light);
+ margin: 0 0 10px;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ line-height: 1.4;
+}
+
+.card-footer {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+}
+
+.card-tags {
+ display: flex;
+ gap: 4px;
+ flex-wrap: wrap;
+ flex: 1;
+ min-width: 0;
+}
+
+.tag {
+ font-size: 10px;
+ font-weight: 500;
+ padding: 2px 6px;
+ background: var(--bg-contrast);
+ border-radius: 6px;
+ color: var(--font-color-light);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 80px;
+}
+
+.card-date {
+ font-size: 10px;
+ color: var(--font-color-light);
+ white-space: nowrap;
+}
+</style>
diff --git a/frontend/app/components/Kanban/KanbanColumn.vue b/frontend/app/components/Kanban/KanbanColumn.vue
new file mode 100644
index 00000000..572474d1
--- /dev/null
+++ b/frontend/app/components/Kanban/KanbanColumn.vue
@@ -0,0 +1,441 @@
+<template>
+ <div class="kanban-column" :class="{ 'drag-over': isDragOver }" @dragover.prevent="onDragOver" @dragleave="onDragLeave" @drop="onDrop">
+ <div class="column-header">
+ <div class="column-title-row">
+ <button class="column-color-btn" title="Change color" :style="{ background: `var(--${getAppColor(column.color, true)})` }" @click="toggleColorPicker" />
+ <input
+ v-if="isEditing"
+ ref="titleInput"
+ v-model="editedTitle"
+ class="column-title-input"
+ @blur="saveTitle"
+ @keydown.enter="saveTitle"
+ @keydown.escape="cancelEdit"
+ />
+ <h3 v-else class="column-title" @dblclick="startEdit">{{ column.title }}</h3>
+
+ <div class="column-actions">
+ <button class="action-btn" title="Edit name" @click="startEdit">
+ <Icon name="edit" />
+ </button>
+ <button class="action-btn danger" title="Delete column" @click="confirmDelete">
+ <Icon name="delete" />
+ </button>
+ <span class="column-count">{{ cards.length }}</span>
+ </div>
+ </div>
+
+ <!-- Color picker dropdown -->
+ <Transition name="dropdown">
+ <div v-if="showColorPicker" class="color-picker">
+ <button
+ v-for="(_, index) in appColors"
+ :key="index"
+ :style="{ backgroundColor: `var(--${getAppColor(index, true)})` }"
+ :class="['color-option ', { active: column.color === index }]"
+ @click="selectColor(index)"
+ />
+ </div>
+ </Transition>
+ </div>
+
+ <div ref="contentRef" class="column-content">
+ <TransitionGroup name="card-list">
+ <KanbanCard
+ v-for="card in cards"
+ :key="card.id"
+ :node="card"
+ :parent="parent"
+ @drag-start="$emit('cardDragStart', $event)"
+ @drag-end="$emit('cardDragEnd')"
+ />
+ </TransitionGroup>
+ <div v-if="!cards.length" class="empty-state">
+ <Icon name="file" />
+ <p>No documents</p>
+ <span>Drag documents here</span>
+ </div>
+ </div>
+
+ <button class="add-card-btn" @click="$emit('addCard', column.id)"><Icon name="plus" /> Add document</button>
+ </div>
+</template>
+
+<script setup lang="ts">
+import KanbanCard from './KanbanCard.vue';
+import DeleteColumnModal from './DeleteColumnModal.vue';
+import type { Node } from '~/stores';
+
+export interface KanbanColumnData {
+ id: string;
+ title: string;
+ color: number;
+ order: number;
+}
+
+const props = defineProps<{
+ column: KanbanColumnData;
+ cards: Node[];
+ parent: Node;
+}>();
+
+const emit = defineEmits<{
+ drop: [columnId: string, nodeId: string];
+ delete: [columnId: string];
+ update: [column: KanbanColumnData];
+ addCard: [columnId: string];
+ cardDragStart: [node: Node];
+ cardDragEnd: [];
+}>();
+
+const isDragOver = ref(false);
+const isEditing = ref(false);
+const editedTitle = ref(props.column.title);
+const showColorPicker = ref(false);
+const titleInput = ref<HTMLInputElement | null>(null);
+
+const onDragOver = () => {
+ isDragOver.value = true;
+};
+
+const onDragLeave = (e: DragEvent) => {
+ // Only set false if leaving the column entirely
+ const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
+ if (e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom) {
+ isDragOver.value = false;
+ }
+};
+
+const onDrop = (e: DragEvent) => {
+ isDragOver.value = false;
+ const nodeId = e.dataTransfer?.getData('text/plain');
+ if (nodeId) {
+ emit('drop', props.column.id, nodeId);
+ }
+};
+
+const startEdit = () => {
+ showColorPicker.value = false;
+ editedTitle.value = props.column.title;
+ isEditing.value = true;
+ nextTick(() => titleInput.value?.focus());
+};
+
+const saveTitle = () => {
+ if (editedTitle.value.trim()) {
+ emit('update', { ...props.column, title: editedTitle.value.trim() });
+ }
+ isEditing.value = false;
+};
+
+const cancelEdit = () => {
+ editedTitle.value = props.column.title;
+ isEditing.value = false;
+};
+
+const toggleColorPicker = () => {
+ showColorPicker.value = !showColorPicker.value;
+};
+
+const selectColor = (color: number) => {
+ emit('update', { ...props.column, color });
+ showColorPicker.value = false;
+};
+
+const confirmDelete = () => {
+ useModal().add(
+ new Modal(shallowRef(DeleteColumnModal), {
+ props: {
+ columnTitle: props.column.title,
+ cardCount: props.cards.length,
+ onConfirm: () => emit('delete', props.column.id),
+ },
+ size: 'small',
+ }),
+ );
+};
+
+// Close color picker on click outside
+onMounted(() => {
+ document.addEventListener('click', handleClickOutside);
+});
+
+onUnmounted(() => {
+ document.removeEventListener('click', handleClickOutside);
+});
+
+function handleClickOutside(e: MouseEvent) {
+ const target = e.target as HTMLElement;
+ if (!target.closest('.column-header')) {
+ showColorPicker.value = false;
+ }
+}
+</script>
+
+<style scoped lang="scss">
+.kanban-column {
+ display: flex;
+ flex-direction: column;
+ min-width: 300px;
+ max-width: 320px;
+ background: var(--bg-contrast);
+ border-radius: 12px;
+ padding: 12px;
+ transition: all $transition-duration $transition-duration;
+
+ &.drag-over {
+ background: rgba(57, 86, 231, 0.06);
+ box-shadow: inset 0 0 0 2px var(--primary);
+ }
+}
+
+.column-header {
+ position: relative;
+ margin-bottom: 12px;
+}
+
+.column-title-row {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-bottom: 8px;
+}
+
+.column-color-btn {
+ width: 14px;
+ height: 14px;
+ padding: 0;
+ border: none;
+ border-radius: 50%;
+ cursor: pointer;
+ flex-shrink: 0;
+ transition: transform $transition-duration;
+
+ &:hover {
+ transform: scale(1.2);
+ }
+}
+
+.column-title {
+ flex: 1;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--font-color-dark);
+ margin: 0;
+ cursor: pointer;
+ padding: 2px 0;
+ border-radius: 6px;
+ transition: color $transition-duration;
+
+ &:hover {
+ color: var(--primary);
+ }
+}
+
+.column-title-input {
+ flex: 1;
+ font-size: 14px;
+ font-weight: 600;
+ padding: 4px 8px;
+ border: 1px solid var(--primary);
+ border-radius: 6px;
+ background: var(--bg-color);
+ color: var(--font-color-dark);
+ outline: none;
+ box-shadow: 0 0 0 3px rgba(57, 86, 231, 0.1);
+}
+
+.column-count {
+ font-size: 12px;
+ font-weight: 600;
+ padding: 2px 8px;
+ height: fit-content;
+ background: var(--bg-color);
+ border-radius: 16px;
+ color: var(--font-color-light);
+}
+
+.column-actions {
+ display: flex;
+ gap: 2px;
+}
+
+.action-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 28px;
+ height: 28px;
+ padding: 0;
+ border: none;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--font-color-light);
+ cursor: pointer;
+ transition: all $transition-duration $transition-duration;
+
+ &:hover {
+ background: var(--bg-color);
+ color: var(--font-color);
+ }
+
+ &.danger:hover {
+ background: var(--red-bg);
+ color: var(--red);
+ }
+
+ :deep(svg) {
+ width: 16px;
+ height: 16px;
+ fill: currentColor;
+ }
+}
+
+.color-picker {
+ position: absolute;
+ top: 100%;
+ left: 0;
+ z-index: 10;
+ display: flex;
+ gap: 6px;
+ padding: 10px;
+ background: var(--bg-color);
+ border: 1px solid var(--border-color);
+ border-radius: 8px;
+ box-shadow: var(--shadow-md);
+ flex-wrap: wrap;
+ max-width: 180px;
+}
+
+.color-option {
+ width: 26px;
+ height: 26px;
+ padding: 0;
+ border: 2px solid transparent;
+ border-radius: 50%;
+ cursor: pointer;
+ transition: all $transition-duration $transition-duration;
+
+ &:hover {
+ transform: scale(1.15);
+ }
+
+ &.active {
+ border-color: var(--font-color-dark);
+ box-shadow: 0 0 0 2px var(--bg-color);
+ }
+}
+
+.column-content {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ min-height: 120px;
+ max-height: 60vh;
+ overflow-y: auto;
+ padding: 4px;
+ margin: -4px;
+
+ &::-webkit-scrollbar {
+ width: 4px;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ background: transparent;
+ border-radius: 4px;
+ }
+
+ &:hover::-webkit-scrollbar-thumb {
+ background: var(--border-color);
+ }
+}
+
+.empty-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 32px 16px;
+ color: var(--font-color-light);
+ text-align: center;
+ border: 2px dashed var(--border-color);
+ border-radius: 8px;
+ background: rgba(0, 0, 0, 0.02);
+
+ :deep(svg) {
+ width: 24px;
+ height: 24px;
+ fill: currentColor;
+ opacity: 0.5;
+ margin-bottom: 8px;
+ }
+
+ p {
+ font-size: 13px;
+ font-weight: 500;
+ margin: 0 0 2px;
+ }
+
+ span {
+ font-size: 11px;
+ opacity: 0.7;
+ }
+}
+
+.add-card-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ width: 100%;
+ padding: 10px;
+ margin-top: 12px;
+ border: none;
+ border-radius: 8px;
+ background: var(--bg-color);
+ color: var(--font-color-light);
+ font-size: 13px;
+ font-weight: 500;
+ cursor: pointer;
+ transition: all $transition-duration $transition-duration;
+
+ &:hover {
+ color: var(--primary);
+ background: rgba(57, 86, 231, 0.08);
+ }
+
+ :deep(svg) {
+ width: 16px;
+ height: 16px;
+ fill: currentColor;
+ }
+}
+
+// Transitions
+.dropdown-enter-active,
+.dropdown-leave-active {
+ transition: all 0.15s ease;
+}
+
+.dropdown-enter-from,
+.dropdown-leave-to {
+ opacity: 0;
+ transform: translateY(-8px);
+}
+
+.card-list-enter-active,
+.card-list-leave-active {
+ transition: all 0.2s ease;
+}
+
+.card-list-enter-from,
+.card-list-leave-to {
+ opacity: 0;
+ transform: translateY(-10px);
+}
+
+.card-list-move {
+ transition: transform 0.2s ease;
+}
+</style>
diff --git a/frontend/app/components/Node/NodeList.vue b/frontend/app/components/Node/NodeList.vue
index ef2232f5..1c54adb5 100644
--- a/frontend/app/components/Node/NodeList.vue
+++ b/frontend/app/components/Node/NodeList.vue
@@ -1,5 +1,5 @@
<template>
- <div class="card-component">
+ <div class="card-component node-list">
<header>
<h1 v-if="parent">
<Icon
@@ -17,33 +17,53 @@
<Icon name="workspace" display="xl" class="parent-icon primary" />
All workspaces
</h1>
- <div style="display: flex; align-items: center; gap: 4px">
+ <div class="header-actions">
<NodeFilter v-show="!isMobile()" :nodes="nodes" @update:nodes="filteredNodes = $event" />
- <NuxtLink v-if="parent?.shared && parent.user_id != connectedId" class="btn-icon no-mobile" @click="openRemoveShareModal"
- ><Icon name="group_off" display="lg"
- /></NuxtLink>
- <NuxtLink v-if="parent && nodesStore.hasPermissions(parent, 4)" class="btn-icon no-mobile" @click="openPermissionsModal"
- ><Icon name="manage_access" display="lg"
- /></NuxtLink>
- <NuxtLink v-if="parent && nodesStore.hasPermissions(parent, 2)" class="btn-icon" @click="openEditModal"><Icon name="settings" display="lg" /></NuxtLink>
- <span class="doc-count no-mobile">{{ filteredNodes.length != nodes.length ? `${filteredNodes.length} /` : '' }} {{ nodes.length }} </span>
- <ViewSelection v-model="view" />
+ <NuxtLink v-if="parent?.shared && parent.user_id != connectedId" class="btn-icon no-mobile" @click="openRemoveShareModal">
+ <Icon name="group_off" display="lg" />
+ </NuxtLink>
+ <NuxtLink v-if="parent && nodesStore.hasPermissions(parent, 4)" class="btn-icon no-mobile" @click="openPermissionsModal">
+ <Icon name="manage_access" display="lg" />
+ </NuxtLink>
+ <NuxtLink v-if="parent && nodesStore.hasPermissions(parent, 2)" class="btn-icon" @click="openEditModal">
+ <Icon name="settings" display="lg" />
+ </NuxtLink>
+ <span class="doc-count no-mobile">{{ filteredNodes.length != nodes.length ? `${filteredNodes.length} /` : '' }} {{ nodes.length }}</span>
+ <ViewSelection v-model="view" :show-kanban="!!parent" />
</div>
</header>
- <div v-if="filteredNodes.length">
- <div v-if="view == 'table'" class="line-container">
+
+ <!-- Content based on view mode -->
+ <div v-if="filteredNodes.length" class="node-content">
+ <!-- Table/List View -->
+ <div v-if="view === 'table'" class="line-container">
<DocumentLine v-for="document of filteredNodes" :key="document.id" :document="document" class="line-item" />
</div>
- <div v-else class="document-list">
+
+ <!-- Grid View -->
+ <div v-else-if="view === 'list'" class="document-list">
<DocumentsGrid :documents="filteredNodes" />
</div>
+
+ <!-- Kanban View -->
+ <KanbanBoard
+ v-else-if="view === 'kanban' && parent"
+ :workspace="parent"
+ :documents="filteredNodes"
+ @update-metadata="updateKanbanMetadata"
+ @create-document="createDocumentInColumn"
+ />
</div>
+
<NoContent
v-else-if="!nodesStore.isFetching"
style="width: 100%; height: 100%"
title="No documents found"
description="There are no documents in this category"
- ><NuxtLink to="/dashboard/docs/new"><AppButton type="link" style="font-weight: bold">+ Create new document </AppButton></NuxtLink>
+ >
+ <NuxtLink to="/dashboard/docs/new">
+ <AppButton type="link" style="font-weight: bold">+ Create new document</AppButton>
+ </NuxtLink>
</NoContent>
</div>
</template>
@@ -52,16 +72,35 @@
import NodePermissions from '~/components/Node/NodePermissions.modal.vue';
import RemoveSharedNode from '~/components/Node/RemoveSharedNode.modal.vue';
import NodeFilter from '~/components/Node/Filter.vue';
+import KanbanBoard from '~/components/Kanban/KanbanBoard.vue';
+import type { ViewMode } from '~/components/ViewSelection.vue';
import type { Node } from '~/stores';
import NodeMetadataModal from './NodeMetadata.modal.vue';
const props = defineProps<{ parent?: Node; nodes: Node[]; parentId?: string }>();
const nodesStore = useNodesStore();
+const router = useRouter();
const connectedId = useUserStore().user?.id;
-const view: Ref<'table' | 'list'> = ref('list');
+const view = ref<ViewMode>();
const filteredNodes = ref<Node[]>(props.nodes);
+// Watch for nodes changes to update filtered nodes
+watch(
+ () => props.nodes,
+ newNodes => {
+ filteredNodes.value = newNodes;
+ },
+ { immediate: true },
+);
+
+onMounted(() => {
+ const storedView = localStorage.getItem('viewSelection');
+ if (storedView) {
+ view.value = storedView as ViewMode;
+ }
+});
+
const openPermissionsModal = () => {
if (props.parent) useModal().add(new Modal(shallowRef(NodePermissions), { props: { node: props.parent }, size: 'small' }));
};
@@ -69,27 +108,86 @@ const openRemoveShareModal = () => {
if (props.parent) useModal().add(new Modal(shallowRef(RemoveSharedNode), { props: { nodeId: props.parent.id }, size: 'small' }));
};
const openEditModal = () => useModal().add(new Modal(shallowRef(NodeMetadataModal), { props: { doc: props.parent }, size: 'small' }));
+
+// Kanban functionality
+async function updateKanbanMetadata(metadata: any) {
+ if (!props.parent) return;
+
+ try {
+ await nodesStore.update({
+ ...props.parent,
+ metadata: {
+ ...props.parent.metadata,
+ ...metadata,
+ },
+ });
+ } catch (error) {
+ console.error('Failed to update kanban metadata:', error);
+ }
+}
+
+function createDocumentInColumn(columnId: string) {
+ if (!props.parent) return;
+ router.push({
+ path: '/dashboard/docs/new',
+ query: {
+ parent: String(props.parent.id),
+ kanbanColumn: columnId,
+ },
+ });
+}
</script>
<style scoped lang="scss">
+header {
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
h1 {
display: flex;
align-items: center;
+ gap: 12px;
+ font-size: 18px;
+ font-weight: 600;
}
-.doc-count {
- padding: 4px 6px;
- border: 1px solid var(--border-color);
- border-radius: 4px;
- font-size: 1rem;
- font-weight: bold;
+.header-actions {
+ display: flex;
+ align-items: center;
+ gap: 6px;
}
+.parent-icon-wrapper {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 36px;
+ height: 36px;
+ border-radius: 8px;
+ transition: transform $transition-duration $transition-duration;
+
+ :deep(svg) {
+ fill: currentColor;
+ }
+}
.parent-icon {
padding: 6px;
border-radius: 6px;
margin-right: 10px;
}
+.doc-count {
+ padding: 6px 10px;
+ background: var(--bg-contrast);
+ border-radius: 8px;
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--font-color-light);
+}
+
+.node-content {
+ margin-top: 8px;
+}
.line-container {
display: flex;
diff --git a/frontend/app/components/ViewSelection.vue b/frontend/app/components/ViewSelection.vue
index 454125d2..85f52f81 100644
--- a/frontend/app/components/ViewSelection.vue
+++ b/frontend/app/components/ViewSelection.vue
@@ -1,46 +1,78 @@
<template>
<div class="view-selection">
- <button :class="{ active: view === 'table' }" @click="view = 'table'">
- <Icon name="list" />
- </button>
- <span style="border-right: 1px solid var(--border-color)" />
- <button :class="{ active: view === 'list' }" @click="view = 'list'">
- <Icon name="table" />
+ <button v-for="option in viewOptions" :key="option.value" :class="{ active: view === option.value }" :title="option.label" @click="view = option.value">
+ <Icon :name="option.icon" />
</button>
</div>
</template>
<script setup lang="ts">
-const view = defineModel<'table' | 'list'>();
-const storedView = localStorage.getItem('viewSelection');
-if (storedView) view.value = storedView as 'table' | 'list';
-watch(view, newView => localStorage.setItem('viewSelection', newView as 'table' | 'list'));
+export type ViewMode = 'list' | 'table' | 'kanban';
+
+const props = withDefaults(
+ defineProps<{
+ showKanban?: boolean;
+ }>(),
+ {
+ showKanban: true,
+ },
+);
+
+const view = defineModel<ViewMode>();
+
+const viewOptions = computed(() => {
+ const options = [
+ { value: 'list' as ViewMode, icon: 'table', label: 'Grid view' },
+ { value: 'table' as ViewMode, icon: 'list', label: 'List view' },
+ ];
+ if (props.showKanban) {
+ options.push({ value: 'kanban' as ViewMode, icon: 'kanban', label: 'Kanban view' });
+ }
+ return options;
+});
+
+watch(view, newView => {
+ if (newView) localStorage.setItem('viewSelection', newView);
+});
</script>
<style scoped lang="scss">
.view-selection {
- min-width: 80px;
- margin: 2px 4px;
- padding: 0 4px;
- border: 1px solid var(--border-color);
- border-radius: 18px;
- gap: 10px;
+ display: flex;
+ align-items: center;
+ background: var(--bg-contrast);
+ border-radius: 8px;
+ padding: 3px;
+ gap: 2px;
}
button {
- width: 35px;
- height: 35px;
- padding: 4px 8px;
- transition: background-color 0.3s;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ padding: 0;
+ border: none;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--font-color-light);
cursor: pointer;
+ transition: all $transition-duration $transition-duration;
+
+ &:hover {
+ color: var(--font-color);
+ background: var(--bg-color);
+ }
&.active > svg {
color: var(--primary) !important;
}
- svg {
- width: 20px;
- height: 20px;
+ :deep(svg) {
+ width: 18px;
+ height: 18px;
+ fill: currentColor;
}
}
</style>
diff --git a/frontend/public/app-icons/kanban.svg b/frontend/public/app-icons/kanban.svg
new file mode 100644
index 00000000..9664f30d
--- /dev/null
+++ b/frontend/public/app-icons/kanban.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-280h80v-400h-80v400Zm320-80h80v-320h-80v320ZM440-480h80v-200h-80v200ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>
\ No newline at end of file