Skip to content

Commit 8b1d709

Browse files
committed
updated column titles
1 parent 1327249 commit 8b1d709

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/components/BoardDragAndDrop.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function addColumn() {
4040
watch(columns, () => {
4141
emit(
4242
"update",
43-
cloneDeep({ ...board, order: JSON.stringify(toRaw(columns)) })
43+
cloneDeep({ ...props.board, order: JSON.stringify(toRaw(columns)) })
4444
);
4545
});
4646
@@ -69,7 +69,15 @@ async function addTask({ column, title }: { column: Column; title: string }) {
6969
class="column bg-gray-100 flex flex-col justify-between rounded-lg px-3 py-3 rounded mr-4 w-[300px]"
7070
>
7171
<div>
72-
<h3>{{ column.title }}</h3>
72+
<h3>
73+
<input
74+
type="text"
75+
:value="column.title"
76+
class="bg-transparent mb-2"
77+
@keydown.enter="($event.target as HTMLInputElement).blur()"
78+
@blur="column.title = ($event.target as HTMLInputElement).value"
79+
/>
80+
</h3>
7381
<draggable
7482
:list="column.taskIds"
7583
group="tasks"

src/pages/boards/[id].vue

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,12 @@ const board = computed(() => boardData.value?.board || null);
3636
const tasks = computed(() => board.value?.tasks?.items);
3737
3838
// handle board updates
39-
const updatingTitle = ref(false);
4039
const { mutate: updateBoard, onDone: onBoardUpdated } =
4140
useMutation(updateBoardMutation);
42-
onBoardUpdated(() => {
43-
if (updatingTitle.value) {
44-
alerts.success("Board successfully updated!");
45-
}
46-
});
47-
const updateBoardTitle = async (title: string) => {
41+
onBoardUpdated(() => alerts.success("Board successfully updated!"));
42+
const updateBoardTitle = (title: string) => {
4843
if (board.value.title === title) return;
49-
updatingTitle.value = true;
50-
await updateBoard({ id: boardId.value, title });
51-
updatingTitle.value = false;
44+
updateBoard({ id: boardId.value, title });
5245
};
5346
5447
//handle delete board
@@ -100,7 +93,6 @@ function addTask(task: Task) {
10093
}
10194
10295
onErrorCreatingTask((error) => {
103-
console.log(error);
10496
taskReject(error);
10597
alerts.error("Error creating task");
10698
});

0 commit comments

Comments
 (0)