From 8eb4a0a00e756f53b95a532ff00cf1148ea81e57 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Wed, 4 Dec 2024 23:43:53 +0100 Subject: [PATCH] [tools] Improve the about export (#254) --- tools-public/toolpad/pages/muicomabout/page.yml | 11 +++++++++-- tools-public/toolpad/resources/queryAbout.ts | 12 ++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tools-public/toolpad/pages/muicomabout/page.yml b/tools-public/toolpad/pages/muicomabout/page.yml index 00d184b..5b0f8ee 100644 --- a/tools-public/toolpad/pages/muicomabout/page.yml +++ b/tools-public/toolpad/pages/muicomabout/page.yml @@ -18,18 +18,25 @@ spec: height: 632 props: rows: - $$jsExpression: | - queryAbout.rows + $$jsExpression: |- + queryAbout.rows.map((row) => ({ + ...row, + twitter: row.twitter ? `https://x.com/${row.twitter}` : null, + github: row.github ? `https://github.com/${row.github}` : null, + })) columns: - field: name type: string width: 175 + headerName: Name - field: title type: string width: 246 + headerName: Title - field: about type: string width: 472 + headerName: About - field: location type: string width: 296 diff --git a/tools-public/toolpad/resources/queryAbout.ts b/tools-public/toolpad/resources/queryAbout.ts index beeb833..3b95f49 100644 --- a/tools-public/toolpad/resources/queryAbout.ts +++ b/tools-public/toolpad/resources/queryAbout.ts @@ -22,7 +22,7 @@ export async function queryAbout() { showInactive: false, humanReadable: 'REPLACE', fields: [ - 'root.fullName', + 'root.displayName', // 'root.fullName', is the legal name, use the preferred name instead. 'address.country', 'address.city', 'work.title', @@ -59,13 +59,13 @@ export async function queryAbout() { .map((employee) => { const country = countryFix[employee.address.country] || employee.address.country; return { - name: employee.fullName, + name: employee.displayName, title: employee.work.title, - about: employee.about?.custom?.field_1690557141686, - location: `${employee.address.city} - ${country}`, + location: `${employee.address.city}, ${country}`, locationCountry: countryToISO[country], - twitter: employee.about?.socialData?.twitter, - github: employee.about?.custom?.field_1682954415714, + about: employee.about?.custom?.field_1690557141686, + twitter: employee.about?.socialData?.twitter?.replace('https://www.twitter.com/', ''), + github: employee.about?.custom?.field_1682954415714?.replace('https://github.com/', ''), // ...employee, }; });