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

feat: file actions on dashboard list #680

Merged
merged 25 commits into from
Sep 15, 2023
Merged

Conversation

jimniels
Copy link
Collaborator

@jimniels jimniels commented Sep 1, 2023

File-related actions from the dashboard

On desktop we surface a few of the actions:

CleanShot 2023-09-06 at 14 43 16@2x

And on smaller screens we hide all actions under the dropdown:

CleanShot 2023-09-06 at 14 43 06@2x

"Share File" menu re-used across dashboard and app

  • The share menu now fetches its data from the /file/:uuid/sharing endpoint on-demand.
  • It handles changes optimistically (by immediately rendering the change and syncing to the server).
  • It shows the filename when on the dashboard (for additional context)
CleanShot 2023-09-13 at 16 51 35@2x CleanShot 2023-09-13 at 16 51 26@2x

Reusable "Dialog" component for dialogs

Share & feedback use the same underlying component for displaying their content:

image

image

Todos

  • Optimistically render actions as they take place
    • Delete - immediately removed from list (pops back in if API call fails)
    • Duplicate - immediately add new file to list (disappears if API call fails w/UI message)
    • Rename - immediately change file name (changes to old name if it fails w/UI message)
    • Download - does nothing, just waits for browser to download file
    • Share - immediately show share menu, skeleton loaders for incoming data
  • Keep renames in place by not updating the updated_date (see slack thread)
  • Implement <ShareFileMenu> across the app (fetch its own data, or pass it in manually now...)
  • Mobile/responsive UI

@vercel
Copy link

vercel bot commented Sep 1, 2023

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

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview Sep 15, 2023 3:48pm

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-680 September 1, 2023 23:18 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 5, 2023 15:52 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 6, 2023 01:27 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 6, 2023 15:24 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 6, 2023 19:25 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 6, 2023 21:23 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 6, 2023 22:06 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 6, 2023 22:20 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 8, 2023 16:27 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 12, 2023 17:23 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 13, 2023 00:11 Inactive
@@ -92,6 +102,8 @@ export const router = createBrowserRouter(
element={<CloudFilesMigration.Component />}
loader={CloudFilesMigration.loader}
/>

<Route path="/api/files/:uuid/sharing" action={shareFileMenuAction} loader={shareFileMenuLoader} />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not quite sure what to call this route. These are called "resource routes" in Remix, but that's less of a thing in react-router because it's all client side.

The idea is: we need URLs that react-router fetchers can access without doing navigations. So it's sort of like a client-side, react-router specific API. So for now i'm just having these mirror the actual server API routes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you actually need a whole route, or do you just need a fetcher?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we were fetching directly from the API with our fetchers, then we wouldn't need a route.

But we have the apiClient for talking to the API, so we need client routes for the loaders/fetchers, and the client routes use the apiClient to talk to the API. So in this case, yes we need it.

Maybe in the future we can hit the API directly from our fetchers, but I haven't really thought about how that changes the architecture of the current codebase. So this was the most direct method to get this working.

@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 13, 2023 22:20 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 13, 2023 22:23 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 13, 2023 22:29 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 13, 2023 22:55 Inactive
@davidkircos
Copy link
Collaborator

davidkircos commented Sep 14, 2023

  • Copy link button does not work on list view (copies from URL bar which is not the file URL)
  • Add "Share" and "Delete" to ... menu on the dashboard.
  • The Cannot View / Can view drop-down adds a new layer of background color

@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 14, 2023 21:14 Inactive
@jimniels
Copy link
Collaborator Author

@davidkircos those have all been fixed (also, lmk what you think about the show/hide effect for each row item's icons, similar to google docs)

src/ui/QuadraticUI.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@davidkircos davidkircos left a comment

Choose a reason for hiding this comment

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

Two comments on the code. I am not sure if they marit any changes.

@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-680 September 15, 2023 15:46 Inactive
@jimniels jimniels merged commit 784e597 into main Sep 15, 2023
5 checks passed
@jimniels jimniels deleted the file-actions-on-dashboard branch September 15, 2023 16:22
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