pleroma/src/layouts/default-layout.tsx

49 lines
1 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';
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';
interface IDefaultLayout {
children: React.ReactNode;
2023-01-10 15:03:15 -08:00
}
const DefaultLayout: React.FC<IDefaultLayout> = ({ 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 && (
<CtaBanner />
2022-05-10 03:17:14 -07:00
)}
2022-04-28 10:50:30 -07:00
</Layout.Main>
<Layout.Aside>
{!me && (
<SignUpPanel />
2022-04-28 10:50:30 -07:00
)}
{features.trends && (
<TrendsPanel limit={5} />
2022-04-28 10:50:30 -07:00
)}
{me && features.suggestions && (
<WhoToFollowPanel limit={3} />
2022-04-28 10:50:30 -07:00
)}
<LinkFooter key='link-footer' />
</Layout.Aside>
</>
2022-04-28 10:50:30 -07:00
);
};
export { DefaultLayout as default };