Skip to content

feat: added board ordering in project using dnd#409

Open
kotserge wants to merge 1 commit intokanbn:mainfrom
kotserge:feat/reorder-boards-in-project
Open

feat: added board ordering in project using dnd#409
kotserge wants to merge 1 commit intokanbn:mainfrom
kotserge:feat/reorder-boards-in-project

Conversation

@kotserge
Copy link

This pull request contains feature for reordering boards by drag-and-drop through the UI:

  • Added a position column to the board schema to enable explicit ordering within a workspace
  • Implemented position management in the repository layer: auto-assign on create, decrement on delete, CASE-based reorder with duplicate auto-heal
  • Added position field to the board update tRPC mutation to trigger reordering
  • Built drag-and-drop UI using @dnd-kit with rectSortingStrategy for CSS grid support, programmatic navigation to prevent click-on-drop, and optimistic cache updates with rollback
    on error

@@ -0,0 +1,90 @@
DO $$ BEGIN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why these schema changes are being picked up. Did you run pnpm drizzle-kit generate? @kotserge

visibility: boardVisibilityEnum("visibility").notNull().default("private"),
type: boardTypeEnum("type").notNull().default("regular"),
sourceBoardId: bigint("sourceBoardId", { mode: "number" }),
position: integer("position").notNull(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will update the position for all workspace members. Ideally we want to allow each user to customise the order of their boards so we'll need to do something similar to user_board_favourites.

In fact we should probably merge user_board_favourites into user_board and store position and isFavourite on there. That'll give us greater flexibility in future.

We'll need to:

  • Create board_user table with userId, boardId, position, isFavourite
  • Create migration to create a board_user record for each board a user belongs (all in every workspace they belong to) and check against the board_user_favourites table to set isFavourite
  • Adding a new board should create a board_user record
  • Updating the position should reorder the board_user records
  • Deleting a board should remove any board_user records for that board
  • Favouriting/unfavouriting a board should update the board_user record
  • Boards should be ordered by their position/isFavourite for a given user

Sorry for the dump - there's quite a lot to do here so I'm very happy to help. Just give me a shout if you've got any questions

Copy link
Contributor

@hjball hjball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start @kotserge - I've left some feedback. Give me a shout if you've got any questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants