kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Delete unnecessary middleman account Header component
rodzic
f3f230aece
commit
4d5a32edcb
|
@ -1,32 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import InnerHeader from 'soapbox/features/account/components/header';
|
|
||||||
|
|
||||||
import MovedNote from './moved_note';
|
|
||||||
|
|
||||||
import type { Account } from 'soapbox/types/entities';
|
|
||||||
|
|
||||||
interface IHeader {
|
|
||||||
account?: Account,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Legacy account header middleman component that exists for no reason.
|
|
||||||
* @deprecated Use account Header directly.
|
|
||||||
*/
|
|
||||||
const Header: React.FC<IHeader> = ({ account }) => {
|
|
||||||
if (!account) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{(account.moved && typeof account.moved === 'object') && (
|
|
||||||
<MovedNote from={account} to={account.moved} />
|
|
||||||
)}
|
|
||||||
<InnerHeader account={account} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Header;
|
|
|
@ -1,9 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import Header from 'soapbox/features/account/components/header';
|
||||||
import { useAppSelector } from 'soapbox/hooks';
|
import { useAppSelector } from 'soapbox/hooks';
|
||||||
import { makeGetAccount } from 'soapbox/selectors';
|
import { makeGetAccount } from 'soapbox/selectors';
|
||||||
|
|
||||||
import Header from '../components/header';
|
import MovedNote from '../components/moved_note';
|
||||||
|
|
||||||
const getAccount = makeGetAccount();
|
const getAccount = makeGetAccount();
|
||||||
|
|
||||||
|
@ -19,7 +20,14 @@ const HeaderContainer: React.FC<IHeaderContainer> = ({ accountId }) => {
|
||||||
const account = useAppSelector(state => getAccount(state, accountId));
|
const account = useAppSelector(state => getAccount(state, accountId));
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
return <Header account={account} />;
|
return (
|
||||||
|
<>
|
||||||
|
{(account.moved && typeof account.moved === 'object') && (
|
||||||
|
<MovedNote from={account} to={account.moved} />
|
||||||
|
)}
|
||||||
|
<Header account={account} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue