fixing props function things

This commit is contained in:
ingawei 2022-09-26 13:02:27 -07:00
parent 85ccdfbf59
commit 74bb21180c
3 changed files with 14 additions and 10 deletions

View File

@ -63,16 +63,15 @@ export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: {
}, },
] ]
} }
const firstPoints = data[0].data let firstPoints = data[0].data
// const numYTickValues = !width || width < 800 ? 2 : 4
const numYTickValues = 2 const numYTickValues = 2
const endDate = last(firstPoints)?.x const endDate = last(data[0].data)?.x
const firstPointsY = firstPoints const firstPointsY = firstPoints
.filter((p) => {
return p.y !== null
})
.map((p) => p.y) .map((p) => p.y)
.filter((y) => {
return y !== null
})
const yMin = const yMin =
mode === 'value' mode === 'value'

View File

@ -7,7 +7,6 @@ import { Period } from 'web/lib/firebase/users'
import { PillButton } from '../buttons/pill-button' import { PillButton } from '../buttons/pill-button'
import { Col } from '../layout/col' import { Col } from '../layout/col'
import { Row } from '../layout/row' import { Row } from '../layout/row'
import { Spacer } from '../layout/spacer'
import { PortfolioValueGraph } from './portfolio-value-graph' import { PortfolioValueGraph } from './portfolio-value-graph'
export const PortfolioValueSection = memo( export const PortfolioValueSection = memo(
@ -18,6 +17,9 @@ export const PortfolioValueSection = memo(
const portfolioHistory = usePortfolioHistory(userId, portfolioPeriod) const portfolioHistory = usePortfolioHistory(userId, portfolioPeriod)
const [graphMode, setGraphMode] = useState<'profit' | 'value'>('value') const [graphMode, setGraphMode] = useState<'profit' | 'value'>('value')
const [graphDisplayNumber, setGraphDisplayNumber] = useState(null) const [graphDisplayNumber, setGraphDisplayNumber] = useState(null)
const handleGraphDisplayChange = (num) => {
setGraphDisplayNumber(num)
}
// Remember the last defined portfolio history. // Remember the last defined portfolio history.
const portfolioRef = useRef(portfolioHistory) const portfolioRef = useRef(portfolioHistory)
@ -94,7 +96,7 @@ export const PortfolioValueSection = memo(
portfolioHistory={currPortfolioHistory} portfolioHistory={currPortfolioHistory}
includeTime={true} includeTime={true}
mode={graphMode} mode={graphMode}
setGraphDisplayNumber={setGraphDisplayNumber} setGraphDisplayNumber={handleGraphDisplayChange}
/> />
<PortfolioPeriodSelection <PortfolioPeriodSelection
portfolioPeriod={portfolioPeriod} portfolioPeriod={portfolioPeriod}

View File

@ -122,7 +122,10 @@ export function UserPage(props: { user: User }) {
{!isCurrentUser && <UserFollowButton userId={user.id} />} {!isCurrentUser && <UserFollowButton userId={user.id} />}
</div> </div>
{!isMobile && ( {!isMobile && (
<ProfilePublicStats className="text-md" user={user} /> <ProfilePublicStats
className="sm:text-md text-greyscale-6 text-sm"
user={user}
/>
)} )}
</Col> </Col>
</Row> </Row>
@ -132,7 +135,7 @@ export function UserPage(props: { user: User }) {
<Spacer h={1} /> <Spacer h={1} />
{user.bio && ( {user.bio && (
<> <>
<div className="sm:text-md text-greyscale-6 mt-2 text-sm sm:mt-0"> <div className="sm:text-md mt-2 text-sm sm:mt-0">
<Linkify text={user.bio}></Linkify> <Linkify text={user.bio}></Linkify>
</div> </div>
<Spacer h={2} /> <Spacer h={2} />