Author SHA1 Message Date
admin ab88d6e1bc fix(ui): stabilize post preview modal and cleanup global styles
- fix post preview modal height and scrolling (comments fully visible)
- prevent bottom navigation from overlapping modal content
- cleanup duplicate global CSS definitions
- normalize spacing and overflow behavior across feed and explore
- improve overall layout stability on mobile devices
2025-12-24 22:33:47 +01:00
admin 6ebbd5d457 feat(ui): global redesign, unified layout and personalized feed
- introduce global design system via CSS variables
- modern green-based color palette with improved readability
- unify Feed, Explore and Profile visual language
- add discovery posts visual highlight via border (no text shift)
- improve card depth, shadows and container consistency
- stabilize personalized feed logic (subscriptions + discovery)
- prepare UI for future theming without TSX changes
2025-12-24 15:52:34 +01:00
7 changed files with 1239 additions and 823 deletions

No files matched your search

+89 -212
View File
@@ -1,242 +1,119 @@
'use client'; 'use client';
import { useState, useEffect } from 'react'; import { useRef } from 'react';
import CommentModal from '../CommentModal/CommentModal';
type Comment = { export type PostCardData = {
id: number; id: number;
author: string; petName: string;
petType: 'Hund' | 'Katze';
authorName: string;
createdAt: string;
text: string; text: string;
}; likesCount: number;
commentsCount: number;
type Media = {
type: 'image' | 'video';
url: string;
aspect: '1:1' | '9:16';
}; };
type PostCardProps = { type PostCardProps = {
petName: string; post: PostCardData;
petType: 'Hund' | 'Katze'; isDiscovery?: boolean
ownerName?: string; onOpenPreview: (post: PostCardData) => void;
text: string; onCommentClick?: (post: PostCardData) => void;
createdAt: string;
media?: Media;
likes: number;
likedByCurrentUser?: boolean;
commentsCount: number;
commentsList: Comment[];
}; };
// 🔐 Simulierter eingeloggter User
const CURRENT_USER_ID = 1;
export default function PostCard({ export default function PostCard({
petName, post,
petType, onOpenPreview,
ownerName, onCommentClick,
text, isDiscovery,
createdAt,
media,
likes,
likedByCurrentUser,
commentsCount,
commentsList,
}: PostCardProps) { }: PostCardProps) {
const [showComments, setShowComments] = useState(false); const likeRef = useRef<HTMLButtonElement | null>(null);
const [showMediaFullscreen, setShowMediaFullscreen] = useState(false); const commentRef = useRef<HTMLButtonElement | null>(null);
const [localLikes, setLocalLikes] = useState(likes); function animate(
const [liked, setLiked] = useState(!!likedByCurrentUser); ref: React.RefObject<HTMLButtonElement>,
animation: string
const isSquare = media?.aspect === '1:1'; ) {
if (!ref.current) return;
// ⛔ Scroll sperren bei Vollbild const el = ref.current;
useEffect(() => { el.style.animation = animation;
if (showMediaFullscreen) { el.addEventListener(
document.body.style.overflow = 'hidden'; 'animationend',
} else { () => {
document.body.style.overflow = ''; el.style.animation = '';
} },
}, [showMediaFullscreen]); { once: true }
);
}
return ( return (
<> <article
<article className={`postcard ${
style={{ isDiscovery ? 'postcard--discovery' : ''
border: '1px solid #e5e5e5', }`}
borderRadius: '16px', >
backgroundColor: 'white',
overflow: 'hidden', {/* Klickbarer Bereich → Preview */}
}} <div
className="postcard-main"
onClick={() => onOpenPreview(post)}
> >
{/* HEADER */} <div className="postcard-media" />
<header style={{ padding: '1rem', display: 'grid', gap: '0.2rem' }}>
<div style={{ fontWeight: 800, fontSize: '1.1rem' }}>
{petName}{' '}
<span style={{ fontWeight: 500, color: '#666' }}>
({petType})
</span>
</div>
<div style={{ fontSize: '0.8rem', color: '#777' }}> <div className="postcard-content">
{createdAt} <div className="postcard-header">
{ownerName && ( {isDiscovery && (
<> <div className="post-discovery-wrapper">
{' · '}
<span style={{ fontStyle: 'italic' }}>
verwaltet von {ownerName}
</span>
</>
)}
</div>
</header>
{/* MEDIA */} </div>
{media && ( )}
<div
onClick={() => setShowMediaFullscreen(true)}
style={{
width: '100%',
aspectRatio: isSquare ? '1 / 1' : '9 / 16',
backgroundColor: '#000',
cursor: 'pointer',
}}
>
{media.type === 'image' && (
<img
src={media.url}
alt={petName}
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
}}
/>
)}
{media.type === 'video' && ( <div className="postcard-title-row">
<video <strong className="postcard-title">
src={media.url} {post.petName}
muted </strong>
style={{ <span className="postcard-meta">
width: '100%', · {post.petType} · {post.authorName} · {post.createdAt}
height: '100%', </span>
objectFit: 'cover', </div>
}} </div>
/>
)}
</div>
)}
{/* TEXT */} <p className="postcard-text">{post.text}</p>
<div style={{ padding: '1rem', fontSize: '0.95rem' }}>
{text}
</div> </div>
</div>
{/* FOOTER */} {/* Interaktionen */}
<footer <div className="postcard-actions">
style={{ <button
padding: '0 1rem 1rem', ref={likeRef}
display: 'flex', type="button"
gap: '1.2rem', className="postcard-action"
fontSize: '0.85rem', onClick={(e) => {
e.stopPropagation();
animate(likeRef, 'heart-pop 0.3s ease');
// später: Like-Logik
}} }}
> >
<button <span aria-hidden>❤️</span>
type="button" <span>{post.likesCount}</span>
onClick={() => { </button>
setLiked(!liked);
setLocalLikes((prev) => (liked ? prev - 1 : prev + 1));
console.log('LIKE', { <button
byUser: CURRENT_USER_ID, ref={commentRef}
pet: petName, type="button"
}); className="postcard-action"
}} onClick={(e) => {
style={{ e.stopPropagation();
background: 'none', animate(commentRef, 'comment-wiggle 0.25s ease');
border: 'none', onCommentClick?.(post);
cursor: 'pointer',
fontWeight: 600,
color: liked ? '#d32f2f' : '#555',
}}
>
❤️ {localLikes}
</button>
<button
type="button"
onClick={() => setShowComments(true)}
style={{
background: 'none',
border: 'none',
cursor: 'pointer',
fontWeight: 600,
color: '#2E7D32',
}}
>
💬 {commentsCount} Kommentare
</button>
</footer>
</article>
{/* 💬 Kommentare */}
{showComments && (
<CommentModal
comments={commentsList}
onClose={() => setShowComments(false)}
/>
)}
{/* 🖼️ MEDIA FULLSCREEN */}
{showMediaFullscreen && media && (
<div
onClick={() => setShowMediaFullscreen(false)}
style={{
position: 'fixed',
inset: 0,
backgroundColor: 'rgba(0,0,0,0.9)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
zIndex: 2000,
cursor: 'zoom-out',
}} }}
> >
<div <span aria-hidden>💬</span>
onClick={(e) => e.stopPropagation()} <span>{post.commentsCount}</span>
style={{ </button>
maxWidth: '95vw', </div>
maxHeight: '95vh', </article>
}}
>
{media.type === 'image' && (
<img
src={media.url}
alt={petName}
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'contain',
}}
/>
)}
{media.type === 'video' && (
<video
src={media.url}
controls
autoPlay
style={{
maxWidth: '100%',
maxHeight: '100%',
}}
/>
)}
</div>
</div>
)}
</>
); );
} }
+89 -335
View File
@@ -1,26 +1,15 @@
'use client'; 'use client';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import PostCard, {
PostCardData,
} from '@/app/components/PostCard/PostCard';
type ExplorePet = { /* =======================
id: number; MOCK DATA
name: string; ======================= */
type: 'Hund' | 'Katze';
};
type ExplorePost = { const trendingPets = [
id: number;
petId: number;
petName: string;
petType: 'Hund' | 'Katze';
authorName: string;
createdAt: string;
text: string;
likesCount: number;
commentsCount: number;
};
const trendingPets: ExplorePet[] = [
{ id: 1, name: 'Luna', type: 'Katze' }, { id: 1, name: 'Luna', type: 'Katze' },
{ id: 2, name: 'Bello', type: 'Hund' }, { id: 2, name: 'Bello', type: 'Hund' },
{ id: 3, name: 'Milo', type: 'Katze' }, { id: 3, name: 'Milo', type: 'Katze' },
@@ -29,10 +18,9 @@ const trendingPets: ExplorePet[] = [
{ id: 6, name: 'Leo', type: 'Hund' }, { id: 6, name: 'Leo', type: 'Hund' },
]; ];
const latestPosts: ExplorePost[] = [ const latestPosts: PostCardData[] = [
{ {
id: 101, id: 101,
petId: 1,
petName: 'Luna', petName: 'Luna',
petType: 'Katze', petType: 'Katze',
authorName: 'Anna', authorName: 'Anna',
@@ -43,7 +31,6 @@ const latestPosts: ExplorePost[] = [
}, },
{ {
id: 102, id: 102,
petId: 2,
petName: 'Bello', petName: 'Bello',
petType: 'Hund', petType: 'Hund',
authorName: 'Markus', authorName: 'Markus',
@@ -54,7 +41,6 @@ const latestPosts: ExplorePost[] = [
}, },
{ {
id: 103, id: 103,
petId: 3,
petName: 'Milo', petName: 'Milo',
petType: 'Katze', petType: 'Katze',
authorName: 'Sophie', authorName: 'Sophie',
@@ -65,7 +51,6 @@ const latestPosts: ExplorePost[] = [
}, },
{ {
id: 104, id: 104,
petId: 4,
petName: 'Rocky', petName: 'Rocky',
petType: 'Hund', petType: 'Hund',
authorName: 'Timo', authorName: 'Timo',
@@ -76,15 +61,20 @@ const latestPosts: ExplorePost[] = [
}, },
]; ];
/* =======================
PAGE
======================= */
export default function ExplorePage() { export default function ExplorePage() {
const [activeFilter, setActiveFilter] = useState< const [activeFilter, setActiveFilter] =
'ALLE' | 'HUND' | 'KATZE' useState<'ALLE' | 'HUND' | 'KATZE'>('ALLE');
>('ALLE');
const [previewPost, setPreviewPost] = useState<ExplorePost | null>(null); const [previewPost, setPreviewPost] =
const [openComments, setOpenComments] = useState(false); useState<PostCardData | null>(null);
// Swipe-Down Handling fürs Modal const [openComments, setOpenComments] = useState(false);
// Swipe-Down fürs Modal
const startY = useRef<number | null>(null); const startY = useRef<number | null>(null);
const filteredPosts = latestPosts.filter((p) => { const filteredPosts = latestPosts.filter((p) => {
@@ -96,90 +86,46 @@ const [openComments, setOpenComments] = useState(false);
return ( return (
<> <>
{/* ================= HEADER / FILTER ================= */} {/* ================= HEADER / FILTER ================= */}
<section <section className="explore-header">
style={{
padding: '1rem',
display: 'grid',
gap: '1rem',
maxWidth: '720px',
margin: '0 auto',
}}
>
<header> <header>
<h1 style={{ marginBottom: '0.3rem' }}>Entdecken</h1> <h1>Entdecken</h1>
<p style={{ margin: 0, color: '#666' }}> <p>Neue Tiere, Trends & besondere Momente</p>
Neue Tiere, Trends & besondere Momente
</p>
</header> </header>
<div style={{ display: 'flex', gap: '0.5rem' }}> <div className="explore-filter">
{[ {[
{ key: 'ALLE', label: 'Alle' }, { key: 'ALLE', label: 'Alle' },
{ key: 'HUND', label: 'Hunde' }, { key: 'HUND', label: 'Hunde' },
{ key: 'KATZE', label: 'Katzen' }, { key: 'KATZE', label: 'Katzen' },
].map((f) => { ].map((f) => (
const active = activeFilter === f.key; <button
return ( key={f.key}
<button className={
key={f.key} activeFilter === f.key
onClick={() => ? 'filter-button active'
setActiveFilter(f.key as 'ALLE' | 'HUND' | 'KATZE') : 'filter-button'
} }
style={{ onClick={() =>
padding: '0.45rem 0.9rem', setActiveFilter(f.key as 'ALLE' | 'HUND' | 'KATZE')
borderRadius: '999px', }
border: active ? 'none' : '1px solid #ccc', >
backgroundColor: active ? '#2E7D32' : 'white', {f.label}
color: active ? 'white' : 'inherit', </button>
fontSize: '0.75rem', ))}
fontWeight: active ? 600 : 400,
cursor: 'pointer',
transform: active ? 'scale(1.05)' : 'scale(1)',
transition:
'background-color 0.2s ease, transform 0.15s ease',
}}
>
{f.label}
</button>
);
})}
</div> </div>
</section> </section>
{/* ================= BELIEBTE TIERE ================= */} {/* ================= BELIEBTE TIERE ================= */}
<section style={{ paddingLeft: '1rem', marginBottom: '1.5rem' }}> <section className="explore-trending">
<strong style={{ display: 'block', marginBottom: '0.6rem' }}> <strong>Beliebte Tiere</strong>
Beliebte Tiere
</strong>
<div <div className="trending-scroll hide-scrollbar">
className="hide-scrollbar"
style={{
display: 'flex',
gap: '0.8rem',
overflowX: 'auto',
WebkitOverflowScrolling: 'touch',
}}
>
{trendingPets.map((pet) => ( {trendingPets.map((pet) => (
<div key={pet.id} style={{ width: '84px', flex: '0 0 auto' }}> <div key={pet.id} className="trending-item">
<div <div className="trending-avatar">🐾</div>
style={{ <div className="trending-meta">
width: '84px',
height: '84px',
borderRadius: '18px',
backgroundColor: '#f2f2f2',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '1.4rem',
}}
>
🐾
</div>
<div style={{ marginTop: '0.4rem', fontSize: '0.72rem' }}>
<strong>{pet.name}</strong> <strong>{pet.name}</strong>
<div style={{ color: '#777' }}>{pet.type}</div> <span>{pet.type}</span>
</div> </div>
</div> </div>
))} ))}
@@ -187,151 +133,23 @@ const [openComments, setOpenComments] = useState(false);
</section> </section>
{/* ================= POSTS ================= */} {/* ================= POSTS ================= */}
<section <section className="explore-posts">
style={{ <strong>Neueste Beiträge</strong>
padding: '0 1rem 1rem',
maxWidth: '720px',
margin: '0 auto',
}}
>
<strong style={{ display: 'block', marginBottom: '0.6rem' }}>
Neueste Beiträge
</strong>
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.9rem' }}> <div className="post-list">
{filteredPosts.map((post) => ( {filteredPosts.map((post) => (
<article <PostCard
key={post.id} key={post.id}
style={{ post={post}
border: '1px solid #eee', onOpenPreview={(p) => {
borderRadius: '18px', setOpenComments(false);
overflow: 'hidden', setPreviewPost(p);
backgroundColor: 'white',
}} }}
> onCommentClick={(p) => {
{/* ✅ Nur dieser Bereich öffnet das Modal */} setOpenComments(true);
<div setPreviewPost(p);
onClick={() => setPreviewPost(post)} }}
style={{ cursor: 'pointer' }} />
>
<div
style={{
width: '100%',
aspectRatio: '3 / 2',
backgroundColor: '#eaeaea',
}}
/>
<div style={{ padding: '0.8rem', display: 'grid', gap: '0.35rem' }}>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
gap: '0.6rem',
}}
>
<div>
<strong>{post.petName}</strong>{' '}
<span style={{ color: '#777', fontSize: '0.8rem' }}>
· {post.petType} · {post.authorName}
</span>
</div>
<span
style={{
color: '#777',
fontSize: '0.8rem',
whiteSpace: 'nowrap',
}}
>
{post.createdAt}
</span>
</div>
<p style={{ margin: 0, fontSize: '0.9rem' }}>{post.text}</p>
</div>
</div>
{/* ✅ Interaktionszeile (öffnet KEIN Modal) */}
<div
style={{
padding: '0 0.8rem 0.8rem',
display: 'flex',
gap: '1rem',
fontSize: '0.85rem',
color: '#555',
}}
>
<button
type="button"
onClick={(e) => {
e.stopPropagation();
const el = e.currentTarget;
el.style.animation = 'heart-pop 0.3s ease';
el.addEventListener(
'animationend',
() => {
el.style.animation = '';
},
{ once: true }
);
console.log('LIKE CLICK', post.id);
}}
style={{
border: 'none',
background: 'transparent',
padding: 0,
cursor: 'pointer',
display: 'flex',
gap: '0.35rem',
alignItems: 'center',
color: 'inherit',
}}
>
<span aria-hidden>❤️</span>
<span>{post.likesCount}</span>
</button>
<button
type="button"
onClick={(e) => {
e.stopPropagation();
// Animation
const el = e.currentTarget;
el.style.animation = 'comment-wiggle 0.25s ease';
el.addEventListener(
'animationend',
() => {
el.style.animation = '';
},
{ once: true }
);
// 👉 LOGIK
setOpenComments(true);
setPreviewPost(post);
}}
style={{
border: 'none',
background: 'transparent',
padding: 0,
cursor: 'pointer',
display: 'flex',
gap: '0.35rem',
alignItems: 'center',
color: 'inherit',
}}
>
<span aria-hidden>💬</span>
<span>{post.commentsCount}</span>
</button>
</div>
</article>
))} ))}
</div> </div>
</section> </section>
@@ -339,127 +157,63 @@ const [openComments, setOpenComments] = useState(false);
{/* ================= PREVIEW MODAL ================= */} {/* ================= PREVIEW MODAL ================= */}
{previewPost && ( {previewPost && (
<div <div
onClick={() => setPreviewPost(null)} className="post-preview-overlay"
style={{ onClick={() => {
position: 'fixed', setPreviewPost(null);
inset: 0, setOpenComments(false);
backgroundColor: 'rgba(0,0,0,0.4)',
zIndex: 50,
display: 'flex',
justifyContent: 'center',
alignItems: 'flex-end',
}} }}
> >
<div <div
className="post-preview-modal"
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
onTouchStart={(e) => (startY.current = e.touches[0].clientY)} onTouchStart={(e) =>
(startY.current = e.touches[0].clientY)
}
onTouchEnd={(e) => { onTouchEnd={(e) => {
if ( if (
startY.current && startY.current &&
e.changedTouches[0].clientY - startY.current > 80 e.changedTouches[0].clientY - startY.current > 80
) { ) {
setPreviewPost(null); setPreviewPost(null);
setOpenComments(false); setOpenComments(false);
} }
}} }}
style={{
backgroundColor: 'white',
width: '100%',
maxWidth: '720px',
borderTopLeftRadius: '22px',
borderTopRightRadius: '22px',
padding: '1rem',
animation: 'slideUp 0.25s ease',
paddingBottom: '5rem',
}}
> >
<div <div className="modal-handle" />
style={{
width: '36px',
height: '4px',
borderRadius: '999px',
backgroundColor: '#ccc',
margin: '0 auto 0.8rem',
}}
/>
<div <div className="modal-media" />
style={{
width: '100%',
aspectRatio: '3 / 2',
backgroundColor: '#eaeaea',
borderRadius: '14px',
marginBottom: '0.8rem',
}}
/>
<strong>{previewPost.petName}</strong>{' '} <strong>{previewPost.petName}</strong>{' '}
<span style={{ color: '#777', fontSize: '0.85rem' }}> <span className="modal-meta">
· {previewPost.petType} · {previewPost.authorName} · {previewPost.petType} · {previewPost.authorName}
</span> </span>
<p style={{ marginTop: '0.6rem' }}>{previewPost.text}</p> <p className="modal-text">{previewPost.text}</p>
{openComments && (
<div
style={{
marginTop: '1rem',
paddingTop: '0.8rem',
borderTop: '1px solid #eee',
}}
>
<strong style={{ fontSize: '0.9rem' }}>Kommentare</strong>
<div <div className="modal-stats">
style={{ <span>❤️ {previewPost.likesCount}</span>
marginTop: '0.6rem', <span>💬 {previewPost.commentsCount}</span>
fontSize: '0.85rem', </div>
color: '#666',
}}
>
Noch keine Kommentare.
</div>
<input {openComments && (
placeholder="Kommentar schreiben…" <div className="modal-comments">
style={{ <strong>Kommentare</strong>
marginTop: '0.6rem', <p className="modal-comment-empty">
width: '100%', Noch keine Kommentare.
padding: '0.6rem 0.8rem', </p>
borderRadius: '999px',
border: '1px solid #ccc',
fontSize: '0.85rem',
}}
autoFocus
/>
</div>
)}
<div <input
style={{ className="modal-comment-input"
display: 'flex', placeholder="Kommentar schreiben…"
justifyContent: 'space-between', autoFocus
alignItems: 'center', />
marginTop: '1rem',
}}
>
<div style={{ fontSize: '0.9rem', color: '#555', display: 'flex', gap: '1rem' }}>
<span>❤️ {previewPost.likesCount}</span>
<span>💬 {previewPost.commentsCount}</span>
</div> </div>
)}
<div className="modal-actions">
<a <a
href={`/post/${previewPost.id}`} href={`/post/${previewPost.id}`}
style={{ className="modal-open-post"
padding: '0.5rem 0.9rem',
borderRadius: '999px',
backgroundColor: '#2E7D32',
color: 'white',
textDecoration: 'none',
fontSize: '0.85rem',
fontWeight: 600,
}}
> >
Zum Beitrag Zum Beitrag
</a> </a>
+207 -149
View File
@@ -1,179 +1,237 @@
'use client'; 'use client';
import { useState } from 'react'; import { useRef, useState } from 'react';
import PostCard from '../components/PostCard/PostCard'; import PostCard, {
import FreshPostsSlider from '../components/FreshPostsSlider/FreshPostsSlider'; PostCardData,
} from '@/app/components/PostCard/PostCard';
/* ---------------- TYPES ---------------- */ /* =======================
MOCK: USER KONTEXT
======================= */
type Comment = { const myPets = [
id: number;
author: string;
text: string;
};
type Media = {
type: 'image' | 'video';
url: string;
aspect: '1:1' | '9:16';
};
type FeedPost = {
id: number;
// 🐾 Tier (Absender)
petId: number;
petName: string;
petType: 'Hund' | 'Katze';
// 👤 Admin (sekundär)
ownerId: number;
ownerName: string;
// 📝 Inhalt
text: string;
createdAt: string;
// 📸 / 🎥 Media
media?: Media;
// ❤️ Interaktion
likes: number;
//likedByCurrentUser: number; // ✅ FEHLTE
commentsCount: number;
commentsList: Comment[];
};
type FeedAdmin = {
id: number;
name: string;
avatar: string;
};
/* ---------------- MOCK ADMINS ---------------- */
const mockAdmins: FeedAdmin[] = [
{ {
id: 1, id: 1,
name: 'Anna', petType: 'Katze',
avatar: 'https://i.pravatar.cc/100?img=12', breed: 'Bengal',
}, ageMonths: 24,
{
id: 2,
name: 'Markus',
avatar: 'https://i.pravatar.cc/100?img=32',
}, },
]; ];
/* ---------------- MOCK POSTS ---------------- */ const followedPetIds = [1, 3, 5];
const mockPosts: FeedPost[] = [ /* =======================
MOCK: POSTS
======================= */
type FeedPost = PostCardData & {
petId: number;
breed: string;
ageMonths: number;
};
const allPosts: FeedPost[] = [
{ {
id: 1, id: 401,
petId: 1, petId: 1,
petName: 'Luna', petName: 'Luna',
petType: 'Katze', petType: 'Katze',
breed: 'Bengal',
ownerId: 1, ageMonths: 26,
ownerName: 'Anna', authorName: 'Anna',
createdAt: 'vor 10 Minuten',
text: 'Luna genießt die Sonne auf dem Balkon ☀️', text: 'Luna liebt den neuen Kratzbaum.',
createdAt: 'vor 2 Stunden', likesCount: 8,
media: {
type: 'image',
url: 'https://placekitten.com/600/600',
aspect: '1:1',
},
likes: 12,
commentsCount: 2, commentsCount: 2,
commentsList: [
{ id: 1, author: 'Lisa', text: 'Wie süß 😍' },
{ id: 2, author: 'Tom', text: 'Typisch Katze!' },
],
}, },
{ {
id: 2, id: 402,
petId: 2, petId: 2,
petName: 'Bello', petName: 'Rocky',
petType: 'Hund', petType: 'Hund',
breed: 'Labrador',
ownerId: 2, ageMonths: 30,
ownerName: 'Markus', authorName: 'Tim',
createdAt: 'vor 1 Stunde',
text: 'Spaziergang im Park – jemand hatte sehr viel Energie 🐕', text: 'Rocky war schwimmen 🐕‍🦺',
createdAt: 'heute Morgen', likesCount: 15,
commentsCount: 4,
media: { },
type: 'video', {
url: 'https://www.w3schools.com/html/mov_bbb.mp4', id: 403,
aspect: '9:16', petId: 3,
}, petName: 'Milo',
petType: 'Katze',
likes: 20, breed: 'Bengal',
ageMonths: 22,
authorName: 'Sophie',
commentsCount: 0, createdAt: 'heute',
commentsList: [], text: 'Milo entdeckt den Balkon.',
likesCount: 11,
commentsCount: 3,
},
{
id: 404,
petId: 4,
petName: 'Nala',
petType: 'Katze',
breed: 'Maine Coon',
ageMonths: 40,
authorName: 'Laura',
createdAt: 'gestern',
text: 'Nala beobachtet alles ganz ruhig.',
likesCount: 6,
commentsCount: 1,
}, },
]; ];
/* ---------------- PAGE ---------------- */ /* =======================
RELEVANZ LOGIK
======================= */
function relevanceScore(post: FeedPost) {
let score = 0;
myPets.forEach((pet) => {
if (post.petType === pet.petType) score += 3;
if (post.breed === pet.breed) score += 5;
if (Math.abs(post.ageMonths - pet.ageMonths) <= 6) score += 2;
});
score += Math.min(post.likesCount / 10, 3);
score += Math.min(post.commentsCount / 5, 2);
return score;
}
/* =======================
PAGE
======================= */
export default function FeedPage() { export default function FeedPage() {
const [selectedOwnerId, setSelectedOwnerId] = useState<number | null>(null); const [previewPost, setPreviewPost] =
useState<PostCardData | null>(null);
const [openComments, setOpenComments] = useState(false);
const visiblePosts = selectedOwnerId const startY = useRef<number | null>(null);
? mockPosts.filter((post) => post.ownerId === selectedOwnerId)
: mockPosts; /* =======================
FEED ZUSAMMENSTELLEN
======================= */
const subscribedPosts = allPosts.filter((post) =>
followedPetIds.includes(post.petId)
);
const discoveryPosts = allPosts
.filter((post) => !followedPetIds.includes(post.petId))
.sort((a, b) => relevanceScore(b) - relevanceScore(a));
const FEED_SIZE = 20;
const DISCOVERY_RATIO = 0.15;
const discoveryCount = Math.max(
1,
Math.round(FEED_SIZE * DISCOVERY_RATIO)
);
const finalFeed = [
...subscribedPosts
.slice(0, FEED_SIZE - discoveryCount)
.map((p) => ({ ...p, isDiscovery: false })),
...discoveryPosts
.slice(0, discoveryCount)
.map((p) => ({ ...p, isDiscovery: true })),
];
return ( return (
<section <>
style={{ {/* ================= HEADER ================= */}
maxWidth: '600px', <section className="feed-header">
margin: '0 auto', <header>
display: 'grid', <h1>Feed</h1>
gap: '1.5rem', <p>Beiträge deiner Tiere & Abos</p>
}} </header>
>
{/* HEADER */}
<header>
<h1 style={{ marginBottom: '0.3rem' }}>Feed</h1>
<p style={{ margin: 0, color: '#555' }}>
Neueste Beiträge aus der OnlyPets-Community
</p>
</header>
{/* 🔄 Frische Tier-Admins Slider */}
<FreshPostsSlider
users={mockAdmins}
onSelectUser={setSelectedOwnerId}
/>
{/* 📰 FEED */}
<section style={{ display: 'grid', gap: '1.5rem' }}>
{visiblePosts.length === 0 && (
<p style={{ color: '#777' }}>
Keine Beiträge von diesen Tier-Admins.
</p>
)}
{visiblePosts.map((post) => (
<PostCard
key={post.id}
petName={post.petName}
petType={post.petType}
ownerName={post.ownerName}
text={post.text}
createdAt={post.createdAt}
media={post.media}
likes={post.likes}
commentsCount={post.commentsCount}
commentsList={post.commentsList}
/>
))}
</section> </section>
</section>
{/* ================= POSTS ================= */}
<section className="feed-posts">
<div className="post-list">
{finalFeed.map((post) => (
<PostCard
key={post.id}
post={post}
isDiscovery={post.isDiscovery}
onOpenPreview={(p) => {
setOpenComments(false);
setPreviewPost(p);
}}
onCommentClick={(p) => {
setOpenComments(true);
setPreviewPost(p);
}}
/>
))}
</div>
</section>
{/* ================= PREVIEW MODAL ================= */}
{previewPost && (
<div
className="post-preview-overlay"
onClick={() => {
setPreviewPost(null);
setOpenComments(false);
}}
>
<div
className="post-preview-modal"
onClick={(e) => e.stopPropagation()}
onTouchStart={(e) =>
(startY.current = e.touches[0].clientY)
}
onTouchEnd={(e) => {
if (
startY.current &&
e.changedTouches[0].clientY - startY.current > 80
) {
setPreviewPost(null);
setOpenComments(false);
}
}}
>
<div className="modal-handle" />
<div className="modal-media" />
<strong>{previewPost.petName}</strong>{' '}
<span className="modal-meta">
· {previewPost.petType} · {previewPost.authorName}
</span>
<p className="modal-text">{previewPost.text}</p>
<div className="modal-stats">
<span>❤️ {previewPost.likesCount}</span>
<span>💬 {previewPost.commentsCount}</span>
</div>
{openComments && (
<div className="modal-comments">
<strong>Kommentare</strong>
<p className="modal-comment-empty">
Noch keine Kommentare.
</p>
<input
className="modal-comment-input"
placeholder="Kommentar schreiben…"
autoFocus
/>
</div>
)}
</div>
</div>
)}
</>
); );
} }
+555 -14
View File
@@ -1,23 +1,51 @@
@import "tailwindcss"; @import "tailwindcss";
* {
box-sizing: border-box;
}
:root { :root {
--background: #ffffff; /* ===== COLORS ===== */
--foreground: #171717; --color-primary: #2e7d32;
--color-primary-soft: #e6efe9;
--color-bg: #f6faf7;
--color-surface: #ffffff;
--color-text-main: #1f2d24;
--color-text-secondary: #5f6f66;
--color-text-muted: #8a9b92;
--color-border: rgba(0, 0, 0, 0.06);
/* ===== SHADOWS ===== */
--shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
--shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
/* ===== RADIUS ===== */
--radius-sm: 10px;
--radius-md: 14px;
--radius-lg: 18px;
/* ===== SPACING ===== */
--space-xs: 0.25rem;
--space-sm: 0.5rem;
--space-md: 1rem;
--space-lg: 1.5rem;
--space-xl: 2rem;
}
html, body {
background: var(--color-bg);
color: var(--color-text-main);
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
line-height: 1.5;
} }
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
body { body {
background: var(--background); background: var(--background);
@@ -97,3 +125,516 @@ body {
} }
} }
.postcard {
background: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-border);
box-shadow: var(--shadow-sm);
padding: var(--space-md);
display: flex;
flex-direction: column;
gap: var(--space-sm);
transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.postcard:hover {
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.postcard-content {
font-size: 0.95rem;
color: var(--color-text-secondary);
}
.postcard-actions {
display: flex;
gap: var(--space-md);
align-items: center;
font-size: 0.85rem;
color: var(--color-text-muted);
}
.postcard-action {
display: flex;
align-items: center;
gap: 0.3rem;
cursor: pointer;
user-select: none;
}
.postcard-action:hover {
color: var(--color-text-main);
}
.postcard--discovery {
border: 1px solid var(--color-primary);
box-shadow:
0 0 0 1px rgba(236, 214, 15, 0.925),
var(--shadow-sm);
}
.feed-header,
.explore-header {
padding: var(--space-lg) var(--space-md) var(--space-md);
}
.feed-header p,
.explore-header p {
color: var(--color-text-secondary);
margin: 0.25rem 0 0;
}
.post-list {
display: flex;
flex-direction: column;
gap: var(--space-md);
padding-bottom: calc(var(--space-xl) + 60px);
}
.fresh-scroll,
.trending-scroll {
display: flex;
gap: var(--space-sm);
overflow-x: auto;
padding: var(--space-sm) var(--space-md);
}
.hide-scrollbar::-webkit-scrollbar {
display: none;
}
.fresh-item,
.trending-item {
background: var(--color-surface);
border-radius: var(--radius-md);
padding: var(--space-sm);
min-width: 80px;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.3rem;
box-shadow: var(--shadow-sm);
border: 1px solid var(--color-border);
}
.profile-header {
display: flex;
gap: var(--space-lg);
padding: var(--space-lg);
margin: var(--space-md);
background: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-border);
box-shadow: var(--shadow-sm);
}
.profile-avatar {
width: 72px;
height: 72px;
border-radius: 50%;
background: var(--color-primary-soft);
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
}
.profile-info h1 {
font-size: 1.3rem;
margin: 0;
}
.profile-username {
font-size: 0.85rem;
color: var(--color-text-muted);
}
.profile-bio {
margin-top: var(--space-sm);
font-size: 0.9rem;
color: var(--color-text-secondary);
}
.profile-stats {
display: flex;
gap: var(--space-lg);
margin-top: var(--space-md);
}
.profile-stats div {
text-align: center;
}
.profile-stats strong {
font-size: 1.05rem;
font-weight: 600;
}
.profile-stats span {
font-size: 0.75rem;
color: var(--color-text-muted);
}
.profile-pets {
margin-top: var(--space-lg);
padding: 0 var(--space-md);
}
.profile-pets h2 {
font-size: 1.1rem;
margin-bottom: var(--space-sm);
}
.pets-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: var(--space-md);
}
.pet-card {
background: var(--color-surface);
border-radius: var(--radius-md);
border: 1px solid var(--color-border);
box-shadow: var(--shadow-sm);
padding: var(--space-sm);
text-align: center;
transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.profile-posts {
margin-top: var(--space-xl);
}
.profile-posts h2 {
font-size: 1.1rem;
margin: 0 var(--space-md) var(--space-sm);
}
.pet-card:hover {
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.post-preview-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.35);
display: flex;
justify-content: center;
align-items: flex-end;
z-index: 50;
overflow: hidden;
}
.post-preview-modal {
background: var(--color-surface);
width: 100%;
max-width: 600px;
/* 🔥 DAS FEHLT */
max-height: calc(100vh - 70px); /* Platz für Statusbar */
overflow-y: auto;
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
padding: var(--space-lg);
box-shadow: var(--shadow-lg);
padding-bottom: calc(var(--space-xl) + 60px);
}
.explore-filter {
display: flex;
gap: var(--space-sm);
margin-top: var(--space-md);
}
.filter-button {
padding: 0.4rem 0.8rem;
border-radius: 999px;
border: 1px solid var(--color-border);
background: var(--color-surface);
font-size: 0.85rem;
color: var(--color-text-secondary);
cursor: pointer;
}
.filter-button.active {
background: var(--color-primary);
color: white;
border-color: var(--color-primary);
}
.explore-header,
.explore-trending,
.explore-posts {
padding: 0 var(--space-md);
}
.explore-trending,
.explore-posts {
margin-top: var(--space-lg);
}
.explore-header h1 {
font-size: 1.4rem;
margin-bottom: 0.2rem;
}
.explore-header p {
font-size: 0.9rem;
color: var(--color-text-secondary);
}
.explore-trending strong,
.explore-posts strong {
display: block;
margin-bottom: var(--space-sm);
}
.feed-header {
padding: var(--space-lg) var(--space-md) var(--space-md);
}
.feed-header h1 {
font-size: 1.4rem;
margin-bottom: 0.2rem;
}
.feed-header p {
font-size: 0.9rem;
color: var(--color-text-secondary);
}
.feed-posts {
margin-top: var(--space-md);
}
.feed-posts .postcard {
margin-bottom: var(--space-md);
}
.feed-header h1::after {
content: '•';
margin-left: 0.4rem;
color: var(--color-primary);
}
.pets-page {
padding-bottom: calc(var(--space-xl) + 60px); /* Abstand zur BottomNav */
}
.pets-header {
padding: var(--space-lg) var(--space-md) var(--space-md);
}
.pets-header h1 {
font-size: 1.4rem;
margin-bottom: 0.25rem;
}
.pets-header p {
font-size: 0.9rem;
color: var(--color-text-secondary);
margin: 0;
}
.pets-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: var(--space-md);
padding: 0 var(--space-md);
}
.pet-card {
background: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-border);
box-shadow: var(--shadow-sm);
padding: var(--space-md);
text-align: center;
text-decoration: none;
color: inherit;
display: flex;
flex-direction: column;
gap: 0.3rem;
transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.pet-card:hover {
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.pet-avatar {
width: 56px;
height: 56px;
border-radius: 50%;
background: var(--color-primary-soft);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.6rem;
margin: 0 auto var(--space-sm);
}
.pet-name {
font-size: 1rem;
font-weight: 600;
}
.pet-meta {
font-size: 0.8rem;
color: var(--color-text-muted);
}
.pet-age {
font-size: 0.75rem;
color: var(--color-text-secondary);
}
.pets-actions {
margin-top: var(--space-xl);
padding: 0 var(--space-md);
}
.button-primary {
display: inline-flex;
justify-content: center;
align-items: center;
gap: 0.4rem;
padding: 0.8rem 1.2rem;
border-radius: var(--radius-lg);
background: var(--color-primary);
color: white;
font-weight: 600;
text-decoration: none;
border: none;
cursor: pointer;
box-shadow: var(--shadow-sm);
transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.button-primary:hover {
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.button-secondary {
display: inline-flex;
justify-content: center;
align-items: center;
padding: 0.8rem 1.2rem;
border-radius: var(--radius-lg);
background: var(--color-surface);
color: var(--color-text-main);
border: 1px solid var(--color-border);
font-weight: 500;
cursor: pointer;
}
.button-danger {
background: #c62828;
color: white;
border: none;
}
.button-danger:hover {
background: #b71c1c;
}
.badge {
display: inline-block;
padding: 0.15rem 0.5rem;
font-size: 0.7rem;
border-radius: 999px;
background: var(--color-border);
color: var(--color-text-muted);
}
.badge-pet {
background: var(--color-primary-soft);
color: var(--color-primary);
}
.postcard--discovery {
border: 1px solid var(--color-primary);
box-shadow:
0 0 0 1px rgba(46, 125, 50, 0.15),
var(--shadow-sm);
}
.empty-state {
padding: var(--space-xl);
margin: var(--space-md);
text-align: center;
background: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px dashed var(--color-border);
color: var(--color-text-secondary);
}
.empty-state strong {
display: block;
font-size: 1rem;
font-weight: 600;
color: var(--color-text-main);
margin-bottom: 0.3rem;
}
.empty-state span {
font-size: 0.85rem;
line-height: 1.4;
}
.empty-state--explore {
border-style: solid;
}
.empty-state--pets {
border-style: dashed;
}
button:active,
.button-primary:active {
transform: scale(0.98);
}
a {
-webkit-tap-highlight-color: transparent;
}
section + section {
margin-top: var(--space-xl);
}
h1, h2, h3 {
line-height: 1.25;
}
.pet-detail-page {
padding-bottom: calc(var(--space-xl) + 60px); /* Platz für BottomNav */
}
.pet-detail-header {
display: flex;
gap: var(--space-lg);
padding: var(--space-lg);
margin: var(--space-md);
background: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-border);
box-shadow: var(--shadow-sm);
align-items: center;
}
.pet-detail-avatar {
width: 72px;
height: 72px;
border-radius: 50%;
background: var(--color-primary-soft);
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
flex-shrink: 0;
}
.pet-detail-info h1 {
font-size: 1.4rem;
margin: 0;
}
.pet-detail-meta {
display: block;
font-size: 0.9rem;
color: var(--color-text-secondary);
margin-top: 0.2rem;
}
.pet-detail-owner {
display: block;
font-size: 0.8rem;
color: var(--color-text-muted);
margin-top: 0.3rem;
}
.pet-detail-posts {
margin-top: var(--space-xl);
}
.pet-detail-posts h2 {
font-size: 1.1rem;
margin: 0 var(--space-md) var(--space-sm);
}
.container {
max-width: 720px;
margin: 0 auto;
}
.divider {
height: 1px;
background: var(--color-border);
margin: var(--space-lg) 0;
}
+93 -66
View File
@@ -1,27 +1,27 @@
'use client';
import { useParams } from 'next/navigation';
import PostCard from '@/app/components/PostCard/PostCard'; import PostCard from '@/app/components/PostCard/PostCard';
type Comment = {
id: number;
author: string;
text: string;
};
type PetPost = {
id: number;
text: string;
createdAt: string;
likes: number;
commentsCount: number;
commentsList: Comment[];
};
type Pet = { type Pet = {
id: number; id: number;
name: string; name: string;
type: 'Hund' | 'Katze'; type: 'Hund' | 'Katze';
breed: string; breed: string;
bio?: string; age?: string;
posts: PetPost[]; owner: string;
};
type Post = {
id: number;
petId: number;
petName: string;
petType: 'Hund' | 'Katze';
author: string;
text: string;
createdAt: string;
likes: number;
comments: number;
}; };
const mockPets: Pet[] = [ const mockPets: Pet[] = [
@@ -29,76 +29,103 @@ const mockPets: Pet[] = [
id: 1, id: 1,
name: 'Luna', name: 'Luna',
type: 'Katze', type: 'Katze',
breed: 'Bengal x Mix', breed: 'Bengal',
bio: 'Neugierig, verspielt und liebt Sonne.', age: '2 Jahre',
posts: [ owner: 'Anna',
{
id: 101,
text: 'Luna genießt die Sonne ☀️',
createdAt: 'vor 2 Stunden',
likes: 12,
commentsCount: 2,
commentsList: [
{ id: 1, author: 'Lisa', text: 'Wie süß 😍' },
{ id: 2, author: 'Tom', text: 'Typisch Bengal!' },
],
},
],
}, },
{ {
id: 2, id: 2,
name: 'Bello', name: 'Bello',
type: 'Hund', type: 'Hund',
breed: 'Labrador Retriever x Mix', breed: 'Labrador',
bio: 'Immer gute Laune.', age: '4 Jahre',
posts: [], owner: 'Markus',
}, },
]; ];
type PageProps = { const mockPosts: Post[] = [
params: Promise<{ id: string }>; {
}; id: 101,
petId: 1,
petName: 'Luna',
petType: 'Katze',
author: 'Anna',
text: 'Luna liebt sonnige Nachmittage auf dem Balkon ☀️',
createdAt: 'vor 3 Stunden',
likes: 12,
comments: 3,
},
{
id: 102,
petId: 1,
petName: 'Luna',
petType: 'Katze',
author: 'Anna',
text: 'Heute gab es neue Spielsachen 🧶',
createdAt: 'gestern',
likes: 7,
comments: 1,
},
];
export default async function PetDetailPage({ params }: PageProps) { export default function PetDetailPage() {
const { id } = await params; // ✅ DAS ist der entscheidende Fix const params = useParams();
const petId = Number(id); const petId = Number(params.id);
console.log('PET ID:', petId);
const pet = mockPets.find((p) => p.id === petId); const pet = mockPets.find((p) => p.id === petId);
const posts = mockPosts.filter((p) => p.petId === petId);
if (!pet) { if (!pet) {
return <p>Haustier nicht gefunden.</p>; return (
<div className="empty-state">
<strong>Tier nicht gefunden</strong>
<span>Dieses Haustier existiert nicht oder wurde entfernt.</span>
</div>
);
} }
return ( return (
<section style={{ maxWidth: '600px', margin: '0 auto', display: 'grid', gap: '1.5rem' }}> <section className="pet-detail-page">
<header style={{ border: '1px solid #e5e5e5', borderRadius: '16px', padding: '1rem' }}> {/* Header */}
<h1>{pet.name}</h1> <header className="pet-detail-header">
<div>{pet.type} · {pet.breed}</div> <div className="pet-detail-avatar">🐾</div>
{pet.bio && <p>{pet.bio}</p>}
<div className="pet-detail-info">
<h1>{pet.name}</h1>
<span className="pet-detail-meta">
{pet.type} · {pet.breed}
{pet.age && ` · ${pet.age}`}
</span>
<span className="pet-detail-owner">
Betreut von {pet.owner}
</span>
</div>
</header> </header>
<section style={{ display: 'grid', gap: '1.2rem' }}> {/* Posts */}
<section className="pet-detail-posts">
<h2>Beiträge</h2> <h2>Beiträge</h2>
{pet.posts.length === 0 && ( {posts.length === 0 ? (
<p style={{ color: '#777' }}>Dieses Haustier hat noch keine Beiträge.</p> <div className="empty-state">
<strong>Noch keine Beiträge</strong>
<span>
Für {pet.name} wurden noch keine Beiträge erstellt.
</span>
</div>
) : (
<div className="post-list">
{posts.map((post) => (
<PostCard
key={post.id}
post={post}
isDiscovery={false}
/>
))}
</div>
)} )}
{pet.posts.map((post) => (
<PostCard
key={post.id}
petName={pet.name}
petType={pet.type}
author="Du"
text={post.text}
createdAt={post.createdAt}
likes={post.likes}
commentsCount={post.commentsCount}
commentsList={post.commentsList}
/>
))}
</section> </section>
</section> </section>
); );
+51 -46
View File
@@ -1,75 +1,80 @@
'use client';
import Link from 'next/link'; import Link from 'next/link';
type Pet = { type Pet = {
id: number; id: number;
name: string; name: string;
type: 'Hund' | 'Katze'; type: 'Hund' | 'Katze';
breed: string;
age?: string;
}; };
const mockPets: Pet[] = [ const mockPets: Pet[] = [
{ id: 1, name: 'Luna', type: 'Katze' }, {
{ id: 2, name: 'Bello', type: 'Hund' }, id: 1,
name: 'Luna',
type: 'Katze',
breed: 'Bengal',
age: '2 Jahre',
},
{
id: 2,
name: 'Bello',
type: 'Hund',
breed: 'Labrador',
age: '4 Jahre',
},
{
id: 3,
name: 'Milo',
type: 'Katze',
breed: 'Europäisch Kurzhaar',
},
]; ];
export default function PetsPage() { export default function PetsPage() {
return ( return (
<section <section className="pets-page">
style={{ {/* Header */}
maxWidth: '600px', <header className="pets-header">
margin: '0 auto', <h1>Meine Tiere</h1>
display: 'grid', <p>
gap: '1.5rem', Verwalte deine Haustiere – Beiträge sind immer einem Tier zugeordnet.
}}
>
<header>
<h1 style={{ marginBottom: '0.5rem' }}>Meine Haustiere</h1>
<p style={{ margin: 0, color: '#555' }}>
Verwalte deine Hunde und Katzen
</p> </p>
</header> </header>
<section style={{ display: 'grid', gap: '1rem' }}> {/* Pets Grid */}
<div className="pets-grid">
{mockPets.map((pet) => ( {mockPets.map((pet) => (
<Link <Link
key={pet.id} key={pet.id}
href={`/pets/${pet.id}`} href={`/pets/${pet.id}`}
style={{ className="pet-card"
textDecoration: 'none',
color: 'inherit',
border: '1px solid #e5e5e5',
borderRadius: '16px',
padding: '1rem',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
> >
<div> <div className="pet-avatar">
<strong>{pet.name}</strong> 🐾
<div style={{ fontSize: '0.9rem', color: '#555' }}>
{pet.type}
</div>
</div> </div>
<span style={{ fontSize: '1.2rem' }}>›</span> <strong className="pet-name">{pet.name}</strong>
<span className="pet-meta">
{pet.type} · {pet.breed}
</span>
{pet.age && (
<span className="pet-age">{pet.age}</span>
)}
</Link> </Link>
))} ))}
</section> </div>
<Link {/* Add Pet */}
href="/pets/new" <div className="pets-actions">
style={{ <Link href="/pets/new" className="button-primary">
alignSelf: 'flex-start', + Neues Tier hinzufügen
padding: '0.7rem 1rem', </Link>
borderRadius: '12px', </div>
backgroundColor: '#2E7D32',
color: 'white',
textDecoration: 'none',
fontWeight: 600,
}}
>
➕ Haustier hinzufügen
</Link>
</section> </section>
); );
} }
+155 -1
View File
@@ -1,3 +1,157 @@
'use client';
import PostCard, {
PostCardData,
} from '@/app/components/PostCard/PostCard';
/* =======================
MOCK: USER
======================= */
const user = {
id: 1,
name: 'Laura',
username: '@laura_pets',
bio: 'Liebt Tiere, Natur & ruhige Momente.',
stats: {
pets: 2,
posts: 6,
follows: 18,
},
};
/* =======================
MOCK: PETS
======================= */
const pets = [
{
id: 1,
name: 'Nala',
type: 'Katze',
breed: 'Maine Coon',
age: '3 Jahre',
},
{
id: 2,
name: 'Rocky',
type: 'Hund',
breed: 'Labrador',
age: '4 Jahre',
},
];
/* =======================
MOCK: POSTS
======================= */
const posts: PostCardData[] = [
{
id: 501,
petName: 'Nala',
petType: 'Katze',
authorName: 'Laura',
createdAt: 'gestern',
text: 'Nala beobachtet alles ganz ruhig.',
likesCount: 6,
commentsCount: 1,
},
{
id: 502,
petName: 'Rocky',
petType: 'Hund',
authorName: 'Laura',
createdAt: 'vor 2 Tagen',
text: 'Rocky liebt lange Spaziergänge.',
likesCount: 9,
commentsCount: 2,
},
];
/* =======================
PAGE
======================= */
export default function ProfilePage() { export default function ProfilePage() {
return <h1>Profil</h1>; return (
<>
{/* ================= USER HEADER ================= */}
<section className="profile-header">
<div className="profile-avatar">
<span>👤</span>
</div>
<div className="profile-info">
<h1>{user.name}</h1>
<span className="profile-username">
{user.username}
</span>
{user.bio && (
<p className="profile-bio">
{user.bio}
</p>
)}
<div className="profile-stats">
<div>
<strong>{user.stats.pets}</strong>
<span>Tiere</span>
</div>
<div>
<strong>{user.stats.posts}</strong>
<span>Beiträge</span>
</div>
<div>
<strong>{user.stats.follows}</strong>
<span>Abos</span>
</div>
</div>
</div>
</section>
{/* ================= PETS ================= */}
<section className="profile-pets">
<h2>Meine Tiere</h2>
<div className="pets-grid">
{pets.map((pet) => (
<a
key={pet.id}
href={`/pets/${pet.id}`}
className="pet-card"
>
<div className="pet-avatar">🐾</div>
<strong className="pet-name">
{pet.name}
</strong>
<span className="pet-meta">
{pet.type} · {pet.breed}
</span>
<span className="pet-age">
{pet.age}
</span>
</a>
))}
</div>
</section>
{/* ================= POSTS ================= */}
<section className="profile-posts">
<h2>Beiträge</h2>
<div className="post-list">
{posts.map((post) => (
<PostCard
key={post.id}
post={post}
/>
))}
</div>
</section>
</>
);
} }