~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

next: double-tap favorites stories and galleries, a story has a ♡

Merged
Merged chadtmiller.com asked to merge into feature/hud from grain.social/grain:next/story-desktop

What changes

A story's comments on a wide window open as a sheet one phone-column wide (480px), centred over the story's picture. Grain web does the same: it draws a story in a 420px column, with its comments sheet inside that column. Before, the sheet started at the frame's column (x≈375) and ran to the right edge, over the black and the side of the picture. On a phone it is still the full-width bottom sheet. In the archive (a screen, not the pager) the sheet lines up with the story's column.

Add a comment… is the sheet's full width at every size. grain-comments draws it as a field (Compose style: "field"), like Grain web's comment input and the gallery's Add a comment…. Signed out it reads "Sign in to comment". It used to be a button-style Compose: a filled pill no wider than 24rem, which is why it stopped short.

A story can be favorited. Each story's top row in grain-stories and grain-story-archive has a ♡ between its 💬 and its ⋯. It writes a social.grain.favorite with the story's at-uri as its subject, the same record Grain web and grain-ios write. It starts done from viewer.fav, fills red as soon as it is tapped, and a second tap deletes the record. Like Grain, it shows no count, because storyView has no favCount. Signed out on the web, tapping it goes to sign in.

Double-tap to favorite, on stories and galleries. A double-tap on a story's picture (Slides like: "Favorite"), on a feed card's photo (grain-feed's Gallery) or on a gallery page's photo (grain-gallery-view's Gallery like: "Favorite") runs that ♡ and bursts a heart where the tap landed, as Grain web and grain-ios do. It only favorites: a second double-tap leaves the favorite in place and never deletes it. On a gallery page a single tap still opens the lightbox, about 250ms later, once it is clear the tap is not the first half of a double-tap. On a feed photo a single tap opens nothing, as before. A gallery's comments keep their own ♡s, which a double-tap on the photo never touches.

iOS UI tests follow the new layout. testStoryComments checks that the top row is 💬, ♡ and ⋯, each 44pt apart. testGalleryZoom opens the gallery from its card's title, because a tap on a feed photo opens nothing (HUD fa60f26, already in main) and a double-tap favorites.

vendor/hud is at d74c7fe (app/shell). That HUD draws the centred sheet and the ♡ in the top row, and has like on Slides and Gallery, with the double-tap and its heart on web, HUDKit and Android. It also fixes HUDKit's heart, which never showed on iOS: its keyframe animator was set not to repeat, which holds the first frame (invisible) instead of playing it.

Why

On next.grain.social at 1440px the comments sheet covered most of the screen, offset over the story, and the Add a comment button stopped about 700px into an 1100px sheet. Grain web and grain-ios let you heart a story and double-tap a photo to favorite it. next did neither.

How it was checked

All runs used a release HUD built from bd7494d, the server side of d74c7fe (which changes only HUDKit), with HUD_WORKSPACE=off and HUD_APPS set to this branch's next/. A stand-in for a signed-in viewer sat in front of it. The stand-in answered writes itself, so nothing reached a real account, and it put the favorites it made back into later reads as viewer.fav. No real account was used.

Web (Chromium at 390 with touch, and 1440 with a mouse):

  • Comments sheet at 1440: x 480–960, over a picture at 383–1058. Add a comment… is 456px wide in the 480px sheet, and 366px of 390 at 390.
  • Story ♡: a tap writes create_record social.grain.favorite and turns red at once. The next tap writes delete_record. Signed out, ♡ goes to /auth/signin.
  • Double-tap on a story, a feed card and a gallery page: ♡ on, heart burst, one favorite written. A second double-tap writes nothing more and deletes nothing.
  • Single taps: on a feed photo, nothing (no navigation, lightbox or write). On a gallery page, the lightbox opens about 250ms later.
  • Two quick touch scrolls over a feed photo favorited nothing.

iOS simulator (iPhone 17 Pro, the app built from this branch). The app signed in through a stand-in OAuth server on the HUD test CA, so it ran as a signed-in viewer whose writes stayed local:

  • Story: the top row is 💬 at x 234, ♡ at 278, ⋯ at 322 and ✕ at 358, all 44pt and on one line. A double-tap fills the ♡ (Favorited) and bursts the heart, with one create. A second double-tap writes nothing. Tapping ♡ deletes the favorite, and tapping it again creates one. The comments sheet comes up with a full-width Add a comment…. The story waits under it, and is still there once the sheet goes.
  • Feed card: a double-tap gives ♡ 1 and the burst, with one create. A second double-tap and a few scrolls write nothing. A single tap on the photo opens nothing, and the card's title opens the gallery.
  • Gallery page: a double-tap gives ♡ on and the burst, with one create and no lightbox. A single tap opens the lightbox.
  • testGalleryZoom and testStoryComments pass.

npm run check and node check-apps.mjs in next/ pass, and so do this pull's CI checks. HUD's own checks (svelte-check, ssr, unit, just cov at 100%, Android unit tests, hud-core tests of like against Grain's stories, feed and gallery views) pass at bd7494d. d74c7fe changes only HUDKit's heart and builds without warnings.

Shortcomings

  • No favorite count on a story's ♡, because grain-serve's storyView has no favCount.
  • Not run on a physical iPhone or on Android, only on the iOS simulator and in Chromium.
  • In the simulator run, the stand-in's only story was set to show for 15s rather than 5s. With one 1-of-1 story, the pager closes once it ends, which cut the slower steps short. The views in this pull are unchanged.
  • Needs HUD d74c7fe (app/shell) on hud-next before it deploys. An older HUD rejects Gallery's like, draws the ♡ under the 💬, and shows no heart on iOS.

bursts.png

Approved

This pull does three things. It makes the comment form a full-width field with a "Sign in to comment" prompt. It adds a ♡ Action to grain-stories and grain-story-archive that writes social.grain.favorite with the story's uri and starts done from viewer.fav. It bumps vendor/hud to 34a6147, which centres the comments sheet and draws the ♡ in the top row. The view JSON matches the existing Action pattern. I found nothing wrong in the vendored changes: the centred sheet, the Escape guard on open dialogs, the signed-out redirect in act, and the tint for a done bar action in HUDKit.

I did not run it, and I did not check that 34a6147 exists on hud-next. The author's checks and the iOS caveat in the body are noted. Merge only once that HUD commit is on hud-next.

Approved

Since my approval at 51c4d70, the pull adds "like": "Favorite" to the Slides in grain-stories and grain-story-archive. It also bumps vendor/hud to 55ed487. That bump adds a double-tap that runs the ♡ and bursts a heart where it landed. It does this on web and in HUDKit, and HUDKit's bar now also takes Actions that sit inside a Stack.

The like value matches the ♡ Action's label, "Favorite", in both views. The vendored double-tap only runs the Action when it isn't done yet, so it never un-favorites. The web tap delay applies only when like is set. I found nothing wrong.

Two things remain from the body and are unchanged. The double-tap is new since the body, and the body still lists it as a shortcoming, so it should be updated. Nobody has tried HUDKit's double-tap on a device. I did not run any of it.

Approved

Since my approval at 3ab81ef, the pull merges the base and adds a "like": "Favorite" to the Gallery in grain-feed.json and grain-gallery-view.json. A double-tap on a photo then runs the gallery's ♡. In both views a ♡ Action labelled "Favorite" exists (feed line 786, gallery view line 498), so the names match. The base merge is not the pull's own change, and I didn't review it. I read only the two JSON lines. I did not run anything.

The body is still out of date. It lists double-tap as a shortcoming, and the pull now has it for stories and galleries. The body also says nothing about the gallery change. No one has tried HUDKit's double-tap on a device.

Approved

Since my approval at d14532d, the pull's own changes look like the vendor/hud bump to d74c7fe and an update to GrainUITests. I read all of the diff from d14532d to the head, and I did not run anything.

  • HeartBurst fix: The change in DoubleTap.swift fires the burst once on appear. It sets shown = true in onAppear, with shown as the keyframe trigger, because a non-repeating animator otherwise holds its first value, which is invisible. That reads correctly. I have not seen it on a device.
  • UI test: testStoryComments now checks that the ♡ sits between the 💬 and the ⋯, each 44pt apart. testGalleryZoom now taps the card below the picture, since a double-tap on the picture favorites. Both match the new behaviour.
  • View JSON diffs: The diff also shows changes to the comment and form views: max removed, Reply and Comment relabelled "Post", and a reply prefilled with the author's handle. It also shows gallery "more" tiles with limit and where. These look like they came in with a base merge rather than from this pull, so I did not review them as the pull's own.

The body is still out of date. It lists double-tap as a shortcoming, and the pull now has it for stories and galleries.

Thanks. I've rewritten the body to cover all of it: the double-tap on stories, feed cards and gallery pages is now under What changes rather than Shortcomings. Galleries are included, with the single-tap rules (the gallery page opens the lightbox after about 250ms, a feed photo opens nothing).

HUDKit's double-tap has now been run on the iOS simulator as a stand-in signed-in viewer whose writes stayed local. That run found one bug: the heart never appeared on iOS. The burst's keyframe animator had repeating: false, which holds its first, invisible frame. HUD d74c7fe (app/shell) plays it once as it appears, and vendor/hud is now at d74c7fe. After that fix, on stories, feed cards and gallery pages, a double-tap favorites with the burst and makes one write. A second double-tap writes nothing, scrolling favorites nothing, and on a gallery page a double-tap does not open the lightbox.

The ♡ sitting between the 💬 and the ⋯ broke testStoryComments's 44pt check, so that test now checks 💬, ♡ and ⋯, each 44pt apart. testGalleryZoom now opens the gallery from its card's title, because a tap on a feed photo opens nothing. hud-next needs d74c7fe before this deploys.

Approved

Since my approval at 9a61892, the only change is in testGalleryZoom. It used to tap a fixed offset below the picture. Now it finds the card's title, scrolling the feed up a little at a time until the title shows, and taps that. The title is the first static text just below the ♡ row. It fails with a screenshot if no title shows. This only makes the test less brittle and matches the behaviour I approved. I did not run it. The body's note about the gallery test is still accurate.

Merged as a64f3f5
Part of a stack of 2
  1. next: double-tap favorites stories and galleries, a story has a ♡ Landed as a64f3f5
  2. main