fix(01-04): replace all R2/api-avatar URLs with Supabase Storage CDN via getAvatarUrl()

This commit is contained in:
admin committed 2026-06-06 11:38:37 +02:00
1 parent e3c279d6a4
commit 95e42f5474
5 files changed
+18 -12

No files matched your search

+3 -2
View File
@@ -20,6 +20,7 @@ import {
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Badge } from "@/components/ui/badge";
import { useActivePet } from "@/context/ActivePetContext";
import { getAvatarUrl } from "@/lib/avatar-url";
type Pet = {
id: string;
@@ -70,7 +71,7 @@ export function MobileNav({ pets }: MobileNavProps) {
<Avatar className="h-6 w-6 shrink-0">
{activePet.avatarKey && (
<AvatarImage
src={`${process.env.NEXT_PUBLIC_R2_PUBLIC_URL}/${activePet.avatarKey}`}
src={getAvatarUrl(activePet.avatarKey)!}
alt={activePet.name}
/>
)}
@@ -93,7 +94,7 @@ export function MobileNav({ pets }: MobileNavProps) {
<Avatar className="h-6 w-6 shrink-0">
{pet.avatarKey && (
<AvatarImage
src={`${process.env.NEXT_PUBLIC_R2_PUBLIC_URL}/${pet.avatarKey}`}
src={getAvatarUrl(pet.avatarKey)!}
alt={pet.name}
/>
)}
+3 -2
View File
@@ -22,6 +22,7 @@ import {
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Badge } from "@/components/ui/badge";
import { useActivePet } from "@/context/ActivePetContext";
import { getAvatarUrl } from "@/lib/avatar-url";
type Pet = {
id: string;
@@ -85,7 +86,7 @@ export function Sidebar({ pets }: SidebarProps) {
<Avatar className="h-8 w-8 shrink-0">
{activePet.avatarKey && (
<AvatarImage
src={`${process.env.NEXT_PUBLIC_R2_PUBLIC_URL}/${activePet.avatarKey}`}
src={getAvatarUrl(activePet.avatarKey)!}
alt={activePet.name}
/>
)}
@@ -108,7 +109,7 @@ export function Sidebar({ pets }: SidebarProps) {
<Avatar className="h-6 w-6 shrink-0">
{pet.avatarKey && (
<AvatarImage
src={`${process.env.NEXT_PUBLIC_R2_PUBLIC_URL}/${pet.avatarKey}`}
src={getAvatarUrl(pet.avatarKey)!}
alt={pet.name}
/>
)}
+2 -4
View File
@@ -3,6 +3,7 @@
import { Card, CardContent } from "@/components/ui/card";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Badge } from "@/components/ui/badge";
import { getAvatarUrl } from "@/lib/avatar-url";
/**
* PetCard — renders a pet's identity card for the My Pets grid.
@@ -53,10 +54,7 @@ export function PetCard({ pet, isActive, onSelect }: PetCardProps) {
}`}
>
{pet.avatarKey && (
<AvatarImage
src={`/api/avatar/${pet.avatarKey}`}
alt={pet.name}
/>
<AvatarImage src={getAvatarUrl(pet.avatarKey)!} alt={pet.name} />
)}
<AvatarFallback className="text-base font-semibold">
{getInitials(pet.name)}