Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-8396 - Adjust BoardTile design #3464

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
20905f8
extract RoomMenu component
odalys-dataport Nov 26, 2024
b2d33b6
separate RoomDetailsPage from switch logic
odalys-dataport Nov 26, 2024
71594eb
adjust room variable usage
odalys-dataport Nov 28, 2024
3b6ddb4
Merge branch 'main' into BC-8396-board-card-design
odalys-dataport Nov 28, 2024
afbfdef
remove RoomDetails component
odalys-dataport Nov 28, 2024
462537b
adjust boardtile design
odalys-dataport Nov 28, 2024
8c3ca7d
emit events in RoomMenu instead of linking directly
odalys-dataport Nov 29, 2024
94e64be
solve merge conflict in RoomDetailsPage
odalys-dataport Nov 29, 2024
b10b3da
keep loading state in RoomDetailsSwitchPage
odalys-dataport Nov 29, 2024
83b93f3
add sidebar highlight for room boards
odalys-dataport Nov 29, 2024
961286a
two columns for tablet sizes
odalys-dataport Nov 29, 2024
a8a0d05
fix board-tile-title data-testid index
odalys-dataport Nov 29, 2024
b7822a3
fix routing bug & rename route
odalys-dataport Dec 2, 2024
53680f1
add id regex to room routes
odalys-dataport Dec 2, 2024
c3098e7
correct router import
odalys-dataport Dec 2, 2024
768ac34
use card variants instead of classes
odalys-dataport Dec 2, 2024
0c78095
use bg-surface-light
odalys-dataport Dec 2, 2024
f47a645
fix RoomColor enum imports
odalys-dataport Dec 4, 2024
59c158d
Merge branch 'main' into BC-8396-board-card-design
odalys-dataport Dec 4, 2024
8f33964
Merge branch 'BC-8396-board-card-design' of https://github.com/hpi-sc…
odalys-dataport Dec 4, 2024
95f424f
adjust opacity
odalys-dataport Dec 4, 2024
accf780
use line clamp component
odalys-dataport Dec 4, 2024
0342763
use LineClamp on RoomTile
odalys-dataport Dec 4, 2024
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
1 change: 1 addition & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ module.exports = {
"@ui-kebab-menu": getDir("src/modules/ui/kebab-menu"),
"@ui-layout": getDir("src/modules/ui/layout"),
"@ui-light-box": getDir("src/modules/ui/light-box"),
"@ui-line-clamp": getDir("src/modules/ui/line-clamp"),
"@ui-preview-image": getDir("src/modules/ui/preview-image"),
"@ui-room-details": getDir("src/modules/ui/room-details"),
"@ui-skip-link": getDir("src/modules/ui/skip-link"),
Expand Down
2 changes: 1 addition & 1 deletion src/modules/data/board/Board.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export const useBoardStore = defineStore("boardStore", () => {
const deleteBoardSuccess = (payload: DeleteBoardSuccessPayload) => {
if (payload.isOwnAction === true) {
router.replace({
name: "rooms-id",
name: "room-details",
params: { id: roomId.value },
});
return;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/data/board/Board.store.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ describe("BoardStore", () => {
});

expect(router.replace).toHaveBeenCalledWith({
name: "rooms-id",
name: "room-details",
params: { id: "roomId" },
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/modules/data/room/RoomCreate.state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RoomApiFactory, RoomColor } from "@/serverApi/v3";
import { RoomCreateParams, RoomItem } from "@/types/room/Room";
import { RoomApiFactory } from "@/serverApi/v3";
import { RoomCreateParams, RoomItem, RoomColorEnum } from "@/types/room/Room";
import { $axios, mapAxiosErrorToResponseError } from "@/utils/api";
import { ref } from "vue";

Expand All @@ -9,7 +9,7 @@ export const useRoomCreateState = () => {

const roomData = ref<RoomCreateParams>({
name: "",
color: RoomColor.BlueGrey,
color: RoomColorEnum.BlueGrey,
startDate: undefined,
endDate: undefined,
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/data/room/RoomCreate.state.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useApplicationError } from "@/composables/application-error.composable"
import { initializeAxios, mapAxiosErrorToResponseError } from "@/utils/api";
import setupStores from "@@/tests/test-utils/setupStores";
import ApplicationErrorModule from "@/store/application-error";
import { RoomCreateParams } from "@/types/room/Room";
import { RoomCreateParams, RoomColorEnum } from "@/types/room/Room";
import { ref } from "vue";
import {
apiResponseErrorFactory,
Expand Down Expand Up @@ -73,7 +73,7 @@ describe("useRoomCreateState", () => {
describe("createRoom", () => {
const roomData = ref<RoomCreateParams>({
name: "Room 1",
color: serverApi.RoomColor.BlueGrey,
color: RoomColorEnum.BlueGrey,
startDate: undefined,
endDate: undefined,
});
Expand Down
10 changes: 7 additions & 3 deletions src/modules/data/room/RoomEdit.state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { RoomApiFactory, RoomColor } from "@/serverApi/v3";
import { RoomDetails, RoomUpdateParams } from "@/types/room/Room";
import { RoomApiFactory } from "@/serverApi/v3";
import {
RoomDetails,
RoomUpdateParams,
RoomColorEnum,
} from "@/types/room/Room";
import { $axios, mapAxiosErrorToResponseError } from "@/utils/api";
import { createApplicationError } from "@/utils/create-application-error.factory";
import { ref } from "vue";
Expand All @@ -19,7 +23,7 @@ export const useRoomEditState = () => {

const roomData = ref<RoomUpdateParams>({
name: "",
color: RoomColor.BlueGrey,
color: RoomColorEnum.BlueGrey,
startDate: undefined,
endDate: undefined,
});
Expand Down
5 changes: 3 additions & 2 deletions src/modules/data/room/RoomEdit.state.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
apiResponseErrorFactory,
axiosErrorFactory,
} from "@@/tests/test-utils";
import { RoomColorEnum } from "@/types/room/Room";

jest.mock("@/utils/api");
const mockedMapAxiosErrorToResponseError = jest.mocked(
Expand Down Expand Up @@ -105,7 +106,7 @@ describe("useRoomEditState", () => {
expect(isLoading.value).toBe(true);
const params = {
name: "room-name",
color: serverApi.RoomColor.BlueGrey,
color: RoomColorEnum.BlueGrey,
};

await updateRoom("room-id", params);
Expand All @@ -123,7 +124,7 @@ describe("useRoomEditState", () => {
const { updateRoom, isLoading } = setup();
const params = {
name: "room-name",
color: serverApi.RoomColor.BlueGrey,
color: RoomColorEnum.BlueGrey,
};
roomApiMock.roomControllerUpdateRoom.mockRejectedValue({ code: 404 });

Expand Down
3 changes: 2 additions & 1 deletion src/modules/data/room/Rooms.state.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
apiResponseErrorFactory,
axiosErrorFactory,
} from "@@/tests/test-utils";
import { RoomColorEnum } from "@/types/room/Room";

jest.mock("@/utils/api");
const mockedMapAxiosErrorToResponseError = jest.mocked(
Expand Down Expand Up @@ -125,7 +126,7 @@ describe("useRoomsState", () => {
{
id: "1",
name: "Room 1",
color: serverApi.RoomColor.BlueGrey,
color: RoomColorEnum.BlueGrey,
createdAt: "2024.11.18",
updatedAt: "2024.11.18",
},
Expand Down
2 changes: 1 addition & 1 deletion src/modules/feature/board/board/Board.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ describe("Board", () => {

expect(wrapperVM.isBoardVisible).toBe(false);
expect(router.replace).toHaveBeenCalledWith({
name: "rooms-id",
name: "room-details",
params: { id: mockRoomId },
});
expect(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/feature/board/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ watch(
setAlert();

if (!(isBoardVisible.value || isTeacher)) {
router.replace({ name: "rooms-id", params: { id: roomId.value } });
router.replace({ name: "room-details", params: { id: roomId.value } });
applicationErrorModule.setError(
createApplicationError(
HttpStatusCode.Forbidden,
Expand Down
1 change: 1 addition & 0 deletions src/modules/feature/room/BoardGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
v-for="(board, index) in boards"
:key="board.id"
cols="12"
sm="6"
md="4"
xl="3"
>
Expand Down
37 changes: 14 additions & 23 deletions src/modules/feature/room/BoardTile.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<template>
<VCard
class="board-tile"
:class="{ 'board-is-draft': isDraft }"
hover
:data-testid="`board-tile-${props.index}`"
:class="isDraft ? 'opacity-70' : 'bg-surface-light'"
:variant="isDraft ? 'outlined' : 'flat'"
draggable="false"
:data-testid="`board-tile-${index}`"
:to="boardPath"
>
<VCardSubtitle
class="board-tile-subtitle mt-4"
:data-testid="`board-tile-subtitle-${props.index}`"
class="mt-4 d-flex align-center"
:class="{ 'opacity-100': isDraft }"
:data-testid="`board-tile-subtitle-${index}`"
>
<VIcon size="14" class="mr-1" :icon="subtitleIcon" />
{{ subtitleText }}
</VCardSubtitle>

<VCardTitle
class="board-tile-title text-h6 my-2"
:data-testid="`board-tile-title-${props.index}`"
class="board-tile-title text-body-1 font-weight-bold my-2"
:data-testid="`board-tile-title-${index}`"
>
{{ board.title }}
<LineClamp>
{{ board.title }}
</LineClamp>
</VCardTitle>
</VCard>
</template>
Expand All @@ -28,6 +32,7 @@ import { RoomBoardItem } from "@/types/room/Room";
import { mdiViewAgendaOutline, mdiViewDashboardOutline } from "@icons/material";
import { computed, PropType, toRef } from "vue";
import { useI18n } from "vue-i18n";
import { LineClamp } from "@ui-line-clamp";

const props = defineProps({
board: { type: Object as PropType<RoomBoardItem>, required: true },
Expand Down Expand Up @@ -69,17 +74,3 @@ const boardPath = computed(() => {
return `/boards/${board.value.id}`;
});
</script>

<style lang="scss" scoped>
@import "@/styles/settings.scss";

.board-tile {
background-color: map-get($grey, lighten-5);
border: 1px solid map-get($grey, lighten-2);

&.board-is-draft .board-tile-subtitle,
&.board-is-draft .board-tile-title {
opacity: 0.5;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { mount } from "@vue/test-utils";
import { ComponentProps } from "vue-component-type-helpers";
import RoomColorPicker from "./RoomColorPicker.vue";
import { RoomColor } from "@/serverApi/v3";
import { RoomColorEnum } from "@/types/room/Room";

describe("@feature-room/RoomColorPicker", () => {
const setup = (props?: ComponentProps<typeof RoomColorPicker>) => {
Expand Down Expand Up @@ -42,7 +42,7 @@ describe("@feature-room/RoomColorPicker", () => {

describe("when a color is given", () => {
it("should render given color as selected", () => {
const { wrapper } = setup({ color: RoomColor.Red });
const { wrapper } = setup({ color: RoomColorEnum.Red });

const selectedColor = wrapper.findComponent(
"[data-testid=color-swatch-red]"
Expand Down
12 changes: 6 additions & 6 deletions src/modules/feature/room/RoomColorPicker/RoomColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
role="radiogroup"
aria-labelledby="room-color-label"
>
<template v-for="swatchColor in RoomColor" :key="swatchColor">
<template v-for="swatchColor in RoomColorEnum" :key="swatchColor">
<RoomColorPickerSwatch
:color="swatchColor"
:is-selected="isSelected(swatchColor)"
Expand All @@ -19,12 +19,12 @@
import { useVModel } from "@vueuse/core";
import { PropType } from "vue";
import RoomColorPickerSwatch from "./RoomColorPickerSwatch.vue";
import { RoomColor } from "@/serverApi/v3";
import { RoomColorEnum } from "@/types/room/Room";

const props = defineProps({
color: {
type: String as PropType<RoomColor>,
default: RoomColor.BlueGrey,
type: String as PropType<RoomColorEnum>,
default: RoomColorEnum.BlueGrey,
},
label: {
type: String,
Expand All @@ -36,11 +36,11 @@ const emit = defineEmits(["update:color"]);

const currentColor = useVModel(props, "color", emit);

const isSelected = (color: RoomColor) => {
const isSelected = (color: RoomColorEnum) => {
return color === currentColor.value;
};

const onUpdateColor = (color: RoomColor) => {
const onUpdateColor = (color: RoomColorEnum) => {
emit("update:color", color);
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { mount } from "@vue/test-utils";
import { ComponentProps } from "vue-component-type-helpers";
import RoomColorPickerSwatch from "./RoomColorPickerSwatch.vue";
import { RoomColor } from "@/serverApi/v3";
import { RoomColorEnum } from "@/types/room/Room";

describe("@feature-room/RoomColorPicker/RoomColorPickerSwatch", () => {
const setup = (props?: ComponentProps<typeof RoomColorPickerSwatch>) => {
Expand Down Expand Up @@ -37,7 +37,7 @@ describe("@feature-room/RoomColorPicker/RoomColorPickerSwatch", () => {

describe("when color is set", () => {
it("should render with given color", () => {
const { wrapper } = setup({ color: RoomColor.Red, isSelected: true });
const { wrapper } = setup({ color: RoomColorEnum.Red, isSelected: true });

const selectedColor = wrapper.findComponent(
"[data-testid=color-swatch-red]"
Expand All @@ -47,7 +47,7 @@ describe("@feature-room/RoomColorPicker/RoomColorPickerSwatch", () => {
});

it("should render selected icon", () => {
const { wrapper } = setup({ color: RoomColor.Red, isSelected: true });
const { wrapper } = setup({ color: RoomColorEnum.Red, isSelected: true });

const selectedColor = wrapper.findComponent(
"[data-testid=color-swatch-red]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import { computed, PropType } from "vue";
import { mdiCheckCircleOutline } from "@icons/material";
import { useI18n } from "vue-i18n";
import { RoomColor } from "@/serverApi/v3";
import { RoomColorEnum } from "@/types/room/Room";

const props = defineProps({
color: {
type: String as PropType<RoomColor>,
default: RoomColor.BlueGrey,
type: String as PropType<RoomColorEnum>,
default: RoomColorEnum.BlueGrey,
},
isSelected: {
type: Boolean,
Expand Down
39 changes: 0 additions & 39 deletions src/modules/feature/room/RoomDetails.unit.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src/modules/feature/room/RoomDetails.vue

This file was deleted.

7 changes: 3 additions & 4 deletions src/modules/feature/room/RoomForm.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import {
import { flushPromises, mount } from "@vue/test-utils";
import { ComponentProps } from "vue-component-type-helpers";
import RoomForm from "./RoomForm.vue";
import { RoomCreateParams } from "@/types/room/Room";
import { RoomColor } from "@/serverApi/v3";
import { RoomColorEnum, RoomCreateParams } from "@/types/room/Room";

const mockRoom: RoomCreateParams = {
name: "A11Y for Beginners",
color: RoomColor.Magenta,
color: RoomColorEnum.Magenta,
startDate: "",
endDate: "",
};

const emptyMockRoom: RoomCreateParams = {
name: "",
color: RoomColor.Magenta,
color: RoomColorEnum.Magenta,
startDate: undefined,
endDate: undefined,
};
Expand Down
Loading
Loading