feat: add featured flag to project, display featured projects on home page
This commit is contained in:
@@ -33,6 +33,7 @@ interface ProjectData {
|
||||
image: string;
|
||||
gallery?: string[];
|
||||
website?: string;
|
||||
featured?: boolean;
|
||||
}
|
||||
|
||||
interface PartnerData {
|
||||
@@ -94,6 +95,7 @@ export default function AdminClient({
|
||||
const [formGallery, setFormGallery] = useState<string[]>([]);
|
||||
const [newGalleryItem, setNewGalleryItem] = useState("");
|
||||
const [formWebsite, setFormWebsite] = useState("");
|
||||
const [formFeatured, setFormFeatured] = useState(false);
|
||||
|
||||
const [uploadingImage, setUploadingImage] = useState(false);
|
||||
const [uploadingGallery, setUploadingGallery] = useState(false);
|
||||
@@ -178,6 +180,7 @@ export default function AdminClient({
|
||||
setFormGallery(p.gallery ? [...p.gallery] : []);
|
||||
setNewGalleryItem("");
|
||||
setFormWebsite(p.website || "");
|
||||
setFormFeatured(p.featured || false);
|
||||
};
|
||||
|
||||
// Open modal for project adding
|
||||
@@ -200,6 +203,7 @@ export default function AdminClient({
|
||||
setFormGallery([]);
|
||||
setNewGalleryItem("");
|
||||
setFormWebsite("");
|
||||
setFormFeatured(false);
|
||||
};
|
||||
|
||||
// Save project
|
||||
@@ -237,6 +241,7 @@ export default function AdminClient({
|
||||
image: formImage,
|
||||
gallery: formGallery,
|
||||
website: formWebsite,
|
||||
featured: formFeatured,
|
||||
};
|
||||
|
||||
const res = await saveProject(projectDataToSave);
|
||||
@@ -1157,6 +1162,18 @@ export default function AdminClient({
|
||||
className="w-full font-mono text-[11px] bg-[#EDE8E0] border border-[#C8C2B8] focus:border-[#0A0A0A] outline-none px-3 py-2 text-[#0A0A0A]"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<label className="font-mono text-[9px] uppercase text-[#A0998E] block">Öne Çıkan Proje (Ana Sayfa İçin)</label>
|
||||
<div className="flex items-center h-[30px]">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={formFeatured}
|
||||
onChange={(e) => setFormFeatured(e.target.checked)}
|
||||
className="w-4 h-4 cursor-pointer"
|
||||
/>
|
||||
<span className="ml-2 font-mono text-[10px] text-[#0A0A0A]">Bu bizim kendi projemiz (Ana sayfada göster)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
|
||||
@@ -175,7 +175,7 @@ function Label({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
|
||||
// ── MAIN COMPONENT ──
|
||||
export default function HomeClient({ lang, dict }: { lang: Locale; dict: any }) {
|
||||
export default function HomeClient({ lang, dict, featuredProjects }: { lang: Locale; dict: any; featuredProjects?: any[] }) {
|
||||
const heroRef = useRef<HTMLDivElement>(null);
|
||||
const { scrollYProgress } = useScroll({ target: heroRef, offset: ["start start", "end start"] });
|
||||
const heroY = useTransform(scrollYProgress, [0, 1], ["0%", "25%"]);
|
||||
@@ -283,7 +283,7 @@ export default function HomeClient({ lang, dict }: { lang: Locale; dict: any })
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<HomeClientBelowFold lang={lang} dict={dict} />
|
||||
<HomeClientBelowFold lang={lang} dict={dict} featuredProjects={featuredProjects} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ function Label({ children }: { children: React.ReactNode }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default function HomeClientBelowFold({ lang, dict }: { lang: Locale; dict: any }) {
|
||||
export default function HomeClientBelowFold({ lang, dict, featuredProjects }: { lang: Locale; dict: any; featuredProjects?: any[] }) {
|
||||
const [activeFaq, setActiveFaq] = useState<number | null>(null);
|
||||
const [formSent, setFormSent] = useState(false);
|
||||
const [hoverCase, setHoverCase] = useState<number | null>(null);
|
||||
@@ -169,9 +169,10 @@ export default function HomeClientBelowFold({ lang, dict }: { lang: Locale; dict
|
||||
}))
|
||||
: [];
|
||||
|
||||
const caseStudies = (dict.work.items as any[]).map((item: any, idx: number) => ({
|
||||
const rawCases = featuredProjects && featuredProjects.length > 0 ? featuredProjects : (dict.work.items as any[]);
|
||||
const caseStudies = rawCases.map((item: any, idx: number) => ({
|
||||
...item,
|
||||
tech: [
|
||||
tech: item.tech || [
|
||||
["Python", "TensorFlow", "Next.js", "PostgreSQL"],
|
||||
["Solidity", "React", "IPFS", "Node.js"],
|
||||
["Flutter", "Firebase", "Django", "AWS"],
|
||||
|
||||
Reference in New Issue
Block a user