Closed achou11 closed 3 months ago
Misunderstood the ticket that this is supposedly addressing, so this PR is relatively non-urgent. will keep as a draft for now in case we are interested in potentially merging since it's mostly done. what's missing is implementation of some of the thumbnails based on ready-to-go designs.
Let's maybe hold off on this until we have some UX time available to think through whether these should be pressable and when the modal should look like, and also make sure that we have the different states correctly included.
~Towards #449~ EDIT: see PR comment - not totally accurate
Updates the existing observation screen to better handle valid attachment types that it may be unfamiliar with. At the moment, any non-photo attachments are essentially rendering a placeholder thumbnail with some copy about what it is. when saving other attachment types is more extensively implemented, updating the corresponding placeholders should be straightforward.
Open to ideas about what the placeholders should look like. Tried to use my best judgment but I'm sure it can be improved upon.
To support this, this PR introduces more flexible and reusable components with the intention of replacing the existing
MediaScrollView
component. reasons for a new component:the
MediaScrollView
implementation only works with photos. in addition to that, there's a good amount code that's attempting to unify the interface for a photo attachment and a draft photo. i found that mixing these together instead of separating the implementations made the implementation difficult to follow, and I have a strong idea of how to go about this (that i think is easier to reason about)moves the attachment blob url query logic closer to where it's needed. the existing implementation had a more complicated approach of using
useQueries
and mapping over the observation attachments at the list level. it also did not fully handle error or loading states for any of these queries. my change introduces a query that's meant to be used at the singular level i.e. when the attachment thumbnail component is rendered (not at the list level).uses a
FlatList
instead ofScrollView
, which may not be completely necessary but felt like an appropriate change (see differences here)Follow up PRs will update the other callsites of the
MediaScrollView
component (editor component, which is planned to be used in the observation edit screen)There may be some design help needed but I did what felt reasonable for now, especially since we don't have a non-experimental way of creating other attachment types just yet.
Preview
Success (not scrollable):
Success (scrollable):
Loading (when fetching blob url, not the image itself):
Error (when trying to fetch blob url, or if the image can't load):