Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ebcfa8da27 | |||
| 0b659816be |
@@ -1,11 +1,13 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import dataImage1 from "../../assets/images/data-table-user-1.png";
|
import dataImage1 from "../../assets/images/data-table-user-1.png";
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import SelectBox from "../Helpers/SelectBox";
|
import SelectBox from "../Helpers/SelectBox";
|
||||||
|
|
||||||
|
|
||||||
export default function ReminderTable({ className }) {
|
export default function ReminderTable({ className }) {
|
||||||
const [userReminders, setUserReminders] = useState([]);
|
const [userReminders, setUserReminders] = useState([]);
|
||||||
|
const filterCategories = ["All Categories", "Appointments","Exercise/Gym", "Medication"];
|
||||||
const api = new usersService();
|
const api = new usersService();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getUserReminders();
|
getUserReminders();
|
||||||
@@ -14,16 +16,13 @@ export default function ReminderTable({ className }) {
|
|||||||
const getUserReminders = async () => {
|
const getUserReminders = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await api.getUserReminders();
|
const res = await api.getUserReminders();
|
||||||
|
|
||||||
setUserReminders(res.data.reminders);
|
setUserReminders(res.data.reminders);
|
||||||
console.log("res", res);
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error from User Reminders", error);
|
console.log("Error from User Reminders", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterCategories = ["All Categories", "Doctors Visit", "Medications"];
|
|
||||||
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -44,6 +43,21 @@ export default function ReminderTable({ className }) {
|
|||||||
contentBodyClasses="w-auto min-w-max"
|
contentBodyClasses="w-auto min-w-max"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{userReminders.map((reminders, index) =>{
|
||||||
|
if (userReminders.length < 1 ) {
|
||||||
|
return(
|
||||||
|
<div className="lg:flex justify-center">
|
||||||
|
<div style={{ transform: 'translateY(150px)' }}>
|
||||||
|
<Link
|
||||||
|
to="/add-reminder"
|
||||||
|
className="btn-gradient lg:flex hidden w-[300px] h-[50px] rounded-full text-white justify-center items-center"
|
||||||
|
>
|
||||||
|
0 Reminders Start Reminder
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)} else{
|
||||||
|
return (
|
||||||
<div className="relative w-full overflow-x-auto sm:rounded-lg">
|
<div className="relative w-full overflow-x-auto sm:rounded-lg">
|
||||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -72,7 +86,7 @@ export default function ReminderTable({ className }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<h1 className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
<h1 className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
||||||
{reminders.description}
|
{reminders.description.substring(0,30) + "..."}
|
||||||
</h1>
|
</h1>
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
|
|
||||||
@@ -320,6 +334,22 @@ export default function ReminderTable({ className }) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user