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 my coins #3726

Merged
merged 32 commits into from
Oct 30, 2024
Merged

Conversation

evavirseda
Copy link
Contributor

@evavirseda evavirseda commented Oct 28, 2024

Description of change

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

Links to any relevant issues

fixes #3684

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

@evavirseda evavirseda added tooling Issues related to the Tooling team wallet-dashboard Issues related to the Wallet Dashboard dApp labels Oct 28, 2024
@evavirseda evavirseda self-assigned this Oct 28, 2024
@evavirseda evavirseda requested review from a team as code owners October 28, 2024 16:58
@evavirseda evavirseda linked an issue Oct 28, 2024 that may be closed by this pull request
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 440291f

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 440291f

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 440291f

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

@evavirseda evavirseda marked this pull request as draft October 28, 2024 17:02
@evavirseda evavirseda marked this pull request as ready for review October 28, 2024 17:14
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: b832e54

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: b832e54

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: b832e54

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 99c6e14

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

Comment on lines 15 to 76
export interface ImageIconProps {
src: string | null | undefined;
label: string;
fallback: string;
alt?: string;
rounded?: boolean;
size?: ImageIconSize;
}

function FallBackAvatar({
str,
rounded,
size = ImageIconSize.Large,
}: {
str: string;
rounded?: boolean;
size?: ImageIconSize;
}) {
function generateTextSize(size: ImageIconSize) {
switch (size) {
case ImageIconSize.Small:
return 'text-label-sm';
case ImageIconSize.Medium:
return 'text-label-md';
case ImageIconSize.Large:
return 'text-title-md';
case ImageIconSize.Full:
return 'text-title-lg';
}
}
return (
<div
className={cn(
'flex h-full w-full items-center justify-center bg-neutral-96 bg-gradient-to-r capitalize dark:bg-neutral-20',
{ 'rounded-full': rounded },
generateTextSize(size),
)}
>
{str?.slice(0, 2)}
</div>
);
}

export function ImageIcon({ src, label, alt = label, fallback, rounded, size }: ImageIconProps) {
const [error, setError] = useState(false);
return (
<div role="img" aria-label={label} className={size}>
{error || !src ? (
<FallBackAvatar rounded={rounded} str={fallback} size={size} />
) : (
<Image
src={src}
alt={alt}
className="flex h-full w-full items-center justify-center rounded-full object-cover"
onError={() => setError(true)}
layout="fill"
objectFit="cover"
/>
)}
</div>
);
}
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
export interface ImageIconProps {
src: string | null | undefined;
label: string;
fallback: string;
alt?: string;
rounded?: boolean;
size?: ImageIconSize;
}
function FallBackAvatar({
str,
rounded,
size = ImageIconSize.Large,
}: {
str: string;
rounded?: boolean;
size?: ImageIconSize;
}) {
function generateTextSize(size: ImageIconSize) {
switch (size) {
case ImageIconSize.Small:
return 'text-label-sm';
case ImageIconSize.Medium:
return 'text-label-md';
case ImageIconSize.Large:
return 'text-title-md';
case ImageIconSize.Full:
return 'text-title-lg';
}
}
return (
<div
className={cn(
'flex h-full w-full items-center justify-center bg-neutral-96 bg-gradient-to-r capitalize dark:bg-neutral-20',
{ 'rounded-full': rounded },
generateTextSize(size),
)}
>
{str?.slice(0, 2)}
</div>
);
}
export function ImageIcon({ src, label, alt = label, fallback, rounded, size }: ImageIconProps) {
const [error, setError] = useState(false);
return (
<div role="img" aria-label={label} className={size}>
{error || !src ? (
<FallBackAvatar rounded={rounded} str={fallback} size={size} />
) : (
<Image
src={src}
alt={alt}
className="flex h-full w-full items-center justify-center rounded-full object-cover"
onError={() => setError(true)}
layout="fill"
objectFit="cover"
/>
)}
</div>
);
}
interface FallBackAvatarProps {
text: string;
rounded?: boolean;
size?: ImageIconSize;
}
function FallBackAvatar({
text,
rounded,
size = ImageIconSize.Large,
}: FallBackAvatarProps ) {
const textSize = (() => {
switch (size) {
case ImageIconSize.Small:
return 'text-label-sm';
case ImageIconSize.Medium:
return 'text-label-md';
case ImageIconSize.Large:
return 'text-title-md';
case ImageIconSize.Full:
return 'text-title-lg';
}
})();
return (
<div
className={cn(
'flex h-full w-full items-center justify-center bg-neutral-96 bg-gradient-to-r capitalize dark:bg-neutral-20',
{ 'rounded-full': rounded },
textSize ,
)}
>
{text.slice(0, 2)}
</div>
);
}
export interface ImageIconProps {
src: string | null | undefined;
label: string;
fallbackText: string;
alt?: string;
rounded?: boolean;
size?: ImageIconSize;
}
export function ImageIcon({ src, label, alt = label, fallbackText, rounded, size }: ImageIconProps) {
const [error, setError] = useState(false);
return (
<div role="img" aria-label={label} className={size}>
{error || !src ? (
<FallBackAvatar rounded={rounded} text={fallbackText} size={size} />
) : (
<Image
src={src}
alt={alt}
className="flex h-full w-full items-center justify-center rounded-full object-cover"
onError={() => setError(true)}
layout="fill"
objectFit="cover"
/>
)}
</div>
);
}

<ImageIcon
src={coinMeta?.iconUrl}
label={coinMeta?.name || coinType}
fallback={coinMeta?.name || coinType}
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
fallback={coinMeta?.name || coinType}
fallbackText={coinMeta?.name || coinType}

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 2820b8c

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

@evavirseda evavirseda requested a review from marc2332 October 29, 2024 14:02
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: c62c21b

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

Base automatically changed from tooling-dashboard/style-balance-box to develop October 29, 2024 14:42
Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 7638ded

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: db68f79

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 7b93192

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

Copy link
Contributor

This pull request has been deployed to Vercel.

Latest commit: 751ceca

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

@cpl121 cpl121 merged commit f31e0f5 into develop Oct 30, 2024
28 of 30 checks passed
@cpl121 cpl121 deleted the tooling-dashboard/style-my-coins branch October 30, 2024 12:44
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 my coins
5 participants