fix: removes reliance on session for Header

This commit is contained in:
Ben Kremer 2022-02-14 13:41:33 +01:00
parent 68a5335b02
commit 6a23ad8a0a
2 changed files with 7 additions and 7 deletions

View File

@ -208,7 +208,7 @@ export default function App() {
</SLanding> </SLanding>
) : ( ) : (
<SAccountsContainer> <SAccountsContainer>
<h3>Accounts</h3> <h3>Account</h3>
<SAccounts> <SAccounts>
{accounts.map(account => { {accounts.map(account => {
return ( return (
@ -232,7 +232,7 @@ export default function App() {
return ( return (
<SLayout> <SLayout>
<Column maxWidth={1000} spanHeight> <Column maxWidth={1000} spanHeight>
<Header ping={() => Promise.resolve()} disconnect={disconnect} session={session} /> <Header ping={() => Promise.resolve()} disconnect={disconnect} accounts={accounts} />
<SContent>{isInitializing ? "Loading..." : renderContent()}</SContent> <SContent>{isInitializing ? "Loading..." : renderContent()}</SContent>
</Column> </Column>
<Modal show={!!modal} closeModal={closeModal}> <Modal show={!!modal} closeModal={closeModal}>

View File

@ -50,18 +50,18 @@ const SActiveSession = styled(SActiveAccount as any)`
interface HeaderProps { interface HeaderProps {
ping: () => Promise<void>; ping: () => Promise<void>;
disconnect: () => Promise<void>; disconnect: () => Promise<void>;
session: SessionTypes.Created | undefined; accounts: string[];
} }
const Header = (props: HeaderProps) => { const Header = (props: HeaderProps) => {
const { ping, disconnect, session } = props; const { ping, disconnect, accounts } = props;
return ( return (
<SHeader {...props}> <SHeader {...props}>
{session ? ( {accounts.length > 0 ? (
<> <>
<SActiveSession> <SActiveSession>
<p>{`Connected to`}</p> <p>{`Connected with`}</p>
<p>{session.peer.metadata.name}</p> <p>{accounts[0]}</p>
</SActiveSession> </SActiveSession>
<SHeaderActions> <SHeaderActions>
<Button outline color="black" onClick={ping}> <Button outline color="black" onClick={ping}>