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

refactor: time buckets (2) #3554

Merged
merged 1 commit into from
Aug 5, 2023
Merged

refactor: time buckets (2) #3554

merged 1 commit into from
Aug 5, 2023

Conversation

jrasm91
Copy link
Contributor

@jrasm91 jrasm91 commented Aug 4, 2023

Follow-up PR to address auto navigating unarchived assets, etc.

In this PR:

  • Add option to AssetGrid to auto advance the asset view for a specific action (archive on the timeline, unfavorite on favorites page, unarchive on archive page)
  • Navigate to previous asset if it is the last asset
  • Close the viewer if you trigger removing the last item via archive/unarchive/unfavorite.

Tested scenarios:

  • Archive on main timeline via asset viewer
  • Unfavorite on favorites page via asset viewer
  • Unarchive on archive page via asset viewer
  • All the same actions for the first image, last image of page

@vercel
Copy link

vercel bot commented Aug 4, 2023

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

1 Ignored Deployment
Name Status Preview Updated (UTC)
immich ⬜️ Ignored (Inspect) Aug 4, 2023 9:45pm

}

return !!previousAsset;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help explain the logic here?

Copy link
Contributor Author

@jrasm91 jrasm91 Aug 5, 2023

Choose a reason for hiding this comment

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

Just returns a boolean value to indicate if one was found or not. Makes it possible to fallback to navigating to the previous asset and again falling back to closing the viewer if there is not another asset to show.

Basically, when you archive an asset and it should advance, what if there is no next asset? Now we can know that and show the previous one instead. Double !! just converts it to a boolean.

@alextran1502
Copy link
Contributor

Looks good to me, besides that one question, feel free to merge

@jrasm91 jrasm91 merged commit 68b5202 into main Aug 5, 2023
21 checks passed
@jrasm91 jrasm91 deleted the refactor/time-buckets-2 branch August 5, 2023 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants