From 204d5f68319b97ca03b7c60f77b53126d6b67cf8 Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Thu, 1 Oct 2026 20:46:29 +0200 Subject: [PATCH] fix: eigene Story als Ring "Deine Story" in der Story-Leiste (Web + App) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Leiste zeigte nur Storys gefolgter Tiere — das eigene aktive Tier war nie enthalten, man konnte die eigene Story nach dem Posten nicht ansehen. Neuer Ring direkt nach der "+"-Kachel, solange stories.hasActiveStory für das aktive Tier true ist. Co-Authored-By: Claude Opus 5.5 --- messages/de.json | 3 +- messages/en.json | 3 +- mobile/found.md | 3 ++ mobile/src/components/StoryTray.tsx | 41 +++++++++++++++++++--------- mobile/src/i18n/locales/de.json | 3 +- mobile/src/i18n/locales/en.json | 3 +- src/components/stories/StoryTray.tsx | 40 +++++++++++++++++++++++++++ 7 files changed, 79 insertions(+), 17 deletions(-) diff --git a/messages/de.json b/messages/de.json index 13b129f..6670c3c 100644 --- a/messages/de.json +++ b/messages/de.json @@ -586,7 +586,8 @@ "StoryTray": { "storiesAriaLabel": "Storys", "addStory": "Story hinzufügen", - "newStoryTitle": "Neue Story" + "newStoryTitle": "Neue Story", + "yourStory": "Deine Story" }, "RepostCard": { "pawedBackBy": "Paw-Back von" diff --git a/messages/en.json b/messages/en.json index 7e5d810..c8ff329 100644 --- a/messages/en.json +++ b/messages/en.json @@ -586,7 +586,8 @@ "StoryTray": { "storiesAriaLabel": "Stories", "addStory": "Add story", - "newStoryTitle": "New Story" + "newStoryTitle": "New Story", + "yourStory": "Your story" }, "RepostCard": { "pawedBackBy": "Pawed-back by" diff --git a/mobile/found.md b/mobile/found.md index dd24bdc..a97a331 100644 --- a/mobile/found.md +++ b/mobile/found.md @@ -139,6 +139,9 @@ Neu 7: **Stolperstein beim Publish:** Das lokale (gitignorete) `mobile/android/`-Verzeichnis vom Device-Test der letzten Session ließ `eas update` das Projekt fälschlich als "Bare Workflow" erkennen (`CommandError: runtime version policies are not supported` statt der konfigurierten `"policy": "appVersion"`) — Fix war, `android/` kurz umzubenennen/wegzuschieben, Update zu publishen, danach zurückzubenennen. Für künftige OTA-Publishes nach einem lokalen `expo run:android`-Test: dasselbe Problem erwarten. - [x] Im Pet-Profil ist der Erste Post nicht Klickbar da er in die Gesten-Steuerung rein ragt. → Ursache: Android läuft edge-to-edge, und die Stack-Screens (ohne Tab-Leiste darunter) hatten unten keinen Safe-Area-Abstand — der letzte Inhalt lag unter der Gesten-Leiste. Fix: neuer Hook `src/hooks/useBottomSafePadding.ts` (paddingBottom = 16 + insets.bottom), eingebaut in Tierprofil, Follower, Folgt, Gesundheit, Meilensteine, Profil bearbeiten, Einstellungen, Suche, Nachrichten-Liste und Konto löschen. Commit `de237f1`, per OTA für Android veröffentlicht (Update-Group `4dc6f797`), noch nicht am Gerät bestätigt. Gilt automatisch auch für iOS (Home-Indicator). +- [x] Nutzer-Feedback: Nach dem Posten einer Story erscheint man selbst nicht als Ring — man kann die eigene Story nicht ansehen. + → Ursache (Web **und** App gleich): Die Story-Leiste zeigt nur die „+“-Kachel und Storys gefolgter Tiere (`follows.getPetsWithActiveStories`); das eigene aktive Tier ist darin nie enthalten. Fix: zusätzlicher Ring „Deine Story“ direkt nach der „+“-Kachel, solange das aktive Tier eine aktive Story hat (`stories.hasActiveStory`, wird nach dem Posten schon invalidiert). Web: `src/components/stories/StoryTray.tsx` (öffnet den StoryViewer — dort sieht der Owner auch die Zuschauerliste); App: `src/components/StoryTray.tsx`. Typecheck/Tests/Build grün; die 2 Lint-Fehler „Cannot access refs during render“ in der Web-StoryTray bestanden schon vorher (horizontales Scrollen). + **Story-Kommentare:** Backend (`stories.addComment/listComments/deleteComment`, `toggleReaction`, `getViewers`) und Web-UI (`StoryCommentsOverlay`) existieren bereits — nur der App-Viewer (`app/(app)/story-viewer.tsx`) hat Kommentare, Reaktionen und Zuschauerliste beim Portieren bewusst ausgelassen. Offen als eigener Punkt. - diff --git a/mobile/src/components/StoryTray.tsx b/mobile/src/components/StoryTray.tsx index 4513ba5..9e31e4e 100644 --- a/mobile/src/components/StoryTray.tsx +++ b/mobile/src/components/StoryTray.tsx @@ -16,8 +16,9 @@ const RING_BOX = getPawRingBox(AVATAR_SIZE); /** * Port of web's src/components/stories/StoryTray.tsx: an "add story" tile - * for the active pet, then followed pets with an active story (each in a - * PawRing). No viewer list, reactions, or comments on stories yet (Gitea + * for the active pet, then the active pet's own story while it has one + * ("Deine Story" — the followed-pets query never includes the viewer's own + * pet), then followed pets with an active story (each in a PawRing). No viewer list, reactions, or comments on stories yet (Gitea * #29 on web) — that's a fast-follow, matching how earlier phases trimmed * AI-disclosure/mentions from ported forms. Photo stories only, no video * story upload/playback (mirrors mobile's post-creation scope decision). @@ -26,10 +27,22 @@ export function StoryTray() { const { t } = useTranslation(); const trpc = useTRPC(); const router = useRouter(); - const { activePetId } = useActivePet(); + const { activePetId, pets } = useActivePet(); const { colors } = useTheme(); const styles = useMemo(() => makeStyles(colors), [colors]); + const { data: ownStory } = useQuery({ + ...trpc.stories.hasActiveStory.queryOptions({ petId: activePetId ?? "" }), + enabled: !!activePetId, + }); + const activePet = pets.find((pet) => pet.id === activePetId) ?? null; + + const openViewer = (pet: { id: string; name: string; avatarKey?: string | null }) => + router.push({ + pathname: "/story-viewer", + params: { petId: pet.id, petName: pet.name, petAvatarKey: pet.avatarKey ?? "" }, + }); + const { data: followedWithStories = [] } = useQuery({ ...trpc.follows.getPetsWithActiveStories.queryOptions({ followerPetId: activePetId ?? "" }), enabled: !!activePetId, @@ -48,17 +61,19 @@ export function StoryTray() { + {ownStory?.hasStory && activePet && ( + openViewer(activePet)}> + + + + + {t("feed.yourStory")} + + + )} + {followedWithStories.map((pet) => ( - - router.push({ - pathname: "/story-viewer", - params: { petId: pet.id, petName: pet.name, petAvatarKey: pet.avatarKey ?? "" }, - }) - } - > + openViewer(pet)}> diff --git a/mobile/src/i18n/locales/de.json b/mobile/src/i18n/locales/de.json index 7d6f4a6..2e2ff09 100644 --- a/mobile/src/i18n/locales/de.json +++ b/mobile/src/i18n/locales/de.json @@ -48,7 +48,8 @@ "feed": { "empty": "Noch keine Beiträge im Feed.", "storyLabel": "Story", - "trendingBadge": "Trending" + "trendingBadge": "Trending", + "yourStory": "Deine Story" }, "explore": { "allTab": "Alle", diff --git a/mobile/src/i18n/locales/en.json b/mobile/src/i18n/locales/en.json index e78e01c..0dc223d 100644 --- a/mobile/src/i18n/locales/en.json +++ b/mobile/src/i18n/locales/en.json @@ -48,7 +48,8 @@ "feed": { "empty": "No posts in your feed yet.", "storyLabel": "Story", - "trendingBadge": "Trending" + "trendingBadge": "Trending", + "yourStory": "Your story" }, "explore": { "allTab": "All", diff --git a/src/components/stories/StoryTray.tsx b/src/components/stories/StoryTray.tsx index 111e594..a4b2c28 100644 --- a/src/components/stories/StoryTray.tsx +++ b/src/components/stories/StoryTray.tsx @@ -27,6 +27,10 @@ const TRAY_ITEM_SIZE = TRAY_AVATAR_SIZE + RING_PAD * 2; // total height of a Paw * StoryTray — horizontal scroll row at the top of the feed. * * First item: "Add story" button (orange) → opens StoryForm dialog. + * Second item (only while it has an active story): the active pet's own + * story — the followed-pets query below never includes the viewer's own pet, + * so without this an owner could not see what they just posted (and the + * owner-only viewer list in StoryViewer was unreachable from the tray). * Remaining items: pets followed by the active pet that have active stories, * each wrapped in PawRing. Tapping a pet opens the StoryViewer. */ @@ -44,6 +48,16 @@ export function StoryTray() { } | null>(null); // Fetch pets followed by the active pet that have active stories + // Eigene Story: gleiche Query-Form wie StoryForm's Invalidierung ({ petId }), + // damit der Ring direkt nach dem Posten erscheint. + const { data: ownStory } = useQuery({ + ...trpc.stories.hasActiveStory.queryOptions({ petId: activePetId ?? "" }), + enabled: !!activePetId, + }); + const { data: myPets = [] } = useQuery({ ...trpc.pets.list.queryOptions(), enabled: !!activePetId }); + const activePet = myPets.find((pet) => pet.id === activePetId) ?? null; + const showOwnStory = !!ownStory?.hasStory && !!activePet; + const { data: followedWithStories = [] } = useQuery({ ...trpc.follows.getPetsWithActiveStories.queryOptions({ followerPetId: activePetId ?? "", @@ -81,6 +95,32 @@ export function StoryTray() { + {/* Own active story */} + {showOwnStory && activePet && ( +
+ + setViewingPet({ id: activePet.id, name: activePet.name, avatarKey: activePet.avatarKey ?? null }) + } + > + + {activePet.avatarKey && ( + + )} + + {activePet.name[0]?.toUpperCase() ?? "?"} + + + + {t("yourStory")} +
+ )} + {/* Followed pets with active stories */} {followedWithStories.map((pet) => (