fix(mobile): feed separation, adaptive launcher icon; feat: full pet profile
Fixes from user testing on a real device: - Feed: replaced an invisible spacing-only separator with an actual hairline divider between posts. - Android launcher icon showed Expo's default placeholder (a blue arrow) because the app icon and the Android adaptive-icon layers (foreground/background/monochrome) are two separate asset sets — only icon.png/favicon.png had been replaced. Added scripts/derive-adaptive- icon.js to crop the paw glyph out of icon.png (detected by its marigold color) and generate all three adaptive-icon layers plus the splash icon; this is an explicit placeholder per user's own call, not final art. New: full pet profile (app/(app)/pets/[petId]/), matching web's src/app/(app)/pets/[petId]/page.tsx: - View: identity, species, bio/adoption story, follower/following counts (tappable → list screens), the pet's own posts below. - Follow/unfollow with real initial state (follows.isFollowing) and optimistic toggle — unlike feed reactions, this endpoint actually exists, so no need to fake an initial state. - Edit screen (name/nickname/bio/adoption story via pets.update) for the owner's own pets. - Tapping a pet (feed header, Explore card, Pets-tab row) now opens this profile instead of nowhere; the Pets tab's active-pet switch is now a separate checkmark control instead of overloading the whole row tap. PostCard's post-shape prop is now structural rather than tied to feed.getFeed's output type, since posts.byPetId selects `pet` via the narrower petIdentitySelect (no isVerified/owner) — both need to satisfy the same component. Verified end-to-end on-device: feed separator visible, own-pet profile shows a working Bearbeiten button whose form is correctly prefilled (a stray edit was made to Bianca's nickname field by mistake during testing and was discarded via back-navigation without saving — never sent to the server), someone else's pet profile shows a working Follow/Unfollow toggle, followers list navigates correctly, and the home-screen launcher icon now shows the paw instead of the default Expo icon.
This commit is contained in:
1 parent
c35d4cda46
commit
a737a17976
15 files changed
+583
-36
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { View, Text, StyleSheet, ScrollView, useWindowDimensions } from "react-native";
|
||||
import { View, Text, Pressable, StyleSheet, ScrollView, useWindowDimensions } from "react-native";
|
||||
import { useRouter } from "expo-router";
|
||||
import { Image } from "expo-image";
|
||||
import { MessageCircle, Repeat2, Video } from "lucide-react-native";
|
||||
import { PetAvatar } from "./PetAvatar";
|
||||
@@ -7,10 +8,43 @@ import { PawButton } from "./PawButton";
|
||||
import { getMediaUrl } from "../lib/media-url";
|
||||
import { formatPetName, formatRelativeTime } from "../lib/format";
|
||||
import { colors, typography, radii } from "../theme/tokens";
|
||||
import type { FeedPost } from "../api/types";
|
||||
|
||||
/**
|
||||
* Structural rather than imported from a single router's inferred output:
|
||||
* `feed.getFeed` selects `pet` via `petCardSelect` (isVerified/owner
|
||||
* present), but `posts.byPetId` selects it via the narrower
|
||||
* `petIdentitySelect` (those keys absent, not just undefined) — both need
|
||||
* to satisfy this prop type, so isVerified/owner are optional here.
|
||||
*/
|
||||
type PostCardImage = {
|
||||
id: string;
|
||||
storageKey: string;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
blurhash?: string | null;
|
||||
};
|
||||
|
||||
type PostCardPost = {
|
||||
id: string;
|
||||
type?: string | null;
|
||||
caption?: string | null;
|
||||
createdAt: string | Date;
|
||||
reactionCount?: number | null;
|
||||
commentCount?: number | null;
|
||||
repostCount?: number | null;
|
||||
images: PostCardImage[];
|
||||
pet: {
|
||||
id: string;
|
||||
name: string;
|
||||
nickname?: string | null;
|
||||
avatarKey?: string | null;
|
||||
isVerified?: boolean;
|
||||
owner?: { sponsorSince: Date | string | null; sponsorPeriodEnd: Date | string | null } | null;
|
||||
};
|
||||
};
|
||||
|
||||
type Props = {
|
||||
post: FeedPost;
|
||||
post: PostCardPost;
|
||||
/** The signed-in owner's currently active pet — the one reacting/acting. */
|
||||
actingPetId: string;
|
||||
};
|
||||
@@ -25,11 +59,12 @@ type Props = {
|
||||
*/
|
||||
export function PostCard({ post, actingPetId }: Props) {
|
||||
const { width } = useWindowDimensions();
|
||||
const router = useRouter();
|
||||
const cardWidth = width - 32; // matches the 16px screen padding used by the feed list
|
||||
|
||||
return (
|
||||
<View style={styles.card}>
|
||||
<View style={styles.header}>
|
||||
<Pressable style={styles.header} onPress={() => router.push(`/pets/${post.pet.id}`)}>
|
||||
<PetAvatar name={post.pet.name} avatarKey={post.pet.avatarKey} />
|
||||
<View style={styles.headerText}>
|
||||
<View style={styles.nameRow}>
|
||||
@@ -38,7 +73,7 @@ export function PostCard({ post, actingPetId }: Props) {
|
||||
</View>
|
||||
<Text style={styles.timestamp}>{formatRelativeTime(post.createdAt)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
|
||||
{post.type === "VIDEO" ? (
|
||||
<View style={[styles.videoPlaceholder, { width: cardWidth }]}>
|
||||
@@ -65,7 +100,7 @@ export function PostCard({ post, actingPetId }: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
function PostImages({ images, width }: { images: FeedPost["images"]; width: number }) {
|
||||
function PostImages({ images, width }: { images: PostCardImage[]; width: number }) {
|
||||
if (images.length === 0) return null;
|
||||
|
||||
if (images.length === 1) {
|
||||
@@ -81,7 +116,7 @@ function PostImages({ images, width }: { images: FeedPost["images"]; width: numb
|
||||
);
|
||||
}
|
||||
|
||||
function PostImage({ image, width }: { image: FeedPost["images"][number]; width: number }) {
|
||||
function PostImage({ image, width }: { image: PostCardImage; width: number }) {
|
||||
const rawRatio = image.width && image.height ? image.width / image.height : 1;
|
||||
const aspectRatio = Math.min(1.91, Math.max(0.75, rawRatio));
|
||||
|
||||
|
||||
Reference in new issue
Block a user