seanmturley / natureddit

A simple Reddit client, featuring a landing page dedicated to nature with posts pulled from a curated list of subreddits.
0 stars 1 forks source link

Fix or exclude posts with "slides" #162

Closed seanmturley closed 5 months ago

seanmturley commented 7 months ago

Description

Posts with "slides" don't display the image (e.g. this post). Media handling should either be improved to display the image(s) in some way, or these should be excluded from the results.

seanmturley commented 7 months ago

This link is useful for testing purposes: http://localhost:3000/natureddit/fullpage/r/LandscapePhotography/comments/1aj2zsc/a_somewhat_snowy_winter_in_the_jemez_mountains_nm/

seanmturley commented 7 months ago

Now returning an object containing the gallery URL data and a tag identifying the mediaType (which will be used for rendering logic within Card and Post. Need to implement the equivalent for "normal" image posts, then setup the conditional rendering logic in the aforementioned components.

seanmturley commented 6 months ago

Should probably rename a few things:

It's also looking like some extra components should be created to handle media rendering:

seanmturley commented 6 months ago

I played with the idea of having an Image component as a child of Media, but this seems like an unnecessary abstraction.

I have realised that wrapping Media in a Context.Provider is probably useful to pass several parameters into the image and Gallery i.e. class (referring to Card vs Post), size, subreddit name, and post title.

seanmturley commented 6 months ago

Upon further reflection, the idea of using Context.Provider to avoid props in Media was overkill - there's not much data to pass, and at worst it has to drill only 2 levels into Gallery.

I've implemented this partly - so far just dealing with images in Post via the new Media component.

seanmturley commented 6 months ago

All images are now implemented via Media.

The gallery images are also rendering in both Post and Card, but as a simple list.

To do:

seanmturley commented 6 months ago

Currently the Gallery images are all hidden off to the right page by default with left: 100%;. The idea is that the currently viewed image will be made visible with left: unset;, and eventually slide off the other side of the page with left:-100%;. Changes in left will be animated (if necessary, can use left: 0; for current slide).

seanmturley commented 6 months ago

Basic functionality of prev/next buttons are implemented in Gallery, but these need to be disabled when there is no prev/next item to view.

seanmturley commented 6 months ago

Having prev/next buttons and the current position in the Gallery only visible when the Gallery is hovered is problematic - they're the only means of communicating that the media is a Gallery, rather than just a single image. These should probably all be reverted to be visible at all times, possibly with a slight reduction in size of the prev/next buttons to make them less obtrusive.

seanmturley commented 6 months ago

The display of position in Gallery is currently unreadable in the light theme - the colours need adjusting.

seanmturley commented 5 months ago

I think this is done, and looking pretty decent.

A recent example: http://localhost:3000/natureddit/fullpage/r/LandscapePhotography/comments/1bd7t94/surrey_photography/

Closing this task as complete.