Skip to content

Commit

Permalink
TW-1547: [evm] Settings. DApps. + Disabled 'Disconnect all' button
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsx committed Oct 31, 2024
1 parent 1ad5b1f commit 5067e88
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/app/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export { HashChip } from './HashChip';

export { Lines } from './Lines';

export { Loader } from './Loader';

export { ExternalLinkChip } from './ExternalLinkChip';

export { default as SubTitle } from './SubTitle';
Expand Down
40 changes: 21 additions & 19 deletions src/app/pages/Settings/DApps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,32 @@ export const DAppsSettings = memo(() => {

const onRemoveAllClick = useCallback(() => disconnectDApps(dapps.map(([o]) => o)), [disconnectDApps, dapps]);

if (!dapps.length) return <EmptyState forSearch={false} text="No connections" stretch />;

return (
<>
<ScrollView className="gap-y-6 px-4 py-6">
{activeDApp ? (
<Section title="Current connection">
<DAppItem dapp={activeDApp[1]} origin={activeDApp[0]} onRemoveClick={disconnectOne} />
</Section>
) : null}
{dapps.length ? (
<ScrollView className="gap-y-6 px-4 py-6">
{activeDApp ? (
<Section title="Current connection">
<DAppItem dapp={activeDApp[1]} origin={activeDApp[0]} onRemoveClick={disconnectOne} />
</Section>
) : null}

{displayedDapps.length ? (
<Section title="Connected Dapps">
<div className="flex flex-col gap-y-3">
{displayedDapps.map(([origin, dapp]) => (
<DAppItem key={dapp.appMeta.name} dapp={dapp} origin={origin} onRemoveClick={disconnectOne} />
))}
</div>
</Section>
) : null}
</ScrollView>
{displayedDapps.length ? (
<Section title="Connected Dapps">
<div className="flex flex-col gap-y-3">
{displayedDapps.map(([origin, dapp]) => (
<DAppItem key={dapp.appMeta.name} dapp={dapp} origin={origin} onRemoveClick={disconnectOne} />
))}
</div>
</Section>
) : null}
</ScrollView>
) : (
<EmptyState forSearch={false} text="No connections" stretch />
)}

<ActionsButtonsBox className="sticky left-0 bottom-0" bgSet={false}>
<StyledButton className="flex-1" size="L" color="red-low" onClick={onRemoveAllClick}>
<StyledButton className="flex-1" size="L" color="red-low" disabled={!dapps.length} onClick={onRemoveAllClick}>
Disconnect All
</StyledButton>
</ActionsButtonsBox>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ui/use-styled-button-or-link-props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useMemo } from 'react';

import clsx from 'clsx';

import { Loader } from 'app/atoms';
import { ButtonProps } from 'app/atoms/Button';
import { Loader } from 'app/atoms/loader';
import { LinkProps } from 'lib/woozie/Link';

type Size = 'L' | 'M' | 'S';
Expand Down

0 comments on commit 5067e88

Please sign in to comment.