Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning message for upgrading wallet #10

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion backend/b3_basic_wallet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "b3_basic_wallet"
version = "0.0.0-alpha.16"
version = "0.0.0-alpha.17"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "b3wallet-frontend",
"version": "0.4.4",
"version": "0.4.5",
"author": "b3hr4d",
"description": "Wallet and System Canister for the B3Wallet on the Internet Computer",
"keywords": [
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ import {
ModalHeader,
ModalOverlay,
Select,
Stack
Stack,
Text
} from "@chakra-ui/react"
import { ManagementCanisterRecord } from "@dfinity/agent"
import { Principal } from "@dfinity/principal"
import useToastMessage from "hooks/useToastMessage"
import { useCallback, useEffect, useState } from "react"
import { B3System, CanisterStatus } from "service"
import Loading from "./Loading"
import Address from "./Wallet/Address"
import PrincipalCard from "./Wallet/PrincipalCard"
import CanisterControllers from "./Wallet/Setting/CanisterController"
import WalletError from "./WalletError"
Expand Down Expand Up @@ -206,6 +208,9 @@ const Header: React.FC<HeaderProps> = ({
)}
<Stack spacing={4}>
<PrincipalCard address={principal} fontSize="sm" p={2} />
<Text fontSize="sm">
If you want to use your own wallet canister, please add it here.
</Text>
<FormControl id="addWallet">
<FormLabel>Add Wallet Canister</FormLabel>
<Stack direction="row">
Expand Down Expand Up @@ -253,6 +258,9 @@ const Header: React.FC<HeaderProps> = ({
</option>
))}
</Select>
{selectedCanisterId && (
<Address address={selectedCanisterId} hiddenAddress />
)}
<Button
colorScheme="orange"
flex={2}
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/components/Wallet/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { useMemo } from "react"
interface AddressWithCopyProps extends FlexProps {
address: string
noIcon?: boolean
hiddenAddress?: boolean
}

const Address: React.FC<AddressWithCopyProps> = ({
address,
noIcon,
overflow,
children,
hiddenAddress,
...rest
}) => {
const { hasCopied, onCopy } = useClipboard(address)
Expand All @@ -44,15 +46,20 @@ const Address: React.FC<AddressWithCopyProps> = ({
<Tooltip label={address} aria-label="Full address">
<Flex alignItems="center" overflow={overflow} {...rest}>
{children}
<Text overflow="hidden" textOverflow="ellipsis" whiteSpace="nowrap">
<Text
overflow="hidden"
textOverflow="ellipsis"
whiteSpace="nowrap"
hidden={hiddenAddress}
>
{truncatedAddress}
</Text>
{noIcon ? null : (
<IconButton
colorScheme="blue"
onClick={onCopy}
aria-label="Copy to clipboard"
variant="ghost"
variant={hiddenAddress ? "solid" : "ghost"}
icon={hasCopied ? <CheckIcon /> : <CopyIcon />}
/>
)}
Expand Down
20 changes: 19 additions & 1 deletion frontend/src/components/Wallet/Setting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Stack, Text } from "@chakra-ui/react"
import { Alert, AlertIcon, Stack, Text } from "@chakra-ui/react"
import { WalletSettings } from "declarations/b3_wallet/b3_wallet.did"
import { B3_SYSTEM_CANISTER_ID } from "helpers/config"
import { B3BasicWallet, B3System, B3Wallet } from "service"
import Address from "../Address"
import PrincipalCard from "../PrincipalCard"
import Controllers from "./Controllers"
import Cycles from "./Cycles"
Expand Down Expand Up @@ -37,6 +39,22 @@ const Settings: React.FC<SettingsProps> = ({
Settings
</Text>
<PrincipalCard address={principal} />
<Alert status="warning" borderRadius="base">
<AlertIcon />
<Text fontSize="sm">
If you have trouble with your wallet canister, you should try to
update it.
<br />
If update fails, you can uninstall from below and reinstall it. don't
forget to add system
<Address
address={B3_SYSTEM_CANISTER_ID}
display="inline-flex"
color="blue.500"
/>
canister id as a controller before uninstalling.
</Text>
</Alert>
<Cycles actor={actor} />
{signers && (
<Signers
Expand Down