KlimaDAO / klimadao

Monorepo for the official KlimaDAO site, dApp, components and design system.
https://klimadao.finance
MIT License
90 stars 71 forks source link

[carousel] Info icon on project image carousel not working #1907

Open jabby09 opened 7 months ago

jabby09 commented 7 months ago

See this project as example:

https://www.carbonmark.com/projects/VCS-1190-2017

I cannot click on the info icon to show the caption.

Screenshot 2023-11-17 at 9 32 01 AM

Using Chrome on mac.

0xMakka commented 7 months ago

@Atmosfearful / @0xemc / @jabby09 looking at this issue this morning. The tooltips use the caption field from the api, this looks to be returning null, and this is the reason the tooltips aren't displaying anything when hovering. See image below of response from api.

Image

jabby09 commented 7 months ago

ooking at this issue this morning. The tooltips use the caption field from the api, this looks to be returning null, and this is the reason the tooltips aren't displaying anything when hovering. See image below of response from api.

@0xemc are you able to help @0xMakka and unblock this one?

0xemc commented 7 months ago

I'm not sure why but there is a difference between the GraphQL schema and the old GROK schema (we used to use GROK but migrated 6 months ago)

GQL: https://l6of5nwi.api.sanity.io/v1/graphql/production/default

query getProjectContent($registry: String!, $registryProjectId: String!){  
  allProjectContent(where:{
    project:{
      registryProjectId:{eq:$registryProjectId},
      registry:{eq:$registry}
    }
  }){
    images {
      asset {
        url
        altText
      }
    }
  }
}

Sanity: https://carbon-projects.sanity.studio/vision

*[_type == 'project' && registry == $registry && registryProjectId == $registryProjectId][0]{
    "id": id.current,
    "projectContent": *[references(^._id)]{

      images[]{
        caption,
        'url': asset->url
      }
    }[0],
  }

I've raised this in the Sanity Slack workspace and am waiting on a response.

jabby09 commented 6 months ago

I've raised this in the Sanity Slack workspace and am waiting on a response.

@0xemc any update on this?

0xemc commented 6 months ago

@jabby09 I got a response from another developer (posting here for posterity):

I believe the reason for the SanityImageAsset type not containing the caption attribute is because it is not something found on an image type by default. It is something every individual adds if they are looking to add more metadata fields to their images. Not sure how exactly your project is setup, but if you are able to set the type of your images to a custom type to include the asset attribute and then also your custom attribute of caption. This is how I have done it in my Next.js projects. import { ImageAsset } from 'sanity';

type TImage = { asset: ImageAsset; alt?: string; // In your case it would be caption };

Hope this somewhat helps or at least points you in the right direction

Will investigate this further this week