// import PropTypes from "prop-types" // import styled from 'styled-components'; // import '../DataBase/DummyDBWinLoss.js' // import '../DataBase/DataProfileUser.js' // import { DBWinLoss } from '../../DataBase/DummyDBWinLoss.js'; import '../../styles/Win_Loss.css' // import { UserProfile } from '../../DataBase/DataUserProfile'; // import color from '../../utils/style/color.js'; // const CardWrapper = styled.div` // display: flex; // flex-direction: column; // padding: 15px; // background-color: black; // border-radius: 30px; // width: 350px; // transition: 200ms; // margin-top: 50px; // &:hover { // cursor: pointer; // box-shadow: 2px 2px 10px #b6b6b6; // } // ` // const CardLabel1 = styled.h1` // color: #5843e4; // // font-size: 22px; // font-weight: bold; // margin-bottom: 25px; // ` // const CardLabel2 = styled.span` // color: #5843e4; // font-size: 22px; // font-weight: bold; // display: flex; // flex-direction: column; // ` // const CardImage = styled.img` // heigh: 80px; // width: 80px; // border-radius: 50%; // ` import React, { useState, useEffect, useRef } from "react"; import { useParams } from 'react-router-dom'; import api from '../../script/axiosApi'; function WinLoss() { const [user, setUser] = useState(null); const [history, setHistory] = useState([]); const [isLoading, setIsLoading] = useState(true); const { username } = useParams(); useEffect(()=> { const getUser = async ()=>{ try{ // const tmpUser = await api.get("/profile") const tmpUser = await api.post("/user", {username: username}) const tmpHistory = await api.post("/history", {username: username}) setHistory(tmpHistory.data); setUser(tmpUser.data); setIsLoading(false) } catch(err){ console.log(err); } }; getUser(); }, []) // console.log(`user= ${user.children}`) return ( //
// {isLoading ? ( //

Loading...

// ) : ( //

{user.username}

// )} //
{isLoading ? (

Loading...

// Loading... ) : (

Match history Win/Loss

{history.map((c, index) => { return (
  • {/*

    {c.id}

    */}

    {user.username}

    {c.myScore} - {c.opScore}

    {c.opponent}

    {/*

    {c.openent}

    */}
  • ) })}
    //
    //

    User: {user.name}

    //
    //

    Children:

    // {history.map((child) => ( //
    //

    Child ID: {child.id}

    //

    Child Name: {child.name}

    // {/* Render other child properties as needed */} //
    // ))} //
    //
    )}
    ) } // Card.propTypes = { // label: PropTypes.string, // title: PropTypes.string.isRequired, // picture: PropTypes.string, // } export default WinLoss