rowyio / rowy

Low-code backend platform. Manage database on spreadsheet-like UI and build cloud functions workflows in JS/TS, all in your browser.
http://rowy.io
Other
6.14k stars 487 forks source link

Sort button to showcase if a column is sorted or not #1268

Closed mnmt7 closed 1 year ago

mnmt7 commented 1 year ago

closes #1244

This PR adds a sort button which is visible only when the sort is applied on a column. Clicking on sort button opens a popover where the user can select other columns for sorting and as well as select the sorting direction i.e. ascending or descending.

Also on a side note, I noticed that even if you remove the sort, it is not removed from the Firebase and if you reload the page after removing the sort, it will be reapplied on the table. This should be an easy fix and I can do it in this PR if you say so.

/claim #1244

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rowy-os ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 5:08am
1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **rowy-typedoc** | ⬜️ Ignored ([Inspect](https://vercel.com/rowy/rowy-typedoc/FDESb9kG2QfgFBxgema9aJWYDtfv)) | | | Jun 1, 2023 5:08am |
vercel[bot] commented 1 year ago

@mnmt7 is attempting to deploy a commit to the Rowy Team on Vercel.

A member of the Team first needs to authorize it.

iamanishroy commented 1 year ago

Also on a side note, I noticed that even if you remove the sort, it is not removed from the Firebase and if you reload the page after removing the sort, it will be reapplied on the table. This should be an easy fix and I can do it in this PR if you say so.

Hey @mnmt7, it would be great if you could work on it. Also, please check the requested change as it is related to this fix.

mnmt7 commented 1 year ago

Hey @iamanishroy, didn't get what you meant by the requested change?

mnmt7 commented 1 year ago

@iamanishroy, I have implemented the requested changes Now, when a user removes the sort and reloads the page, the previous sort won't be reapplied. As per your suggestion, I have utilized the triggerSaveTableSorts() function to achieve this. However, I would like to confirm one thing. It seems to me that triggerSaveTableSorts() is intended to modify sort settings for individual users rather than applying them for all users. Please clarify if my understanding is correct.

The current flow of the sort is as follows:

  1. The user applies the sort.
  2. A popup appears, giving the option to save the sort for all users.
  3. If the user chooses not to save the sort and:
    • The user removes the sort and refreshes the page, the sort won't be reapplied.
  4. If the user chooses to save the sort and:
    • The user removes the sort, the changes are immediately reflected on the screen i.e. the sort is removed. However, if the page is reloaded, the sort will be reapplied because now the "sort settings for all users" will take the precedence. In short, if no user-specific sort setting exists, the sort settings for all users will be utilized.

Furthermore, there was one more thing I wanted to mention. Regarding the design of the columns dropdown, I made a slight modification. Instead of the design shown in the provided images, I have opted for a slightly different design:

Requested design - 236119112-caed044e-1c03-4c25-b054-1428d97ff38d

Implemented design - Screenshot 2023-06-01 at 10-16-30 Rowy – GCP as easy as ABC

I chose this design since the dropdown component was already being used for the filter functionality, and it seemed logical to maintain consistency. The only issue with this was what should be the action performed when the "clear" option is clicked. Right now, the sort is removed and consequently the sort modal disappears.