zesty-io / manager-ui

Content platform powering enterprise websites and applications
https://www.zesty.io
Other
40 stars 5 forks source link

Media App: Add Sort & Filter parameters to the page URL #1546

Closed zcolah closed 1 year ago

zcolah commented 1 year ago

When a user applies a time or file type filter, append text to the URL in a format similar to: "?from=2022-09-30&to=2022-11-23& filetype="PNG"

agalin920 commented 1 year ago

const [params, setParams] = useParams()

rjpals commented 1 year ago

@zcolah Is there a parameter for sort?

Also, when a user bookmarks a preset selection, e.g. "Today" and then visits that link many days later, what is the expectation? Does it navigate to the current day (?dateFilter=today), or does the link save "Today" as a date (?on=2022-11-22) in the link?

zcolah commented 1 year ago

Ryan thank you for initiating this discussion and asking for more context. I appreciate the attention to detail.

Here are my thoughts on what should be done. These are open to discussion and revision.

Sort By The initial scope did not include scope but on reflection I believe it should. The options should be:

?sortby=AtoZ ?sortby=ZtoA ?sortby=dateadded

Filters ?dateFilter=today should link to the present ?dateFilter=last7days should link to the last 7 days ?dateFilter=last14days should link to the last 14 days ?dateFilter=last30days should link to the last 30 days ?dateFilter=last3months should link to the last 3 months ?dateFilter=last12months should link to the last 12 months