bigbuffet-rw/app/soapbox/pages/default-page.tsx

58 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-04-28 10:50:30 -07:00
import React from 'react';
2022-11-16 05:32:32 -08:00
import LinkFooter from 'soapbox/features/ui/components/link-footer';
import BundleContainer from 'soapbox/features/ui/containers/bundle-container';
2022-04-28 10:50:30 -07:00
import {
WhoToFollowPanel,
TrendsPanel,
SignUpPanel,
2022-05-10 03:17:14 -07:00
CtaBanner,
2022-04-28 10:50:30 -07:00
} from 'soapbox/features/ui/util/async-components';
import { useAppSelector, useFeatures } from 'soapbox/hooks';
import { Layout } from '../components/ui';
2023-01-10 15:03:15 -08:00
interface IDefaultPage {
children: React.ReactNode
}
const DefaultPage: React.FC<IDefaultPage> = ({ children }) => {
2022-04-28 10:50:30 -07:00
const me = useAppSelector(state => state.me);
const features = useFeatures();
return (
<>
2022-04-28 10:50:30 -07:00
<Layout.Main>
{children}
2022-05-10 03:17:14 -07:00
{!me && (
<BundleContainer fetchComponent={CtaBanner}>
{Component => <Component key='cta-banner' />}
</BundleContainer>
)}
2022-04-28 10:50:30 -07:00
</Layout.Main>
<Layout.Aside>
{!me && (
2022-04-28 10:50:30 -07:00
<BundleContainer fetchComponent={SignUpPanel}>
{Component => <Component key='sign-up-panel' />}
</BundleContainer>
)}
{features.trends && (
<BundleContainer fetchComponent={TrendsPanel}>
2022-10-13 09:00:44 -07:00
{Component => <Component limit={5} key='trends-panel' />}
2022-04-28 10:50:30 -07:00
</BundleContainer>
)}
{me && features.suggestions && (
2022-04-28 10:50:30 -07:00
<BundleContainer fetchComponent={WhoToFollowPanel}>
2022-09-26 12:22:00 -07:00
{Component => <Component limit={3} key='wtf-panel' />}
2022-04-28 10:50:30 -07:00
</BundleContainer>
)}
<LinkFooter key='link-footer' />
</Layout.Aside>
</>
2022-04-28 10:50:30 -07:00
);
};
export default DefaultPage;