fix: resolve 5 bugs from dev testing
- PostCard: add variant="detail" (object-contain + black bg) for profile sheet — full image in original format - VideoCard: getByPostId polls Mux API directly when PROCESSING, self-heals without webhooks in dev - PawRing: gray ring for all-seen stories, orange for unseen; reads viewerPetId from ActivePetContext - Search: add People tab via new search.byOwner (Clerk username search → owner's pets) - Notifications: rows now navigate to actor profile (FOLLOW) or pet profile (REACTION/COMMENT) - Notifications router: include post.petId for navigation target Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
60366691e8
commit
da0f9f2bb7
9 files changed
+261
-59
No files matched your search
@@ -110,6 +110,11 @@ export type PostCardProps = {
|
||||
post: PostCardPost;
|
||||
/** Called after successful delete so parent can remove from list */
|
||||
onDeleted?: (postId: string) => void;
|
||||
/**
|
||||
* "feed" (default): images cropped to max-h-[560px] object-cover — consistent card heights.
|
||||
* "detail": images shown in full original format (object-contain, black bg) — used in profile sheet.
|
||||
*/
|
||||
variant?: "feed" | "detail";
|
||||
};
|
||||
|
||||
function formatRelativeTime(date: Date | string): string {
|
||||
@@ -127,7 +132,7 @@ function formatRelativeTime(date: Date | string): string {
|
||||
return new Date(date).toLocaleDateString();
|
||||
}
|
||||
|
||||
export function PostCard({ post, onDeleted }: PostCardProps) {
|
||||
export function PostCard({ post, onDeleted, variant = "feed" }: PostCardProps) {
|
||||
const trpc = useTRPC();
|
||||
const { activePetId } = useActivePet();
|
||||
|
||||
@@ -325,7 +330,7 @@ export function PostCard({ post, onDeleted }: PostCardProps) {
|
||||
<img
|
||||
src={getMediaUrl(img.storageKey) ?? ""}
|
||||
alt={currentCaption ?? `${pet.name}'s post`}
|
||||
className="w-full object-cover max-h-[560px]"
|
||||
className={variant === "detail" ? "w-full object-contain bg-black max-h-[70dvh]" : "w-full object-cover max-h-[560px]"}
|
||||
/>
|
||||
</CarouselItem>
|
||||
))}
|
||||
@@ -357,12 +362,12 @@ export function PostCard({ post, onDeleted }: PostCardProps) {
|
||||
</div>
|
||||
) : (
|
||||
/* Single image */
|
||||
<div className="w-full">
|
||||
<div className={variant === "detail" ? "w-full bg-black flex justify-center" : "w-full"}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src={getMediaUrl(images[0].storageKey) ?? ""}
|
||||
alt={currentCaption ?? `${pet.name}'s post`}
|
||||
className="w-full object-cover max-h-[560px]"
|
||||
className={variant === "detail" ? "max-w-full max-h-[70dvh] object-contain" : "w-full object-cover max-h-[560px]"}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -123,6 +123,7 @@ export function ProfileTabs({ petId }: ProfileTabsProps) {
|
||||
{selectedPost && (
|
||||
<PostCard
|
||||
post={selectedPost}
|
||||
variant="detail"
|
||||
onDeleted={() => setSelectedPost(null)}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useTRPC } from "@/trpc/client";
|
||||
import { useActivePet } from "@/context/ActivePetContext";
|
||||
|
||||
interface PawRingProps {
|
||||
petId: string;
|
||||
@@ -13,39 +14,40 @@ interface PawRingProps {
|
||||
onPress?: () => void;
|
||||
}
|
||||
|
||||
const RING_PAD = 8; // px of space outside avatar for the paw outline
|
||||
const RING_PAD = 8;
|
||||
|
||||
/**
|
||||
* PawRing — wraps an avatar with a paw-print outline when the pet has an active story.
|
||||
*
|
||||
* Design: the main pad is a circle slightly larger than the avatar; four toe beans sit
|
||||
* above it, collectively forming a paw silhouette. The entire outline is orange-500.
|
||||
* Activates only when stories.hasActiveStory returns true (STORY-02).
|
||||
* Orange = unseen stories; gray = all stories already seen; no ring = no stories (STORY-02).
|
||||
* viewerPetId is read from ActivePetContext so callers don't need to pass it explicitly.
|
||||
*/
|
||||
export function PawRing({ petId, children, size = 32, onPress }: PawRingProps) {
|
||||
const trpc = useTRPC();
|
||||
const { data: hasStory = false } = useQuery(
|
||||
trpc.stories.hasActiveStory.queryOptions({ petId })
|
||||
const { activePetId } = useActivePet();
|
||||
|
||||
const { data = { hasStory: false, allSeen: false } } = useQuery(
|
||||
trpc.stories.hasActiveStory.queryOptions({
|
||||
petId,
|
||||
viewerPetId: activePetId ?? undefined,
|
||||
})
|
||||
);
|
||||
|
||||
const S = size + RING_PAD * 2; // total container px
|
||||
const { hasStory, allSeen } = data;
|
||||
const ringColor = allSeen ? "#9ca3af" : "#f97316"; // gray-400 if seen, orange-500 if unseen
|
||||
|
||||
const S = size + RING_PAD * 2;
|
||||
|
||||
// All SVG coordinates derived from container size S so the paw scales with the avatar.
|
||||
// viewBox is fixed at 100×100; S px maps to 100 SVG units.
|
||||
// Main pad: slightly larger than the avatar circle, centered horizontally,
|
||||
// shifted down so the toe beans have room above.
|
||||
const mainCx = 50;
|
||||
const mainCy = 50;
|
||||
const mainR = 44;
|
||||
const strokeW = Math.max(4, (size / 8)); // thicker ring for larger avatars
|
||||
const strokeW = Math.max(4, size / 8);
|
||||
|
||||
// 4 toe beans above the main pad — positions as fractions of the 100-unit viewBox.
|
||||
// They overlap the top of the main circle slightly (natural paw anatomy).
|
||||
const beans = [
|
||||
{ cx: 13, cy: 10, r: 8 }, // far left toe
|
||||
{ cx: 31, cy: 1, r: 10 }, // inner left toe
|
||||
{ cx: 69, cy: 1, r: 10 }, // inner right toe
|
||||
{ cx: 87, cy: 10, r: 8 }, // far right toe
|
||||
{ cx: 13, cy: 10, r: 8 },
|
||||
{ cx: 31, cy: 1, r: 10 },
|
||||
{ cx: 69, cy: 1, r: 10 },
|
||||
{ cx: 87, cy: 10, r: 8 },
|
||||
];
|
||||
|
||||
const Tag = hasStory && onPress ? "button" : "div";
|
||||
@@ -66,18 +68,16 @@ export function PawRing({ petId, children, size = 32, onPress }: PawRingProps) {
|
||||
aria-hidden="true"
|
||||
style={{ overflow: "visible" }}
|
||||
>
|
||||
{/* Main pad ring */}
|
||||
<circle
|
||||
cx={mainCx}
|
||||
cy={mainCy}
|
||||
r={mainR}
|
||||
fill="none"
|
||||
stroke="#f97316"
|
||||
stroke={ringColor}
|
||||
strokeWidth={strokeW}
|
||||
/>
|
||||
{/* Toe beans */}
|
||||
{beans.map((b, i) => (
|
||||
<circle key={i} cx={b.cx} cy={b.cy} r={b.r} fill="#f97316" />
|
||||
<circle key={i} cx={b.cx} cy={b.cy} r={b.r} fill={ringColor} />
|
||||
))}
|
||||
</svg>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user