Simplify user page error handling: consolidate account deletion and profile not found states into a single fallback component

This commit is contained in:
MartinBraquet
2026-05-10 13:34:45 +02:00
parent dc9fccd9f5
commit cd5d581e63

View File

@@ -229,18 +229,6 @@ export default function UserPage(props: UserPageProps) {
return <Custom404 customText={fetchedProps.notFoundCustomText} />
}
if (!fetchedProps.user) {
return (
<PageBase trackPageView={'user page'} className={'relative p-2 sm:pt-0'}>
<Col className="items-center justify-center h-full">
<div className="text-xl font-semibold text-center mt-8">
{t('userpage.accountDeleted', 'This account has been deleted.')}
</div>
</Col>
</PageBase>
)
}
if (fetchedProps.user?.isBannedFromPosting) {
return (
<PageBase trackPageView={'user page'} className={'relative p-2 sm:pt-0'}>
@@ -253,18 +241,12 @@ export default function UserPage(props: UserPageProps) {
)
}
if (!fetchedProps.profile) {
return (
<PageBase trackPageView={'user page'} className={'relative p-2 sm:pt-0'}>
<Col className="items-center justify-center h-full">
<div className="text-xl font-semibold text-center mt-8">
{t('custom404.profileNotFound', 'Profile not found.')}
</div>
</Col>
</PageBase>
)
if (!fetchedProps.user || !fetchedProps.profile) {
return <Custom404 customText={'profileNotFound'} />
}
// console.log('fetchedProps', fetchedProps)
return <UserPageInner {...(fetchedProps as ActiveUserPageProps)} />
}