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

Wallet apps #4650

Merged
merged 18 commits into from
Sep 20, 2022
Merged

Wallet apps #4650

merged 18 commits into from
Sep 20, 2022

Conversation

Jibz1
Copy link
Contributor

@Jibz1 Jibz1 commented Sep 15, 2022

  • Apps section added
  • Curated and connected apps
  • connected and disconnected apps
  • remove playground from dropdown menu
Screen.Recording.2022-09-16.at.12.55.42.PM.mov
Screen.Recording.2022-09-16.at.5.32.14.PM.mov

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2022

💳 Wallet Extension has been built, you can download the packaged extension here: https://github.com/MystenLabs/sui/actions/runs/3087380774#artifacts

wallet/src/ui/app/components/sui-apps/filters.tsx Outdated Show resolved Hide resolved
wallet/src/ui/app/components/sui-apps/filters.tsx Outdated Show resolved Hide resolved
wallet/src/ui/app/redux/slices/dapps/index.ts Show resolved Hide resolved
wallet/src/ui/app/index.tsx Outdated Show resolved Hide resolved
dispatch(getCuratedApps()).unwrap();
let timeout: number;
if (mintStatus !== null) {
timeout = window.setTimeout(() => setMintStatus(null), 3000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure why this timeout is 3 seconds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you follow-up with this? IMO we should just wait for network response before un-disabling the button.

wallet/src/ui/app/components/sui-apps/index.tsx Outdated Show resolved Hide resolved
wallet/src/ui/app/components/sui-apps/SuiApp.tsx Outdated Show resolved Hide resolved
@bwann52
Copy link
Contributor

bwann52 commented Sep 15, 2022

If there are active connections, clicking on apps tab should default to active connections view

@Jibz1
Copy link
Contributor Author

Jibz1 commented Sep 16, 2022

If there are active connections, clicking on apps tab should default to active connections view

Got it

@Jibz1
Copy link
Contributor Author

Jibz1 commented Sep 16, 2022

@bwann52 see above video

@bwann52
Copy link
Contributor

bwann52 commented Sep 16, 2022

@Jibz1 thanks for sharing the video!

Some clarification: the apps tab should not just link to websites, it should actually lead to real applications and send a message to trigger the connect wallet prompt (if not connected). In addition, it's not opening the webpage within the wallet, it should be opening the website as a new tab in the full browser.

I get that you're probably just using filler content, but fyi we need to still finalize a list of applications we want to show case next week.

@Jibz1
Copy link
Contributor Author

Jibz1 commented Sep 16, 2022

@bwann52 ok. Currently the app does not open the website within the app, it actually opens in a new tab. That just recorded video dimension. I will update the app to trigger app connection for unconnected app.

@Jibz1 Jibz1 marked this pull request as ready for review September 19, 2022 15:05
@Jibz1
Copy link
Contributor Author

Jibz1 commented Sep 19, 2022

@bwann52 I will open a separate PR for to connect wallet prompt (if not connected).

@Jordan-Mysten
Copy link
Contributor

@bwann52 @Jibz1 I don't think we should trigger the connect UI ourself, instead we should append a query param that informs the UI to trigger the connection UI, and tell developers that they should respect this. Self-triggering the UI isn't possible because we need to know the permissions that the dapp needs ahead of time.

@Jibz1
Copy link
Contributor Author

Jibz1 commented Sep 19, 2022

agreed

// Get all permissions from from storage
// remove the permission for a given origin
// set the new permissions in storage
export const revokeAppPermissionByOrigin = createAsyncThunk<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pchrysochoidis is doing something similar in his PR for the current connected dapp. We should make sure that these approaches are compatible.

wallet/src/ui/app/hooks/index.ts Outdated Show resolved Hide resolved
wallet/apps/dapps.json Show resolved Hide resolved
wallet/src/ui/app/pages/home/receipt/index.tsx Outdated Show resolved Hide resolved
wallet/src/ui/app/hooks/useMutationObserver.ts Outdated Show resolved Hide resolved
wallet/src/ui/app/components/filters-tags/index.tsx Outdated Show resolved Hide resolved
const [ready, setReady] = useState(false);
const content = document.querySelector(ELEMENT_ID) as HTMLElement;

const handleMutations = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think rather than a generic useMutationObserver you could create a useWaitForElement hook that wraps all of this logic + mutation observer into a single thing.


function FiltersPortal({ tags }: Tags) {
const [ready, setReady] = useState(false);
const content = document.querySelector(ELEMENT_ID) as HTMLElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be in state or something synced with an effect? This isn't great to read the DOM during render.

dispatch(getCuratedApps()).unwrap();
let timeout: number;
if (mintStatus !== null) {
timeout = window.setTimeout(() => setMintStatus(null), 3000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you follow-up with this? IMO we should just wait for network response before un-disabling the button.


return (
<>
{showModal ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we start updating this to use shared UI components, we should make this use headless UI's dialog for a11y. This is fine for now though.

const [element, setElement] = useState<HTMLElement | null>(null);

useEffect(() => {
const content = document.querySelector(ELEMENT_ID) as HTMLElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this for the sake of getting this feature out but this isn't great, because it depends on this div being present right after this renders.

callback: MutationCallback;
}

export const useWaitForElement = ({ target, callback }: Props): void => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like this is used?

@Jordan-Mysten Jordan-Mysten merged commit 0b170f2 into main Sep 20, 2022
@Jordan-Mysten Jordan-Mysten deleted the wallet-apps branch September 20, 2022 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants