Fix up tiny cases where user should not be nullable

This commit is contained in:
Marshall Polaris 2022-05-03 22:30:39 -07:00
parent a004d3a4bf
commit c49015bb10
3 changed files with 9 additions and 11 deletions

View File

@ -62,7 +62,7 @@ export function FeedPromo(props: { hotContracts: Contract[] }) {
} }
export default function FeedCreate(props: { export default function FeedCreate(props: {
user?: User user: User
tag?: string tag?: string
placeholder?: string placeholder?: string
className?: string className?: string
@ -98,7 +98,7 @@ export default function FeedCreate(props: {
}} }}
> >
<div className="relative flex items-start space-x-3"> <div className="relative flex items-start space-x-3">
<Avatar username={user?.username} avatarUrl={user?.avatarUrl} noLink /> <Avatar username={user.username} avatarUrl={user.avatarUrl} noLink />
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<Row className="justify-between"> <Row className="justify-between">

View File

@ -25,17 +25,15 @@ export function getNavigationOptions(user?: User | null) {
] ]
} }
export function ProfileSummary(props: { user: User | undefined }) { export function ProfileSummary(props: { user: User }) {
const { user } = props const { user } = props
return ( return (
<Row className="group avatar items-center gap-4 rounded-md py-3 text-gray-500 group-hover:bg-gray-100 group-hover:text-gray-700"> <Row className="group items-center gap-4 rounded-md py-3 text-gray-500 group-hover:bg-gray-100 group-hover:text-gray-700">
<Avatar avatarUrl={user?.avatarUrl} username={user?.username} noLink /> <Avatar avatarUrl={user.avatarUrl} username={user.username} noLink />
<div className="truncate text-left"> <div className="truncate text-left">
<div>{user?.name}</div> <div>{user.name}</div>
<div className="text-sm"> <div className="text-sm">{formatMoney(Math.floor(user.balance))}</div>
{user ? formatMoney(Math.floor(user.balance)) : ' '}
</div>
</div> </div>
</Row> </Row>
) )

View File

@ -31,7 +31,7 @@ const Home = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [router.isReady]) }, [router.isReady])
if (user === null) { if (user == null) {
Router.replace('/') Router.replace('/')
return <></> return <></>
} }
@ -41,7 +41,7 @@ const Home = () => {
<Page assertUser="signed-in" suspend={!!contract}> <Page assertUser="signed-in" suspend={!!contract}>
<Col className="items-center"> <Col className="items-center">
<Col className="w-full max-w-[700px]"> <Col className="w-full max-w-[700px]">
<FeedCreate user={user ?? undefined} /> <FeedCreate user={user} />
<Spacer h={10} /> <Spacer h={10} />
{feed ? ( {feed ? (
<ActivityFeed <ActivityFeed