-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: develop
Are you sure you want to change the base?
Conversation
029d55d
to
3e6609a
Compare
This pull request has been deployed to Vercel. Latest commit: 3e6609a ✅ Preview: https://apps-ui-k3bwiq3s3-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 3e6609a ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-eh61zw26s.vercel.app |
apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx
Outdated
Show resolved
Hide resolved
apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx
Outdated
Show resolved
Hide resolved
3e6609a
to
093c3f4
Compare
This pull request has been deployed to Vercel. Latest commit: 093c3f4 ✅ Preview: https://apps-ui-gmb4m6m9l-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 093c3f4 ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-9zytokc9d.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b3291fb ✅ Preview: https://apps-ui-hqd7rines-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b3291fb ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-eqvcvqz9h.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b3291fb ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-em3q1ti7k.vercel.app |
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultOpen, | |
defaultOpen = false, |
apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx
Outdated
Show resolved
Hide resolved
This pull request has been deployed to Vercel. Latest commit: b15c9e8 ✅ Preview: https://apps-ui-r3abi1al2-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b15c9e8 ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-omixq143z.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b15c9e8 ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-aw4xjm5cp.vercel.app |
apps/core/src/hooks/useNftDetails.ts
Outdated
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 : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a simple simplification
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[] }, | |
); |
apps/core/src/hooks/useNftDetails.ts
Outdated
metaKeys, | ||
metaValues, | ||
formatMetaValue, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/core/src/hooks/useNftDetails.ts
Outdated
|
||
isContainedInKiosk, | ||
kioskItem, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: string; | ||
hideBorder?: boolean; | ||
defaultExpanded?: boolean; | ||
headerProps?: AccordionHeaderProps; | ||
titleSize?: TitleSize; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
This pull request has been deployed to Vercel. Latest commit: fc404d8 ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-ojxkwrinj.vercel.app |
This pull request has been deployed to Vercel. Latest commit: fc404d8 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-go1zs5kdg.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 7bd0c26 ✅ Preview: https://apps-ui-mnqd0af3o-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 7bd0c26 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-bt400lni2.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 7bd0c26 ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-ikghtim73.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 7bd0c26 ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-qhiulsgg1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 61a13f8 ✅ Preview: https://apps-ui-ensfe39ma-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 61a13f8 ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-559rvirkk.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 61a13f8 ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-63kt470my.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 61a13f8 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-js7keu7r9.vercel.app |
There was a problem hiding this 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
apps/core/src/hooks/useNftDetails.ts
Outdated
acc.values.push(value as string); | ||
return acc; | ||
}, | ||
{ keys: [] as string[], values: [] as string[] }, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
{view && ( | ||
<AssetsDialog | ||
view={view} | ||
setView={setView} | ||
isOpen={!!selectedAsset} | ||
onClose={onCloseDialog} | ||
asset={selectedAsset} | ||
/> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{view && ( | |
<AssetsDialog | |
view={view} | |
setView={setView} | |
isOpen={!!selectedAsset} | |
onClose={onCloseDialog} | |
asset={selectedAsset} | |
/> | |
)} | |
{selectedAsset && ( | |
<AssetsDialog | |
onClose={() => setSelectedAsset(null)} | |
asset={selectedAsset} | |
/> | |
)} |
interface AssetsDialogProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
asset: IotaObjectData | null; | ||
view: AssetsDialogView; | ||
setView: (view: AssetsDialogView | undefined) => void; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface AssetsDialogProps { | |
isOpen: boolean; | |
onClose: () => void; | |
asset: IotaObjectData | null; | |
view: AssetsDialogView; | |
setView: (view: AssetsDialogView | undefined) => void; | |
} | |
interface AssetsDialogProps { | |
onClose: () => void; | |
asset: IotaObjectData; | |
} |
async function onSubmit(values: FormValues) { | ||
try { | ||
await sendAsset.mutateAsync(values.to); | ||
} catch (error) { | ||
addNotification('Transfer transaction failed', NotificationType.Error); | ||
} | ||
} |
There was a problem hiding this comment.
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?
function onSendClose() { | ||
setView(undefined); | ||
} | ||
|
||
function onSendBack() { | ||
setView(AssetsDialogView.Details); | ||
} |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
<span className="text-title-lg text-neutral-10">{nftName}</span> | |
<Title title={nftName} /> |
This pull request has been deployed to Vercel. Latest commit: 16110bb ✅ Preview: https://apps-ui-ezy45gk6k-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 16110bb ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-f7j2lvxbz.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 16110bb ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-463o726ju.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 16110bb ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-c37yr7he9.vercel.app |
There was a problem hiding this 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
This pull request has been deployed to Vercel. Latest commit: 0bd5c50 ✅ Preview: https://apps-ui-oouvt07te-iota1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 0bd5c50 ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-pm1c63vza.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 0bd5c50 ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-2g78eskyu.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 0bd5c50 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-21bgl7ayl.vercel.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 flagisTransferable
(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.
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.