-
Notifications
You must be signed in to change notification settings - Fork 0
feat(frontend): brand assets page #54
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
Conversation
WalkthroughThe pull request introduces a new Brand Assets page featuring a Changes
Possibly related PRs
Suggested reviewers
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for kleros-website-v2 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
frontend/src/components/ForBuilders/Hero.tsx (1)
Line range hint
32-45
: Add aria-labels and improve accessibility for arrow links.The arrow links should have proper aria-labels and keyboard navigation support.
{heroData.arrowLink?.map((arrowLink) => ( <Link key={arrowLink.text} href={arrowLink.link.url} target="_blank" rel="noopener noreferrer" + aria-label={`${arrowLink.text} - opens in new tab`} + className="inline-flex items-center hover:underline focus:outline-none focus:ring-2 focus:ring-offset-2" > <span className="mr-2">{arrowLink.text}</span> <Image src={LinkArrow} - width="24" - height="24" + width={24} + height={24} alt="Arrow link image" + aria-hidden="true" className="inline" /> </Link> ))}
🧹 Nitpick comments (3)
frontend/src/app/brand-assets/page.tsx (1)
13-13
: Simplify props passing syntax.The object spread syntax is unnecessary here. Directly pass the prop.
- <Hero {...{ heroData: heroData.brandAssetsPageHero }} /> + <Hero heroData={heroData.brandAssetsPageHero} />frontend/src/components/BrandAssets/Hero.tsx (2)
13-40
: Consider creating a shared base Hero component.The
Hero
component shares significant code withForBuilders/Hero.tsx
. Consider extracting common functionality into a base component to avoid duplication.Create a new
BaseHero
component that both heroes can extend:// components/shared/BaseHero.tsx interface BaseHeroProps { header: string; subtitle: string; button?: { text: string; link: { url: string; }; }; background?: { url: string; alt: string; }; children?: React.ReactNode; } const BaseHero: React.FC<BaseHeroProps> = ({ header, subtitle, button, background, children }) => { return ( <div className="relative px-6 pb-12 pt-32"> <div className="space-y-6"> <h1 className="w-min text-3xl">{header}</h1> <p className="text-lg">{subtitle}</p> {button && ( <div> <Link href={button.link.url} target="_blank" rel="noopener noreferrer" > <Button variant="secondary"> <span>{button.text}</span> </Button> </Link> </div> )} {children} </div> {background && ( <Image src={background.url} alt={background.alt} fill className="absolute left-0 top-0 z-[-1] object-cover object-left" /> )} </div> ); };
20-29
: Add aria-label to the link for better accessibility.The link should have an aria-label for better screen reader support.
<Link href={heroData.button?.link?.url} target="_blank" rel="noopener noreferrer" + aria-label={`${heroData.button?.text} - opens in new tab`} >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
frontend/src/app/brand-assets/page.tsx
(1 hunks)frontend/src/components/BrandAssets/Hero.tsx
(1 hunks)frontend/src/components/ForBuilders/Hero.tsx
(1 hunks)frontend/src/queries/brand-assets/hero.tsx
(1 hunks)frontend/src/queries/for-builders/hero.tsx
(0 hunks)
💤 Files with no reviewable changes (1)
- frontend/src/queries/for-builders/hero.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - kleros-website-v2
- GitHub Check: Header rules - kleros-website-v2
- GitHub Check: Pages changed - kleros-website-v2
…agesection components
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.
Actionable comments posted: 5
♻️ Duplicate comments (1)
frontend/src/app/brand-assets/page.tsx (1)
15-23
:⚠️ Potential issueAdd error handling for GraphQL requests.
The component should handle potential GraphQL request failures gracefully.
const BrandAssets: React.FC = async () => { + try { const heroData = await request<HeroQueryType>(heroQuery); const logosPackageData = await request<LogosPackageSectionQueryType>( logosPackageSectionQuery, ); const klerosLogoSection = await request<KlerosLogoSectionQueryType>( klerosLogoSectionQuery, ); + } catch (error) { + console.error('Failed to fetch brand assets data:', error); + return <div>Failed to load brand assets. Please try again later.</div>; + }
🧹 Nitpick comments (8)
frontend/src/queries/brand-assets/kleros-logo-section.tsx (2)
9-11
: Consider adding more image metadata.The image object could benefit from additional metadata fields like dimensions, file size, or aspect ratio to help with optimized rendering and user expectations before download.
image { url + width + height + size }
26-33
: Add JSDoc comments for better documentation.Consider adding JSDoc comments to describe the purpose and usage of the
ImageDownloadType
interface.+/** + * Represents a downloadable image asset with its metadata and download links + * @property name - Display name of the image + * @property image - Image preview data + * @property svgDownloadLink - URL to download SVG version + * @property pngDownloadLink - URL to download PNG version + */ export type ImageDownloadType = {frontend/src/components/BrandAssets/KlerosLogoSection.tsx (1)
13-24
: Add semantic HTML structure and loading state.Consider using semantic HTML elements and handling loading states:
- Use
section
with ARIA label- Add loading state handling
-<div className="relative bg-background-1 px-6 pb-12 pt-32"> +<section + aria-label="Kleros Logo Downloads" + className="relative bg-background-1 px-6 pb-12 pt-32" +> <div className="space-y-6"> <h1 className="max-w-full text-3xl break-words">{klerosLogoData.header}</h1> <div className="flex flex-row flex-wrap justify-center gap-8"> {klerosLogoData.imageDownloads.map((imageDownload) => { return ( <ImageDownload key={imageDownload.name} {...{ imageDownload }} /> ); })} </div> </div> -</div> +</section>frontend/src/components/ImageDownload.tsx (1)
19-24
: Simplify conditional rendering.The conditional rendering of download buttons can be simplified using optional chaining.
- {imageDownload.svgDownloadLink ? ( - <DownloadButton name="SVG" url={imageDownload.svgDownloadLink} /> - ) : null} - {imageDownload.pngDownloadLink ? ( - <DownloadButton name="PNG" url={imageDownload.pngDownloadLink} /> - ) : null} + {imageDownload.svgDownloadLink && + <DownloadButton name="SVG" url={imageDownload.svgDownloadLink} /> + } + {imageDownload.pngDownloadLink && + <DownloadButton name="PNG" url={imageDownload.pngDownloadLink} /> + }frontend/src/components/BrandAssets/LogosPackageSection.tsx (2)
21-31
: Add aria-label to improve accessibility.The Link component wrapping the Button should have an aria-label to improve accessibility for screen readers.
<Link href={logosPackageData.button?.link?.url} target="_blank" rel="noopener noreferrer" + aria-label={`Download ${logosPackageData.button?.text}`} >
16-16
: Consider responsive padding adjustments.The padding classes could be adjusted for different screen sizes to maintain visual balance.
- <div className="relative bg-background-2 px-6 pb-12 pt-32"> + <div className="relative bg-background-2 px-4 sm:px-6 pb-8 sm:pb-12 pt-24 sm:pt-32">frontend/src/app/brand-assets/page.tsx (2)
16-22
: Optimize GraphQL requests using parallel execution.The sequential GraphQL requests can be optimized using Promise.all for parallel execution.
- const heroData = await request<HeroQueryType>(heroQuery); - const logosPackageData = await request<LogosPackageSectionQueryType>( - logosPackageSectionQuery, - ); - const klerosLogoSection = await request<KlerosLogoSectionQueryType>( - klerosLogoSectionQuery, - ); + const [heroData, logosPackageData, klerosLogoSection] = await Promise.all([ + request<HeroQueryType>(heroQuery), + request<LogosPackageSectionQueryType>(logosPackageSectionQuery), + request<KlerosLogoSectionQueryType>(klerosLogoSectionQuery), + ]);
24-34
: Add loading states for progressive enhancement.Consider adding loading states or skeletons while data is being fetched.
+import { Suspense } from 'react'; +import LoadingSkeleton from '@/components/LoadingSkeleton'; return ( <> + <Suspense fallback={<LoadingSkeleton type="hero" />}> <Hero {...{ heroData: heroData.brandAssetsPageHero }} /> + </Suspense> + <Suspense fallback={<LoadingSkeleton type="section" />}> <LogosPackageSection logosPackageData={logosPackageData.brandAssetsPageLogosPackageSection} /> + </Suspense> + <Suspense fallback={<LoadingSkeleton type="section" />}> <KlerosLogoSection klerosLogoData={klerosLogoSection.brandAssetsPageKlerosLogoSection} /> + </Suspense> </> );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
frontend/src/assets/svgs/icons/download.svg
is excluded by!**/*.svg
📒 Files selected for processing (7)
frontend/src/app/brand-assets/page.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosLogoSection.tsx
(1 hunks)frontend/src/components/BrandAssets/LogosPackageSection.tsx
(1 hunks)frontend/src/components/DownloadButton.tsx
(1 hunks)frontend/src/components/ImageDownload.tsx
(1 hunks)frontend/src/queries/brand-assets/kleros-logo-section.tsx
(1 hunks)frontend/src/queries/brand-assets/logos-package-section.tsx
(1 hunks)
🔇 Additional comments (2)
frontend/src/components/BrandAssets/LogosPackageSection.tsx (1)
33-37
: Verify arrowLink property access.The code assumes arrowLink and its nested properties always exist, but the type suggests they might be optional. This could cause runtime errors.
frontend/src/components/DownloadButton.tsx (1)
48-54
: 🛠️ Refactor suggestionImprove button accessibility and loading state.
The button needs ARIA attributes and should reflect loading/error states.
<button onClick={handleDownload} - className={clsx(primaryStyle, "flex flex-row gap-2")} + className={clsx( + primaryStyle, + "flex flex-row gap-2", + isLoading && "opacity-50 cursor-not-allowed" + )} + disabled={isLoading} + aria-busy={isLoading} + aria-label={`Download ${name}`} > - {name} + {isLoading ? "Downloading..." : name} <Image src={DownloadIcon} alt={name} width="14" height="14" /> + {error && <span className="text-red-500 text-sm mt-2">{error}</span>} </button>Likely invalid or redundant comment.
… images, various components, tweaks
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.
Actionable comments posted: 1
🧹 Nitpick comments (14)
frontend/src/queries/brand-assets/kleros-colors-section.tsx (1)
21-23
: Consider adding hex color validation.The
hexColor
field should be validated to ensure it contains a valid hex color format.Consider using a more specific type with validation:
type HexColor = `#${string}`; // Or more strictly: `#${string & { length: 6 }}`; type ColorCard = { name: string; hexColor: HexColor; };frontend/src/components/BrandAssets/KlerosColorsSection/ColorCard.tsx (1)
10-16
: Improve accessibility and maintainability.A few suggestions for improvement:
- Add color contrast check to ensure text is readable against the background color
- Consider extracting dimensions to CSS variables for better maintainability
- Add ARIA labels for better accessibility
Here's a suggested implementation:
import { useMemo } from "react"; import { getContrastYIQ } from "@/utils/colors"; // You'll need to implement this const ColorCard: React.FC<IColorCard> = ({ name, hexColor }) => { const textColor = useMemo(() => getContrastYIQ(hexColor) ? "text-black" : "text-white" , [hexColor]); return ( <div className="flex h-[--card-height] w-[--card-width] flex-col items-center justify-center gap-3 rounded-lg shadow-md" style={{ backgroundColor: hexColor, "--card-height": "200px", "--card-width": "380px" }} role="article" aria-label={`Color card for ${name}`} > <span className={`text-lg ${textColor}`}>{name}</span> <span className={textColor}>{hexColor}</span> </div> ); };frontend/src/queries/brand-assets/kleros-fonts-section.tsx (1)
7-16
: Simplify nested link structure.The current link structure has unnecessary nesting (
link.link.url
). This could be simplified for better maintainability.Consider flattening the structure:
export const klerosFontsSectionQuery = gql` { brandAssetsPageKlerosFontsSection { header linkCard { title subtitle linkText linkUrl } } } `; export type KlerosFontsSectionQueryType = { brandAssetsPageKlerosFontsSection: { header: string; linkCard: { title: string; subtitle: string; linkText: string; linkUrl: string; }; }; };Also applies to: 24-33
frontend/src/queries/brand-assets/kleros-badges-section.tsx (1)
28-35
: Enhance type safety for image downloads.Consider the following improvements:
- Add URL validation for download links
- Create an enum for supported file types
- Make image type more specific
Here's a suggested implementation:
export enum ImageFormat { SVG = 'svg', PNG = 'png' } type ValidUrl = `http${'s' | ''}://${string}`; export type ImageDownloadType = { name: string; image: { url: ValidUrl; width: number; height: number; alt: string; }; downloads: { [format in ImageFormat]: ValidUrl; }; };frontend/src/components/BrandAssets/KlerosFontsSection.tsx (2)
15-15
: Use semantic heading levels appropriatelyThe
h1
tag should be used for the main heading of the page. Since this is a section component, consider usingh2
or a lower level heading to maintain proper document outline.-<h1 className="w-min text-3xl">{klerosFontsData.header}</h1> +<h2 className="w-min text-3xl">{klerosFontsData.header}</h2>
13-13
: Add semantic section wrapperSince this is a distinct section of content, wrap it with a
section
element and add appropriate ARIA attributes.-<div className="relative bg-background-1 px-6 pb-12 pt-32"> +<section aria-labelledby="fonts-section-header" className="relative bg-background-1 px-6 pb-12 pt-32">frontend/src/components/BrandAssets/KlerosColorsSection/index.tsx (2)
20-27
: Optimize null checks and add fallback for empty stateThe optional chaining on
colorCards
could be replaced with a more robust null check, and an empty state should be handled explicitly.- {klerosColorsData?.colorCards?.map((colorCard) => ( + {klerosColorsData.colorCards?.length ? ( + klerosColorsData.colorCards.map((colorCard) => ( <ColorCard key={colorCard.name} name={colorCard.name} hexColor={colorCard.hexColor} /> - ))} + )) + ) : ( + <p>No color cards available</p> + )}
15-15
: Use semantic heading levels consistentlySimilar to the fonts section, use appropriate heading levels for document outline.
-<h1 className="w-min text-3xl">{klerosColorsData.header}</h1> +<h2 className="w-min text-3xl">{klerosColorsData.header}</h2>frontend/src/components/CtaCard.tsx (2)
29-36
: Enhance Image component configurationThe Next.js Image component should include additional optimization props and better alt text handling.
<Image width={90} height={90} src={icon.url} + quality={90} + priority={false} className="mb-4 aspect-square object-contain" - alt="Icon" + alt={`${title} icon`} />
27-27
: Add ARIA attributes for better accessibilityThe card should be more accessible with proper ARIA attributes and role.
-<div className="flex flex-col items-start rounded-2xl border border-stroke bg-background-2 p-6"> +<div + role="article" + aria-labelledby="cta-title" + className="flex flex-col items-start rounded-2xl border border-stroke bg-background-2 p-6" +>frontend/src/components/BrandAssets/KlerosBadgesSection.tsx (2)
15-15
: Removew-min
class from header to prevent text truncation.The
w-min
class on the header could cause text truncation for longer headers. Consider removing it or using a more flexible width constraint.-<h1 className="w-min text-3xl">{klerosBadgesData.header}</h1> +<h1 className="text-3xl">{klerosBadgesData.header}</h1>
22-25
: Avoid spreading the entire imageDownload object.Using the spread operator with
imageDownload
could pass unnecessary props. Be explicit about which props are needed.-<ImageDownload - key={imageDownload.image.url} - {...{ imageDownload }} -/> +<ImageDownload + key={imageDownload.image.url} + image={imageDownload.image} + name={imageDownload.name} + svgDownloadLink={imageDownload.svgDownloadLink} + pngDownloadLink={imageDownload.pngDownloadLink} +/>frontend/src/queries/brand-assets/kleros-logo-section.tsx (1)
19-24
: Add JSDoc comments and make required fields explicit.Consider adding documentation and making the type definitions more explicit about required fields.
+/** Type representing the response from the kleros logo section query */ export type KlerosLogoSectionQueryType = { brandAssetsPageKlerosLogoSection: { header: string; imageDownloads: ImageDownloadType[]; }; }; +/** Type representing an image download with optional format-specific download links */ export type ImageDownloadType = { name: string; image: { url: string; }; + // Optional download links for different formats svgDownloadLink?: string; pngDownloadLink?: string; };Also applies to: 26-33
frontend/src/app/brand-assets/page.tsx (1)
33-36
: Clean up commented code.Either remove the commented code or add a TODO comment explaining why it's temporarily disabled.
-// import { -// pnkTokenSectionQuery, -// PnkTokenSectionQueryType, -// } from "@/queries/brand-assets/pnk-token-section"; - -// import PnkTokenSection from "@/components/BrandAssets/PnkTokenSection"; +// TODO: PNK token section temporarily disabled - will be enabled in future PR #XXAlso applies to: 40-40, 62-64
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
frontend/src/app/brand-assets/page.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosBadgesSection.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosColorsSection/ColorCard.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosColorsSection/index.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosFontsSection.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosLogoSection.tsx
(1 hunks)frontend/src/components/BrandAssets/LogosPackageSection.tsx
(1 hunks)frontend/src/components/BrandAssets/StyledImagesSection.tsx
(1 hunks)frontend/src/components/CtaCard.tsx
(2 hunks)frontend/src/queries/brand-assets/kleros-badges-section.tsx
(1 hunks)frontend/src/queries/brand-assets/kleros-colors-section.tsx
(1 hunks)frontend/src/queries/brand-assets/kleros-fonts-section.tsx
(1 hunks)frontend/src/queries/brand-assets/kleros-logo-section.tsx
(1 hunks)frontend/src/queries/brand-assets/styled-images-section.tsx
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- frontend/src/components/BrandAssets/LogosPackageSection.tsx
- frontend/src/components/BrandAssets/KlerosLogoSection.tsx
🔇 Additional comments (5)
frontend/src/queries/brand-assets/kleros-badges-section.tsx (1)
8-15
: Consider adding error states for failed downloads.The current implementation doesn't handle cases where download links might be invalid or temporarily unavailable.
Run this script to check if all download links are accessible:
frontend/src/queries/brand-assets/styled-images-section.tsx (1)
41-47
: Add URL validation for image and download linksThe
ImageDownloadType
should include runtime validation to ensure URLs are properly formatted and point to expected domains.Consider implementing URL validation or using a validation library. Here's a script to check current URL patterns:
frontend/src/components/BrandAssets/StyledImagesSection.tsx (1)
23-24
: Avoid spreading the imageDownload object in both sections.Similar to the previous component, be explicit about which props are passed to ImageDownload.
-<ImageDownload key={imageDownload.name} {...{ imageDownload }} /> +<ImageDownload + key={imageDownload.name} + image={imageDownload.image} + name={imageDownload.name} + svgDownloadLink={imageDownload.svgDownloadLink} + pngDownloadLink={imageDownload.pngDownloadLink} +/>Also applies to: 37-40
frontend/src/app/brand-assets/page.tsx (2)
66-94
: 🛠️ Refactor suggestionAdd loading and error states to the UI.
The component should handle loading and error states gracefully.
+ } catch (error) { + console.error('Failed to fetch brand assets data:', error); + return ( + <div className="p-4 text-center"> + <h1 className="text-xl text-red-500">Failed to load brand assets</h1> + <p>Please try again later</p> + </div> + ); + }Likely invalid or redundant comment.
42-65
:⚠️ Potential issueAdd error handling and optimize data fetching.
- Add error handling for GraphQL requests
- Use Promise.all for parallel requests to improve performance
- Remove or document commented code
const BrandAssets: React.FC = async () => { - const heroData = await request<HeroQueryType>(heroQuery); - const logosPackageData = await request<LogosPackageSectionQueryType>( - logosPackageSectionQuery, - ); - // ... more sequential requests + try { + const [ + heroData, + logosPackageData, + klerosLogoSection, + klerosFontsSection, + klerosColorsSection, + klerosBadgesSection, + styledImagesSection, + ] = await Promise.all([ + request<HeroQueryType>(heroQuery), + request<LogosPackageSectionQueryType>(logosPackageSectionQuery), + request<KlerosLogoSectionQueryType>(klerosLogoSectionQuery), + request<KlerosFontsSectionQueryType>(klerosFontsSectionQuery), + request<KlerosColorsSectionQueryType>(klerosColorsSectionQuery), + request<KlerosBadgesSectionQueryType>(klerosBadgesSectionQuery), + request<StyledImagesSectionQueryType>(styledImagesSectionQuery), + ]);Likely invalid or redundant comment.
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.
Actionable comments posted: 1
♻️ Duplicate comments (1)
frontend/src/app/brand-assets/page.tsx (1)
40-95
:⚠️ Potential issueAdd error handling for GraphQL requests.
The component should handle potential GraphQL request failures gracefully.
🧹 Nitpick comments (4)
frontend/src/queries/brand-assets/pnk-token-section.tsx (1)
28-35
: Consider extracting ImageDownloadType to a shared types file.The implementation looks clean and well-typed. Since
ImageDownloadType
might be reused across different sections of the brand assets page, consider moving it to a shared types file.frontend/src/components/BrandAssets/PnkTokenSection.tsx (1)
16-19
: Simplify ImageDownload props and remove unnecessary key.The component renders a single
ImageDownload
, making thekey
prop unnecessary. Also, the spread operator usage could be more explicit.- <ImageDownload - key={pnkTokenData.imageDownload.name} - {...{ imageDownload: pnkTokenData.imageDownload }} - /> + <ImageDownload imageDownload={pnkTokenData.imageDownload} />frontend/src/app/brand-assets/page.tsx (2)
65-65
: Make props passing more explicit.Avoid props spreading for better code maintainability and readability.
- <Hero {...{ heroData: heroData.brandAssetsPageHero }} /> + <Hero heroData={heroData.brandAssetsPageHero} />
1-38
: Organize imports for better readability.Consider grouping related imports together (components, queries, utilities) and sorting them alphabetically within each group.
+// Components import Hero from "@/components/BrandAssets/Hero"; import KlerosBadgesSection from "@/components/BrandAssets/KlerosBadgesSection"; import KlerosColorsSection from "@/components/BrandAssets/KlerosColorsSection/index"; import KlerosFontsSection from "@/components/BrandAssets/KlerosFontsSection"; import KlerosLogoSection from "@/components/BrandAssets/KlerosLogoSection"; import LogosPackageSection from "@/components/BrandAssets/LogosPackageSection"; import PnkTokenSection from "@/components/BrandAssets/PnkTokenSection"; import StyledImagesSection from "@/components/BrandAssets/StyledImagesSection"; +// Queries and Types import { heroQuery, HeroQueryType } from "@/queries/brand-assets/hero"; import { klerosBadgesSectionQuery, KlerosBadgesSectionQueryType, } from "@/queries/brand-assets/kleros-badges-section"; // ... other query imports +// Utilities import { request } from "@/utils/graphQLClient";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
frontend/src/app/brand-assets/page.tsx
(1 hunks)frontend/src/components/BrandAssets/PnkTokenSection.tsx
(1 hunks)frontend/src/queries/brand-assets/pnk-token-section.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - kleros-website-v2
- GitHub Check: Header rules - kleros-website-v2
- GitHub Check: Pages changed - kleros-website-v2
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.
Actionable comments posted: 0
♻️ Duplicate comments (1)
frontend/src/app/brand-assets/page.tsx (1)
40-61
: 🛠️ Refactor suggestion
⚠️ Potential issueAdd error handling for the GraphQL requests.
The component should handle potential GraphQL request failures gracefully.
Optimize data fetching with Promise.all.
Multiple sequential GraphQL requests can impact page load time. Consider using Promise.all to fetch data concurrently.
🧹 Nitpick comments (4)
frontend/src/queries/brand-assets/pnk-token-section.tsx (1)
20-35
: Consider adding field validation constraints.The types are well-defined, but consider adding validation for the URL fields to ensure they contain valid URLs.
export type ImageDownloadType = { name: string; image: { - url: string; + url: string & { __brand: 'URL' }; // Type branding for URL validation }; - svgDownloadLink?: string; - pngDownloadLink?: string; + svgDownloadLink?: string & { __brand: 'URL' }; + pngDownloadLink?: string & { __brand: 'URL' }; };frontend/src/components/BrandAssets/PnkTokenSection.tsx (2)
13-14
: Add semantic HTML and ARIA attributes for better accessibility.The heading and paragraph could benefit from improved accessibility.
- <h1 className="w-min text-3xl">{pnkTokenData.header}</h1> - <p className="text-lg text-secondary-text">{pnkTokenData.subtitle}</p> + <h1 className="w-min text-3xl" role="heading" aria-level="1">{pnkTokenData.header}</h1> + <p className="text-lg text-secondary-text" aria-label="Section subtitle">{pnkTokenData.subtitle}</p>
16-19
: Avoid using object spread for component props.The ImageDownload component props could be more explicitly defined.
- <ImageDownload - key={pnkTokenData.imageDownload.name} - {...{ imageDownload: pnkTokenData.imageDownload }} - /> + <ImageDownload + key={pnkTokenData.imageDownload.name} + imageDownload={pnkTokenData.imageDownload} + />frontend/src/app/brand-assets/page.tsx (1)
65-92
: Avoid prop spreading and use explicit prop passing.The Hero component uses prop spreading which makes it harder to track prop dependencies.
- <Hero {...{ heroData: heroData.brandAssetsPageHero }} /> + <Hero heroData={heroData.brandAssetsPageHero} />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
frontend/src/app/brand-assets/page.tsx
(1 hunks)frontend/src/components/BrandAssets/PnkTokenSection.tsx
(1 hunks)frontend/src/queries/brand-assets/pnk-token-section.tsx
(1 hunks)frontend/src/queries/for-builders/hero.tsx
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/src/queries/for-builders/hero.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - kleros-website-v2
- GitHub Check: Header rules - kleros-website-v2
- GitHub Check: Pages changed - kleros-website-v2
🔇 Additional comments (1)
frontend/src/queries/brand-assets/pnk-token-section.tsx (1)
3-18
: LGTM! Well-structured GraphQL query.The query is well-organized and includes all necessary fields for the PNK token section.
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.
looks good, left some comments
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
frontend/src/components/BrandAssets/PnkTokenSection.tsx (2)
14-17
: Simplify ImageDownload props and remove unnecessary key.The
key
prop is unnecessary here as the component isn't rendered in a list. Also, the object spread syntax could be simplified.- <ImageDownload - key={pnkTokenData.imageDownload.name} - {...{ imageDownload: pnkTokenData.imageDownload }} - /> + <ImageDownload imageDownload={pnkTokenData.imageDownload} />
11-11
: Consider extracting utility classes into a reusable Tailwind class.The container div has multiple utility classes that could be extracted into a reusable class in your Tailwind config to maintain consistency across similar sections.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
frontend/src/components/BrandAssets/KlerosBadgesSection.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosColorsSection/ColorCard.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosColorsSection/index.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosFontsSection.tsx
(1 hunks)frontend/src/components/BrandAssets/KlerosLogoSection.tsx
(1 hunks)frontend/src/components/BrandAssets/LogosPackageSection.tsx
(1 hunks)frontend/src/components/BrandAssets/PnkTokenSection.tsx
(1 hunks)frontend/src/components/BrandAssets/StyledImagesSection.tsx
(1 hunks)frontend/src/components/DownloadButton.tsx
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
- frontend/src/components/BrandAssets/KlerosColorsSection/ColorCard.tsx
- frontend/src/components/BrandAssets/KlerosColorsSection/index.tsx
- frontend/src/components/BrandAssets/KlerosFontsSection.tsx
- frontend/src/components/BrandAssets/KlerosBadgesSection.tsx
- frontend/src/components/BrandAssets/LogosPackageSection.tsx
- frontend/src/components/BrandAssets/KlerosLogoSection.tsx
- frontend/src/components/BrandAssets/StyledImagesSection.tsx
- frontend/src/components/DownloadButton.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - kleros-website-v2
- GitHub Check: Header rules - kleros-website-v2
- GitHub Check: Pages changed - kleros-website-v2
🔇 Additional comments (4)
frontend/src/components/BrandAssets/PnkTokenSection.tsx (4)
1-7
: LGTM! Well-structured imports and type definitions.The imports are properly organized and the interface is well-typed using the GraphQL query type.
22-22
: LGTM! Proper component export.The default export follows React component export conventions.
11-18
: Container styles are now justified.Addressing @Harman-singh-waraich's previous comment: The container div is now necessary as it provides consistent spacing and background for multiple children (header, subtitle, and image download).
12-12
: Reconsider using w-min on header.The
w-min
class might restrict the header's width unnecessarily, potentially causing text overflow or wrapping issues with longer content.Let's check if there are any similar headers in the codebase and how they handle width:
Summary by CodeRabbit
New Features
BrandAssets
,Hero
,LogosPackageSection
,KlerosLogoSection
,KlerosBadgesSection
,KlerosColorsSection
,KlerosFontsSection
,StyledImagesSection
,PnkTokenSection
,DownloadButton
, andImageDownload
.heroQuery
,logosPackageSectionQuery
,klerosLogoSectionQuery
,klerosBadgesSectionQuery
,klerosColorsSectionQuery
,klerosFontsSectionQuery
,styledImagesSectionQuery
, andpnkTokenSectionQuery
.Improvements
Changes
background
field from For Builders hero query and type definition.CtaCard
component to allow optional icon property.