Skip to content

Commit

Permalink
Merge branch 'master' into subgraph-bean-usd-volume
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofromguy authored Sep 27, 2023
2 parents b2660b1 + c5c155c commit c0fcbf4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
38 changes: 22 additions & 16 deletions projects/ui/src/components/Silo/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Stat from '~/components/Common/Stat';
import useFarmerSiloHistory from '~/hooks/farmer/useFarmerSiloHistory';
import { FC } from '~/types';
import { BaseDataPoint } from '~/components/Common/Charts/ChartPropProvider';

import useMigrationNeeded from '~/hooks/farmer/useMigrationNeeded';
import stalkIconWinter from '~/img/beanstalk/stalk-icon-green.svg';
import seedIconWinter from '~/img/beanstalk/seed-icon-green.svg';
import { MigrateTab } from '~/components/Silo/MigrateTab';
Expand Down Expand Up @@ -64,18 +64,20 @@ const seedsStats = (s: BigNumber, v: BigNumber[], d: string) => (
);

const SLUGS = ['migrate', 'deposits', 'stalk', 'seeds'];
const altSLUGS = ['deposits', 'stalk', 'seeds'];

const Overview: FC<{
farmerSilo: AppState['_farmer']['silo'];
beanstalkSilo: AppState['_beanstalk']['silo'];
breakdown: ReturnType<typeof useFarmerBalancesBreakdown>;
season: BigNumber;
}> = ({ farmerSilo, beanstalkSilo, breakdown, season }) => {
const [tab, handleChange] = useTabs(SLUGS, 'view');

//
const account = useAccount();
const { data, loading } = useFarmerSiloHistory(account, false, true);
const migrationNeeded = useMigrationNeeded();
//
const [tab, handleChange] = useTabs(migrationNeeded ? SLUGS : altSLUGS, 'view');

//
const ownership =
Expand Down Expand Up @@ -122,7 +124,9 @@ const Overview: FC<{
return (
<Module>
<ModuleTabs value={tab} onChange={handleChange} sx={{ minHeight: 0 }}>
<StyledTab label={<ChipLabel name="Silo V3">Migrate</ChipLabel>} />
{migrationNeeded && (
<StyledTab label={<ChipLabel name="Silo V3">Migrate</ChipLabel>} />
)}
<StyledTab
label={
<ChipLabel name="Deposits">
Expand Down Expand Up @@ -153,16 +157,18 @@ const Overview: FC<{
}
/>
</ModuleTabs>
<Box
sx={{
display: tab === 0 ? 'block' : 'none',
minHeight: '400px',
backgroundColor: 'rgba(244, 244, 244, 0.4)',
}}
>
<MigrateTab />
</Box>
<Box sx={{ display: tab === 1 ? 'block' : 'none' }}>
{migrationNeeded && (
<Box
sx={{
display: tab === 0 ? 'block' : 'none',
minHeight: '400px',
backgroundColor: 'rgba(244, 244, 244, 0.4)',
}}
>
<MigrateTab />
</Box>
)}
<Box sx={{ display: tab === (migrationNeeded ? 1 : 0) ? 'block' : 'none' }}>
<OverviewPlot
label="Silo Deposits"
account={account}
Expand All @@ -184,7 +190,7 @@ const Overview: FC<{
empty={breakdown.states.deposited.value.eq(0)}
/>
</Box>
<Box sx={{ display: tab === 2 ? 'block' : 'none' }}>
<Box sx={{ display: tab === (migrationNeeded ? 2 : 1) ? 'block' : 'none' }}>
<OverviewPlot
label="Stalk Ownership"
account={account}
Expand Down Expand Up @@ -214,7 +220,7 @@ const Overview: FC<{
empty={farmerSilo.stalk.total.lte(0)}
/>
</Box>
<Box sx={{ display: tab === 3 ? 'block' : 'none' }}>
<Box sx={{ display: tab === (migrationNeeded ? 3 : 2) ? 'block' : 'none' }}>
<OverviewPlot
label="Seeds Ownership"
account={account}
Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/pages/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AnalyticsPage: FC<{}> = () => (
<PageHeader
title="Analytics"
description="View historical data on Beanstalk"
href="https://analytics.bean.money/"
href="https://docs.bean.money/almanac/community/links#analytics"
/>
<BeanAnalytics />
<SiloAnalytics />
Expand Down

0 comments on commit c0fcbf4

Please sign in to comment.