nutrition-monitoring-system / nhms

Source code for the nutrition management system. A link to the current website is below.
https://nhms-beta.vercel.app/
0 stars 1 forks source link

[TODO]: Add functionality to the admin dashboard. #53

Open harrykeeran12 opened 4 months ago

harrykeeran12 commented 4 months ago
harrykeeran12 commented 4 months ago

@nann7 Would you be able to get this done? Basically you'd just need to add 2 buttons, which replace the content of the admin dashboard site with two tables, one with a list of all the symptoms, and the other with a list of all the users(you can use the table listed in the link above)

nann7 commented 4 months ago

Ok, no problem!

nann7 commented 4 months ago

Is it to create a new management page that only administrators can use? Or add it to our original application page.

harrykeeran12 commented 4 months ago

Is it to create a new management page that only administrators can use? Or add it to our original application page.

So this would be for the admin dashboard that we already have, which would have like a button which the admin could press, and then it shows a list of users, that the administrator could see and use. @nann7 If you have any questions please ask!

harrykeeran12 commented 4 months ago

I've mocked up a basic design on Figma(don't worry about the sidenav bar I'll fix that in a bit), please make sure you're up to date with the main branch before you create a new branch @nann7

nann7 commented 4 months ago

OK I see that. I would like to ask if the user list contains the user's name, account number and other information?

harrykeeran12 commented 4 months ago

@nann7 It should contain everything that the selectAllUsers api returns(aka everything apart from the password), so if you use the useSWR hook, which returns the JSON output, you would get all the data. Currently the register function is not working though, so you might have to manually add data to your postgres database.

harrykeeran12 commented 4 months ago

Also I'll create a branch for you called adminDashboard.

harrykeeran12 commented 4 months ago

I've created the adminDashboard branch and added the table component. If you have any other questions please ask!

nann7 commented 4 months ago

Ok, thank you!

nann7 commented 4 months ago
0232c2bf692b77108f5b8be93235f2b 52e52fa666cfe82b65f701ac3e0d38a 95d00f45bfc7e548721bab5c90d1390

Why is there this error saying that it does not match the TypeScript format?
Type '{ children: Element[]; }' has no properties in common with type 'IntrinsicAttributes & RefAttributes

harrykeeran12 commented 4 months ago

You have to use the table like its a component import, and probably do it in the admin folder. If you use components/ui/table in the import, the table is in there(provided you've done an npm ci recently and that your branch is up to date)

harrykeeran12 commented 4 months ago

@nann7 could I ask you to also:

There are methods to add and delete a user, I'll make one to upgrade a user to be an admin.

Ask if you have any questions.

nann7 commented 4 months ago

Sorry, I would like to ask if it is possible to still use react table without tanstack-table. There is so much to change, and I make a lot of mistakes when I try it.

harrykeeran12 commented 4 months ago

Sorry, I would like to ask if it is possible to still use react table without tanstack-table. There is so much to change, and I make a lot of mistakes when I try it.

It would be better if we used the best version of the table. I'm sorry but we do still have time for you to attempt this. I would recommend watching videos.

nann7 commented 4 months ago

I tried changing the code, but after finding errors, I tried to rewrite it. It is found that the useTable hook function of @tanstack/react-table cannot be used. I imported it correctly and reinstalled the dependencies. Don't know what's wrong.

b6ccf595116b65bf42d96f051c42726
harrykeeran12 commented 4 months ago

@nann7 If you push it I can take a look at it?

harrykeeran12 commented 4 months ago

I tried changing the code, but after finding errors, I tried to rewrite it. It is found that the useTable hook function of @tanstack/react-table cannot be used. I imported it correctly and reinstalled the dependencies. Don't know what's wrong. b6ccf595116b65bf42d96f051c42726

https://tanstack.com/table/latest/docs/framework/react/react-table

This link has your answer.

nann7 commented 4 months ago

我尝试更改代码,但在发现错误后,我尝试重写它。发现无法使用 @tanstack/react-table 的 useTable 钩子函数。我正确导入了它并重新安装了依赖项。不知道怎么了。编号:b6ccf595116b65bf42d96f051c42726

https://tanstack.com/table/latest/docs/framework/react/react-table

这个链接有你的答案。

I just watched this page and changed my code

nann7 commented 4 months ago

I submitted it to github. I didn't change it based on my original one because I was worried that my changes would make a mess. So I created a new usertable1.jsx. The inside is newly modified by me. I'm very sorry, I tried all afternoon without success. Can you help take a look?