Skip to content

Commit

Permalink
fix(extension): resolved pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vetalcore committed Jul 17, 2024
1 parent 864e4af commit 78f9304
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
3 changes: 1 addition & 2 deletions apps/browser-extension-wallet/src/utils/is-shared-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export const getSharedWalletSignPolicy = (script: Wallet.Cardano.Script): SignPo

if (Wallet.Cardano.isNativeScript(script) && isValidSharedWalletScript(script) && isSharedWalletScriptKind(script)) {
const signers = script.scripts
// eslint-disable-next-line unicorn/no-array-callback-reference
.filter(isRequireSignatureScriptKind)
.filter((s): s is Wallet.Cardano.RequireSignatureScript => isRequireSignatureScriptKind(s))
.map(({ keyHash }: Wallet.Cardano.RequireSignatureScript) => ({ keyHash }));
let required;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable react/no-multi-comp */
import { Box, Flex, Table, Text, useVisibleItemsCount } from '@input-output-hk/lace-ui-toolkit';
import { useOutsideHandles } from 'features/outside-handles-provider';
import React, { ReactElement, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ListRange } from 'react-virtuoso';
Expand All @@ -10,8 +12,13 @@ import { StakePoolsListHeader } from './StakePoolsListHeader';
import { StakePoolsListRow } from './StakePoolsListRow';
import { StakePoolsListRowSkeleton } from './StakePoolsListRowSkeleton';

const WrappedStakePoolsListRowSkeleton = ({ index }: { index: number }) => {
const { isSharedWallet } = useOutsideHandles();
return <StakePoolsListRowSkeleton index={index} columns={config.columns} withSelection={!isSharedWallet} />;
};

const itemContent = (index: number, data: StakePoolDetails | undefined): React.ReactElement =>
data ? <StakePoolsListRow {...data} /> : <StakePoolsListRowSkeleton index={index} columns={config.columns} />;
data ? <StakePoolsListRow {...data} /> : <WrappedStakePoolsListRowSkeleton index={index} />;

export type StakePoolsListProps = {
scrollableTargetId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
import { Box, Flex } from '@input-output-hk/lace-ui-toolkit';
import cn from 'classnames';
import { useOutsideHandles } from 'features/outside-handles-provider';
import { stakePoolCellPlaceholderRenderer } from './StakePoolSkeletonCellRenderer';
import * as styles from './StakePoolsListRowSkeleton.css';

export type StakePoolsListRowSkeletonProps<E extends string> = {
index: number;
columns: E[];
dataTestId?: string;
withSelection?: boolean;
};

export const StakePoolsListRowSkeleton = <E extends string>({
index,
columns,
dataTestId,
}: StakePoolsListRowSkeletonProps<E>) => {
const { isSharedWallet } = useOutsideHandles();

return (
<div
data-testid="stake-pool-list-row-skeleton"
className={cn(styles.row, {
[styles.selectableRow]: !isSharedWallet,
})}
>
{!isSharedWallet && <Box />}
{columns.map((cell, cellIndex) => (
<Flex key={cell} className={styles.cell} data-testid={`${dataTestId}-placeholder-list-${cell}`}>
{stakePoolCellPlaceholderRenderer(index + cellIndex)}
</Flex>
))}
</div>
);
};
withSelection,
}: StakePoolsListRowSkeletonProps<E>) => (
<div
data-testid="stake-pool-list-row-skeleton"
className={cn(styles.row, {
[styles.selectableRow]: withSelection,
})}
>
{withSelection && <Box />}
{columns.map((cell, cellIndex) => (
<Flex key={cell} className={styles.cell} data-testid={`${dataTestId}-placeholder-list-${cell}`}>
{stakePoolCellPlaceholderRenderer(index + cellIndex)}
</Flex>
))}
</div>
);

0 comments on commit 78f9304

Please sign in to comment.