import React, { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import authProfilePic from "../../assets/images/auth-profile-picture.png"; import profileBanner from "../../assets/images/profile-cover.png"; import collections from "../../data/collectionplan_data.json"; import marketPlace from "../../data/marketplace_data.json"; import products from "../../data/product_data.json"; import Layout from "../Partials/Layout"; import ActivitiesTab from "./ActivitiesTab"; import CollectionTab from "./CollectionTab"; import CreatedTab from "./CreatedTab"; import HiddenProductsTab from "./HiddenProductsTab"; import OnSaleTab from "./OnSaleTab"; import OwnTab from "./OwnTab"; import BlogTab from "./BlogTab"; import VideoYouTube from "./VideoYouTube"; import usersService from "../../services/UsersService"; export default function Resources() { const onSaleProducts = marketPlace.data; const CreatedSell = marketPlace.data; const CreatedBits = products.datas; // const mainProducts = products.datas; const ownProducts = products.datas; const collectionProducts = collections.data; const api = new usersService(); const [tabs, setUserTab] = useState([]); const [isLoading, setIsLoading] = useState(true) const [userResources, setUserResource] = useState([]); const [tab, setTab] = useState(/*tabs[0].name*/ null); const getUserResources = async () => { try { const res = await api.getUserResources(); setUserResource(res.data.resources); setUserTab(res.data.category); setTab(res.data.category[0].name); setIsLoading(false) }catch(error) { setIsLoading(false) } }; useEffect(() => { getUserResources(); }, []); //debugger; const tabHandler = (value) => { setTab(value); }; return ( <>
    {tabs && tabs.length > 0 && tabs.map((tabValue) => (
  • tabHandler(tabValue.name)} > {tabValue.content} 16
  • ))}
{tab === "blog" ? ( ) : tab === "youtube" ? ( ) : tab === "owned" ? ( ) : tab === "created" ? ( ) : tab === "hidden" ? ( ) : tab === "collection" ? ( ) : tab === "activity" ? ( ) : ( "" )}
); }