-
Notifications
You must be signed in to change notification settings - Fork 0
refactor/add-new-kanban #68
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
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6a87f81
feature: install Kanban from reui, replace kanban
AlexandrNel 4a00907
fix: fix gidratation error
AlexandrNel 70c4253
feat: add checkbox
AlexandrNel c63b107
refactor: update kanban board and mock data
AlexandrNel beb3c4e
refactor: add link highligting for projects
AlexandrNel 83b14fe
refactor: enhance KanbanBoard layout and improve column handle visibi…
AlexandrNel 67e3128
refactor: update MockBoard structure and enhance TaskColumn with icons
AlexandrNel 648975c
refactor: create Task component and update TaskCard integration in Ta…
AlexandrNel 1a50435
refactor: enhance ProjectKanban and TaskColumn components with improv…
AlexandrNel a7b7664
feat(task): add entitry 'task'
AlexandrNel 936aab7
feat(board): add entitry 'board'
AlexandrNel 922b215
feat: add useProjectStore
AlexandrNel f435c5e
feat(board): add all schemas, types, api routes and queires
AlexandrNel 45cd5b1
refactor(task): remove TaskCard component and clean up exports
AlexandrNel 66a3785
feat(color-picker): add ColorPicker component and color constants
AlexandrNel a0eb4a9
feat(task): implement CreateTask components and hooks for task creation
AlexandrNel 596f708
feat(board): add CreateBoard components, form, and hooks for board cr…
AlexandrNel ac2b134
feat(board/remove/column): add RemoveColumn components, form, and hoo…
AlexandrNel 5bd82a2
feat(board): implement board management with Zustand store and Kanban…
AlexandrNel 67a1b58
refactor(config): update steiger configuration to disable public-api …
AlexandrNel 7514a8d
feat(board/column): add CreateBoardColumn components, form, and dialo…
AlexandrNel c9ff640
feat(board/remove/column): enhance useRemoveColumn hook and RemoveCol…
AlexandrNel 7c94933
feat(board/column/create): add color selection with ColorPicker and d…
AlexandrNel de47e36
chore: delete console.log
AlexandrNel 3021ecf
feat(board): enhance useBoardsPage with error handling and refetch ca…
AlexandrNel c3a5ab9
Merge branch 'dev' into refactor/add-new-kanban
AlexandrNel 17110d4
fix(ProjectBoardsPage): update PageProps type definition for params
AlexandrNel a060ba1
Merge dev into refactor/add-new-kanban
AlexandrNel 9e2ca81
refactor(board): remove unused queries, update board and column schem…
AlexandrNel 30c0c29
Merge branch 'dev' into refactor/add-new-kanban
AlexandrNel 0205f26
refactor(board, project): replace projectId with projectSlug and upda…
AlexandrNel 4fa4ea1
refactor(useClickOutside): replace handler dependency with useRef pat…
AlexandrNel 6337dce
fix(board): update API endpoints and schemas for board columns and st…
AlexandrNel 7539e21
refactor(auth, board): update imports to use type-only imports for types
AlexandrNel 2728a60
fix: resolve PR review issues
AlexandrNel 037e071
refactor: remove projectStore
AlexandrNel e817ba9
refactor: remove orderIndex field
AlexandrNel 1bdd5fa
refactor: restructure project boards view handling
AlexandrNel ee4edde
chore: move constants to config & fix typos
AlexandrNel 2a24927
refactor: fix PR issues
AlexandrNel 5eddf1f
Merge branch 'dev' into refactor/add-new-kanban
AlexandrNel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| import { api } from 'shared/api'; | ||
| import * as SBoard from '../model/schemas'; | ||
| import type * as TBoard from '../model/types'; | ||
|
|
||
| export class BoardHttp { | ||
| static getBoardList(projectSlug: string, signal?: AbortSignal) { | ||
| return api<TBoard.BoardListResponse>({ | ||
| url: `/projects/${projectSlug}/area`, | ||
| method: 'GET', | ||
| contracts: { | ||
| response: SBoard.BoardListResponse, | ||
| }, | ||
| signal, | ||
| }); | ||
| } | ||
|
|
||
| static getBoard(projectSlug: string, id: string, signal?: AbortSignal) { | ||
| return api<TBoard.BoardResponse>({ | ||
| url: `/projects/${projectSlug}/area/${id}`, | ||
| method: 'GET', | ||
| contracts: { | ||
| response: SBoard.Board, | ||
| }, | ||
| signal, | ||
| }); | ||
| } | ||
|
|
||
| static createBoard(projectSlug: string, data: TBoard.CreateBoardBody) { | ||
| return api<TBoard.CreateBoardResponse>({ | ||
| url: `/projects/${projectSlug}/area`, | ||
| method: 'POST', | ||
| data, | ||
| contracts: { | ||
| body: SBoard.CreateBoardBody, | ||
| response: SBoard.CreateBoardResponse, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| static updateBoard(projectSlug: string, boardSlug: string, data: TBoard.UpdateBoardBody) { | ||
| return api<TBoard.ActionResponse>({ | ||
| url: `/projects/${projectSlug}/area/${boardSlug}`, | ||
| method: 'PUT', | ||
| data, | ||
| contracts: { | ||
| body: SBoard.UpdateBoardBody, | ||
| response: SBoard.ActionResponse, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| static removeBoard(projectSlug: string, boardSlug: string) { | ||
| return api<TBoard.ActionResponse>({ | ||
| url: `/projects/${projectSlug}/area/${boardSlug}`, | ||
| method: 'DELETE', | ||
| contracts: { | ||
| response: SBoard.ActionResponse, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| static getBoardColumnList(boardSlug: string, signal?: AbortSignal) { | ||
| return api<TBoard.BoardColumnListResponse>({ | ||
| url: `/area/${boardSlug}/states`, | ||
| method: 'GET', | ||
| contracts: { | ||
| response: SBoard.BoardColumnListResponse, | ||
| }, | ||
| signal, | ||
| }); | ||
| } | ||
|
|
||
| static getBoardColumn(boardSlug: string, columnId: string, signal?: AbortSignal) { | ||
| return api<TBoard.BoardColumnResponse>({ | ||
| url: `/area/${boardSlug}/states/${columnId}`, | ||
| method: 'GET', | ||
| contracts: { | ||
| response: SBoard.BoardColumn, | ||
| }, | ||
| signal, | ||
| }); | ||
| } | ||
|
|
||
| static createBoardColumn(boardSlug: string, data: TBoard.CreateBoardColumnBody) { | ||
| return api<TBoard.CreateBoardColumnResponse>({ | ||
| url: `/area/${boardSlug}/states`, | ||
| method: 'POST', | ||
| data, | ||
| contracts: { | ||
| body: SBoard.CreateBoardColumnBody, | ||
| response: SBoard.CreateBoardColumnResponse, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| static updateBoardColumn( | ||
| boardSlug: string, | ||
| columnId: string, | ||
| data: TBoard.UpdateBoardColumnBody | ||
| ) { | ||
| return api<TBoard.ActionResponse>({ | ||
| url: `/area/${boardSlug}/states/${columnId}`, | ||
| method: 'PATCH', | ||
| data, | ||
| contracts: { | ||
| body: SBoard.UpdateBoardColumnBody, | ||
| response: SBoard.ActionResponse, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| static removeBoardColumn(boardSlug: string, columnId: string) { | ||
| return api<TBoard.ActionResponse>({ | ||
| url: `/area/${boardSlug}/states/${columnId}`, | ||
| method: 'DELETE', | ||
| contracts: { | ||
| response: SBoard.ActionResponse, | ||
| }, | ||
| }); | ||
| } | ||
| static restoreBoardColumn(boardSlug: string, columnId: string) { | ||
| return api<TBoard.ActionResponse>({ | ||
| url: `/area/${boardSlug}/states/${columnId}/restore`, | ||
| method: 'POST', | ||
| contracts: { | ||
| response: SBoard.ActionResponse, | ||
| }, | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { queryOptions } from '@tanstack/react-query'; | ||
| import { boardFabricKeys } from '../model/consts'; | ||
| import { BoardHttp } from './http'; | ||
|
|
||
| export class BoardQueries { | ||
| static getBoardList(slug: string) { | ||
| return queryOptions({ | ||
| queryKey: boardFabricKeys.list(slug), | ||
| queryFn: async ({ signal }) => BoardHttp.getBoardList(slug, signal), | ||
| staleTime: 60_000, | ||
| }); | ||
| } | ||
|
|
||
| static getBoard(slug: string, id: string) { | ||
| return queryOptions({ | ||
| queryKey: boardFabricKeys.detail(slug, id), | ||
| queryFn: async ({ signal }) => BoardHttp.getBoard(slug, id, signal), | ||
| staleTime: 60_000, | ||
| }); | ||
| } | ||
|
|
||
| static getBoardColumnList(slug: string) { | ||
| return queryOptions({ | ||
| queryKey: boardFabricKeys.columns(slug), | ||
| queryFn: async ({ signal }) => BoardHttp.getBoardColumnList(slug, signal), | ||
| staleTime: 60_000, | ||
| }); | ||
| } | ||
|
|
||
| static getBoardColumn(slug: string, id: string) { | ||
| return queryOptions({ | ||
| queryKey: boardFabricKeys.column(slug, id), | ||
| queryFn: async ({ signal }) => BoardHttp.getBoardColumn(slug, id, signal), | ||
| staleTime: 60_000, | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export const BOARD_COLUMN_COLORS = [ | ||
| '#9FA8DA', | ||
| '#7E57C2', | ||
| '#9575CD', | ||
| '#AB47BC', | ||
| '#F06292', | ||
| '#FF8A65', | ||
| '#4FC3F7', | ||
| '#4DB6AC', | ||
| '#81C784', | ||
| '#DCE775', | ||
| '#FFF176', | ||
| '#FFB74D', | ||
| ] as const; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export type * as TBoard from './model/types'; | ||
| export * as SBoard from './model/schemas'; | ||
| export { boardFabricKeys } from './model/consts'; | ||
| export { BoardHttp } from './api/http'; | ||
| export { BoardQueries } from './api/queries'; | ||
| export { BoardMapper, type KanbanBoardData } from './model/mapper'; | ||
| export { BOARD_COLUMN_COLORS } from './config/colors'; | ||
| export { useBoardStore } from './model/store'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { createEntityKeys } from 'shared/lib/utils'; | ||
|
|
||
| export const boardFabricKeys = createEntityKeys('board', { | ||
| detail: (slug: string, id: string) => ['projects', slug, 'boards', id], | ||
| columns: (slug: string) => ['boards', slug, 'columns'], | ||
| column: (slug: string, id: string) => ['boards', slug, 'columns', id], | ||
| views: (slug: string) => ['boards', slug, 'views'], | ||
| view: (slug: string, id: string) => ['boards', slug, 'views', id], | ||
| tasks: (boardSlug: string) => ['board', boardSlug, 'tasks'], | ||
| task: (columnId: string, taskId: string) => ['columns', columnId, 'tasks', taskId], | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import type { BoardColumnResponse, BoardResponse } from './types'; | ||
|
|
||
| // TODO: добавить таски в типы, когда они появятся в API | ||
|
|
||
| type KanbanTaskStub = { | ||
| id: string; | ||
| columnId: string; | ||
| }; | ||
|
|
||
| export type KanbanBoardData = { | ||
| board: BoardResponse; | ||
| columns: Record<string, BoardColumnResponse>; | ||
| tasksByColumn: Record<string, unknown[]>; | ||
| }; | ||
|
|
||
| export class BoardMapper { | ||
| static toKanban( | ||
| board: BoardResponse, | ||
| columnList: BoardColumnResponse[], | ||
| taskList: unknown[] | ||
| ): KanbanBoardData { | ||
| const sortedColumns = [...columnList].sort((a, b) => a.orderIndex - b.orderIndex); | ||
| const tasksByColumn: Record<string, unknown[]> = {}; | ||
| const columns: Record<string, BoardColumnResponse> = {}; | ||
|
|
||
| sortedColumns.forEach((column) => { | ||
| tasksByColumn[column.id] = []; | ||
| columns[column.id] = column; | ||
| }); | ||
|
|
||
| taskList?.forEach((task) => { | ||
| const kanbanTask = task as KanbanTaskStub; | ||
|
|
||
| if (tasksByColumn[kanbanTask.columnId]) { | ||
| tasksByColumn[kanbanTask.columnId].push(task); | ||
| } else { | ||
| console.warn(`Task ${kanbanTask.id} references unknown column ${kanbanTask.columnId}`); | ||
| } | ||
| }); | ||
|
|
||
| // Object.keys(tasksByColumn).forEach((columnId) => { | ||
| // tasksByColumn[columnId].sort((a, b) => a.position - b.position); | ||
| // }); | ||
|
|
||
| return { | ||
| board, | ||
| columns, | ||
| tasksByColumn, | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.