This commit is contained in:
eric
2026-06-08 06:05:31 -05:00
parent ebfec37e47
commit 06ab949d81
77 changed files with 3646 additions and 358 deletions

View File

@@ -1,5 +1,6 @@
"use client";
import type { ReactNode } from "react";
import { Link } from "@/i18n/navigation";
import { mediaUrl } from "@/app/lib/media";
import type { DatingProfile } from "../types";
@@ -10,6 +11,8 @@ interface LikesPanelProps {
formatTime: (value?: string) => string;
t: (key: string) => string;
onSelectProfile?: (profile: DatingProfile) => void;
onLikeBack?: (profile: DatingProfile) => void;
likingBackId?: string | null;
}
function ProfileRow({
@@ -17,11 +20,13 @@ function ProfileRow({
timeLabel,
badge,
onSelect,
action,
}: {
profile: DatingProfile;
timeLabel: string;
badge?: string;
onSelect?: () => void;
action?: ReactNode;
}) {
const className =
"flex w-full items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 text-left shadow-sm transition-shadow hover:shadow-md dark:border-gray-800 dark:bg-gray-900";
@@ -41,9 +46,12 @@ function ProfileRow({
</span>
) : null}
</div>
<span className="flex-shrink-0 rounded-full bg-gray-50 px-2 py-1 text-[10px] text-gray-400 dark:bg-gray-800 dark:text-gray-500">
{timeLabel}
</span>
<div className="flex flex-shrink-0 flex-col items-end gap-2">
{action}
<span className="rounded-full bg-gray-50 px-2 py-1 text-[10px] text-gray-400 dark:bg-gray-800 dark:text-gray-500">
{timeLabel}
</span>
</div>
</>
);
if (onSelect) {
@@ -56,7 +64,15 @@ function ProfileRow({
return <div className={className}>{content}</div>;
}
export default function LikesPanel({ likes, mutual, formatTime, t, onSelectProfile }: LikesPanelProps) {
export default function LikesPanel({
likes,
mutual,
formatTime,
t,
onSelectProfile,
onLikeBack,
likingBackId,
}: LikesPanelProps) {
return (
<div className="space-y-6">
<section>
@@ -77,6 +93,21 @@ export default function LikesPanel({ likes, mutual, formatTime, t, onSelectProfi
profile={profile}
timeLabel={formatTime(profile.likedAt)}
onSelect={() => onSelectProfile?.(profile)}
action={
onLikeBack ? (
<button
type="button"
onClick={(event) => {
event.stopPropagation();
onLikeBack(profile);
}}
disabled={likingBackId === profile.id}
className="rounded-full bg-[#ff4d4f] px-3 py-1 text-[11px] font-semibold text-white disabled:opacity-60"
>
{likingBackId === profile.id ? "..." : t("likeBack")}
</button>
) : null
}
/>
))
) : (

View File

@@ -12,6 +12,8 @@ interface SwipeCardProps {
isAnimatingOut: "left" | "right" | null;
onLike: () => void;
onDislike: () => void;
onSuperLike?: () => void;
showSuperLike?: boolean;
onBeginDrag: (clientX: number) => void;
onMoveDrag: (clientX: number) => void;
onEndDrag: () => void;
@@ -26,6 +28,8 @@ export default function SwipeCard({
isAnimatingOut,
onLike,
onDislike,
onSuperLike,
showSuperLike = false,
onBeginDrag,
onMoveDrag,
onEndDrag,
@@ -76,17 +80,20 @@ export default function SwipeCard({
<Link
href={`/feedback?type=report&target=${encodeURIComponent(profile.id)}`}
className="text-sm font-medium text-[#ff4d4f] hover:text-red-600"
onPointerDown={(e) => e.stopPropagation()}
>
{t("report")}
</Link>
</div>
<div className="mb-6 mt-12 flex justify-center">
<img
src={mediaUrl(profile.photo)}
alt={profile.name}
className="h-28 w-28 rounded-full border-4 border-white/50 object-cover shadow-lg"
/>
<Link href={`/members/${profile.id}`} onPointerDown={(e) => e.stopPropagation()}>
<img
src={mediaUrl(profile.photo)}
alt={profile.name}
className="h-28 w-28 rounded-full border-4 border-white/50 object-cover shadow-lg transition hover:scale-105"
/>
</Link>
</div>
<div className="mb-4 text-center">
@@ -114,11 +121,17 @@ export default function SwipeCard({
<p className="mb-8 px-2 text-center text-sm leading-relaxed text-white/95">{profile.bio}</p>
<div className="flex items-center justify-center gap-8">
<div
className={`flex items-center justify-center ${showSuperLike ? "gap-5" : "gap-8"}`}
onPointerDown={(e) => e.stopPropagation()}
>
<div className="flex flex-col items-center gap-2">
<button
type="button"
onClick={onDislike}
onClick={(e) => {
e.stopPropagation();
onDislike();
}}
className="flex h-16 w-16 items-center justify-center rounded-full bg-white text-[#ff4d4f] shadow-lg transition-all hover:scale-105 hover:bg-red-50 active:scale-95"
aria-label={t("dislike")}
>
@@ -126,10 +139,29 @@ export default function SwipeCard({
</button>
<span className="text-xs font-medium text-white/80">{t("dislike")}</span>
</div>
{showSuperLike && onSuperLike ? (
<div className="flex flex-col items-center gap-2">
<button
type="button"
onClick={(e) => {
e.stopPropagation();
onSuperLike();
}}
className="flex h-14 w-14 items-center justify-center rounded-full bg-amber-400 text-white shadow-lg ring-2 ring-amber-200 transition-all hover:scale-105 hover:bg-amber-500 active:scale-95"
aria-label={t("superlike")}
>
<span className="text-xl">⭐</span>
</button>
<span className="text-xs font-medium text-white/80">{t("superlike")}</span>
</div>
) : null}
<div className="flex flex-col items-center gap-2">
<button
type="button"
onClick={onLike}
onClick={(e) => {
e.stopPropagation();
onLike();
}}
className="flex h-16 w-16 items-center justify-center rounded-full bg-[#22c55e] text-white shadow-lg transition-all hover:scale-105 hover:bg-[#16a34a] active:scale-95"
aria-label={t("like")}
>

View File

@@ -13,6 +13,8 @@ interface SwipeStackProps {
isAnimatingOut: "left" | "right" | null;
onLike: () => void;
onDislike: () => void;
onSuperLike?: () => void;
showSuperLike?: boolean;
onBeginDrag: (clientX: number) => void;
onMoveDrag: (clientX: number) => void;
onEndDrag: () => void;
@@ -28,6 +30,8 @@ export default function SwipeStack({
isAnimatingOut,
onLike,
onDislike,
onSuperLike,
showSuperLike,
onBeginDrag,
onMoveDrag,
onEndDrag,
@@ -59,6 +63,8 @@ export default function SwipeStack({
isAnimatingOut={isAnimatingOut}
onLike={onLike}
onDislike={onDislike}
onSuperLike={onSuperLike}
showSuperLike={showSuperLike}
onBeginDrag={onBeginDrag}
onMoveDrag={onMoveDrag}
onEndDrag={onEndDrag}