Skip to content

Commit

Permalink
feat: add info kanban + filters, fix: colors, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mnenie committed Jul 29, 2024
1 parent f7503fb commit ae99b1a
Show file tree
Hide file tree
Showing 29 changed files with 479 additions and 151 deletions.
10 changes: 7 additions & 3 deletions src/entities/board/model/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UserType } from '@/entities/user/model';
import type { User } from '@/entities/user/model';

type DateParams = {
createdAt?: Date;
Expand All @@ -10,12 +10,15 @@ export interface BoardPreview extends DateParams {
_id: string;
title: string;
description: string;
users: UserType[];
users: User[];
}

export interface Board extends DateParams {
_id: string;
columns?: Column[];
name: string;
users: User[];
status: 'work' | 'archive' | 'closed';
}

type Tag = {
Expand All @@ -29,7 +32,8 @@ export interface Card extends DateParams {
priority: 'none' | 'low' | 'medium' | 'high';
tags?: Tag[];
chat?: boolean;
users: UserType[];
chatCount?: number;
users: User[];
}

export interface Column extends DateParams {
Expand Down
4 changes: 2 additions & 2 deletions src/entities/board/ui/BoardPreviewCard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import type { UserType } from '@/entities/user/model';
import type { User} from '@/entities/user/model';
import { UserAvatar } from '@/entities/user';
import type { BoardPreview } from '../model';
Expand All @@ -12,7 +12,7 @@ defineProps<{
const { t } = useI18n();
const userPosition = computed(() => {
return (board: BoardPreview, user: UserType) => {
return (board: BoardPreview, user: User) => {
return (board.users.length - 1 - +user._id!) * 12;
};
});
Expand Down
2 changes: 1 addition & 1 deletion src/entities/board/ui/CardItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const priority = computed(() => {
<span> #{{ card._id }}</span>
<div v-if="card.chat" :class="$style.messages">
<MessagesSquare :size="14" />
<span>2</span>
<span>{{ card.chatCount }}</span>
</div>
</div>
<div :class="$style.right_container">
Expand Down
20 changes: 14 additions & 6 deletions src/entities/board/ui/ColumnItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { useDark } from '@vueuse/core';
import { Ellipsis, Plus } from 'lucide-vue-next';
import type { Column } from '../model';
import { useI18n } from 'vue-i18n';
defineProps<{
column: Column;
Expand All @@ -11,6 +12,7 @@ defineOptions({
});
const isDark = useDark();
const { t } = useI18n();
defineSlots<{
content: () => any;
Expand All @@ -31,9 +33,9 @@ defineSlots<{
<slot name="content" />
</div>
<div :class="$style.bottom">
<div :class="$style.add">
<div class="text-sm" :class="$style.add">
<Plus :size="16" :color="isDark ? 'var(--zinc-300)' : 'var(--zinc-500)'" />
Add card
{{ t('kanban.cards.add') }}
</div>
</div>
</div>
Expand All @@ -56,9 +58,12 @@ defineSlots<{
scroll-margin: 8px;
.top_part {
position: sticky;
top: 0;
left: 0;
z-index: 999;
padding: 0.8rem;
border-radius: 12px 12px 0 0;
// border-bottom: 1px solid #ddd;
background-color: #f9f9f9;
cursor: grab;
display: flex;
Expand All @@ -70,9 +75,12 @@ defineSlots<{
.content {
padding: 6px;
display: flex;
flex-direction: column;
gap: 6px;
& > div {
display: flex;
flex-direction: column;
gap: 6px;
}
}
.name {
Expand Down
4 changes: 2 additions & 2 deletions src/entities/user/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ type DateParams = {
deletedAt?: Date;
};

export interface UserType extends DateParams {
export interface User extends DateParams {
_id?: string;
email: string;
photoUrl?: string;
role?: string;
}

export interface UserAuth extends UserType {
export interface UserAuth extends User {
token: string;
}
2 changes: 1 addition & 1 deletion src/features/boards/add-board/ui/CreationBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const open = () => {
min-width: 220px;
height: 120px;
border-radius: 15px;
color: var(--purple-main);
color: var(--zinc-600);
cursor: pointer;
display: flex;
align-items: center;
Expand Down
11 changes: 6 additions & 5 deletions src/features/filter/ui/SearchFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const { t } = useI18n();
</script>

<template>
<div :class="$style.search_container">
<div :class="$style.search_container" :style="{ marginBottom: isExpanded ? '15px' : '16px' }">
<Search
:class="[isExpanded ? $style.icon : $style.icon_no_expanded]"
:color="iconColor"
Expand All @@ -45,7 +45,11 @@ const { t } = useI18n();
:placeholder="t('sidebar.input')"
:class="$style.input_filter"
/>
<UiBadge v-show="isExpanded" variant="secondary" :class="$style.badge">
<UiBadge
variant="secondary"
:class="$style.badge"
:style="{ top: isExpanded ? '50%' : '20%', right: isExpanded ? '8px' : '-2px' }"
>
<span>⌘</span>
<span>K</span>
</UiBadge>
Expand All @@ -56,7 +60,6 @@ const { t } = useI18n();
.search_container {
position: relative;
height: 32px;
margin-bottom: 15px;
.icon {
position: absolute;
Expand Down Expand Up @@ -89,8 +92,6 @@ const { t } = useI18n();
.badge {
position: absolute;
right: 8px;
top: 50%;
height: 16px;
transform: translateY(-50%);
padding-left: 4px;
Expand Down
7 changes: 5 additions & 2 deletions src/features/kanban/ui/AddColumn.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<script setup lang="ts">
import { useDark } from '@vueuse/core';
import { useI18n } from 'vue-i18n';
import { Plus } from 'lucide-vue-next';
const isDark = useDark();
const { t } = useI18n();
</script>

<template>
<div :class="$style.block">
<div class="text-sm" :class="$style.block">
<Plus :size="16" :color="isDark ? 'var(--zinc-300)' : 'var(--zinc-500)'" />
Add new column
{{ t('kanban.new') }}
</div>
</template>

Expand All @@ -26,6 +28,7 @@ const isDark = useDark();
border-radius: 12px;
padding: 0.8rem;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
font-weight: 500;
}
:global(html.dark) {
Expand Down
1 change: 1 addition & 0 deletions src/features/kanban/ui/DragColumns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const dragOptions = ref({
flex-direction: row;
list-style: none;
gap: 15px;
max-height: 100%;
}
.flip-list-move {
Expand Down
34 changes: 34 additions & 0 deletions src/features/kanban/ui/RemoveBoard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script setup lang="ts">
import { UiButton } from '@/shared/ui';
import { Trash2 } from 'lucide-vue-next';
</script>

<template>
<UiButton :variant="'dashed'" :size="'sm'" :class="$style.trash">
<Trash2 :size="16" />
</UiButton>
</template>

<style module lang="scss">
.trash {
height: 30px;
gap: 8px;
& > svg {
color: var(--zinc-500);
}
}
:global(html.dark) {
.trash {
background-color: transparent;
&:hover {
background-color: transparent;
border-color: var(--zinc-500);
}
& > svg {
color: var(--zinc-300);
}
}
}
</style>
45 changes: 45 additions & 0 deletions src/features/kanban/ui/SettingsSheet.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script setup lang="ts">
import { ref } from 'vue';
import { UiButton, UiSheet } from '@/shared/ui';
import type { SheetElement } from '@/shared/ui';
import { Settings2 } from 'lucide-vue-next';
const sheet = ref<SheetElement | null>(null);
const open = () => {
if (sheet.value) {
sheet.value.open();
}
};
</script>

<template>
<UiButton :variant="'dashed'" :size="'sm'" :class="$style.settings" @click="open">
<Settings2 :size="16" />
</UiButton>
<UiSheet ref="sheet"> settings </UiSheet>
</template>

<style module lang="scss">
.settings {
height: 30px;
gap: 8px;
& > svg {
color: var(--zinc-500);
}
}
:global(html.dark) {
.settings {
background-color: transparent;
&:hover {
background-color: transparent;
border-color: var(--zinc-500);
}
& > svg {
color: var(--zinc-300);
}
}
}
</style>
42 changes: 42 additions & 0 deletions src/features/kanban/ui/SortingItems.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { UiButton } from '@/shared/ui';
import { AlignEndHorizontal, ArrowDown10 } from 'lucide-vue-next';
const { t } = useI18n();
</script>

<template>
<UiButton :variant="'dashed'" :size="'sm'" :class="$style.sort_button">
<AlignEndHorizontal :size="16" />
{{ t('kanban.sorting.activity') }}
</UiButton>
<UiButton :variant="'dashed'" :size="'sm'" :class="$style.sort_button">
<ArrowDown10 :size="16" />
{{ t('kanban.sorting.workload') }}
</UiButton>
</template>

<style module lang="scss">
.sort_button {
height: 30px;
gap: 8px;
& > svg {
color: var(--zinc-400);
}
}
:global(html.dark) {
.sort_button {
background-color: transparent;
&:hover {
background-color: transparent;
border-color: var(--zinc-500);
}
& > svg {
color: var(--zinc-300);
}
}
}
</style>
5 changes: 4 additions & 1 deletion src/features/kanban/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import AddColumn from './AddColumn.vue';
import DragCards from './DragCards.vue';
import DragColumns from './DragColumns.vue';
import SettingsSheet from './SettingsSheet.vue';
import SortingItems from './SortingItems.vue';
import RemoveBoard from './RemoveBoard.vue';

export { AddColumn, DragCards, DragColumns };
export { AddColumn, DragCards, DragColumns, SortingItems, SettingsSheet, RemoveBoard };
Loading

0 comments on commit ae99b1a

Please sign in to comment.