-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
168 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
// Copyright 2023-2024 @polkagate/snap authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export { default as exportAccount } from './exportAccount3.svg' | ||
export { default as exportAccount } from './exportAccount.svg' | ||
export { default as ellipsisV } from './ellipsisV.svg' | ||
export { default as metadata } from './metadata.svg' | ||
export { default as send } from './send.svg' | ||
export { default as settings } from './settings.svg' | ||
export { default as stake } from './stake.svg' | ||
export { default as vote } from './vote.svg' | ||
export { default as vote } from './vote.svg' | ||
export { default as more } from './more.svg' | ||
export { default as twitter } from './twitter.svg' | ||
export { default as book } from './book.svg' | ||
export { default as webSite } from './webSite.svg' | ||
export { default as email } from './email.svg' | ||
export { default as youtube } from './youtube.svg' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// Copyright 2023-2024 @polkagate/snap authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './accountDemo'; | ||
export * from './partials/accountDemo'; | ||
export * from './accountInfo'; | ||
export * from './dappList'; | ||
export * from './exportAccount'; | ||
export * from './review/'; | ||
export * from './showSpinner'; | ||
export * from './transfer'; |
6 changes: 3 additions & 3 deletions
6
packages/snap/src/ui/accountDemo.tsx → ...ages/snap/src/ui/partials/accountDemo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Box, Image, Button, SnapComponent, Divider, Link, Heading, Text } from "@metamask/snaps-sdk/jsx"; | ||
import { book, email, exportAccount, twitter, webSite } from "./image/icons"; | ||
|
||
/** | ||
* This shows the more page | ||
* | ||
* @param id - The id of UI interface to be updated. | ||
*/ | ||
export async function showMore(id: string) { | ||
await snap.request({ | ||
method: 'snap_updateInterface', | ||
params: { | ||
id, | ||
ui: ui() | ||
}, | ||
}); | ||
} | ||
|
||
export const ui = () => { | ||
|
||
return ( | ||
<Box direction="vertical" alignment="start"> | ||
<Heading>PolkaGate Snap Menu</Heading> | ||
<MenuItem icon={exportAccount} name='export' label={'Export Account as JSON File'} /> | ||
<Divider /> | ||
<LinkItem icon={book} link='https://docs.polkagate.xyz' label={'View Documents'} /> | ||
<Divider /> | ||
<LinkItem icon={twitter} link='https://x.com/@polkagate' label={'Follow Us on X (twitter)'} /> | ||
<LinkItem icon={twitter} link='https://x.com/@polkagate' label={'Follow Us on X (twitter)'} /> | ||
<LinkItem icon={twitter} link='https://youtube.com/@polkagate' label={'Subscribe to YouTube Channel'} /> | ||
<LinkItem icon={webSite} link='https://polkagate.xyz' label={'Visit Website'} /> | ||
<LinkItem icon={email} link='mailto:[email protected]' label={'Contact Us'} /> | ||
</Box> | ||
); | ||
}; | ||
|
||
|
||
|
||
type MenuProps = { | ||
icon: string; | ||
name: string; | ||
label: string; | ||
} | ||
|
||
type LinkProps = { | ||
icon: string; | ||
link: string; | ||
label: string; | ||
} | ||
|
||
export const MenuItem: SnapComponent<MenuProps> = ({ icon, name, label }: MenuProps) => { | ||
|
||
return ( | ||
<Box direction="horizontal" alignment="start"> | ||
<Image src={icon} /> | ||
<Button name={name?.toLowerCase()} variant='primary'> | ||
{label} | ||
</Button> | ||
</Box> | ||
); | ||
}; | ||
|
||
export const LinkItem: SnapComponent<LinkProps> = ({ icon, link, label }: LinkProps) => { | ||
|
||
return ( | ||
<Box direction="horizontal" alignment="start"> | ||
<Image src={icon} /> | ||
<Link href={link}>{label}</Link> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Box, Spinner, Text } from "@metamask/snaps-sdk/jsx"; | ||
/** | ||
* Show an spinner while processing. | ||
* | ||
* @param id - The id of interface. | ||
* @param title - The title to show while spinning. | ||
*/ | ||
export async function showSpinner(id: string, label?: string) { | ||
await snap.request({ | ||
method: 'snap_updateInterface', | ||
params: { | ||
id, | ||
ui: ui(label) | ||
}, | ||
}); | ||
} | ||
|
||
export const ui = (label?: string) => { | ||
|
||
return ( | ||
<Box direction="vertical" alignment="center"> | ||
<Spinner /> | ||
<Text> | ||
{label || 'Processing, Please Wait!'} | ||
</Text> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.