's'
This commit is contained in:
76
app/[locale]/dating/components/AdvancedFilters.tsx
Normal file
76
app/[locale]/dating/components/AdvancedFilters.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
"use client";
|
||||
|
||||
import { Link } from "@/i18n/navigation";
|
||||
|
||||
export interface AdvancedFilterState {
|
||||
gender: string;
|
||||
single: string;
|
||||
}
|
||||
|
||||
interface AdvancedFiltersProps {
|
||||
value: AdvancedFilterState;
|
||||
onChange: (next: AdvancedFilterState) => void;
|
||||
isVip: boolean;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
const GENDER_OPTIONS = ["all", "男", "女"];
|
||||
const SINGLE_OPTIONS = ["all", "单身", "恋爱中", "已婚", "不限"];
|
||||
|
||||
export default function AdvancedFilters({ value, onChange, isVip, t }: AdvancedFiltersProps) {
|
||||
return (
|
||||
<div className="relative mx-auto mb-4 max-w-md px-4">
|
||||
<div
|
||||
className={`rounded-2xl border p-4 ${
|
||||
isVip
|
||||
? "border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900"
|
||||
: "border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-gray-900/60"
|
||||
}`}
|
||||
>
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<p className="text-sm font-semibold text-gray-900 dark:text-gray-100">{t("advancedFilters")}</p>
|
||||
{!isVip ? (
|
||||
<Link href="/pricing" className="text-xs font-semibold text-[#ff4d4f] hover:underline">
|
||||
{t("upgradeVip")}
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
<div className={`grid grid-cols-2 gap-3 ${!isVip ? "pointer-events-none opacity-50" : ""}`}>
|
||||
<label className="text-xs text-gray-500 dark:text-gray-400">
|
||||
{t("filterGender")}
|
||||
<select
|
||||
value={value.gender}
|
||||
onChange={(e) => onChange({ ...value, gender: e.target.value })}
|
||||
disabled={!isVip}
|
||||
className="mt-1 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-800"
|
||||
>
|
||||
{GENDER_OPTIONS.map((option) => (
|
||||
<option key={option} value={option}>
|
||||
{option === "all" ? t("all") : option}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-xs text-gray-500 dark:text-gray-400">
|
||||
{t("filterSingle")}
|
||||
<select
|
||||
value={value.single}
|
||||
onChange={(e) => onChange({ ...value, single: e.target.value })}
|
||||
disabled={!isVip}
|
||||
className="mt-1 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-800"
|
||||
>
|
||||
{SINGLE_OPTIONS.map((option) => (
|
||||
<option key={option} value={option}>
|
||||
{option === "all" ? t("all") : option}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
{!isVip ? (
|
||||
<p className="mt-3 text-xs text-gray-500 dark:text-gray-400">{t("vipFilterHint")}</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
32
app/[locale]/dating/components/CityFilter.tsx
Normal file
32
app/[locale]/dating/components/CityFilter.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
interface CityFilterProps {
|
||||
value: string;
|
||||
onChange: (city: string) => void;
|
||||
cities: Array<{ slug: string; name: string; nameEn?: string }>;
|
||||
locale: string;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
export default function CityFilter({ value, onChange, cities, locale, t }: CityFilterProps) {
|
||||
return (
|
||||
<div className="mx-auto flex max-w-md items-center justify-center gap-2 px-4 pb-4">
|
||||
<label htmlFor="dating-city-filter" className="text-xs font-medium text-gray-500 dark:text-gray-400">
|
||||
{t("cityFilter")}
|
||||
</label>
|
||||
<select
|
||||
id="dating-city-filter"
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
className="min-w-[140px] rounded-full border border-gray-200 bg-white px-3 py-2 text-xs font-medium text-gray-700 shadow-sm outline-none focus:border-[#ff4d4f] dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200"
|
||||
>
|
||||
<option value="all">{t("allCities")}</option>
|
||||
{cities.map((city) => (
|
||||
<option key={city.slug} value={city.slug}>
|
||||
{locale === "zh" ? city.name : city.nameEn || city.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
33
app/[locale]/dating/components/IntentTabs.tsx
Normal file
33
app/[locale]/dating/components/IntentTabs.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
import { TAB_ORDER } from "../constants";
|
||||
import type { MatchIntent } from "../types";
|
||||
|
||||
interface IntentTabsProps {
|
||||
activeTab: MatchIntent;
|
||||
onChange: (tab: MatchIntent) => void;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
export default function IntentTabs({ activeTab, onChange, t }: IntentTabsProps) {
|
||||
return (
|
||||
<div className="flex justify-center pt-6 pb-3 px-4">
|
||||
<div className="flex max-w-3xl flex-wrap justify-center gap-2">
|
||||
{TAB_ORDER.map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
onClick={() => onChange(tab)}
|
||||
className={`rounded-full px-4 py-2 text-xs font-medium transition-all duration-200 sm:text-sm ${
|
||||
activeTab === tab
|
||||
? "bg-[#ff4d4f] text-white shadow-sm"
|
||||
: "border border-gray-100 bg-white text-gray-600 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
|
||||
}`}
|
||||
>
|
||||
{t(tab)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
122
app/[locale]/dating/components/LikesPanel.tsx
Normal file
122
app/[locale]/dating/components/LikesPanel.tsx
Normal file
@@ -0,0 +1,122 @@
|
||||
"use client";
|
||||
|
||||
import { Link } from "@/i18n/navigation";
|
||||
import { mediaUrl } from "@/app/lib/media";
|
||||
import type { DatingProfile } from "../types";
|
||||
|
||||
interface LikesPanelProps {
|
||||
likes: DatingProfile[];
|
||||
mutual: DatingProfile[];
|
||||
formatTime: (value?: string) => string;
|
||||
t: (key: string) => string;
|
||||
onSelectProfile?: (profile: DatingProfile) => void;
|
||||
}
|
||||
|
||||
function ProfileRow({
|
||||
profile,
|
||||
timeLabel,
|
||||
badge,
|
||||
onSelect,
|
||||
}: {
|
||||
profile: DatingProfile;
|
||||
timeLabel: string;
|
||||
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"
|
||||
>
|
||||
<img
|
||||
src={mediaUrl(profile.photo)}
|
||||
alt={profile.name}
|
||||
className="h-12 w-12 flex-shrink-0 rounded-full object-cover shadow-sm"
|
||||
/>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="truncate font-medium text-gray-900 dark:text-gray-100">{profile.name}</p>
|
||||
<p className="truncate text-xs text-gray-500 dark:text-gray-400">📍 {profile.location}</p>
|
||||
{badge ? (
|
||||
<span className="mt-1 inline-flex rounded-full bg-pink-50 px-2 py-0.5 text-[10px] font-semibold text-pink-600 dark:bg-pink-950/40 dark:text-pink-200">
|
||||
{badge}
|
||||
</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>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export default function LikesPanel({ likes, mutual, formatTime, t, onSelectProfile }: LikesPanelProps) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<section>
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100">{t("title")} 💕</h2>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">{t("likedYou")}</p>
|
||||
</div>
|
||||
{likes.length > 0 ? (
|
||||
<span className="rounded-full bg-[#ff4d4f] px-2 py-0.5 text-xs font-bold text-white">{likes.length}</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{likes.length ? (
|
||||
likes.map((profile) => (
|
||||
<ProfileRow
|
||||
key={profile.id}
|
||||
profile={profile}
|
||||
timeLabel={formatTime(profile.likedAt)}
|
||||
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("noLikesYet")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<div>
|
||||
<h3 className="font-semibold text-gray-900 dark:text-gray-100">{t("mutualTitle")}</h3>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">{t("mutualSubtitle")}</p>
|
||||
</div>
|
||||
{mutual.length > 0 ? (
|
||||
<span className="rounded-full bg-emerald-500 px-2 py-0.5 text-xs font-bold text-white">{mutual.length}</span>
|
||||
) : null}
|
||||
</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)}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<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")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{mutual.length > 0 ? (
|
||||
<Link
|
||||
href="/messages"
|
||||
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")}
|
||||
</Link>
|
||||
) : null}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
54
app/[locale]/dating/components/MatchModal.tsx
Normal file
54
app/[locale]/dating/components/MatchModal.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
"use client";
|
||||
|
||||
import { Link } from "@/i18n/navigation";
|
||||
import { mediaUrl } from "@/app/lib/media";
|
||||
import type { DatingProfile } from "../types";
|
||||
|
||||
interface MatchModalProps {
|
||||
profile: DatingProfile | null;
|
||||
onClose: () => void;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
export default function MatchModal({ profile, onClose, t }: MatchModalProps) {
|
||||
if (!profile) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm">
|
||||
<div className="w-full max-w-sm overflow-hidden rounded-3xl bg-white shadow-2xl dark:bg-gray-900">
|
||||
<div className="bg-gradient-to-br from-[#ff4d4f] via-pink-500 to-rose-400 px-6 py-8 text-center text-white">
|
||||
<p className="text-sm font-semibold uppercase tracking-widest opacity-90">{t("matchCelebration")}</p>
|
||||
<h2 className="mt-2 text-3xl font-black">{t("itsAMatch")}</h2>
|
||||
<p className="mt-2 text-sm text-white/90">{t("matchHint")}</p>
|
||||
</div>
|
||||
<div className="-mt-10 flex justify-center">
|
||||
<img
|
||||
src={mediaUrl(profile.photo)}
|
||||
alt={profile.name}
|
||||
className="h-24 w-24 rounded-full border-4 border-white object-cover shadow-lg dark:border-gray-900"
|
||||
/>
|
||||
</div>
|
||||
<div className="px-6 pb-6 pt-4 text-center">
|
||||
<h3 className="text-xl font-bold text-gray-900 dark:text-gray-100">{profile.name}</h3>
|
||||
<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"
|
||||
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"
|
||||
>
|
||||
{t("sendMessage")}
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="rounded-full border border-gray-200 px-4 py-3 text-sm font-semibold text-gray-700 transition hover:bg-gray-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800"
|
||||
>
|
||||
{t("keepSwiping")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
143
app/[locale]/dating/components/SwipeCard.tsx
Normal file
143
app/[locale]/dating/components/SwipeCard.tsx
Normal file
@@ -0,0 +1,143 @@
|
||||
"use client";
|
||||
|
||||
import { Link } from "@/i18n/navigation";
|
||||
import { mediaUrl } from "@/app/lib/media";
|
||||
import type { DatingProfile } from "../types";
|
||||
|
||||
interface SwipeCardProps {
|
||||
profile: DatingProfile;
|
||||
badgeText: string;
|
||||
dragX: number;
|
||||
isDragging: boolean;
|
||||
isAnimatingOut: "left" | "right" | null;
|
||||
onLike: () => void;
|
||||
onDislike: () => void;
|
||||
onBeginDrag: (clientX: number) => void;
|
||||
onMoveDrag: (clientX: number) => void;
|
||||
onEndDrag: () => void;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
export default function SwipeCard({
|
||||
profile,
|
||||
badgeText,
|
||||
dragX,
|
||||
isDragging,
|
||||
isAnimatingOut,
|
||||
onLike,
|
||||
onDislike,
|
||||
onBeginDrag,
|
||||
onMoveDrag,
|
||||
onEndDrag,
|
||||
t,
|
||||
}: SwipeCardProps) {
|
||||
return (
|
||||
<div
|
||||
className={`relative touch-pan-y select-none overflow-hidden rounded-2xl border border-white/20 bg-gradient-to-br ${profile.gradient} p-8 pb-6 shadow-xl ${
|
||||
isDragging ? "cursor-grabbing" : "cursor-grab"
|
||||
} transition-transform`}
|
||||
style={{
|
||||
transform: `translateX(${isAnimatingOut === "right" ? 420 : isAnimatingOut === "left" ? -420 : dragX}px) rotate(${dragX / 18}deg)`,
|
||||
opacity: isAnimatingOut ? 0.25 : 1,
|
||||
transitionDuration: isDragging ? "0ms" : "180ms",
|
||||
}}
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "ArrowRight") onLike();
|
||||
if (e.key === "ArrowLeft") onDislike();
|
||||
}}
|
||||
onPointerDown={(e) => {
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
onBeginDrag(e.clientX);
|
||||
}}
|
||||
onPointerMove={(e) => onMoveDrag(e.clientX)}
|
||||
onPointerUp={onEndDrag}
|
||||
onPointerCancel={onEndDrag}
|
||||
>
|
||||
<div
|
||||
className={`pointer-events-none absolute left-5 top-5 rounded-full border-2 border-white/80 px-4 py-2 text-sm font-bold text-white transition-opacity ${
|
||||
dragX > 45 ? "opacity-100" : "opacity-0"
|
||||
}`}
|
||||
>
|
||||
{t("likeOverlay")}
|
||||
</div>
|
||||
<div
|
||||
className={`pointer-events-none absolute right-5 top-5 rounded-full border-2 border-white/80 px-4 py-2 text-sm font-bold text-white transition-opacity ${
|
||||
dragX < -45 ? "opacity-100" : "opacity-0"
|
||||
}`}
|
||||
>
|
||||
{t("passOverlay")}
|
||||
</div>
|
||||
|
||||
<div className="absolute right-4 top-4 flex flex-col items-end gap-1">
|
||||
<span className="rounded-full bg-white/90 px-3 py-1.5 text-xs font-medium text-gray-800 backdrop-blur-sm">
|
||||
{badgeText}
|
||||
</span>
|
||||
<Link
|
||||
href={`/feedback?type=report&target=${encodeURIComponent(profile.id)}`}
|
||||
className="text-sm font-medium text-[#ff4d4f] hover:text-red-600"
|
||||
>
|
||||
{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"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-4 text-center">
|
||||
<h3 className="text-xl font-bold text-white drop-shadow-sm">
|
||||
{profile.name},{profile.age}
|
||||
</h3>
|
||||
<p className="mt-1 text-sm text-white/90">📍 {profile.location}</p>
|
||||
{(profile.gender || profile.single) && (
|
||||
<p className="mt-1 text-xs text-white/80">
|
||||
{[profile.gender, profile.single].filter(Boolean).join(" · ")}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mb-4">
|
||||
<p className="mb-2 text-xs font-medium text-white/90">{t("matchTags")}:</p>
|
||||
<div className="flex flex-wrap justify-center gap-2">
|
||||
{profile.tags.map((tag) => (
|
||||
<span key={tag} className="rounded-full bg-white/80 px-3 py-1 text-xs font-medium text-gray-800">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 flex-col items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={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")}
|
||||
>
|
||||
<span className="text-2xl">✕</span>
|
||||
</button>
|
||||
<span className="text-xs font-medium text-white/80">{t("dislike")}</span>
|
||||
</div>
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={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")}
|
||||
>
|
||||
<span className="text-2xl">💚</span>
|
||||
</button>
|
||||
<span className="text-xs font-medium text-white/80">{t("like")}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
52
app/[locale]/dating/components/SwipeQuota.tsx
Normal file
52
app/[locale]/dating/components/SwipeQuota.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
"use client";
|
||||
|
||||
import { Link } from "@/i18n/navigation";
|
||||
|
||||
interface SwipeQuotaProps {
|
||||
vip: boolean;
|
||||
used: number;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
export default function SwipeQuota({ vip, used, limit, remaining, t }: SwipeQuotaProps) {
|
||||
if (vip) {
|
||||
return (
|
||||
<div className="mx-auto mb-3 max-w-md px-4">
|
||||
<div className="rounded-full bg-emerald-50 px-4 py-2 text-center text-xs font-semibold text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-200">
|
||||
{t("vipUnlimited")}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const pct = Math.min(100, Math.round((used / Math.max(limit, 1)) * 100));
|
||||
|
||||
return (
|
||||
<div className="mx-auto mb-3 max-w-md px-4">
|
||||
<div className="rounded-2xl border border-gray-200 bg-white px-4 py-3 dark:border-gray-800 dark:bg-gray-900">
|
||||
<div className="mb-2 flex items-center justify-between text-xs">
|
||||
<span className="font-medium text-gray-600 dark:text-gray-300">{t("dailyQuota")}</span>
|
||||
<span className="text-gray-500 dark:text-gray-400">
|
||||
{remaining} / {limit}
|
||||
</span>
|
||||
</div>
|
||||
<div className="h-2 overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800">
|
||||
<div
|
||||
className={`h-full rounded-full transition-all ${remaining <= 3 ? "bg-[#ff4d4f]" : "bg-[#ff4d4f]/80"}`}
|
||||
style={{ width: `${pct}%` }}
|
||||
/>
|
||||
</div>
|
||||
{remaining <= 3 ? (
|
||||
<p className="mt-2 text-xs text-[#ff4d4f]">
|
||||
{t("quotaLow")}{" "}
|
||||
<Link href="/pricing" className="font-semibold underline">
|
||||
{t("upgradeVip")}
|
||||
</Link>
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
70
app/[locale]/dating/components/SwipeStack.tsx
Normal file
70
app/[locale]/dating/components/SwipeStack.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
"use client";
|
||||
|
||||
import { mediaUrl } from "@/app/lib/media";
|
||||
import type { DatingProfile } from "../types";
|
||||
import SwipeCard from "./SwipeCard";
|
||||
|
||||
interface SwipeStackProps {
|
||||
current: DatingProfile;
|
||||
next?: DatingProfile;
|
||||
badgeText: string;
|
||||
dragX: number;
|
||||
isDragging: boolean;
|
||||
isAnimatingOut: "left" | "right" | null;
|
||||
onLike: () => void;
|
||||
onDislike: () => void;
|
||||
onBeginDrag: (clientX: number) => void;
|
||||
onMoveDrag: (clientX: number) => void;
|
||||
onEndDrag: () => void;
|
||||
t: (key: string) => string;
|
||||
}
|
||||
|
||||
export default function SwipeStack({
|
||||
current,
|
||||
next,
|
||||
badgeText,
|
||||
dragX,
|
||||
isDragging,
|
||||
isAnimatingOut,
|
||||
onLike,
|
||||
onDislike,
|
||||
onBeginDrag,
|
||||
onMoveDrag,
|
||||
onEndDrag,
|
||||
t,
|
||||
}: SwipeStackProps) {
|
||||
return (
|
||||
<div className="relative">
|
||||
{next ? (
|
||||
<div
|
||||
aria-hidden
|
||||
className={`pointer-events-none absolute inset-x-0 top-3 mx-auto w-[92%] scale-[0.96] rounded-2xl bg-gradient-to-br ${next.gradient} opacity-70 shadow-lg`}
|
||||
>
|
||||
<div className="flex justify-center py-10">
|
||||
<img
|
||||
src={mediaUrl(next.photo)}
|
||||
alt=""
|
||||
className="h-20 w-20 rounded-full border-4 border-white/40 object-cover"
|
||||
/>
|
||||
</div>
|
||||
<div className="pb-6 text-center text-sm font-semibold text-white/90">{next.name}</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="relative z-10">
|
||||
<SwipeCard
|
||||
profile={current}
|
||||
badgeText={badgeText}
|
||||
dragX={dragX}
|
||||
isDragging={isDragging}
|
||||
isAnimatingOut={isAnimatingOut}
|
||||
onLike={onLike}
|
||||
onDislike={onDislike}
|
||||
onBeginDrag={onBeginDrag}
|
||||
onMoveDrag={onMoveDrag}
|
||||
onEndDrag={onEndDrag}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user