feat: complete dynamic JSON-driven photo tools frontend connected to FastAPI backend
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
import { Smartphone, Star, Check, ArrowRight, ShieldCheck } from 'lucide-react';
|
||||
import { AppItem, resolveLocalised } from '@/types';
|
||||
|
||||
interface AppCardsSectionProps {
|
||||
title?: any;
|
||||
subtitle?: any;
|
||||
apps?: AppItem[];
|
||||
layout?: 'compact' | 'detailed';
|
||||
showRating?: boolean;
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export function AppCardsSection({
|
||||
title,
|
||||
subtitle,
|
||||
apps = [],
|
||||
layout = 'compact',
|
||||
showRating = true,
|
||||
locale = 'en',
|
||||
}: AppCardsSectionProps) {
|
||||
return (
|
||||
<section className="py-12 lg:py-16 bg-slate-50/50 dark:bg-slate-950/50">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
{(title || subtitle) && (
|
||||
<div className="text-center max-w-3xl mx-auto mb-12 space-y-3">
|
||||
{title && (
|
||||
<h2 className="text-3xl sm:text-4xl font-bold text-slate-900 dark:text-white">
|
||||
{resolveLocalised(title, locale)}
|
||||
</h2>
|
||||
)}
|
||||
{subtitle && (
|
||||
<p className="text-base text-slate-600 dark:text-slate-400">
|
||||
{resolveLocalised(subtitle, locale)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
{apps.map((app) => (
|
||||
<div
|
||||
key={app.id}
|
||||
className="bg-white dark:bg-slate-900 rounded-3xl p-6 border border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-xl transition-all flex flex-col justify-between"
|
||||
>
|
||||
<div>
|
||||
{/* Header: Icon & Rating */}
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="w-12 h-12 rounded-2xl bg-gradient-to-tr from-blue-600 to-indigo-600 flex items-center justify-center text-white shadow-md shadow-blue-500/20">
|
||||
<Smartphone className="w-6 h-6" />
|
||||
</div>
|
||||
{showRating && (
|
||||
<div className="flex items-center space-x-1 bg-amber-50 dark:bg-amber-950/50 border border-amber-200 dark:border-amber-800 px-2.5 py-1 rounded-full text-xs font-semibold text-amber-700 dark:text-amber-400">
|
||||
<Star className="w-3.5 h-3.5 fill-amber-400 text-amber-400" />
|
||||
<span>{app.rating.value}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<h3 className="text-xl font-bold text-slate-900 dark:text-white">
|
||||
{resolveLocalised(app.name, locale)}
|
||||
</h3>
|
||||
<p className="mt-1 text-xs text-blue-600 dark:text-blue-400 font-medium">
|
||||
{resolveLocalised(app.tagline, locale)}
|
||||
</p>
|
||||
|
||||
<p className="mt-3 text-xs text-slate-600 dark:text-slate-400 leading-relaxed line-clamp-3">
|
||||
{resolveLocalised(app.description, locale)}
|
||||
</p>
|
||||
|
||||
{/* Features Checklist */}
|
||||
{app.features && app.features.length > 0 && (
|
||||
<div className="mt-4 pt-4 border-t border-slate-100 dark:border-slate-800 space-y-2">
|
||||
{app.features.slice(0, 3).map((feat, idx) => (
|
||||
<div key={idx} className="flex items-start space-x-2 text-xs text-slate-600 dark:text-slate-300">
|
||||
<Check className="w-3.5 h-3.5 text-emerald-500 shrink-0 mt-0.5" />
|
||||
<span className="line-clamp-1">{feat}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-6 pt-4 border-t border-slate-100 dark:border-slate-800 space-y-3">
|
||||
{/* Mandatory Disclaimer (PRD §1.2, §9 APP-10) */}
|
||||
<p className="text-[10px] text-slate-400 dark:text-slate-500 italic text-center">
|
||||
{resolveLocalised(app.creditsNote, locale, 'Credits and purchases are specific to this app.')}
|
||||
</p>
|
||||
|
||||
<Link
|
||||
href={`/apps/${app.slug}`}
|
||||
className="w-full inline-flex items-center justify-center space-x-2 py-3 rounded-xl text-xs font-semibold text-white bg-slate-900 dark:bg-white dark:text-slate-900 hover:bg-blue-600 dark:hover:bg-blue-500 dark:hover:text-white transition-all shadow-md"
|
||||
>
|
||||
<span>Get App & Bonus</span>
|
||||
<ArrowRight className="w-3.5 h-3.5" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user