feat: sunum sayfasında danışman adı ve şirket adı göster
Header'da ilan sayısının yanına creator adı + şirket adı eklendi. Footer'da 'Kovak Emlak CRM' yerine dinamik ad/şirket yazıyor. users.get(createdBy) + teams.get(tenantId) ile çekilir; her ikisi de allSettled ile hata toleranslı.
This commit is contained in:
@@ -18,7 +18,7 @@ interface Props {
|
|||||||
|
|
||||||
export default async function SunumPage({ params }: Props) {
|
export default async function SunumPage({ params }: Props) {
|
||||||
const { token } = await params;
|
const { token } = await params;
|
||||||
const { tablesDB } = createAdminClient();
|
const { tablesDB, teams, users } = createAdminClient();
|
||||||
|
|
||||||
const result = await tablesDB.listRows({
|
const result = await tablesDB.listRows({
|
||||||
databaseId: DATABASE_ID,
|
databaseId: DATABASE_ID,
|
||||||
@@ -46,6 +46,13 @@ export default async function SunumPage({ params }: Props) {
|
|||||||
|
|
||||||
void incrementPresentationViewCount(presentation.$id, presentation.viewCount ?? 0);
|
void incrementPresentationViewCount(presentation.$id, presentation.viewCount ?? 0);
|
||||||
|
|
||||||
|
const [creatorResult, teamResult] = await Promise.allSettled([
|
||||||
|
users.get(presentation.createdBy),
|
||||||
|
teams.get(presentation.tenantId),
|
||||||
|
]);
|
||||||
|
const creatorName = creatorResult.status === "fulfilled" ? creatorResult.value.name : null;
|
||||||
|
const companyName = teamResult.status === "fulfilled" ? teamResult.value.name : null;
|
||||||
|
|
||||||
let propertyIds: string[] = [];
|
let propertyIds: string[] = [];
|
||||||
try {
|
try {
|
||||||
propertyIds = JSON.parse(presentation.propertyIds) as string[];
|
propertyIds = JSON.parse(presentation.propertyIds) as string[];
|
||||||
@@ -78,11 +85,18 @@ export default async function SunumPage({ params }: Props) {
|
|||||||
{presentation.notes}
|
{presentation.notes}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<div className="mt-5">
|
<div className="mt-5 flex items-center gap-3 flex-wrap">
|
||||||
<span className="inline-flex items-center gap-1.5 bg-white/10 rounded-full px-3 py-1.5 text-sm">
|
<span className="inline-flex items-center gap-1.5 bg-white/10 rounded-full px-3 py-1.5 text-sm">
|
||||||
<span className="font-semibold text-white">{properties.length}</span>
|
<span className="font-semibold text-white">{properties.length}</span>
|
||||||
<span className="text-slate-300">ilan listelendi</span>
|
<span className="text-slate-300">ilan</span>
|
||||||
</span>
|
</span>
|
||||||
|
{(creatorName || companyName) && (
|
||||||
|
<span className="text-slate-400 text-sm">
|
||||||
|
{creatorName && <span className="text-slate-200 font-medium">{creatorName}</span>}
|
||||||
|
{creatorName && companyName && <span className="mx-1.5">·</span>}
|
||||||
|
{companyName && <span>{companyName}</span>}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -102,7 +116,17 @@ export default async function SunumPage({ params }: Props) {
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<footer className="border-t bg-white mt-8 py-6 text-center text-xs text-gray-400">
|
<footer className="border-t bg-white mt-8 py-6 text-center text-xs text-gray-400">
|
||||||
Bu sunum <span className="font-medium text-gray-500">Kovak Emlak CRM</span> tarafından oluşturulmuştur.
|
{creatorName || companyName ? (
|
||||||
|
<>
|
||||||
|
Bu sunum{" "}
|
||||||
|
{companyName && <span className="font-medium text-gray-600">{companyName}</span>}
|
||||||
|
{creatorName && companyName && " · "}
|
||||||
|
{creatorName && <span className="font-medium text-gray-600">{creatorName}</span>}
|
||||||
|
{" "}tarafından hazırlanmıştır.
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Bu sunum Emlak CRM tarafından hazırlanmıştır."
|
||||||
|
)}
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user