Skip to content

Commit

Permalink
Merge branch 'develop' into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Comp0te authored Jan 22, 2025
2 parents 8c97f5a + 676dd98 commit 1bce731
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/apps/popup/pages/all-accounts/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const AllAccountsContent = () => {
accountsInfo={accountsInfo}
accountLiquidBalance={accountLiquidBalance}
isLoadingBalance={isLoadingBalance}
isAllAccountsPage={true}
/>
);
}}
Expand Down Expand Up @@ -121,6 +122,7 @@ export const AllAccountsContent = () => {
accountsInfo={accountsInfo}
accountLiquidBalance={accountLiquidBalance}
isLoadingBalance={isLoadingBalance}
isAllAccountsPage={true}
/>
);
}}
Expand Down
5 changes: 4 additions & 1 deletion src/libs/ui/components/account-list/account-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface AccountListItemProps {
accountsInfo: Record<string, IAccountInfo> | undefined;
accountLiquidBalance: string | undefined;
isLoadingBalance: boolean;
isAllAccountsPage?: boolean;
}

export const AccountListItem = ({
Expand All @@ -70,7 +71,8 @@ export const AccountListItem = ({
closeModal,
accountsInfo,
accountLiquidBalance,
isLoadingBalance
isLoadingBalance,
isAllAccountsPage = false
}: AccountListItemProps) => {
const popoverParentRef = useRef<HTMLDivElement | null>(null);

Expand Down Expand Up @@ -137,6 +139,7 @@ export const AccountListItem = ({
showHideAccountItem={showHideAccountItem}
onClick={closeModal}
popoverParentRef={popoverParentRef}
isAllAccountsPage={isAllAccountsPage}
/>
</AlignedSpaceBetweenFlexRow>
</ListItemContainer>
Expand Down
17 changes: 10 additions & 7 deletions src/libs/ui/components/account-popover/account-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ interface AccountActionsMenuPopoverProps {
onClick?: (e: React.MouseEvent) => void;
showHideAccountItem?: boolean;
popoverParentRef: React.MutableRefObject<HTMLDivElement | null>;
isAllAccountsPage?: boolean;
}
export const AccountActionsMenuPopover = ({
account,
onClick,
showHideAccountItem,
popoverParentRef
popoverParentRef,
isAllAccountsPage = false
}: AccountActionsMenuPopoverProps) => {
const [isOpen, setIsOpen] = useState(false);

Expand All @@ -59,6 +61,7 @@ export const AccountActionsMenuPopover = ({
return (
<Popover
popoverParentRef={popoverParentRef}
isAllAccountsPage={isAllAccountsPage}
isOpen={isOpen}
setIsOpen={setIsOpen}
content={() => (
Expand All @@ -80,7 +83,7 @@ export const AccountActionsMenuPopover = ({
marginRight="medium"
color="contentDisabled"
/>
<Typography type="body">
<Typography type="body" color="contentPrimary">
<Trans t={t}>Disconnect</Trans>
</Typography>
</PopoverLink>
Expand All @@ -104,7 +107,7 @@ export const AccountActionsMenuPopover = ({
marginRight="medium"
color="contentDisabled"
/>
<Typography type="body">
<Typography type="body" color="contentPrimary">
<Trans t={t}>Connect</Trans>
</Typography>
</PopoverLink>
Expand All @@ -126,7 +129,7 @@ export const AccountActionsMenuPopover = ({
marginRight="medium"
color="contentDisabled"
/>
<Typography type="body">
<Typography type="body" color="contentPrimary">
<Trans t={t}>Rename</Trans>
</Typography>
</PopoverLink>
Expand All @@ -141,7 +144,7 @@ export const AccountActionsMenuPopover = ({
marginRight="medium"
color="contentDisabled"
/>
<Typography type="body">
<Typography type="body" color="contentPrimary">
<Trans t={t}>View on CSPR.live</Trans>
</Typography>
</PopoverLink>
Expand All @@ -163,7 +166,7 @@ export const AccountActionsMenuPopover = ({
marginRight="medium"
color="contentDisabled"
/>
<Typography type="body">
<Typography type="body" color="contentPrimary">
{account.hidden ? (
<Trans t={t}>Show in list</Trans>
) : (
Expand All @@ -189,7 +192,7 @@ export const AccountActionsMenuPopover = ({
marginRight="medium"
color="contentDisabled"
/>
<Typography type="body">
<Typography type="body" color="contentPrimary">
<Trans t={t}>Manage</Trans>
</Typography>
</PopoverLink>
Expand Down
20 changes: 14 additions & 6 deletions src/libs/ui/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ interface PopoverProps {
children: JSX.Element;
isOpen: boolean;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
isAllAccountsPage?: boolean;
}

export function Popover({
content,
children,
popoverParentRef,
isOpen,
setIsOpen
setIsOpen,
isAllAccountsPage = false
}: PropsWithChildren<PopoverProps>) {
useEffect(() => {
// Get the container with class "ms-container"
Expand Down Expand Up @@ -48,11 +50,17 @@ export function Popover({
isOpen={isOpen}
onClickOutside={() => setIsOpen(false)}
positions={['bottom', 'top']}
containerStyle={{
zIndex: '15'
}}
transform={{ top: 55, left: 135 }}
parentElement={popoverParentRef.current || undefined}
containerStyle={
isAllAccountsPage
? undefined
: {
zIndex: '15'
}
}
transform={isAllAccountsPage ? undefined : { top: 55, left: 135 }}
parentElement={
isAllAccountsPage ? undefined : popoverParentRef.current || undefined
}
content={content}
>
{children}
Expand Down

0 comments on commit 1bce731

Please sign in to comment.