's'
This commit is contained in:
@@ -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
|
||||
}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user