bigbuffet-rw/app/soapbox/pages/remote-instance-page.tsx

54 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-05-09 19:35:22 -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-05-09 19:35:22 -07:00
import {
PromoPanel,
InstanceInfoPanel,
InstanceModerationPanel,
} from 'soapbox/features/ui/util/async-components';
import { useAppSelector, useOwnAccount } from 'soapbox/hooks';
import { federationRestrictionsDisclosed } from 'soapbox/utils/state';
import { Layout } from '../components/ui';
interface IRemoteInstancePage {
2022-05-09 19:49:53 -07:00
params?: {
instance?: string,
2022-05-09 19:35:22 -07:00
},
2023-01-10 15:03:15 -08:00
children: React.ReactNode,
2022-05-09 19:35:22 -07:00
}
/** Page for viewing a remote instance timeline. */
2022-05-09 19:49:53 -07:00
const RemoteInstancePage: React.FC<IRemoteInstancePage> = ({ children, params }) => {
const host = params?.instance;
2022-05-09 19:35:22 -07:00
const account = useOwnAccount();
const disclosed = useAppSelector(federationRestrictionsDisclosed);
return (
<>
<Layout.Main>
{children}
</Layout.Main>
<Layout.Aside>
<BundleContainer fetchComponent={PromoPanel}>
{Component => <Component key='promo-panel' />}
</BundleContainer>
<BundleContainer fetchComponent={InstanceInfoPanel}>
{Component => <Component host={host} />}
</BundleContainer>
{(disclosed || account?.admin) && (
<BundleContainer fetchComponent={InstanceModerationPanel}>
{Component => <Component host={host} />}
</BundleContainer>
)}
<LinkFooter key='link-footer' />
</Layout.Aside>
</>
);
};
export default RemoteInstancePage;