@@ -2,26 +2,27 @@ import { UserWithSupertokens } from 'services/userService'
22import style from './admin.module.css'
33import moment from 'moment'
44import TableContainer from '../../components/TableContainer/TableContainer'
5+ import { Cell , CellProps } from 'react-table'
56
67interface IProps {
78 users : UserWithSupertokens [ ]
89}
910
10- export default function RegisteredUsers ( { users } : IProps ) : JSX . Element {
11+ export default function RegisteredUsers ( { users } : IProps ) : JSX . Element {
1112 if ( users === undefined ) return < > </ >
1213
1314 const columns = [
1415 {
1516 Header : 'Registered' ,
1617 accessor : 'registered' ,
17- Cell : ( { cell } : any ) => < span > { cell . value } </ span >
18+ Cell : ( { cell } : CellProps < UserWithSupertokens > ) => < span > { cell . value } </ span >
1819 } ,
1920 {
2021 Header : 'Email' ,
2122 accessor : 'email' ,
22- Cell : ( { cell } : any ) => (
23+ Cell : ( { cell } : Cell < UserWithSupertokens > ) => (
2324 < a
24- href = { `/api/auth/dashboard/?userid=${ cell . row . original . id } &recipeId=emailpassword` }
25+ href = { `/api/auth/dashboard/?userid=${ cell . row . original . id as string } &recipeId=emailpassword` }
2526 target = "_blank"
2627 rel = "noopener noreferrer"
2728 >
@@ -32,18 +33,21 @@ export default function RegisteredUsers({ users }: IProps): JSX.Element {
3233 {
3334 Header : 'Admin' ,
3435 accessor : 'isAdmin' ,
35- Cell : ( { cell } : any ) => (
36+ Cell : ( { cell } : CellProps < UserWithSupertokens > ) => (
3637 cell . value === true ? < span className = { style . admin } > Yes</ span > : 'No'
3738 )
3839 }
3940 ]
40- console . log ( { users} )
41+ console . log ( { users } )
4142 const data = users . map ( user => ( {
4243 id : ( user . stUser ?. id === undefined || user . stUser ?. id === '' ) ? user . userProfile ?. id : user . stUser ?. id ,
43- registered : user . stUser ? moment ( user . stUser . timeJoined ) . fromNow ( ) : 'NO ST USER FOUND' ,
44+ registered : ( user . stUser != null ) ? moment ( user . stUser . timeJoined ) . fromNow ( ) : 'NO ST USER FOUND' ,
4445 email : ( user . stUser ?. email === undefined || user . stUser ?. email === '' ) ? user . userProfile ?. id : user . stUser ?. email ,
4546 isAdmin : user . userProfile ?. isAdmin
4647 } ) )
4748
48- return < TableContainer columns = { columns } data = { data } ssr />
49+ return < >
50+ < h3 > Registered Users</ h3 >
51+ < TableContainer columns = { columns } data = { data } ssr />
52+ </ >
4953}
0 commit comments