这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@daehli
Copy link
Contributor

@daehli daehli commented Sep 2, 2021

I discover the carousel component and the built-image doesn't component doesn't display the same image.

Some images could be sent with Query parameters.

Every loaded image/Video/Audio is sent via URL also.

Some URL are passe with all the search query. The Path.extname method didn't return the good format. Some image was not able to rendered.
@daehli daehli force-pushed the bug/00-image-minetype branch from dc74b0b to d6cf758 Compare September 2, 2021 20:25
@daehli daehli self-assigned this Sep 2, 2021
@daehli daehli requested a review from a team September 2, 2021 20:26
Copy link
Contributor

@laurentlp laurentlp left a comment

Choose a reason for hiding this comment

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

Can you please illustrate your PR with an example of a carousel that does not display the image so it's easier to review?

…r/FileMessage.tsx

Co-authored-by: Laurent Leclerc Poulin <laurentlp@users.noreply.github.com>
@daehli
Copy link
Contributor Author

daehli commented Sep 3, 2021

For example, if I want to display an Image in the builtin_image component from an action. I cannot use images with query parameters. I use the same image URL for bold example.

https://media3.giphy.com/media/mvuxdRNEz0U0RdTihm/100w.gif?cid=500402eb6f70a504b0c5849cdf254395f4c7ca3799c05e32&rid=100w.gif&ct=s

Image.js

  /** Your code starts below */

  const image = async () => {
    // The URL
    const payloads = await bp.cms.renderElement(
      'builtin_image',
      {
        image:
          'https://media3.giphy.com/media/mvuxdRNEz0U0RdTihm/100w.gif?cid=500402eb6f70a504b0c5849cdf254395f4c7ca3799c05e32&rid=100w.gif&ct=s',
        title: 'Image'
      },
      event
    )
    return await bp.events.replyToEvent(event, payloads)
  }

  return image()

  /** Your code ends here */
}

carousel.js

function action(bp: typeof sdk, event: sdk.IO.IncomingEvent, args: any, { user, temp, session } = event.state) {
  /** Your code starts below */
  const carousel = async () => {
    let cards = [
      {
        title: 'Example carousel',
        subtitle: 'Example Carousel',
        image:
          'https://media3.giphy.com/media/mvuxdRNEz0U0RdTihm/100w.gif?cid=500402eb6f70a504b0c5849cdf254395f4c7ca3799c05e32&rid=100w.gif&ct=s'
      }
    ]

    const payloads = await bp.cms.renderElement(
      'builtin_carousel',
      {
        items: cards
      },
      event
    )
    return await bp.events.replyToEvent(event, payloads)
  }

  return carousel()

  /** Your code ends here */
}

Real example

image

@daehli daehli closed this Sep 3, 2021
@daehli daehli reopened this Sep 3, 2021
@daehli daehli marked this pull request as draft September 3, 2021 19:15
@daehli
Copy link
Contributor Author

daehli commented Sep 3, 2021

Invalid URL example

The URL I provided was /tmp

image

@daehli daehli changed the title bug(built_in-image): Modified how we search for Minetype in the image component. fix(built_in-image): Modified how we search for Minetype in the image component. Sep 3, 2021
@daehli daehli changed the title fix(built_in-image): Modified how we search for Minetype in the image component. fix(builtin_image): Modified how we search for Minetype in the image component. Sep 3, 2021
@daehli daehli marked this pull request as ready for review September 3, 2021 19:34
@daehli daehli merged commit 4dc35be into master Sep 5, 2021
@daehli daehli deleted the bug/00-image-minetype branch September 5, 2021 16:20
@daehli daehli changed the title fix(builtin_image): Modified how we search for Minetype in the image component. fix(builtin_image): Modified how we search for Mimetype in the image component. Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants