import React, { useState } from 'react';
import { toast } from 'react-toastify';
import { useAccountState } from 'src/context/AccountContext';
import { useGetForwardsQuery } from 'src/graphql/queries/__generated__/getForwards.generated';
import {
SubTitle,
Card,
CardWithTitle,
CardTitle,
ColorButton,
SingleLine,
} from '../src/components/generic/Styled';
import { getErrorContent } from '../src/utils/error';
import { LoadingCard } from '../src/components/loading/LoadingCard';
import { ForwardCard } from '../src/views/forwards/ForwardsCard';
import { textColorMap } from '../src/styles/Themes';
import { useConfigState } from '../src/context/ConfigContext';
import { ForwardBox } from '../src/views/home/reports/forwardReport';
const timeMap: { [key: string]: string } = {
day: 'today',
week: 'this week',
month: 'this month',
threeMonths: 'these past 3 months',
};
const ForwardsView = () => {
const [time, setTime] = useState('week');
const [indexOpen, setIndexOpen] = useState(0);
const { theme } = useConfigState();
const { auth } = useAccountState();
const { loading, data } = useGetForwardsQuery({
skip: !auth,
variables: { auth, time },
onError: error => toast.error(getErrorContent(error)),
});
if (loading || !data || !data.getForwards) {
return
{`Your node has not forwarded any payments ${timeMap[time]}.`}
); return ( <>