Nuke HeaderContainer
This commit is contained in:
parent
6887852586
commit
9a0531db37
|
@ -22,6 +22,7 @@ import Badge from 'soapbox/components/badge';
|
||||||
import StillImage from 'soapbox/components/still_image';
|
import StillImage from 'soapbox/components/still_image';
|
||||||
import { HStack, IconButton, Menu, MenuButton, MenuItem, MenuList, MenuLink, MenuDivider } from 'soapbox/components/ui';
|
import { HStack, IconButton, Menu, MenuButton, MenuItem, MenuList, MenuLink, MenuDivider } from 'soapbox/components/ui';
|
||||||
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
|
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
|
||||||
|
import MovedNote from 'soapbox/features/account_timeline/components/moved_note';
|
||||||
import ActionButton from 'soapbox/features/ui/components/action-button';
|
import ActionButton from 'soapbox/features/ui/components/action-button';
|
||||||
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button';
|
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button';
|
||||||
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
||||||
|
@ -725,6 +726,10 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='-mt-4 -mx-4'>
|
<div className='-mt-4 -mx-4'>
|
||||||
|
{(account.moved && typeof account.moved === 'object') && (
|
||||||
|
<MovedNote from={account} to={account.moved} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div className='relative h-32 w-full lg:h-48 md:rounded-t-xl bg-gray-200 dark:bg-gray-900/50'>
|
<div className='relative h-32 w-full lg:h-48 md:rounded-t-xl bg-gray-200 dark:bg-gray-900/50'>
|
||||||
{account.header && (
|
{account.header && (
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import Header from 'soapbox/features/account/components/header';
|
|
||||||
import { useAppSelector } from 'soapbox/hooks';
|
|
||||||
import { makeGetAccount } from 'soapbox/selectors';
|
|
||||||
|
|
||||||
import MovedNote from '../components/moved_note';
|
|
||||||
|
|
||||||
const getAccount = makeGetAccount();
|
|
||||||
|
|
||||||
interface IHeaderContainer {
|
|
||||||
accountId: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Legacy account Header container, accepting an accountId instead of an account.
|
|
||||||
* @deprecated Use account Header directly.
|
|
||||||
*/
|
|
||||||
const HeaderContainer: React.FC<IHeaderContainer> = ({ accountId }) => {
|
|
||||||
const account = useAppSelector(state => getAccount(state, accountId));
|
|
||||||
|
|
||||||
if (account) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{(account.moved && typeof account.moved === 'object') && (
|
|
||||||
<MovedNote from={account} to={account.moved} />
|
|
||||||
)}
|
|
||||||
<Header account={account} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default HeaderContainer;
|
|
|
@ -2,6 +2,8 @@ import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { Redirect, useHistory } from 'react-router-dom';
|
import { Redirect, useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { Column, Layout, Tabs } from 'soapbox/components/ui';
|
||||||
|
import Header from 'soapbox/features/account/components/header';
|
||||||
import LinkFooter from 'soapbox/features/ui/components/link_footer';
|
import LinkFooter from 'soapbox/features/ui/components/link_footer';
|
||||||
import BundleContainer from 'soapbox/features/ui/containers/bundle_container';
|
import BundleContainer from 'soapbox/features/ui/containers/bundle_container';
|
||||||
import {
|
import {
|
||||||
|
@ -17,9 +19,6 @@ import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
import { findAccountByUsername } from 'soapbox/selectors';
|
import { findAccountByUsername } from 'soapbox/selectors';
|
||||||
import { getAcct, isLocal } from 'soapbox/utils/accounts';
|
import { getAcct, isLocal } from 'soapbox/utils/accounts';
|
||||||
|
|
||||||
import { Column, Layout, Tabs } from '../components/ui';
|
|
||||||
import HeaderContainer from '../features/account_timeline/containers/header_container';
|
|
||||||
|
|
||||||
interface IProfilePage {
|
interface IProfilePage {
|
||||||
params?: {
|
params?: {
|
||||||
username?: string,
|
username?: string,
|
||||||
|
@ -90,8 +89,9 @@ const ProfilePage: React.FC<IProfilePage> = ({ params, children }) => {
|
||||||
<Layout.Main>
|
<Layout.Main>
|
||||||
<Column label={account ? `@${getAcct(account, displayFqn)}` : ''} withHeader={false}>
|
<Column label={account ? `@${getAcct(account, displayFqn)}` : ''} withHeader={false}>
|
||||||
<div className='space-y-4'>
|
<div className='space-y-4'>
|
||||||
{/* @ts-ignore */}
|
{account && (
|
||||||
<HeaderContainer accountId={account?.id} username={username} />
|
<Header account={account} />
|
||||||
|
)}
|
||||||
|
|
||||||
<BundleContainer fetchComponent={ProfileInfoPanel}>
|
<BundleContainer fetchComponent={ProfileInfoPanel}>
|
||||||
{Component => <Component username={username} account={account} />}
|
{Component => <Component username={username} account={account} />}
|
||||||
|
|
Loading…
Reference in New Issue