diff --git a/web/pages/admin.tsx b/web/pages/admin.tsx index e003eacb..e28e94aa 100644 --- a/web/pages/admin.tsx +++ b/web/pages/admin.tsx @@ -35,55 +35,74 @@ function UsersTable() { // Sort users by createdTime descending, by default users = users.sort((a, b) => b.createdTime - a.createdTime) + function exportCsv() { + const csv = users + // @ts-ignore + .map((u) => [u.email, u.name].join(', ')) + .join('\n') + const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' }) + const url = URL.createObjectURL(blob) + const a = document.createElement('a') + a.href = url + a.download = 'manifold-users.csv' + a.click() + URL.revokeObjectURL(url) + } + return ( - html(avatarHtml(cell as string)), - }, - { - id: 'username', - name: 'Username', - formatter: (cell) => - html(` + html(avatarHtml(cell as string)), + }, + { + id: 'username', + name: 'Username', + formatter: (cell) => + html(`@${cell}`), - }, - 'Email', - { - id: 'createdTime', - name: 'Created Time', - formatter: (cell) => - html( - `${dayjs(cell as number).format( - 'MMM D, h:mma' - )}` - ), - }, - { - id: 'balance', - name: 'Balance', - formatter: (cell) => (cell as number).toFixed(0), - }, - { - id: 'id', - name: 'ID', - formatter: (cell) => - html(` + html( + `${dayjs(cell as number).format( + 'MMM D, h:mma' + )}` + ), + }, + { + id: 'balance', + name: 'Balance', + formatter: (cell) => (cell as number).toFixed(0), + }, + { + id: 'id', + name: 'ID', + formatter: (cell) => + html(`${cell}`), - }, - ]} - search={true} - sort={true} - pagination={{ - enabled: true, - limit: 25, - }} - /> + }, + ]} + search={true} + sort={true} + pagination={{ + enabled: true, + limit: 25, + }} + /> + + ) }