-
Notifications
You must be signed in to change notification settings - Fork 0
Fix(frontend)/apply feedback round 1 #90
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
base: master
Are you sure you want to change the base?
Changes from 13 commits
81a550b
8d87ef0
d72bff4
e7cef8d
c107b2e
68bcee2
d3e6ef8
0bf61ec
b7681c0
2d10990
1fb43e1
38de70c
5983784
eea4ab4
be7e2c0
7e4090e
74d98a0
2a1857a
644dc2e
fdafe15
0d3540b
af89a8d
f3b24be
72adb30
a624af6
eb916d6
28ebf5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import React from "react"; | ||
|
|
||
| import Image from "next/image"; | ||
|
|
||
| import { request } from "@/utils/graphQLClient"; | ||
|
|
||
| import { heroQuery, HeroQueryType } from "../queries/hero"; | ||
|
|
||
| const Hero: React.FC = async () => { | ||
| const { header, subtitle, background } = ( | ||
| await request<HeroQueryType>(heroQuery) | ||
| ).forLawyersPageHero; | ||
|
|
||
| return ( | ||
| <div className="relative px-6 pb-64 pt-44 md:pt-52 lg:px-32 lg:pb-80"> | ||
| <div className="space-y-8"> | ||
| <h1 | ||
| className={ | ||
| "pt-1 text-2xl font-medium text-primary-text lg:pt-3 lg:text-4xl" | ||
| } | ||
| > | ||
| {header} | ||
| </h1> | ||
| <p className="max-w-[685px] text-lg text-primary-text">{subtitle}</p> | ||
| </div> | ||
| <Image | ||
| src={background.url} | ||
| alt="Hero Image Background" | ||
| fill | ||
| unoptimized | ||
| className="absolute left-0 top-0 z-[-1] h-full object-cover" | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Hero; |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||||||||||||||||||||||||||||||
| import React from "react"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import clsx from "clsx"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import CtaCard from "@/components/CtaCard"; | ||||||||||||||||||||||||||||||||||
| import { request } from "@/utils/graphQLClient"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import { enterpriseQuery, IEnterpriseQuery } from "./queries"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const Web3: React.FC = async () => { | ||||||||||||||||||||||||||||||||||
| const { title, subtitle, cards } = await request<IEnterpriseQuery>( | ||||||||||||||||||||||||||||||||||
| enterpriseQuery, | ||||||||||||||||||||||||||||||||||
| ).then(({ homeEnterprise }) => homeEnterprise); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for GraphQL request. The component lacks error handling for the GraphQL request. Consider adding try/catch to handle potential network failures or server errors. -const Web3: React.FC = async () => {
- const { title, subtitle, cards } = await request<IEnterpriseQuery>(
- enterpriseQuery,
- ).then(({ homeEnterprise }) => homeEnterprise);
+const Enterprise: React.FC = async () => {
+ try {
+ const { title, subtitle, cards } = await request<IEnterpriseQuery>(
+ enterpriseQuery,
+ ).then(({ homeEnterprise }) => homeEnterprise);
+
+ // Component rendering code...
+ } catch (error) {
+ console.error("Failed to fetch Enterprise data:", error);
+ return <div>Failed to load Enterprise section. Please try again later.</div>;
+ }📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||
| <div className="bg-background-1 px-6 pb-12 pt-6 lg:px-32 lg:pb-24 lg:pt-12"> | ||||||||||||||||||||||||||||||||||
| <div className="flex flex-col gap-8"> | ||||||||||||||||||||||||||||||||||
| <h3 className="text-xl font-medium text-primary-text lg:text-3xl"> | ||||||||||||||||||||||||||||||||||
| {title} | ||||||||||||||||||||||||||||||||||
| </h3> | ||||||||||||||||||||||||||||||||||
| <p className="text-base text-primary-text lg:text-lg">{subtitle}</p> | ||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||
| className={clsx( | ||||||||||||||||||||||||||||||||||
| "mx-auto mb-12 mt-4 flex flex-wrap gap-4", | ||||||||||||||||||||||||||||||||||
| "xl:mt-16 xl:grid xl:grid-cols-3", | ||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||
| {cards.map(({ icon, title, subtitle }) => ( | ||||||||||||||||||||||||||||||||||
| <CtaCard | ||||||||||||||||||||||||||||||||||
| className="flex-grow" | ||||||||||||||||||||||||||||||||||
| key={title} | ||||||||||||||||||||||||||||||||||
| {...{ icon, title, description: subtitle }} | ||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||
| ))} | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export default Web3; | ||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { gql } from "graphql-request"; | ||
|
|
||
| export const enterpriseQuery = gql` | ||
| { | ||
| homeEnterprise { | ||
| title | ||
| subtitle | ||
| cards { | ||
| icon { | ||
| url | ||
| } | ||
| title | ||
| subtitle | ||
| } | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| export type IEnterpriseQuery = { | ||
| homeEnterprise: { | ||
| title: string; | ||
| subtitle: string; | ||
| cards: Array<{ | ||
| icon: { | ||
| url: string; | ||
| }; | ||
| title: string; | ||
| subtitle: string; | ||
| }>; | ||
| }; | ||
| }; |
This file was deleted.
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.
Component naming doesn't match folder structure.
The component is named
Web3but is located in the Enterprise folder and uses enterprise data. This is confusing and should be corrected for maintainability.Also, remember to update the export at the bottom of the file:
📝 Committable suggestion