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

feat: use new SnapAuthorshipPill component to show snap origin in confirmation flow #26881

Merged
merged 16 commits into from
Sep 6, 2024
Merged
Changes from 3 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
16 changes: 11 additions & 5 deletions ui/components/app/confirm/info/row/url.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useCallback, useState } from 'react';
import {
Box,
Icon,
Expand Down Expand Up @@ -27,17 +27,23 @@ export type ConfirmInfoRowUrlProps = {
export const ConfirmInfoRowUrl = ({ url }: ConfirmInfoRowUrlProps) => {
let urlObject;
const [isModalOpen, setIsModalOpen] = useState(false);
const openModal = () => setIsModalOpen(true);
const closeModal = () => setIsModalOpen(false);
const handleOpenModal = useCallback(
() => setIsModalOpen(true),
[setIsModalOpen],
);
const handleCloseModal = useCallback(
() => setIsModalOpen(false),
[setIsModalOpen],
);

if (isSnapId(url)) {
return (
<>
<SnapAuthorshipPill snapId={url} onClick={openModal} />
<SnapAuthorshipPill snapId={url} onClick={handleOpenModal} />
hmalik88 marked this conversation as resolved.
Show resolved Hide resolved
<SnapMetadataModal
snapId={url}
isOpen={isModalOpen}
onClose={closeModal}
onClose={handleCloseModal}
/>
</>
);
Expand Down