This commit is contained in:
eric
2026-06-08 03:06:12 -05:00
parent 60dfe538b0
commit ebfec37e47
34 changed files with 1753 additions and 31 deletions

View File

@@ -23,12 +23,10 @@ function ProfileRow({
badge?: string;
onSelect?: () => void;
}) {
return (
<button
type="button"
onClick={onSelect}
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"
>
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";
const content = (
<>
<img
src={mediaUrl(profile.photo)}
alt={profile.name}
@@ -46,8 +44,16 @@ function ProfileRow({
<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>
</button>
</>
);
if (onSelect) {
return (
<button type="button" onClick={onSelect} className={className}>
{content}
</button>
);
}
return <div className={className}>{content}</div>;
}
export default function LikesPanel({ likes, mutual, formatTime, t, onSelectProfile }: LikesPanelProps) {
@@ -93,15 +99,29 @@ export default function LikesPanel({ likes, mutual, formatTime, t, onSelectProfi
</div>
<div className="space-y-3">
{mutual.length ? (
mutual.map((profile) => (
<ProfileRow
key={profile.id}
profile={profile}
timeLabel={formatTime(profile.matchedAt)}
badge={t("mutualBadge")}
onSelect={() => onSelectProfile?.(profile)}
/>
))
mutual.map((profile) =>
profile.conversationId ? (
<Link
key={profile.id}
href={`/chat/${profile.conversationId}`}
className="block"
>
<ProfileRow
profile={profile}
timeLabel={formatTime(profile.matchedAt)}
badge={t("mutualBadge")}
/>
</Link>
) : (
<ProfileRow
key={profile.id}
profile={profile}
timeLabel={formatTime(profile.matchedAt)}
badge={t("mutualBadge")}
onSelect={() => onSelectProfile?.(profile)}
/>
)
)
) : (
<div className="rounded-xl border border-dashed border-gray-200 p-4 text-sm text-gray-500 dark:border-gray-700 dark:text-gray-400">
{t("noMutualYet")}
@@ -110,7 +130,7 @@ export default function LikesPanel({ likes, mutual, formatTime, t, onSelectProfi
</div>
{mutual.length > 0 ? (
<Link
href="/messages"
href="/chat"
className="mt-3 inline-flex w-full items-center justify-center rounded-full bg-[#ff4d4f] px-4 py-2 text-sm font-semibold text-white transition hover:bg-red-600"
>
{t("goMessages")}

View File

@@ -6,11 +6,12 @@ import type { DatingProfile } from "../types";
interface MatchModalProps {
profile: DatingProfile | null;
conversationId?: string;
onClose: () => void;
t: (key: string) => string;
}
export default function MatchModal({ profile, onClose, t }: MatchModalProps) {
export default function MatchModal({ profile, conversationId, onClose, t }: MatchModalProps) {
if (!profile) return null;
return (
@@ -33,7 +34,7 @@ export default function MatchModal({ profile, onClose, t }: MatchModalProps) {
<p className="mt-1 text-sm text-gray-500 dark:text-gray-400">📍 {profile.location}</p>
<div className="mt-6 flex flex-col gap-3">
<Link
href="/messages"
href={conversationId ? `/chat/${conversationId}` : "/chat"}
onClick={onClose}
className="inline-flex items-center justify-center rounded-full bg-[#ff4d4f] px-4 py-3 text-sm font-semibold text-white transition hover:bg-red-600"
>