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(wallet-dashboard): style selected visual Assets. #4085

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

panteleymonchuk
Copy link
Contributor

@panteleymonchuk panteleymonchuk commented Nov 15, 2024

Description of change

Please write a summary of your changes and why you made them.

Links to any relevant issues

Closes #3702
Closes #3703

Depends on #4159 because in the file useNftDetails.ts:18 we have flag isTransferable (not critical)

Be sure to reference any related issues by adding fixes #(issue).

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Describe the tests that you ran to verify your changes.

Make sure to provide instructions for the maintainer as well as any relevant configurations.

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@panteleymonchuk panteleymonchuk added the tooling Issues related to the Tooling team label Nov 15, 2024
@panteleymonchuk panteleymonchuk changed the title feat(wallet-dashboard): show details for Assets. feat(wallet-dashboard): style selected visual Assets. Nov 15, 2024
@panteleymonchuk panteleymonchuk linked an issue Nov 15, 2024 that may be closed by this pull request
@begonaalvarezd begonaalvarezd added the wallet-dashboard Issues related to the Wallet Dashboard dApp label Nov 18, 2024
@panteleymonchuk panteleymonchuk force-pushed the tooling-dashboard/style-selected-asset branch from 029d55d to 3e6609a Compare November 19, 2024 15:35
@panteleymonchuk panteleymonchuk marked this pull request as ready for review November 19, 2024 15:35
@panteleymonchuk panteleymonchuk requested review from a team as code owners November 19, 2024 15:35
Copy link

This pull request has been deployed to Vercel.

Latest commit: 3e6609a

✅ Preview: https://apps-ui-k3bwiq3s3-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 3e6609a

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-eh61zw26s.vercel.app

@panteleymonchuk panteleymonchuk force-pushed the tooling-dashboard/style-selected-asset branch from 3e6609a to 093c3f4 Compare November 21, 2024 17:05
Copy link

This pull request has been deployed to Vercel.

Latest commit: 093c3f4

✅ Preview: https://apps-ui-gmb4m6m9l-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 093c3f4

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-9zytokc9d.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: b3291fb

✅ Preview: https://apps-ui-hqd7rines-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: b3291fb

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-eqvcvqz9h.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: b3291fb

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-em3q1ti7k.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: b3291fb

✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-715v9b7bi.vercel.app

export function Collapsible({
title,
children,
defaultOpen,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultOpen,
defaultOpen = false,

apps/wallet-dashboard/components/tiles/AssetTileLink.tsx Outdated Show resolved Hide resolved
Copy link

This pull request has been deployed to Vercel.

Latest commit: b15c9e8

✅ Preview: https://apps-ui-r3abi1al2-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: b15c9e8

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-omixq143z.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: b15c9e8

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-aw4xjm5cp.vercel.app

@marc2332 marc2332 self-requested a review November 25, 2024 15:23
Comment on lines 28 to 41
const metaFields =
(nftFields as NftFields)?.metadata?.fields?.attributes?.fields ||
Object.entries(nftFields ?? {})
.filter(([key]) => key !== 'id')
.reduce(
(acc, [key, value]) => {
acc.keys.push(key);
acc.values.push(value as string);
return acc;
},
{ keys: [] as string[], values: [] as string[] },
);
const metaKeys: string[] = metaFields ? metaFields.keys : [];
const metaValues = metaFields ? metaFields.values : [];
Copy link
Contributor

Choose a reason for hiding this comment

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

a simple simplification

Suggested change
const metaFields =
(nftFields as NftFields)?.metadata?.fields?.attributes?.fields ||
Object.entries(nftFields ?? {})
.filter(([key]) => key !== 'id')
.reduce(
(acc, [key, value]) => {
acc.keys.push(key);
acc.values.push(value as string);
return acc;
},
{ keys: [] as string[], values: [] as string[] },
);
const metaKeys: string[] = metaFields ? metaFields.keys : [];
const metaValues = metaFields ? metaFields.values : [];
const { keys: metaKeys, values: metaValues } =
(nftFields as NftFields)?.metadata?.fields?.attributes?.fields ||
Object.entries(nftFields ?? {})
.filter(([key]) => key !== 'id')
.reduce(
(acc, [key, value]) => {
acc.keys.push(key);
acc.values.push(value as string);
return acc;
},
{ keys: [] as string[], values: [] as string[] },
);

metaKeys,
metaValues,
formatMetaValue,

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change


isContainedInKiosk,
kioskItem,

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 14 to 18
title: string;
hideBorder?: boolean;
defaultExpanded?: boolean;
headerProps?: AccordionHeaderProps;
titleSize?: TitleSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

Of all this props, only title and defaulyExpanded are ever used, I suppose you copied this component from the wallet or someting (not wrong), but does it mean its worth keeping the same props? Maybe it is, just saying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved original component to core, use it in the wallet-dashboard. Current duplicated component was removed.

Base automatically changed from tooling-dashboard/style-selected-stake to develop November 25, 2024 16:20
Copy link

This pull request has been deployed to Vercel.

Latest commit: fc404d8

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-ojxkwrinj.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: fc404d8

✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-go1zs5kdg.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 7bd0c26

✅ Preview: https://apps-ui-mnqd0af3o-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 7bd0c26

✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-bt400lni2.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 7bd0c26

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-ikghtim73.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 7bd0c26

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-qhiulsgg1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 61a13f8

✅ Preview: https://apps-ui-ensfe39ma-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 61a13f8

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-559rvirkk.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 61a13f8

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-63kt470my.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 61a13f8

✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-js7keu7r9.vercel.app

Copy link
Member

@VmMad VmMad left a comment

Choose a reason for hiding this comment

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

Code looks good overall, just some suggestions.

The dialog should close after the NFT is sent, which currently doesn't happen

acc.values.push(value as string);
return acc;
},
{ keys: [] as string[], values: [] as string[] },
Copy link
Member

Choose a reason for hiding this comment

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

I think Line 8 and this one could share a type

setView: (view: AssetsDialogView | undefined) => void;
}

export interface FormValues {
Copy link
Member

Choose a reason for hiding this comment

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

If this interface needs too be exported I would say to rename it to something more specific

@@ -25,6 +26,8 @@ const ASSET_CATEGORIES: { label: string; value: AssetCategory }[] = [
];

export default function AssetsDashboardPage(): React.JSX.Element {
const [view, setView] = useState<AssetsDialogView | undefined>(AssetsDialogView.Details);
Copy link
Member

Choose a reason for hiding this comment

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

I think the view here is not necessary, it could be moved inside the AssetsDialog

Comment on lines 88 to 96
{view && (
<AssetsDialog
view={view}
setView={setView}
isOpen={!!selectedAsset}
onClose={onCloseDialog}
asset={selectedAsset}
/>
)}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{view && (
<AssetsDialog
view={view}
setView={setView}
isOpen={!!selectedAsset}
onClose={onCloseDialog}
asset={selectedAsset}
/>
)}
{selectedAsset && (
<AssetsDialog
onClose={() => setSelectedAsset(null)}
asset={selectedAsset}
/>
)}

Comment on lines 17 to 23
interface AssetsDialogProps {
isOpen: boolean;
onClose: () => void;
asset: IotaObjectData | null;
view: AssetsDialogView;
setView: (view: AssetsDialogView | undefined) => void;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
interface AssetsDialogProps {
isOpen: boolean;
onClose: () => void;
asset: IotaObjectData | null;
view: AssetsDialogView;
setView: (view: AssetsDialogView | undefined) => void;
}
interface AssetsDialogProps {
onClose: () => void;
asset: IotaObjectData;
}

Comment on lines 73 to 79
async function onSubmit(values: FormValues) {
try {
await sendAsset.mutateAsync(values.to);
} catch (error) {
addNotification('Transfer transaction failed', NotificationType.Error);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

After sending, first the dialog should be closed and then shown a notification, no?

Comment on lines 81 to 87
function onSendClose() {
setView(undefined);
}

function onSendBack() {
setView(AssetsDialogView.Details);
}
Copy link
Member

Choose a reason for hiding this comment

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

I feel it's a bit weird that the functions are defined by their view, rather than what they do, like, the function onSendClose should be called handleCloseDialog for example, and onSendBack should be called setDetailsView


function onSendAssetSuccess() {
addNotification('Transfer transaction successful', NotificationType.Success);
router.push(ASSETS_ROUTE.path + '/assets');
Copy link
Member

Choose a reason for hiding this comment

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

this is not necessary, it's the same view, isn't it?

Copy link
Member

Choose a reason for hiding this comment

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

The name should be singular, since it refers to a specific Asset, not multiple. Maybe even VisualAssetDialog or simply AssetDialog

</div>
<div className="flex w-full flex-col gap-md">
<div className="flex flex-col items-center gap-xxxs">
<span className="text-title-lg text-neutral-10">{nftName}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Let's try to avoid setting texts by hand, since we can forget adding darkmode colors

Suggested change
<span className="text-title-lg text-neutral-10">{nftName}</span>
<Title title={nftName} />

Copy link

This pull request has been deployed to Vercel.

Latest commit: 16110bb

✅ Preview: https://apps-ui-ezy45gk6k-iota1.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 16110bb

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-f7j2lvxbz.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 16110bb

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-463o726ju.vercel.app

Copy link

This pull request has been deployed to Vercel.

Latest commit: 16110bb

✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-c37yr7he9.vercel.app

Copy link
Contributor

@brancoder brancoder left a comment

Choose a reason for hiding this comment

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

conflicts 🙏

…style-selected-asset

# Conflicts:
#	apps/wallet-dashboard/providers/AppProviders.tsx
Copy link

github-actions bot commented Dec 2, 2024

This pull request has been deployed to Vercel.

Latest commit: 0bd5c50

✅ Preview: https://apps-ui-oouvt07te-iota1.vercel.app

Copy link

github-actions bot commented Dec 2, 2024

This pull request has been deployed to Vercel.

Latest commit: 0bd5c50

✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-pm1c63vza.vercel.app

Copy link

github-actions bot commented Dec 2, 2024

This pull request has been deployed to Vercel.

Latest commit: 0bd5c50

✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-2g78eskyu.vercel.app

Copy link

github-actions bot commented Dec 2, 2024

This pull request has been deployed to Vercel.

Latest commit: 0bd5c50

✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-21bgl7ayl.vercel.app

Copy link
Contributor

@brancoder brancoder left a comment

Choose a reason for hiding this comment

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

No notification or message is shown if an error occurs while sending the asset eventhough the error is caught in onSendAssetError callback. The Asset dialog is not dismissed and notification is not seen. The Asset dialog just remains open and Send button becomes enabled>
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Issues related to the Tooling team wallet-dashboard Issues related to the Wallet Dashboard dApp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Style send visual asset Style selected visual asset
6 participants