SidebarContents.tsx 790 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React, { FC } from 'react';
  2. import RecentChanges from './RecentChanges';
  3. import CustomSidebar from './CustomSidebar';
  4. import { useCurrentSidebarContents, SidebarContents as SidebarContentType } from '~/stores/ui';
  5. type Props = {
  6. isSharedUser?: boolean,
  7. };
  8. const SidebarContents: FC<Props> = (props: Props) => {
  9. const { data: currentSidebarContents } = useCurrentSidebarContents();
  10. const { isSharedUser } = props;
  11. if (isSharedUser) {
  12. return null;
  13. }
  14. let Contents;
  15. switch (currentSidebarContents) {
  16. case SidebarContentType.RECENT:
  17. Contents = RecentChanges;
  18. break;
  19. default:
  20. Contents = CustomSidebar;
  21. }
  22. return (
  23. <Contents />
  24. );
  25. };
  26. SidebarContents.defaultProps = {
  27. isSharedUser: false,
  28. };
  29. export default SidebarContents;