From 2ef439c7524cc11c4a6b31479851da07b100389a Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Sat, 26 Sep 2026 12:41:43 +0200 Subject: [PATCH] fix(mobile): story paw ring clipped at the top MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The middle toe beans reach y = -9 in the 0–100 viewBox. Web draws the SVG with overflow: visible; react-native-svg clips at the viewBox, cutting the paw off. Extend the viewBox upward and grow the box to match; the "add story" tile uses the same box so it lines up with the rings. Co-Authored-By: Claude Opus 5.5 --- mobile/src/components/PawRing.tsx | 33 +++++++++++++++++++++++------ mobile/src/components/StoryTray.tsx | 19 +++++++++++++---- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/mobile/src/components/PawRing.tsx b/mobile/src/components/PawRing.tsx index 9793fb2..15040a2 100644 --- a/mobile/src/components/PawRing.tsx +++ b/mobile/src/components/PawRing.tsx @@ -13,9 +13,22 @@ type Props = { }; const RING_PAD = 8; +// The two middle toe beans (cy 1, r 10) reach up to y = -9 in the 0–100 +// viewBox. Web renders the SVG with `overflow: visible`; react-native-svg +// clips at the viewBox instead, which cut the paw off at the top (found.md +// "Story Ring ist abgeschnitten"). So the viewBox starts BEAN_OVERHANG units +// higher and the box grows by the same proportion. +const BEAN_OVERHANG = 10; const UNSEEN_COLOR = "#f97316"; const SEEN_COLOR = "#9ca3af"; +/** Outer box of a PawRing for a given avatar size — lets siblings (StoryTray's "add" tile) line up with it. */ +export function getPawRingBox(size: number) { + const width = size + RING_PAD * 2; + const overhang = (width * BEAN_OVERHANG) / 100; + return { width, height: width + overhang, paddingTop: overhang }; +} + /** * Port of web's src/components/stories/PawRing.tsx — a paw-print outline * (one big circle + four "toe bean" circles) drawn with react-native-svg @@ -32,7 +45,7 @@ export function PawRing({ petId, children, size = 32, onPress }: Props) { const { hasStory, allSeen } = data; const ringColor = allSeen ? SEEN_COLOR : UNSEEN_COLOR; - const outerSize = size + RING_PAD * 2; + const box = getPawRingBox(size); const strokeWidth = Math.max(4, size / 8); const beans = [ { cx: 13, cy: 10, r: 8 }, @@ -42,13 +55,21 @@ export function PawRing({ petId, children, size = 32, onPress }: Props) { ]; const content = ( - + {hasStory && ( {beans.map((b, i) => ( diff --git a/mobile/src/components/StoryTray.tsx b/mobile/src/components/StoryTray.tsx index 278cb2f..4513ba5 100644 --- a/mobile/src/components/StoryTray.tsx +++ b/mobile/src/components/StoryTray.tsx @@ -7,11 +7,12 @@ import { PlusCircle } from "lucide-react-native"; import { useTRPC } from "../api/trpc"; import { useActivePet } from "../context/ActivePetContext"; import { useTheme } from "../context/ThemeContext"; -import { PawRing } from "./PawRing"; +import { PawRing, getPawRingBox } from "./PawRing"; import { PetAvatar } from "./PetAvatar"; import { fontFamily, type ColorTokens } from "../theme/tokens"; const AVATAR_SIZE = 56; +const RING_BOX = getPawRingBox(AVATAR_SIZE); /** * Port of web's src/components/stories/StoryTray.tsx: an "add story" tile @@ -37,8 +38,10 @@ export function StoryTray() { return ( router.push("/story-new")}> - - + + + + {t("feed.storyLabel")} @@ -71,7 +74,15 @@ export function StoryTray() { function makeStyles(colors: ColorTokens) { return StyleSheet.create({ row: { gap: 16, paddingHorizontal: 16, paddingVertical: 12 }, - item: { alignItems: "center", gap: 4, width: 72 }, + item: { alignItems: "center", gap: 4, width: RING_BOX.width }, + // Same box as a PawRing so the "add" tile lines up with the story rings. + addButtonBox: { + width: RING_BOX.width, + height: RING_BOX.height, + paddingTop: RING_BOX.paddingTop, + alignItems: "center", + justifyContent: "center", + }, addButton: { width: AVATAR_SIZE, height: AVATAR_SIZE,