Skip to content

Commit

Permalink
Merge branch 'dev' into will/leather-rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
camerow authored Dec 16, 2024
2 parents 2c02360 + 788ba20 commit c039661
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 279 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ module.exports = {
'plugin:storybook/csf',
],
ignorePatterns: ['./leather-styles'],
plugins: ['react', 'react-hooks', '@typescript-eslint', 'deprecation'],
plugins: ['react', 'react-hooks', '@typescript-eslint'],
settings: {
react: {
version: 'detect',
},
},
rules: {
// This rule helps highlight areas of the code that use deprecated
// methods, such as implicit use of signed transactions
'deprecation/deprecation': 'warn',
'no-console': ['error'],
'no-duplicate-imports': ['error'],
'prefer-const': [
Expand Down
6 changes: 6 additions & 0 deletions src/app/common/focus-tab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function focusTabAndWindow(tabId: number | null) {
chrome.tabs.update(tabId ?? 0, { active: true }, tab => {
if (!tab) return;
chrome.windows.update(tab.windowId, { focused: true });
});
}
1 change: 1 addition & 0 deletions src/app/common/publish-subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface GlobalAppEvents {
ledgerStacksMessageSigningCancelled: {
unsignedMessage: UnsignedMessage;
};
ledgerJwtMessageSigningComplete: unknown;
}

export const appEvents = createPublishSubscribe<GlobalAppEvents>();
12 changes: 0 additions & 12 deletions src/app/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,6 @@ export function hexToHumanReadable(hex: string) {
return `0x${hex}`;
}

export const slugify = (...args: (string | number)[]): string => {
const value = args.join(' ');

return value
.normalize('NFD') // split an accented letter in the base letter and the accent
.replace(/[\u0300-\u036f]/g, '') // remove all previously split accents
.toLowerCase()
.trim()
.replace(/[^a-z0-9 ]/g, '') // remove all chars not letters, numbers and spaces (to be replaced)
.replace(/\s+/g, '-'); // separator
};

export function getUrlHostname(url: string) {
return new URL(url).hostname;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ import { closeWindow } from '@shared/utils';
import { useOnMount } from '@app/common/hooks/use-on-mount';
import { FaviconDisplayer } from '@app/components/favicon-displayer/favicon-displayer';

interface GetAddressesLayoutProps {
interface ConnectAccountLayoutProps {
requester: string;
switchAccount: ReactNode;
onBeforeAnimation?(): void;
onUserApprovesGetAddresses(): void;
onUserApprovesGetAddresses(): void | Promise<void>;
onClickRequestedByLink(): void;
}
export function GetAddressesLayout({
export function ConnectAccountLayout({
requester,
switchAccount,
onBeforeAnimation,
onUserApprovesGetAddresses,
onClickRequestedByLink,
}: GetAddressesLayoutProps) {
}: ConnectAccountLayoutProps) {
const originLogoAnimation = useAnimationControls();
const contentDisappears = useAnimationControls();
const checkmarkEnters = useAnimationControls();
Expand Down Expand Up @@ -61,7 +61,7 @@ export function GetAddressesLayout({
});
await checkmarkEnters.start({ scale: 0.5, dur: 0.32 });
await delay(280);
onUserApprovesGetAddresses();
await onUserApprovesGetAddresses();
await delay(280);
await originLogoAnimation.start({
scale: 0,
Expand Down
25 changes: 0 additions & 25 deletions src/app/components/requester-flag.tsx

This file was deleted.

47 changes: 47 additions & 0 deletions src/app/features/current-account/current-account-displayer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Box } from 'leather-styles/jsx';

import { useAccountDisplayName } from '@app/common/hooks/account/use-account-names';
import { AccountTotalBalance } from '@app/components/account-total-balance';
import { AcccountAddresses } from '@app/components/account/account-addresses';
import { AccountListItemLayout } from '@app/components/account/account-list-item.layout';
import { AccountNameLayout } from '@app/components/account/account-name';
import { useCurrentAccountIndex } from '@app/store/accounts/account';
import { useNativeSegwitSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useStacksAccounts } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
import { AccountAvatarItem } from '@app/ui/components/account/account-avatar/account-avatar-item';

interface CurrentAccountDisplayerProps {
onSelectAccount(): void;
}
export function CurrentAccountDisplayer({ onSelectAccount }: CurrentAccountDisplayerProps) {
const index = useCurrentAccountIndex();
const stacksAccounts = useStacksAccounts();
const stxAddress = stacksAccounts[index]?.address || '';
const { data: name = '' } = useAccountDisplayName({ address: stxAddress, index });
const bitcoinSigner = useNativeSegwitSigner(index);
const bitcoinAddress = bitcoinSigner?.(0).address || '';
return (
<AccountListItemLayout
withChevron
accountAddresses={<AcccountAddresses index={index} />}
accountName={<AccountNameLayout isLoading={false}>{name}</AccountNameLayout>}
avatar={
<AccountAvatarItem
index={index}
publicKey={stacksAccounts[index]?.stxPublicKey || ''}
name={name}
/>
}
balanceLabel={
// Hack to center element without adjusting AccountListItemLayout
<Box pos="relative" top={12}>
<AccountTotalBalance stxAddress={stxAddress} btcAddress={bitcoinAddress} />
</Box>
}
index={index}
isLoading={false}
isSelected={false}
onSelectAccount={() => onSelectAccount()}
/>
);
}
53 changes: 0 additions & 53 deletions src/app/pages/choose-account/choose-account.tsx

This file was deleted.

129 changes: 0 additions & 129 deletions src/app/pages/choose-account/components/accounts.tsx

This file was deleted.

Loading

0 comments on commit c039661

Please sign in to comment.