Entry widget
This commit is contained in:
@@ -1,15 +1,44 @@
|
||||
import React from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import Layout from "../../Partials/Layout";
|
||||
import UserWeightWidget from "./UserWeightWidget";
|
||||
import TrackEntryWidget from "./TrackEntryWidget";
|
||||
import UserRecentTracking from "./UserRecentTracking";
|
||||
import usersService from "../../../services/UsersService";
|
||||
|
||||
export default function TrackAction() {
|
||||
const api = new usersService();
|
||||
let { trackpage } = useParams();
|
||||
const [selectedCategory, setSelTrackCat] = useState([]);
|
||||
|
||||
|
||||
const getTrackCat = async () => {
|
||||
try {
|
||||
const res = await api.refreshTrackCategory();
|
||||
if(res.status == 200){
|
||||
var fliterCategory = res.data.filter(function (el) {
|
||||
return el.widget == trackpage;
|
||||
});
|
||||
//debugger;
|
||||
setSelTrackCat([{data:fliterCategory[0]}]);
|
||||
return
|
||||
}
|
||||
}catch(error) {
|
||||
// setIsLoading(false)
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getTrackCat();
|
||||
}, []);
|
||||
|
||||
console.log("TRACK PAGE = = ", trackpage);
|
||||
console.log("SELECTED TRACK PAGE trackCat = = ", selectedCategory);
|
||||
const selectedEntry = selectedCategory[0]?.data; // better way to do this so thst null on promise will not kill the screen
|
||||
|
||||
console.log("wait till you know whst page to show");
|
||||
//debugger;
|
||||
return (
|
||||
<>
|
||||
<Layout>
|
||||
@@ -17,13 +46,13 @@ export default function TrackAction() {
|
||||
<div className="main-wrapper w-full">
|
||||
<div className="balance-inquery w-full lg:h-[436px] lg:flex lg:space-x-11 mb-11">
|
||||
<div className="lg:w-1/2 h-full mb-10 lg:mb-0">
|
||||
<UserWeightWidget />
|
||||
<TrackEntryWidget selectedEntry={selectedEntry} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="my-wallets w-full h-full bg-white dark:bg-dark-white rounded-lg p-6">
|
||||
<div className="mb-4">
|
||||
<h1 className="text-xl font-bold tracking-wide text-dark-gray dark:text-white">
|
||||
Some title HERE
|
||||
{selectedCategory[0]?.data?.title}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="content-area">SOMETHING HERE</div>
|
||||
|
||||
Reference in New Issue
Block a user