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>
) : (
<SAccountsContainer>
<h3>Accounts</h3>
<h3>Account</h3>
<SAccounts>
{accounts.map(account => {
return (
@ -232,7 +232,7 @@ export default function App() {
return (
<SLayout>
<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>
</Column>
<Modal show={!!modal} closeModal={closeModal}>

View File

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