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

Add board custom card order #788

Merged
merged 14 commits into from
Mar 13, 2024

Conversation

st4ng
Copy link
Contributor

@st4ng st4ng commented Feb 14, 2024

Restores the ability to change card order within columns via drag and drop 🎉 (as discussed in #586). Also, fixed one or two bugs and did some minor refactoring. What exactly should be clear from the commit history.

✨ What's new?

Cards can now be reordered within and across columns. The cards in the board and the records in the config are inserted according to the logic below (see table & examples).

The order is persisted in the view config. Optionally, the syncOrderField can be set in the board settings menu to additionally store card positions in the file properties (like the former priorityField). Only numeric fields are allowed.

For better feedback, the column in which the card will be inserted has a slightly different background and light shadow. This is especially needed for long lists with sorting enabled since the card position can be out of view without feedback from shifting cards.

Sorted Filtered Board Config / syncOrderField
Insert at drag position Insert at drag position
Insert at sorted position Insert at end
Insert at drag position If there is a card before the drag position, insert after that record.
Else if there is a card after the drag position, insert before that record.
Else insert at the end.
Same as sorted only Same as sorted only

Example: Default

Example: Sorted

Example: Filtered

🚧 Limitations

File Renaming

  • when files are renamed, the config gets outdated
  • if an order sync field is set, the order will be preserved, else the record jumps to the end
  • the next time the column is saved, the outdated record will be removed, and the new record added
  • We could listen to the rename event and update the config, but I am not sure yet where. The board view should handle it, but it would also have to listen even if the view is not currently open.

Same sync field for different boards

  • using the same sync field on the same files for multiple boards could lead to unexpected behavior from the user's perspective, especially if a different status field is used
  • don't know though, how common a use case like this is anyways
  • we could allow a field to be used only for one board view, or add an info/warning to the settings field

🏗️ ToDo

  • add Chinese translation for the "order-sync-field" setting (@Acylation ^^)
  • Should we add a config migration from priorityField to orderSyncField?
    • I'd argue though it's better not to. Yes, it would automatically restore the user's previous order, but it would also overwrite data as soon as cards are dragged around. Potentially not what the user wants.

st4ng and others added 11 commits February 14, 2024 01:24
* multi line card titles caused wrong card size, since id is replaced by placeholder on drag
* allows views to sort unsorted record arrays according to the current sort criteria
* allows views to get a record, even if it is not in their current data frame due to filtering
* allows views to react if the frame is sorted or filtered
@Acylation Acylation added kind/feature New feature request area/view/board Issues related to the Board view labels Feb 20, 2024
@Acylation Acylation added this to the next milestone Feb 20, 2024
From `copyRecordWithValues` to `updateRecordValues`
Stop the complaining about type instantiation too deep.

Apply prettier
@Acylation
Copy link
Collaborator

For better feedback, the column in which the card will be inserted has a slightly different background and light shadow. This is especially needed for long lists with sorting enabled since the card position can be out of view without feedback from shifting cards.

Like this detail!

when files are renamed, the config gets outdated

Will take board views into account if file rename event detected.

using the same sync field on the same files for multiple boards could lead to unexpected behavior from the user's perspective, especially if a different status field is used

Yes this seems reasonable because the sync-binding field can be modified by each view. Locking a field for only one view is a good proposal but for now, we need to access the complete project from the view level to achieve this. I'm imagining a centric way managing fields, maybe this is where we can mark a field as used. #709

Should we add a config migration from priorityField to orderSyncField?
I'd argue though it's better not to. Yes, it would automatically restore the user's previous order, but it would also overwrite data as soon as cards are dragged around. Potentially not what the user wants.

Agree. Just leave the priorityField there won't cause problems. Back to the deprecation of priority fields in #584, there was no operations on this either.


Thanks you so much for implementing this! I've learnt a lot from going through these changes.

@Acylation Acylation merged commit 59fa82e into marcusolsson:main Mar 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/view/board Issues related to the Board view kind/feature New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants