diff --git a/src/components/Table.js b/src/components/Table.js index ffb57a3..dd9ceea 100644 --- a/src/components/Table.js +++ b/src/components/Table.js @@ -7,10 +7,10 @@ export const TableListEntry = ({onClick, item, itemKeys}) => { ; }; -export const Table = ({headerItems, children, items, itemKeys, maxWidth = '30em'}) => { +export const Table = ({headerItems, children, items, itemKeys}) => { let i = 0; - return + return
{headerItems.map(item => )} diff --git a/src/css/index.css b/src/css/index.css index 1450bc4..ef0f406 100644 --- a/src/css/index.css +++ b/src/css/index.css @@ -68,7 +68,7 @@ body{ } .pageTitle{ - margin: 0.7em 0 0.7em; + margin: 0; } .flex { diff --git a/src/index.js b/src/index.js index 705503b..1068bdb 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './css/index.css'; import App from './App'; -import reportWebVitals from './reportWebVitals'; +// import reportWebVitals from './reportWebVitals'; import { UserContext } from './structures/UserContext'; const root = ReactDOM.createRoot(document.getElementById('root')); @@ -11,6 +11,9 @@ root.render( ); +// root.render( +// +// ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) diff --git a/src/pages/Admin.js b/src/pages/Admin.js index b0e3ee1..70f7df8 100644 --- a/src/pages/Admin.js +++ b/src/pages/Admin.js @@ -4,7 +4,7 @@ import '../css/pages/Admin.css'; const Admin = () => { return
-

Admin

+

Admin

; diff --git a/src/pages/Empty.js b/src/pages/Empty.js index 074bf9a..07a37bb 100644 --- a/src/pages/Empty.js +++ b/src/pages/Empty.js @@ -4,7 +4,7 @@ import '../css/pages/Empty.css'; const Empty = () => { return
-

Empty

+

Empty

; diff --git a/src/pages/Home.js b/src/pages/Home.js index 4b8ab9b..6cf75ac 100644 --- a/src/pages/Home.js +++ b/src/pages/Home.js @@ -1,11 +1,17 @@ import React from "react"; import '../css/pages/Home.css'; +import { get } from "../util/Util"; const Home = () => { return
-

Home

+

Home

+
; }; diff --git a/src/pages/Users.js b/src/pages/Users.js index d8c0f09..f0dfe93 100644 --- a/src/pages/Users.js +++ b/src/pages/Users.js @@ -80,9 +80,18 @@ const ApplicationList = ({ apps }) => { const Application = ({ app }) => { + const descProps = {defaultValue: app.description, placeholder: 'Describe your application'}; + return
+

{app.name} ({app.id})

+ + Description + +
; }; +// TODO: Groups, description, notes const User = ({ user }) => { const navigate = useNavigate(); @@ -90,14 +99,14 @@ const User = ({ user }) => { useEffect(() => { (async () => { - const response = await get(`/api/users/${user._id}/applications`); + const response = await get(`/api/users/${user.id}/applications`); if(response.status === 200) updateApps(response.data); })(); }, []); const ApplicationWrapper = () => { const { appid } = useParams(); - const app = apps.find(a => a._id === appid); + const app = apps.find(a => a.id === appid); if (!app) return null; return ; }; @@ -110,25 +119,32 @@ const User = ({ user }) => { -

User {user._id}

+

User {user.id}

+ + {user.disabled ? : } + + +

Created: {new Date(user.createdTimestamp).toDateString()}

+

2FA: {user.twoFactor.toString()}

+

Disabled: {user.disabled.toString()}

+ - + - + -

Applications

+

Applications

} /> } /> - {/* {apps.map(app => )} */} @@ -144,37 +160,21 @@ const User = ({ user }) => { ; }; -// const UserListEntry = ({ user }) => { - -// const navigate = useNavigate(); +const CreateUserField = () => { -// const onClick = () => { -// navigate(`/users/${user._id}`); -// }; - -// return
-// -// -// ; + const [link, setLink] = useState(null); + const getSignupCode = async () => { + const response = await get('/api/signup/code'); + if(response.status === 200) setLink(response.data); + }; -// }; + return
+ {link ? link : } -// // TODO: Make table list generic component -// const UserList = ({ users }) => { - -// return
{item}
{user.username}{user._id}
-// -// -// -// -// -// -// -// {users.map(user => )} -// -//
UsernameID
; + {/* TODO: Create form */} + ; -// }; +}; const Users = () => { @@ -194,47 +194,55 @@ const Users = () => { const UserWrapper = () => { const { id } = useParams(); - const user = users.find(u => u._id === id); + const user = users.find(u => u.id === id); if (!user) return null; return ; }; const navigate = useNavigate(); const UserListWrapper = () => { - return
- - - {users.map(user => { - navigate(`/users/${user._id}`); - }} - key={user._id} - item={user} - itemKeys={['username', '_id']} />)} -
+ return
+
+ + {users.map(user => { + navigate(`/users/${user.id}`); + }} + key={user.id} + item={user} + itemKeys={['username', 'id']} />)} +
-
- -

Page: {page}

- +
+ +

Page: {page}

+ +
- + +
+ +
+
; }; return
-

Users

+

Users

{error &&

{error}

} -
- - - } /> - } /> - - +
+
+ + + } /> + } /> + + +
+
; diff --git a/src/util/Util.js b/src/util/Util.js index 5717374..1859373 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -57,7 +57,6 @@ export const post = async (url, body) => { }, body: JSON.stringify(body) }); - console.log(response); return parseResponse(response); };