diff --git a/app/src/components/DirectoryPanel.jsx b/app/src/components/DirectoryPanel.jsx new file mode 100644 index 0000000..7fa1e6d --- /dev/null +++ b/app/src/components/DirectoryPanel.jsx @@ -0,0 +1,73 @@ +import React, { useState, useEffect } from 'react'; + +export function DirectoryPanel() { + const [companies, setCompanies] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + async function fetchDirectory() { + try { + const res = await fetch('/api/directory/companies').then(r => r.json()); + if (res.companies) setCompanies(res.companies); + } catch (err) { + console.error(err); + } finally { + setLoading(false); + } + } + fetchDirectory(); + }, []); + + if (loading) return
در حال بارگذاری دایرکتوری...
; + + return ( +
+
+

دایرکتوری فناوری و استارتاپ‌ها

+ +
+ +
+ {companies.map(company => ( +
+
+ {company.logoUrl ? ( + {company.name} + ) : ( +
+ {company.name.charAt(0)} +
+ )} +
+

{company.name}

+ {company.industry &&
{company.industry}
} +
+
+ +

{company.description}

+ +
+ {company.website && ( + وب‌سایت + )} +
+ + {company.claims?.length > 0 && ( +
+ + تایید شده توسط نمایندگان شرکت +
+ )} +
+ ))} + {companies.length === 0 && ( +
+ هیچ شرکتی در دایرکتوری یافت نشد. اولین شرکت را ثبت کنید! +
+ )} +
+
+ ); +}