twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
17.23k stars 2.02k forks source link

Merge RecordActionBar and CommandMenu #3915

Open FelixMalfait opened 8 months ago

FelixMalfait commented 8 months ago

Context

As of today we have two separate systems:

In the future, the commandMenu should also be able to hold context on selected record/entries. As we move forward, it will also become more and more backend driven: extensions will be able to register commands, some actions will not be shown to certain user roles, etc. This direction also feels the most aligned with a more AI-driven UI (text / voice).

Proposal

CommandMenu should be the "brain". RecordActionBar can continue existing but we should transfer most of the logic that keeps selected record state and perform actions to the command menu.

We should refactor CommandMenu so that it works in the context of records. V1 is to take a big JSON as an input. In V2 this JSON will come from the backend.

Here's what the config could look like: [WIP / NOT OKAY]

[
{ 
   "label": ...
   "type": link, callback, component
   "objectName": "company",
   "displayOnContextMenu": true,
   "displayOnBulkSelect": true
   "displayOnListView": false   
   "displayOnShowPage": true
},

Inspiration

FelixMalfait commented 3 days ago

@bosiraphael feel free to close this when you think it's not useful anymore / when you're done refactoring everything! The most useful part were the various "inspiration" links to decide our api (e.g. Forest Admin has something similar to displayOnListView etc, we don't want that but I thought it was interesting)