Skip to content

Commit

Permalink
feat: add base workflows views
Browse files Browse the repository at this point in the history
  • Loading branch information
mnenie committed Jan 28, 2025
1 parent 4d27602 commit 44c7a01
Show file tree
Hide file tree
Showing 55 changed files with 807 additions and 233 deletions.
6 changes: 3 additions & 3 deletions apps/client/src/core/components/headers/BreadcrumbItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const route = useRoute()
const linkClasses = computed(() =>
route.name !== props.breadcrumb.name
? 'text-neutral-800 dark:!text-neutral-500'
? 'text-neutral-500 !fw400 dark:!text-neutral-500'
: 'dark:text-neutral-100',
)
Expand All @@ -38,14 +38,14 @@ const iconClasses = computed(() =>
/>
<p
v-if="breadcrumb.tKey"
class="text-lg mt-1.5px !fw-500"
class="text-lg fw500 mt-1.5px"
:class="linkClasses"
>
{{ $t(`sidebar.${breadcrumb.tKey}`) }}
</p>
<p
v-else
class="text-lg mt-1.5px !fw-500"
class="text-lg mt-1.5px"
:class="linkClasses"
>
{{ breadcrumb.value }}
Expand Down
8 changes: 4 additions & 4 deletions apps/client/src/core/components/headers/HeaderMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ const { breadcrumbs } = useBreadcrumbs()
class="sticky top-0 left-0 right-0 z-999 w-full flex items-center justify-between px-15px py-8px min-h-52px max-h-52px
border-b border-b-solid border-layout"
>
<div class="inline-flex items-center gap-2">
<div v-for="(breadcrumb, idx) in breadcrumbs" :key="idx" class="inline-flex items-center gap-1.5">
<div class="inline-flex items-center gap-1">
<div v-for="(breadcrumb, idx) in breadcrumbs" :key="idx" class="inline-flex items-center gap-1">
<BreadcrumbItem :breadcrumb="breadcrumb" />
<Icon
v-if="idx < breadcrumbs.length - 1"
icon="lucide:chevron-right"
class="text-16px text-neutral-600 dark:text-neutral-500"
icon="heroicons:slash-20-solid"
class="text-18px mt-0.5 text-neutral-400 dark:text-neutral-600"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { useBoardsStore } from '../stores/board'
import CreateNewBoard from './features/CreateNewBoard.vue'
import RemoveBoard from './features/handlers/RemoveBoard.vue'
import BoardsAdvancedFilter from './filters/BoardsAdvancedFilter.vue'
import BoardsSort from './filters/BoardsSort.vue'
import SearchBoards from './filters/SearchBoards.vue'
import type { Board } from '../types'
import { UiTabsList, UiTabsTrigger } from '@/shared/ui'
defineProps<{
isSelected: boolean
idxs: string[]
boards: Board[]
}>()
const boardsStore = useBoardsStore()
const { boards } = storeToRefs(boardsStore)
</script>

<template>
Expand Down
27 changes: 13 additions & 14 deletions apps/client/src/modules/boards/components/BoardsDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { computed, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import { useDark } from '@vueuse/core'
import dayjs from 'dayjs'
import localizedFormat from 'dayjs/plugin/localizedFormat'
import type { Table } from '@tanstack/vue-table'
import type { BoardRow } from '../types'
import { DataTable, UiBadge } from '@/shared/ui'
Expand All @@ -20,13 +22,6 @@ const _columns = [
_tableCell: 'max-w-220px',
},
},
{
accessorKey: 'status',
meta: {
icon: 'hugeicons:energy',
_tableCell: 'text-left',
},
},
{
accessorKey: 'labels',
meta: {
Expand Down Expand Up @@ -89,6 +84,14 @@ function userPosition(idx: number) {
return idx * 20
}
dayjs.extend(localizedFormat)
// mocks -> after from store
const timesAgo = computed(() =>
(board: BoardRow) => {
return dayjs(board.createdAt).format('ll')
})
const isDark = useDark()
defineExpose({
Expand Down Expand Up @@ -128,13 +131,6 @@ defineExpose({
</template>
</div>
</template>
<template #status-cell="{ cell }">
<span
:class="cell.row.original.status === 'archived' ? 'text-neutral-600 dark:text-neutral-400' : 'text-green-600'"
>
{{ t(`kanban.${cell.row.original.status}`) }}
</span>
</template>
<template #users-cell="{ cell }">
<div v-if="visibleUsers(cell).length > 0" class="flex items-center relative h-full w-full justify-between">
<div class="relative flex items-center relative h-full">
Expand Down Expand Up @@ -162,5 +158,8 @@ defineExpose({
</div>
<span v-else class="text-neutral-500">-</span>
</template>
<template #date-cell="{ cell }">
{{ timesAgo(cell.row.original) }}
</template>
</DataTable>
</template>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue'
import { type ButtonVariants, UiButton } from '@/shared/ui'
defineProps<{
Expand All @@ -17,7 +18,7 @@ const emit = defineEmits<{
size="default"
@click="emit('add')"
>
<span i-hugeicons-add-01 class="w-4 h-4" />
<Icon icon="solar:widget-add-bold-duotone" class="min-w-4 min-h-4" />
<span class="text-default">{{ $t('boards.create', plural) }}</span>
</UiButton>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ import { UiInput } from '@/shared/ui'
</script>

<template>
<UiInput :placeholder="$t('boards.filters.search')" class="w-200px h-default focus:ring-0" />
<div class="relative">
<UiInput
:placeholder="$t('boards.filters.search')"
class="w-200px focus:ring-0 shadow-none pl-8"
/>
<span i-lucide-search class="absolute left-2 top-1/2 translate-y--1/2 w-4 h-4 text-neutral-500" />
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
</ReuseTemplate>
<UiAlert
variant="warning"
:content="$t('boards.forms.creating.labels.alert')"
class="mt-3 mb-1"
/>
class="mt-2 mb-1 border-none flex flex-col items-start gap-1"
>
<span class="text-default fw500">
{{ $t('boards.forms.creating.labels.alert', 1) }}
</span>
<span class="text-default text-neutral-500 dark:text-neutral-400">
{{ $t('boards.forms.creating.labels.alert', 2) }}
</span>
</UiAlert>
<ReuseTemplate field="labels">
<TagsChooser id="labels" v-model="labels" />
<span class="text-small text-neutral-500">
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/modules/boards/pages/boards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ useHead({
<template>
<div v-if="$route.name !== 'boards-id'" class="w-full h-full flex flex-col">
<ViewControl>
<BoardsActionsPanel :is-selected :idxs />
<BoardsActionsPanel :boards="filteredBoards" :is-selected :idxs />
<template #table>
<div
class="relative w-full h-full flex flex-col"
Expand Down
14 changes: 14 additions & 0 deletions apps/client/src/modules/common/components/controls/ViewTabs.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
import { UiTabsList, UiTabsTrigger } from '@/shared/ui'
</script>

<template>
<UiTabsList>
<UiTabsTrigger value="table">
<span i-hugeicons-layout-table-02 />
</UiTabsTrigger>
<UiTabsTrigger value="cards">
<span i-hugeicons-dashboard-square-01 />
</UiTabsTrigger>
</UiTabsList>
</template>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue'
import { type ButtonVariants, UiButton } from '@/shared/ui'
defineProps<{
Expand All @@ -17,7 +18,7 @@ const emit = defineEmits<{
size="default"
@click="emit('add')"
>
<span i-hugeicons-add-01 class="w-4 h-4" />
<Icon icon="qlementine-icons:add-file-16" class="min-w-4 min-h-4" />
<span class="text-default">{{ $t('notes.create', plural) }}</span>
</UiButton>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ import { UiInput } from '@/shared/ui'
</script>

<template>
<UiInput :placeholder="$t('notes.filters.search')" class="w-200px !h-default focus:ring-0" />
<div class="relative">
<UiInput
:placeholder="$t('notes.filters.search')"
class="w-200px focus:ring-0 shadow-none pl-8"
/>
<span i-lucide-search class="absolute left-2 top-1/2 translate-y--1/2 w-4 h-4 text-neutral-500" />
</div>
</template>
13 changes: 7 additions & 6 deletions apps/client/src/modules/notes/composables/filtered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ interface FilteredNotesContext {
}

export function useFilteredNotes<U extends Note[]>(notes: Ref<U>, sortModel: Ref<string>) {
const filteredNotes = computed(() => [...notes.value].sort((a, b): number => {
if (sortModel.value === 'date') {
return (b.date ? +new Date(b.date) : 0) - (a.date ? +new Date(a.date) : 0)
}
return 0
}))
const filteredNotes = computed(() =>
[...notes.value].sort((a, b): number => {
if (sortModel.value === 'date') {
return (b.date ? +new Date(b.date) : 0) - (a.date ? +new Date(a.date) : 0)
}
return 0
}))

return {
filteredNotes,
Expand Down
16 changes: 0 additions & 16 deletions apps/client/src/modules/workflows/components/AllWorkflows.vue

This file was deleted.

58 changes: 58 additions & 0 deletions apps/client/src/modules/workflows/components/CardItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script setup lang="ts" generic="T extends WorkflowCard">
import { computed } from 'vue'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import type { WorkflowCard } from '../types'
import { UiBadge } from '@/shared/ui'
defineProps<{
card: T
}>()
dayjs.extend(relativeTime)
const timesAgo = computed(() =>
(workflow: T) => {
return dayjs().to(dayjs(workflow.updatedAt))
})
</script>

<template>
<div
class="relative p-3 cursor-pointer w-full flex flex-col justify-between h-full border border-solid border-neutral-200 rounded-8px dark:border-neutral-700/60"
@click="$router.push({ name: 'workflows-id', params: { id: card._id } })"
>
<div class="absolute inset-0 bg-dotted-pattern opacity-30 pointer-events-none" />

<div class="w-full flex items-start justify-between">
<div class="flex flex-col gap-0.5 w-full">
<p class="text-default hyphens-auto">
{{ card.name }}
</p>
<p class="text-small text-neutral-500 hyphens-auto overflow-hidden text-ellipsis line-clamp-1">
{{ card.description }}
</p>
</div>
<UiBadge variant="soft" class="px-1 py-px mt-px" :class="card.state === 'production' ? 'badge-soft-green' : 'badge-soft'">
{{ $t(`workflows.status.${card.state}`) }}
</UiBadge>
</div>
<span class="text-small mt-3 text-neutral-500 overflow-hidden text-ellipsis line-clamp-1 dark:text-neutral-400">
{{ timesAgo(card) }}
</span>
</div>
</template>

<style scoped>
.bg-dotted-pattern {
background-image: radial-gradient(circle, #ccc 1px, transparent 1px);
background-size: 12px 12px;
background-color: inherit;
}
:global(html.dark) {
.bg-dotted-pattern {
background-image: radial-gradient(circle, #424242 1px, transparent 1px);
}
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script setup lang="ts">
import EmptyContainer from '@/modules/common/components/EmptyContainer.vue'
</script>

<template>
<EmptyContainer icon="hugeicons:workflow-square-03" t-prefix="workflows" />
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@
import CreateNewWorkflow from './features/CreateNewWorkflow.vue'
import SearchWorkflows from './filters/SearchWorkflows.vue'
import WorkflowsSort from './filters/WorkflowsSort.vue'
import RemoveWorkflow from './features/handlers/RemoveWorkflow.vue'
import type { Workflow } from '../types'
import ViewTabs from '@/modules/common/components/controls/ViewTabs.vue'
defineProps<{
workflows: Workflow[]
isSelected: boolean
idxs: string[]
}>()
</script>

<template>
<div class="flex items-center justify-between">
<div class="flex items-center gap-2 w-full">
<ViewTabs />
<WorkflowsSort />
<RemoveWorkflow
v-if="isSelected && workflows.length > 0"
/>
</div>
<div class="flex items-center gap-2">
<SearchWorkflows />
<WorkflowsSort />
<CreateNewWorkflow />
</div>
<CreateNewWorkflow />
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defineProps<{
<div class="flex items-center gap-1.5 text-neutral-500 dark:text-neutral-400">
<div i-lucide:chevron-down class="w-4 h-4" />
<p class="text-small">
{{ section }}
{{ $t(`workflows.section.${section}`) }}
</p>
</div>
</template>
20 changes: 20 additions & 0 deletions apps/client/src/modules/workflows/components/WorkflowsCards.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script setup lang="ts">
import CardItem from './CardItem.vue'
import type { WorkflowCard } from '../types'
defineProps<{
cards: WorkflowCard[]
}>()
</script>

<template>
<div class="flex flex-col space-y-3 mt-1">
<div class="grid grid-cols-4 gap-4 items-stretch">
<CardItem
v-for="card in cards"
:key="card._id"
:card="card"
/>
</div>
</div>
</template>
Loading

0 comments on commit 44c7a01

Please sign in to comment.