Skip to content

Commit

Permalink
feat: add account redesign (#1760)
Browse files Browse the repository at this point in the history
* feat: add account redesign

* fix: deselect AccountTypeNetworkSearch on click

* fix: optional AccountCreateMethodButton.networks prop

* fix: include nativetoken symbol in network search

* fix: copy feedback

* fix: also disable account type picker on second add/watch account page

* fix: navigate to correct tab when clicking on `Add Account` breadcrumb

* fix: copy feedback

* feat: add back button

* fix: watched account form spacing

* fix: trim account type network search input

* fix: account type search field font size
  • Loading branch information
alecdwm authored Dec 24, 2024
1 parent cbe75b2 commit 276f451
Show file tree
Hide file tree
Showing 46 changed files with 811 additions and 346 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-panthers-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@talismn/icons": patch
---

fix: make eye-plus.svg react correctly to stroke-width
3 changes: 0 additions & 3 deletions apps/extension/src/@talisman/util/truncateString.ts

This file was deleted.

25 changes: 15 additions & 10 deletions apps/extension/src/ui/apps/dashboard/layout/LayoutBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { FC, Fragment, ReactNode, useMemo } from "react"
import { useTranslation } from "react-i18next"
import { NavLink, To, useLocation } from "react-router-dom"

import { MethodType } from "@ui/domains/Account/AccountAdd/context"

const useBreadcrumbItems = (): Partial<Record<string, BreadcrumbItemProps[]>> => {
const { t } = useTranslation()

Expand All @@ -13,7 +15,10 @@ const useBreadcrumbItems = (): Partial<Record<string, BreadcrumbItemProps[]>> =>
// reusables
const settings = { label: t("Settings"), to: "/settings/general" }
const accounts = { label: t("Accounts"), to: "/settings/accounts" }
const accountsAdd = { label: t("Add Account"), to: "/accounts/add" }
const accountsAdd = (methodType?: MethodType) => ({
label: t("Add Account"),
to: `/accounts/add${methodType ? `?methodType=${methodType}` : ""}`,
})
const securityAndPrivacy = {
label: t("Security & Privacy"),
to: "/settings/security-privacy-settings",
Expand All @@ -22,53 +27,53 @@ const useBreadcrumbItems = (): Partial<Record<string, BreadcrumbItemProps[]>> =>

return {
"/settings/accounts": [settings, accounts],
"/accounts/add": [settings, accounts, accountsAdd],
"/accounts/add": [settings, accounts, accountsAdd()],
"/accounts/add/derived": [
settings,
accounts,
accountsAdd,
accountsAdd(),
{ label: t("New"), to: "/accounts/add/derived" },
],
"/accounts/add/mnemonic": [
settings,
accounts,
accountsAdd,
accountsAdd("import"),
{ label: t("Recovery Phrase"), to: "/accounts/add/mnemonic" },
],
"/accounts/add/pk": [
settings,
accounts,
accountsAdd,
accountsAdd("import"),
{ label: t("Private Key"), to: "/accounts/add/pk" },
],
"/accounts/add/json": [
settings,
accounts,
accountsAdd,
accountsAdd("import"),
{ label: t("JSON"), to: "/accounts/add/json" },
],
"/accounts/add/ledger": [
settings,
accounts,
accountsAdd,
accountsAdd("connect"),
{ label: t("Ledger"), to: "/accounts/add/ledger" },
],
"/accounts/add/qr": [
settings,
accounts,
accountsAdd,
accountsAdd("connect"),
{ label: t("Polkadot Vault"), to: "/accounts/add/qr" },
],
"/accounts/add/signet": [
settings,
accounts,
accountsAdd,
accountsAdd("connect"),
{ label: t("Signet Vault"), to: "/accounts/add/signet" },
],
"/accounts/add/watched": [
settings,
accounts,
accountsAdd,
accountsAdd("watched"),
{ label: t("Watched Account"), to: "/accounts/add/watched" },
],

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountAddDcentDisabledMessage } from "@ui/domains/Account/AccountAdd/AccountAddDcent"

import { DashboardLayout } from "../../layout"

export const AccountAddDcentDashboardWizard = () => {
return (
<DashboardLayout sidebar="settings">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { useSearchParams } from "react-router-dom"
import { AccountAddressType } from "@extension/core"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Spacer } from "@talisman/components/Spacer"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountAddDerivedForm } from "@ui/domains/Account/AccountAdd/AccountAddDerived/AccountAddDerivedForm"
import { useSelectAccountAndNavigate } from "@ui/hooks/useSelectAccountAndNavigate"

import { DashboardLayout } from "../../layout"

const Content = () => {
const { t } = useTranslation("admin")
// get type paramter from url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import { useTranslation } from "react-i18next"

import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Spacer } from "@talisman/components/Spacer"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountAddJson } from "@ui/domains/Account/AccountAdd/AccountAddJson"
import { useSelectAccountAndNavigate } from "@ui/hooks/useSelectAccountAndNavigate"

import { DashboardLayout } from "../../layout"

const Content = () => {
const { t } = useTranslation("admin")
const { setAddress } = useSelectAccountAndNavigate("/portfolio")

return (
<>
<HeaderBlock
title={t("Import JSON")}
text={t("Please choose the .json file you exported from Polkadot.js or Talisman")}
title={t("Import via JSON")}
text={t("Please choose the json file you exported from Polkadot.js or Talisman")}
/>
<Spacer />
<AccountAddJson onSuccess={setAddress} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountAddSignetWizard } from "@ui/domains/Account/AccountAdd/AccountAddSignet/index"
import { useSelectAccountAndNavigate } from "@ui/hooks/useSelectAccountAndNavigate"

import { DashboardLayout } from "../../layout"

const Content = () => {
const { setAddress } = useSelectAccountAndNavigate("/portfolio")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { useTranslation } from "react-i18next"
import { useSearchParams } from "react-router-dom"

import { AccountAddressType } from "@extension/core"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Spacer } from "@talisman/components/Spacer"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountAddWatchedForm } from "@ui/domains/Account/AccountAdd/AccountAddWatchedForm"
import { useSelectAccountAndNavigate } from "@ui/hooks/useSelectAccountAndNavigate"

import { DashboardLayout } from "../../layout"

export const Content = () => {
const { t } = useTranslation("admin")
// get type paramter from url
const [params] = useSearchParams()
const urlParamType = (params.get("type") ?? undefined) as AccountAddressType | undefined
const { setAddress } = useSelectAccountAndNavigate("/portfolio")

return (
<>
<HeaderBlock
title={t("Choose account type")}
text={t("What type of account would you like to add?")}
title={t("Add a watched account")}
text={!urlParamType && t("What type of account would you like to create?")}
/>
<Spacer />
<Spacer small />
<AccountAddWatchedForm onSuccess={setAddress} />
</>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useTranslation } from "react-i18next"

import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountCreateMenu } from "@ui/domains/Account/AccountAdd"
import { useBalancesHydrate } from "@ui/state"

import { DashboardLayout } from "../../layout"

const Content = () => {
useBalancesHydrate() // preload
const { t } = useTranslation()
Expand All @@ -14,7 +13,7 @@ const Content = () => {
<div className="flex flex-col gap-16">
<HeaderBlock
title={t("Add Account")}
text={t("Create a new account or import an existing one")}
text={t("Create a new account or import an existing account")}
/>
<AccountCreateMenu />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useTranslation } from "react-i18next"
import { useNavigate, useParams } from "react-router-dom"

import { AnalyticsPage } from "@ui/api/analytics"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import {
EvmNetworkForm,
SubNetworkFormAdd,
SubNetworkFormEdit,
} from "@ui/domains/Settings/ManageNetworks/NetworkForm"
import { useAnalyticsPageView } from "@ui/hooks/useAnalyticsPageView"

import { DashboardLayout } from "../../layout"
import { useNetworksType } from "./useNetworksType"

const ANALYTICS_PAGE: AnalyticsPage = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { OptionSwitch } from "@talisman/components/OptionSwitch"
import { SearchInput } from "@talisman/components/SearchInput"
import { Spacer } from "@talisman/components/Spacer"
import { sendAnalyticsEvent } from "@ui/api/analytics"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { EnableTestnetPillButton } from "@ui/domains/Settings/EnableTestnetPillButton"
import { useAnalyticsPageView } from "@ui/hooks/useAnalyticsPageView"
import {
Expand All @@ -21,7 +22,6 @@ import {
getSettingValue$,
} from "@ui/state"

import { DashboardLayout } from "../../layout"
import { ANALYTICS_PAGE } from "./analytics"
import { ChainsList } from "./ChainsList"
import { EvmNetworksList } from "./EvmNetworksList"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { useEffect } from "react"
import { Route, Routes, useSearchParams } from "react-router-dom"

import { NavigateWithQuery } from "@talisman/components/NavigateWithQuery"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { useBuyTokensModal } from "@ui/domains/Asset/Buy/useBuyTokensModal"
import { DashboardPortfolioHeader } from "@ui/domains/Portfolio/DashboardPortfolioHeader"
import { PortfolioContainer } from "@ui/domains/Portfolio/PortfolioContainer"
import { PortfolioToolbarNfts } from "@ui/domains/Portfolio/PortfolioToolbarNfts"
import { PortfolioToolbarTokens } from "@ui/domains/Portfolio/PortfolioToolbarTokens"

import { DashboardLayout } from "../../layout"
import { PortfolioAsset, PortfolioAssetHeader } from "./PortfolioAsset"
import { PortfolioAssets } from "./PortfolioAssets"
import { PortfolioNftCollection } from "./PortfolioNftCollection"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import {
TERMS_OF_USE_URL,
} from "@extension/shared"
import { HeaderBlock } from "@talisman/components/HeaderBlock"

import { DashboardLayout } from "../../layout"
import { DashboardLayout } from "@ui/apps/dashboard/layout"

const Content = () => {
const { t } = useTranslation("admin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { Spacer } from "@talisman/components/Spacer"
import { SuspenseTracker } from "@talisman/components/SuspenseTracker"
import { useOpenClose } from "@talisman/hooks/useOpenClose"
import { AnalyticsPage } from "@ui/api/analytics"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountIcon } from "@ui/domains/Account/AccountIcon"
import { Address } from "@ui/domains/Account/Address"
import { useCopyAddressModal } from "@ui/domains/CopyAddress"
Expand All @@ -45,8 +46,6 @@ import { useAnalyticsPageView } from "@ui/hooks/useAnalyticsPageView"
import { useSendFundsPopup } from "@ui/hooks/useSendFundsPopup"
import { useBalances, useChainByGenesisHash } from "@ui/state"

import { DashboardLayout } from "../../layout"

const ANALYTICS_PAGE: AnalyticsPage = {
container: "Fullscreen",
feature: "Settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { useTranslation } from "react-i18next"
import { Toggle } from "talisman-ui"

import { Setting } from "@talisman/components/Setting"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AnalyticsOptInInfo } from "@ui/domains/Settings/Analytics/AnalyticsOptInInfo"
import { useSetting } from "@ui/state"

import { DashboardLayout } from "../../layout"

const Content = () => {
const { t } = useTranslation("admin")
const [useAnalyticsTracking, setUseAnalyticsTracking] = useSetting("useAnalyticsTracking")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { Spacer } from "@talisman/components/Spacer"
import { shortenAddress } from "@talisman/util/shortenAddress"
import { api } from "@ui/api"
import { AnalyticsPage } from "@ui/api/analytics"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AccountIcon } from "@ui/domains/Account/AccountIcon"
import { AccountsStack } from "@ui/domains/Account/AccountIconsStack"
import { ChainLogo } from "@ui/domains/Asset/ChainLogo"
Expand Down Expand Up @@ -70,7 +71,6 @@ import {
import { isErc20Token } from "@ui/util/isErc20Token"
import { isUniswapV2Token } from "@ui/util/isUniswapV2Token"

import { DashboardLayout } from "../../../layout"
import {
useAssetDiscoveryFetchTokenRates,
useAssetDiscoveryTokenRates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { useTranslation } from "react-i18next"
import { ExclusiveButtonsList } from "@talisman/components/ExclusiveButtonsList"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Spacer } from "@talisman/components/Spacer"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { useSetting } from "@ui/state"

import { DashboardLayout } from "../../layout"

type Option = { value: number; label: string }

export const Content = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AuthorisedSites } from "@ui/domains/Settings/AuthorisedSites/AuthorisedSites"

import { DashboardLayout } from "../../layout"

export const ConnectedSitesPage = () => (
<DashboardLayout sidebar="settings">
<AuthorisedSites />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import { useTranslation } from "react-i18next"

import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Spacer } from "@talisman/components/Spacer"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { currencyConfig, currencyOrder, sortCurrencies } from "@ui/domains/Asset/currencyConfig"
import { useFavoriteCurrencies } from "@ui/hooks/useFavoriteCurrencies"
import { useSetting } from "@ui/state"

import { DashboardLayout } from "../../layout"

const Content = () => {
const [favorites, setFavorites] = useFavoriteCurrencies()
const [, setSelected] = useSetting("selectedCurrency")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import { SPIRIT_KEYS_DOCS_URL } from "@extension/shared"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Setting } from "@talisman/components/Setting"
import { AnalyticsPage } from "@ui/api/analytics"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { AvatarTypeSelect } from "@ui/domains/Settings/AvatarTypeSelect"
import { useRuntimeReload } from "@ui/hooks/useRuntimeReload"
import { useAppState, useSetting } from "@ui/state"

import { DashboardLayout } from "../../layout"

const ANALYTICS_PAGE: AnalyticsPage = {
container: "Fullscreen",
feature: "Settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { languages } from "@common/i18nConfig"
import { ExclusiveButtonsList } from "@talisman/components/ExclusiveButtonsList"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Spacer } from "@talisman/components/Spacer"

import { DashboardLayout } from "../../layout"
import { DashboardLayout } from "@ui/apps/dashboard/layout"

const Content = () => {
const { t, i18n } = useTranslation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import { CtaButton, Toggle } from "talisman-ui"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { Setting } from "@talisman/components/Setting"
import { Spacer } from "@talisman/components/Spacer"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import { useSetting } from "@ui/state"

import { DashboardLayout } from "../../layout"

const Content = () => {
const { t } = useTranslation("admin")
const [useTestnets, setUseTestnets] = useSetting("useTestnets")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FadeIn } from "@talisman/components/FadeIn"
import { HeaderBlock } from "@talisman/components/HeaderBlock"
import { notify } from "@talisman/components/Notifications"
import { api } from "@ui/api"
import { DashboardLayout } from "@ui/apps/dashboard/layout"
import {
MnemonicCreateModal,
MnemonicCreateModalProvider,
Expand All @@ -21,8 +22,6 @@ import { MetadataQrCode } from "@ui/domains/Sign/Qr/MetadataQrCode"
import { NetworkSpecsQrCode } from "@ui/domains/Sign/Qr/NetworkSpecsQrCode"
import { useAppState, useBalancesHydrate, useChains, useMnemonic } from "@ui/state"

import { DashboardLayout } from "../../layout"

const SetVerifierCertificateContentInner = () => {
const { t } = useTranslation("admin")
const navigate = useNavigate()
Expand Down
Loading

0 comments on commit 276f451

Please sign in to comment.