Skip to content

Commit

Permalink
Merge pull request #126 from terra-money/fix/address-book-2
Browse files Browse the repository at this point in the history
Fix/address book 2
  • Loading branch information
ericHgorski authored Dec 5, 2023
2 parents 289838e + 99a9a6f commit 6a9866d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion station-extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion station-extension/src/app/sections/settings/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const useSettingsRoutes = () => {
myWallet: {
route: "address-book/my-addresses",
element: <WalletAddresses />,
title: t("New Address Entry"),
title: t("My Addresses"),
},
}
const home = {
Expand Down
1 change: 0 additions & 1 deletion station-extension/src/pages/wallet/Asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Read } from "components/token"
import { combineState } from "data/query"
import { WithFetching } from "components/feedback"
import { useMemo } from "react"

import styles from "./Asset.module.scss"
import { TokenListItem } from "@terra-money/station-ui"
import { useBankBalance } from "data/queries/bank"
Expand Down
12 changes: 5 additions & 7 deletions station-extension/src/pages/wallet/SendPage/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,11 @@ const Token = () => {
<>
{filtered.length === 0 && <Empty />}
{filtered.map((asset: AssetType) => (
<>
<TokenSingleChainListItem
key={asset.id}
{...asset}
onClick={() => onClick(asset)}
/>
</>
<TokenSingleChainListItem
key={asset.id}
{...asset}
onClick={() => onClick(asset)}
/>
))}
</>
)
Expand Down
2 changes: 1 addition & 1 deletion station-extension/src/pages/wallet/WalletRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const useWalletRoutes = (): IRoute[] => {
},
{
path: "/receive/:address",
backPath: "receive",
backPath: "/receive",
element: <AddressChain />,
title: t("Copy Address"),
},
Expand Down
19 changes: 5 additions & 14 deletions station-extension/src/txs/AddressBook/AddressBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { useAddressBook } from "data/settings/AddressBook"
import { useState } from "react"
import { Button, Grid, Tabs } from "@terra-money/station-ui"
import { useNavigate } from "react-router-dom"
import { useAuth } from "auth"
import { getWallet } from "auth/scripts/keystore"
import { addressFromWords } from "utils/bech32"
import MyWallets from "pages/wallet/SendPage/Components/MyWallets"
import AddressWalletList from "./AddressWalletList"

interface Props {
Expand All @@ -17,16 +15,6 @@ const AddressBook = ({ onClick }: Props) => {
const { list: addressList } = useAddressBook()
const [tabKey, setTabKey] = useState("address")
const navigate = useNavigate()
const { wallets } = useAuth()

const myWallets = wallets.map((wallet) => {
const { words } = getWallet(wallet.name)

return {
name: wallet.name,
recipient: addressFromWords(words["330"]),
}
})

const handleOpen = (index?: number) => {
navigate(`new`, index !== undefined ? { state: { index } } : {})
Expand Down Expand Up @@ -79,7 +67,10 @@ const AddressBook = ({ onClick }: Props) => {
/>
</>
) : (
<AddressWalletList title="" items={myWallets} />
<MyWallets
tab={tabKey}
onClick={(address) => navigate("my-addresses", { state: address })}
/>
)}
</Grid>
)
Expand Down
7 changes: 6 additions & 1 deletion station-extension/src/txs/AddressBook/AddressWalletList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Grid, WalletSelectableListItem, SectionHeader } from "@terra-money/station-ui"
import {
Grid,
WalletSelectableListItem,
SectionHeader,
} from "@terra-money/station-ui"
import { truncate } from "@terra-money/terra-utils"

const AddressWalletList = ({
Expand All @@ -24,6 +28,7 @@ const AddressWalletList = ({
settingsOnClick={onClick ? () => onClick?.(item) : undefined}
label={item.name}
subLabel={truncate(item.recipient, [11, 6])}

/>
))}
</Grid>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Pill from "components/general/pill/Pill"
import styles from "../TokenListItem.module.scss"
import { truncate } from "@terra-money/terra-utils"

export interface TokenSingleChainListItemProps {
tokenImg: string
Expand All @@ -20,7 +21,6 @@ const TokenSingleChainListItem = ({
isSendBack,
onClick,
}: TokenSingleChainListItemProps) => {

return (
<div className={styles.token__container} onClick={onClick}>
<div className={styles.details}>
Expand All @@ -34,7 +34,7 @@ const TokenSingleChainListItem = ({
<div className={styles.details__container}>
<div className={styles.top__row}>
<h3 className={styles.symbol}>
<span className={styles.symbol__name}>{symbol}</span>
<span className={styles.symbol__name}>{truncate(symbol, [15, 15])}</span>
{isSendBack && <Pill variant="warning" text="Send Back" />}
</h3>
<h3 className={styles.amount}>
Expand Down

0 comments on commit 6a9866d

Please sign in to comment.