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

βž– remove b-image component #5854

Merged
merged 26 commits into from
May 29, 2023
Merged

Conversation

roiLeo
Copy link
Contributor

@roiLeo roiLeo commented May 3, 2023

PR Type

  • Refactoring

Context

Before submitting pull request, please make sure:

  • My contribution builds clean without any errors or warnings
  • I've merged recent default branch -- main and I've no conflicts
  • I've tried to respect high code quality standards
  • I've didn't break any original functionality

Screenshot πŸ“Έ

Capture d’écran 2023-05-05 aΜ€ 9 21 11 AM

Copilot Summary

πŸ€– Generated by Copilot at 6f1458f

This pull request refactors several components that use images to improve performance, TypeScript support, and code quality. It replaces the b-image component from Buefy with native img elements, and applies some Vue style guide and Buefy conventions to the code. It also removes an empty line from the graphqlResponseTypes.ts file.

πŸ€– Generated by Copilot at 6f1458f

Oh we're the crew of the Vue ship, and we sail the web so fast
We don't need no b-image, we use img to make it last
We refactor and we tidy, we follow style and guide
And we heave away together, on the count of one, two, three!

@roiLeo roiLeo requested a review from a team as a code owner May 3, 2023 12:30
@roiLeo roiLeo requested review from vikiival and Jarsen136 and removed request for a team May 3, 2023 12:30
@reviewpad reviewpad bot added small Pull request is small waiting-for-review labels May 3, 2023
@reviewpad
Copy link
Contributor

reviewpad bot commented May 3, 2023

Reviewpad Report

⚠️ Warnings

  • Please link an issue to the pull request

@netlify
Copy link

netlify bot commented May 3, 2023

βœ… Deploy Preview for koda-canary ready!

Name Link
πŸ”¨ Latest commit 9d38e10
πŸ” Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/646dfd03ca8f6d0008867aff
😎 Deploy Preview https://deploy-preview-5854--koda-canary.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@reviewpad
Copy link
Contributor

reviewpad bot commented May 3, 2023

AI-Generated Summary: This pull request includes updates to several Vue components, mainly focusing on replacing <b-image> tags with <img> tags. Additionally, a few syntax updates and minor code rearrangements have been made in components such as TransferCollectionModal.vue, DangerModal.vue, and BasicImage.vue. Lastly, a blank line has been removed from graphqlResponseTypes.ts.

@roiLeo roiLeo mentioned this pull request May 3, 2023
37 tasks
Copy link
Contributor

@Jarsen136 Jarsen136 left a comment

Choose a reason for hiding this comment

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

  1. I prefer to add neo-image component to replace b-image, because there is some useful code that could be reused, like 'src-fallback'.
    Or if we could reuse this component in libs/ui libs/ui/src/components/MediaItem/type/ImageMedia.vue

  2. There is still a b-image usage in the codebase as far as I know.

image

components/shared/view/BasicImage.vue Outdated Show resolved Hide resolved
components/shared/view/BasicImage.vue Outdated Show resolved Hide resolved
components/shared/view/BasicImage.vue Show resolved Hide resolved
@roiLeo
Copy link
Contributor Author

roiLeo commented May 3, 2023

I prefer to add neo-image component to replace b-image, because there is some useful code that could be reused, like 'src-fallback'.
Or if we could reuse this component in libs/ui libs/ui/src/components/MediaItem/type/ImageMedia.vue

meh.. I don't find any advantage to push this code in libs/ui, I'm listening if you have a case where this could be useful

There is still a b-image usage in the codebase as far as I know.

Capture d’écran 2023-05-03 aΜ€ 5 26 17 PM

Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

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

everything pinted out by @Jarsen136

@Jarsen136
Copy link
Contributor

Jarsen136 commented May 3, 2023

I prefer to add neo-image component to replace b-image, because there is some useful code that could be reused, like 'src-fallback'.
Or if we could reuse this component in libs/ui libs/ui/src/components/MediaItem/type/ImageMedia.vue

meh.. I don't find any advantage to push this code in libs/ui, I'm listening if you have a case where this could be useful

For example, I would like to add a placeholder image for every image display once the load failed. If we use pure<img /> tag, we have to add an error event listener to every tag. I would like to see a common image component that contains the fallback logic.

<img :src="src" @error="onError" />

const onError = (e: Event) => {
  const target = e.target as HTMLImageElement
  if (target) {
    consola.log('[KODADOT::IMAGE] unable to load', e)
    target.src = props.placeholder
  }
}

b-image has provided these props so that we could easily achieve so.
image

We do not have to push the code into libs/ui. Creating a new common component <CommonImage /> under @/components/shared could also help us to reuse code.

@roiLeo
Copy link
Contributor Author

roiLeo commented May 4, 2023

For example, I would like to add a placeholder image for every image display once the load failed. If we use pure<img /> tag, we have to add an error event listener to every tag. I would like to see a common image component that contains the fallback logic.

isn't it already the case? check onImageError method

b-image has provided these props so that we could easily achieve so.

I don't understand your concern, do you want me to introduce new feature? this isn't the scope of this PR, only migration of our current component. IMO current fallback work as excepted.

We do not have to push the code into libs/ui. Creating a new common component <CommonImage /> under @/components/shared could also help us to reuse code.

Well component is named <BasicImage />, naming is ok to me. It is already used to be a common component lmk if you want me to rename it.

@Jarsen136
Copy link
Contributor

For example, I would like to add a placeholder image for every image display once the load failed. If we use pure<img /> tag, we have to add an error event listener to every tag. I would like to see a common image component that contains the fallback logic.

isn't it already the case? check onImageError method

Yes, it's already there on the BasicImage component. I mean we could replace <img /> with <BasicImage /> to enable these functionality.

b-image has provided these props so that we could easily achieve so.

I don't understand your concern, do you want me to introduce new feature? this isn't the scope of this PR, only migration of our current component. IMO current fallback work as excepted.

I'm not about to introduce some new feature. I mention this because we remove b-image in this PR, and it would also remove some useful functionality provided by b-image.

We do not have to push the code into libs/ui. Creating a new common component <CommonImage /> under @/components/shared could also help us to reuse code.

Well component is named <BasicImage />, naming is ok to me. It is already used to be a common component lmk if you want me to rename it.

The BasicImage naming is also ok to me. Could we replace <img /> with <BasicImage /> for most of the image elements?
In this way, we could easily introduce some common logic for images. It could be another issue for sure.

@reviewpad reviewpad bot added medium Pull request is medium and removed small Pull request is small labels May 5, 2023
@roiLeo
Copy link
Contributor Author

roiLeo commented May 5, 2023

Yes, it's already there on the BasicImage component. I mean we could replace <img /> with <BasicImage /> to enable these functionality.

Yes! Done for the one that was using <b-image />

The BasicImage naming is also ok to me. Could we replace <img /> with <BasicImage /> for most of the image elements? In this way, we could easily introduce some common logic for images. It could be another issue for sure.

For now I don't think it's a good idea to replace all <img /> occurence with <BasicImage /> since it could introduce some strange behavior.
Last <img /> tag standing are mainly icons (.svg) that can imported in component.
Let me know if you see a case where we should use BasicImage with skeleton.

@Jarsen136
Copy link
Contributor

The BasicImage naming is also ok to me. Could we replace <img /> with <BasicImage /> for most of the image elements? In this way, we could easily introduce some common logic for images. It could be another issue for sure.

For now I don't think it's a good idea to replace all <img /> occurence with <BasicImage /> since it could introduce some strange behavior. Last <img /> tag standing are mainly icons (.svg) that can imported in component.

Yes, we do not need to replace all img tag.

Let me know if you see a case where we should use BasicImage with skeleton.

Here is the BasicImage on TopCollection
Kapture 2023-05-05 at 19 41 39

Copy link
Contributor

@Jarsen136 Jarsen136 left a comment

Choose a reason for hiding this comment

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

small stuff. otherwise lgtm

components/shared/view/BasicImage.vue Outdated Show resolved Hide resolved
components/series/SeriesTable.vue Outdated Show resolved Hide resolved
Co-authored-by: Jarsen <31397967+Jarsen136@users.noreply.github.com>
@prury
Copy link
Member

prury commented May 12, 2023

@roiLeo
it loads now but images are stretched
Beta:
2
Deploy:
5854

@prury
Copy link
Member

prury commented May 12, 2023

gallery looking good but wallet icons are now huge:
4

@vikiival
Copy link
Member

Soo what's the status of this one ? πŸ‘€ @roiLeo @prury ?

@roiLeo
Copy link
Contributor Author

roiLeo commented May 21, 2023

Soo what's the status of this one ?

looks good on my side

@prury
Copy link
Member

prury commented May 21, 2023

Soo what's the status of this one ? πŸ‘€ @roiLeo @prury ?

will check again and if everything works properly will change the label

@prury
Copy link
Member

prury commented May 21, 2023

Found some problems:

Collections still not loading:

2023-05-21.19-41-32.mp4

Collection image not showing under created collections:

no images under created collections

@roiLeo
Copy link
Contributor Author

roiLeo commented May 22, 2023

Found some problems:

Collections still not loading:

Idk what happened but I lost some code from https://github.com/kodadot/nft-gallery/pull/5854/commits

@codeclimate
Copy link

codeclimate bot commented May 24, 2023

Code Climate has analyzed commit 9d38e10 and detected 0 issues on this pull request.

View more on Code Climate.

@roiLeo
Copy link
Contributor Author

roiLeo commented May 26, 2023

Merge?

@vikiival
Copy link
Member

@prury can I ask you for one more check pls?

Also @Jarsen136 && @preschian for review

@yangwao
Copy link
Member

yangwao commented May 26, 2023

I would double check everywhere and slow roll with this update as we are using it a lot places and seen there was various bugs :)

@prury
Copy link
Member

prury commented May 26, 2023

@prury can I ask you for one more check pls?

Also @Jarsen136 && @preschian for review

will do on my afternoon today

@prury
Copy link
Member

prury commented May 26, 2023

Tested on Firefox/Chrome for Desktop
Firefox/Chrome Mobile
Working fine!

@prury prury added S-works-for-me-βœ… qa-guild has tested PR from end user perspective and functionality worked and removed S-changes-requested-🀞 PR is almost good to go, just some fine tunning labels May 26, 2023
@prury
Copy link
Member

prury commented May 26, 2023

Found some problems:
Collections still not loading:

Idk what happened but I lost some code from https://github.com/kodadot/nft-gallery/pull/5854/commits

this problem is still happening tho

@yangwao yangwao merged commit 8f94bba into kodadot:main May 29, 2023
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Pull request is medium S-code-lgtm-βœ… code review guild has reviewed this PR and it's code is approved S-works-for-me-βœ… qa-guild has tested PR from end user perspective and functionality worked waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants