Skip to content

Commit

Permalink
Merge branch 'main' into BC-6867-optimize-list-board
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchuhmacher authored Apr 26, 2024
2 parents 096aa88 + 81cc205 commit cb0d1b2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ describe("CollaborativeTextEditorElement", () => {
const boardMenu = wrapper.findComponent(
CollaborativeTextEditorElementMenu
);
boardMenu.vm.$emit("delete:element", Promise.resolve(true));
boardMenu.vm.$emit("delete:element");
await nextTick();

expect(wrapper.emitted("delete:element")).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,8 @@ const onKeydownArrow = (event: KeyboardEvent) => {
emit("move-keyboard:edit", event);
}
};
const onDelete = async (confirmation: Promise<boolean>) => {
const shouldDelete = await confirmation;
if (shouldDelete) {
emit("delete:element", props.element.id);
}
};
const onDelete = () => emit("delete:element", props.element.id);
const onMoveUp = () => emit("move-up:edit");
const onMoveDown = () => emit("move-down:edit");
</script>
3 changes: 3 additions & 0 deletions src/modules/feature/board/board/BoardColumnGhost.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ describe("BoardColumnGhost", () => {
global: {
plugins: [createTestingVuetify(), createTestingI18n()],
},
props: {
isListBoard: false,
},
});

return { wrapper };
Expand Down
12 changes: 11 additions & 1 deletion src/modules/feature/board/board/BoardColumnGhost.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div ref="ghostColumnRef" :class="{ 'pl-2': !isListBoard }">
<BoardColumnGhostHeader
:label="title"
:isColumnActive="isColumnHovered"
:isListBoard="isListBoard"
:centred="isListBoard"
@add-column="onAddColumn"
data-testid="add-column"
:class="{ 'px-4': isListBoard }"
Expand Down Expand Up @@ -39,6 +40,7 @@
import { useElementHover } from "@vueuse/core";
import { Sortable } from "sortablejs-vue3";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useDragAndDrop } from "../shared/DragAndDrop.composable";
import BoardColumnGhostHeader from "./BoardColumnGhostHeader.vue";
Expand Down Expand Up @@ -75,6 +77,14 @@ const sortableGhostClasses = computed(() => {
}
return classes;
});
const { t } = useI18n();
const title = computed(() =>
props.isListBoard
? t("components.board.column.ghost.list.placeholder")
: t("components.board.column.ghost.column.placeholder")
);
</script>

<style scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe("BoardColumnGhostHeader", () => {
},
propsData: {
isColumnActive: true,
isListBoard: false,
label: "Add column",
},
});
Expand Down
22 changes: 8 additions & 14 deletions src/modules/feature/board/board/BoardColumnGhostHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="mb-4" ref="headerRef">
<div
class="d-flex flex-column justify-space-between pt-2"
:class="isListBoard ? 'center' : 'align-start'"
:class="centred ? 'center' : 'align-start'"
>
<VBtn
elevation="0"
Expand All @@ -11,7 +11,7 @@
:color="isColumnActive ? '' : 'grey-darken-2'"
@click="onAddColumn"
>
<VIcon>{{ mdiPlus }}</VIcon> {{ title }}
<VIcon>{{ mdiPlus }}</VIcon> {{ label }}
</VBtn>
</div>
<VDivider aria-hidden="true" class="border-opacity-100" />
Expand All @@ -20,30 +20,24 @@

<script setup lang="ts">
import { mdiPlus } from "@mdi/js";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
const props = defineProps({
defineProps({
isColumnActive: {
type: Boolean,
required: true,
},
isListBoard: { type: Boolean, required: true },
label: {
type: String,
required: true,
},
centred: { type: Boolean },
});
const emit = defineEmits(["add-column"]);
const { t } = useI18n();
const onAddColumn = () => {
emit("add-column");
};
const title = computed(() =>
props.isListBoard
? t("components.board.column.ghost.list.placeholder")
: t("components.board.column.ghost.column.placeholder")
);
</script>

<style scoped>
Expand Down

0 comments on commit cb0d1b2

Please sign in to comment.