diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index d6a718f3..cbaa6700 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/astro.config.mjs b/astro.config.mjs index 40a81fc3..8ef91c10 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -19,16 +19,8 @@ export default defineConfig({ }, }), ], - vite: { - define: { - "import.meta.env.PUBLIC_GOOGLE_ANALYTICS_ID": - process.env.PUBLIC_GOOGLE_ANALYTICS_ID, - "import.meta.env.PUBLIC_GOOGLE_RECAPTCHA_SITE_KEY": - process.env.PUBLIC_GOOGLE_RECAPTCHA_SITE_KEY, - "import.meta.env.GOOGLE_RECAPTCHA_SECRET_KEY": - process.env.GOOGLE_RECAPTCHA_SECRET_KEY, - }, - }, output: "server", - adapter: cloudflare(), + adapter: cloudflare({ + imageService: "cloudflare", + }), }); diff --git a/biome.json b/biome.json index 622a026f..873e34ff 100644 --- a/biome.json +++ b/biome.json @@ -11,6 +11,9 @@ "clientKind": "git", "defaultBranch": "main" }, + "formatter": { + "lineWidth": 120 + }, "linter": { "rules": { "recommended": true, diff --git a/package.json b/package.json index 117f5946..fc51b425 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "typescript", "css", "cloudflare", + "NGO", "blog", "portfolio", "marketing", @@ -52,7 +53,7 @@ "@types/node": "^20.12.7", "@types/react": "^18.2.77", "@types/react-dom": "^18.2.25", - "astro": "^4.6.0", + "astro": "^4.6.1", "firebase": "^10.11.0", "firebase-admin": "^12.0.0", "gsap": "^3.12.5", @@ -75,7 +76,7 @@ "@commitlint/config-conventional": "^19.1.0", "@testing-library/react": "^15.0.1", "@testing-library/react-hooks": "^8.0.1", - "@types/markdown-it": "^14.0.0", + "@types/markdown-it": "^14.0.1", "@types/three": "^0.163.0", "husky": "^9.0.11", "lint-staged": "^15.2.2", diff --git a/scripts/get-tsconfig.cjs b/scripts/get-tsconfig.cjs index 0896e5f4..4aab536c 100644 --- a/scripts/get-tsconfig.cjs +++ b/scripts/get-tsconfig.cjs @@ -4,9 +4,7 @@ const { readFileSync } = require("node:fs"); const assert = require("node:assert"); const tsconfigPath = require.resolve("../tsconfig.json"); -const { config, error } = ts.readConfigFile(tsconfigPath, (path) => - readFileSync(path, "utf-8"), -); +const { config, error } = ts.readConfigFile(tsconfigPath, (path) => readFileSync(path, "utf-8")); assert(!error); diff --git a/src/consts.ts b/src/consts.ts index d6851311..041957f2 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -7,10 +7,7 @@ export const CONTACT_DETAILS: Record = { ENCODED_BIANCA_EMAIL: btoa("biancamaria.fiore@gmail.com"), }; -export const WORLD_GLOBE_CONFIG: Record< - string, - number | boolean | string | object -> = { +export const WORLD_GLOBE_CONFIG: Record = { ANIMATION_DURATION: 500, MOVEMENT_OFFSET: 20, ZOOM_OFFSET: 0.1, diff --git a/src/pages/api/contact-form.ts b/src/pages/api/contact-form.ts index a41a0754..f840df5b 100644 --- a/src/pages/api/contact-form.ts +++ b/src/pages/api/contact-form.ts @@ -30,10 +30,7 @@ export const POST: APIRoute = async ({ request }) => { message: formData.get("message"), }); - if (!contactValidation.success) - throw new Error( - contactValidation.error?.errors.join(", ") || "Invalid data", - ); + if (!contactValidation.success) throw new Error(contactValidation.error?.errors.join(", ") || "Invalid data"); const { data } = contactValidation; const database = getFirestore(app); @@ -50,9 +47,7 @@ export const POST: APIRoute = async ({ request }) => { const { data: emailData, error: emailError } = await sendEmail(data); if (emailError && !emailData) { - throw new Error( - `Something went wrong sending the email. Error: ${emailError.message} (${emailError.name})`, - ); + throw new Error(`Something went wrong sending the email. Error: ${emailError.message} (${emailError.name})`); } return new Response(null, { status: 200 }); diff --git a/src/pages/articles/[...slug].astro b/src/pages/articles/[...slug].astro index bc0f3bbe..5e2b88ca 100644 --- a/src/pages/articles/[...slug].astro +++ b/src/pages/articles/[...slug].astro @@ -30,16 +30,8 @@ const { currentArticle } = Astro.props as ArticleProps; const { featuredImage, author, title, publishDate, tags } = currentArticle.data; const { Content } = await currentArticle.render(); const relatedArticles = articles - .filter(({ data }) => - data.tags.some( - (tag) => data.title !== currentArticle.data.title && tags?.includes(tag), - ), - ) - .sort( - (a, b) => - new Date(b.data.publishDate).valueOf() - - new Date(a.data.publishDate).valueOf(), - ) + .filter(({ data }) => data.tags.some((tag) => data.title !== currentArticle.data.title && tags?.includes(tag))) + .sort((a, b) => new Date(b.data.publishDate).valueOf() - new Date(a.data.publishDate).valueOf()) .splice(0, MAX_RELATED_ARTICLES); --- diff --git a/src/pages/articles/index.astro b/src/pages/articles/index.astro index d03a04b7..b5ef89b0 100644 --- a/src/pages/articles/index.astro +++ b/src/pages/articles/index.astro @@ -17,18 +17,13 @@ enum ArticleType { const articles = await getCollection("articles"); const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}"); -articles.sort( - (a, b) => - new Date(b.data.publishDate).valueOf() - - new Date(a.data.publishDate).valueOf(), -); +articles.sort((a, b) => new Date(b.data.publishDate).valueOf() - new Date(a.data.publishDate).valueOf()); const { body: featuredArticleBody, data: featuredArticle, slug: featuredArticleSlug, -} = articles.find( - (article) => article.data.isFeatured && article.data.featuredImage, -) ?? articles.find((article) => article.data.featuredImage); +} = articles.find((article) => article.data.isFeatured && article.data.featuredImage) ?? +articles.find((article) => article.data.featuredImage); const parser: MarkdownIt = MarkdownIt("default", {}); @@ -36,10 +31,7 @@ const { excerpt: featuredArticleExcerpt } = createExcerpt({ parser, content: featuredArticleBody, }); -const publishedDate = featuredArticle.publishDate.toLocaleDateString( - "en", - DEFAULT_DATE_FORMAT, -); +const publishedDate = featuredArticle.publishDate.toLocaleDateString("en", DEFAULT_DATE_FORMAT); const featuredArticleHref = `/articles/${featuredArticleSlug}`; const featuredArticleShareUrl = new URL(featuredArticleHref, Astro.url).href; --- diff --git a/src/pages/index.astro b/src/pages/index.astro index 8933b1df..ce669c9b 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,7 +6,6 @@ import MyWork from "@components/organisms/myWork/MyWork.astro"; import LatestArticles from "@components/organisms/latestArticles/LatestArticles.astro"; // todo (current): related articles -// todo: control errors in request // todo: responsive // todo: add resume (PDF) in about? // todo: dynamic content diff --git a/src/pages/tags/[...tag].astro b/src/pages/tags/[...tag].astro index a7932628..5e2ab065 100644 --- a/src/pages/tags/[...tag].astro +++ b/src/pages/tags/[...tag].astro @@ -11,9 +11,7 @@ interface TagProps { export async function getStaticPaths() { const allPosts = await getCollection("articles"); - const uniqueAuthors = [ - ...new Set(allPosts.flatMap((post) => post.data.author)), - ]; + const uniqueAuthors = [...new Set(allPosts.flatMap((post) => post.data.author))]; const uniqueTags = [...new Set(allPosts.flatMap((post) => post.data.tags))]; const tags = uniqueTags.map((tag) => ({ diff --git a/src/ui/components/atoms/spinner/Spinner.tsx b/src/ui/components/atoms/spinner/Spinner.tsx index bfe94996..61a58f30 100644 --- a/src/ui/components/atoms/spinner/Spinner.tsx +++ b/src/ui/components/atoms/spinner/Spinner.tsx @@ -1,4 +1,4 @@ -import './spinner.css'; +import "./spinner.css"; const Spinner = () =>
; export default Spinner; diff --git a/src/ui/components/atoms/worldGlobe/WorldGlobe.tsx b/src/ui/components/atoms/worldGlobe/WorldGlobe.tsx index 059f1702..cdd8a6e4 100644 --- a/src/ui/components/atoms/worldGlobe/WorldGlobe.tsx +++ b/src/ui/components/atoms/worldGlobe/WorldGlobe.tsx @@ -72,28 +72,15 @@ const WorldGlobe = memo(({ cities, width = 680 }: GlobeAllCitiesProps) => { const handleAction = useCallback( ({ movementDirection, type }: HandleActionParams) => { if (!worldGlobeReference.current) return; - const { lng: currentLongitude, altitude: currentZoom } = - worldGlobeReference.current.pointOfView(); + const { lng: currentLongitude, altitude: currentZoom } = worldGlobeReference.current.pointOfView(); if (type === MovementType.MOVE) { - const offset = - movementDirection === Direction.CLOCKWISE - ? MOVEMENT_OFFSET - : -MOVEMENT_OFFSET; + const offset = movementDirection === Direction.CLOCKWISE ? MOVEMENT_OFFSET : -MOVEMENT_OFFSET; const newLongitude = currentLongitude + offset; - worldGlobeReference.current.pointOfView( - { lng: newLongitude }, - ANIMATION_DURATION, - ); + worldGlobeReference.current.pointOfView({ lng: newLongitude }, ANIMATION_DURATION); } else if (type === MovementType.ZOOM) { - const newZoom = - movementDirection === Zoom.IN - ? currentZoom - ZOOM_OFFSET - : currentZoom + ZOOM_OFFSET; - worldGlobeReference.current.pointOfView( - { altitude: newZoom }, - ANIMATION_DURATION, - ); + const newZoom = movementDirection === Zoom.IN ? currentZoom - ZOOM_OFFSET : currentZoom + ZOOM_OFFSET; + worldGlobeReference.current.pointOfView({ altitude: newZoom }, ANIMATION_DURATION); } }, [worldGlobeReference], @@ -124,9 +111,7 @@ const WorldGlobe = memo(({ cities, width = 680 }: GlobeAllCitiesProps) => { pointRadius="radius" pointColor="color" htmlElementsData={refineCities(cities)} - htmlElement={(data) => - renderPin({ markerData: data as ReactGlobePoint }) - } + htmlElement={(data) => renderPin({ markerData: data as ReactGlobePoint })} />
diff --git a/src/ui/components/atoms/worldGlobe/utils/calculateCenter/calculateCenter.ts b/src/ui/components/atoms/worldGlobe/utils/calculateCenter/calculateCenter.ts index 4a998c19..c9929496 100644 --- a/src/ui/components/atoms/worldGlobe/utils/calculateCenter/calculateCenter.ts +++ b/src/ui/components/atoms/worldGlobe/utils/calculateCenter/calculateCenter.ts @@ -9,11 +9,8 @@ export function calculateCenter(data: CityValue[]): CalculateCenterReturnType { const latitudes = data.map((point) => Number.parseFloat(point.latitude)); const longitudes = data.map((point) => Number.parseFloat(point.longitude)); - const centerLatitude = - latitudes.reduce((acc, latitude) => acc + latitude, 0) / latitudes.length; - const centerLongitude = - longitudes.reduce((acc, longitude) => acc + longitude, 0) / - longitudes.length; + const centerLatitude = latitudes.reduce((acc, latitude) => acc + latitude, 0) / latitudes.length; + const centerLongitude = longitudes.reduce((acc, longitude) => acc + longitude, 0) / longitudes.length; return { latitude: centerLatitude, longitude: centerLongitude }; } diff --git a/src/ui/components/molecules/aboutLatestArticlesSlider/AboutLatestArticlesSlider.tsx b/src/ui/components/molecules/aboutLatestArticlesSlider/AboutLatestArticlesSlider.tsx index e8a3a14f..e8d82b02 100644 --- a/src/ui/components/molecules/aboutLatestArticlesSlider/AboutLatestArticlesSlider.tsx +++ b/src/ui/components/molecules/aboutLatestArticlesSlider/AboutLatestArticlesSlider.tsx @@ -47,9 +47,7 @@ const SLIDER_CONFIG: SwiperOptions = { const parser: MarkdownIt = MarkdownIt("default", {}); // todo: isolate and use composition -export const AboutLatestArticlesSlider = ({ - articles, -}: AboutLatestArticlesSLiderProps) => { +export const AboutLatestArticlesSlider = ({ articles }: AboutLatestArticlesSLiderProps) => { return (
@@ -59,31 +57,17 @@ export const AboutLatestArticlesSlider = ({ parser, content: content.body, }); - const variant: ArticleType = article.featuredImage - ? ArticleType.DEFAULT - : ArticleType.NO_IMAGE; - const publishedDate = article.publishDate.toLocaleDateString( - "en", - DEFAULT_DATE_FORMAT, - ); + const variant: ArticleType = article.featuredImage ? ArticleType.DEFAULT : ArticleType.NO_IMAGE; + const publishedDate = article.publishDate.toLocaleDateString("en", DEFAULT_DATE_FORMAT); const href = `/articles/${slug}`; return ( -
  • +
  • - +
    {article.featuredImage && ( @@ -95,29 +79,17 @@ export const AboutLatestArticlesSlider = ({ decoding="async" /> )} -

    - by{" "} - - {article.author} - + by {article.author}

    {excerpt}

      {article.tags?.map((tag: string) => ( - + #{tag} ))} diff --git a/src/ui/components/molecules/cityCard/CityCard.tsx b/src/ui/components/molecules/cityCard/CityCard.tsx index 5e5f4d32..60172a92 100644 --- a/src/ui/components/molecules/cityCard/CityCard.tsx +++ b/src/ui/components/molecules/cityCard/CityCard.tsx @@ -1,21 +1,9 @@ import React, { type CSSProperties, type ReactNode } from "react"; import "./city-card.css"; -import { - CityPeriod, - type CityPeriodProps, -} from "src/ui/components/molecules/cityCard/components/cityPeriod"; -import { - CityName, - type CityTitleProps, -} from "src/ui/components/molecules/cityCard/components/cityName"; -import { - CityImage, - type CityImageProps, -} from "@components/molecules/cityCard/components/cityImage"; -import { - CityDescription, - type CityDescriptionProps, -} from "@components/molecules/cityCard/components/cityDescription"; +import { CityPeriod, type CityPeriodProps } from "src/ui/components/molecules/cityCard/components/cityPeriod"; +import { CityName, type CityTitleProps } from "src/ui/components/molecules/cityCard/components/cityName"; +import { CityImage, type CityImageProps } from "@components/molecules/cityCard/components/cityImage"; +import { CityDescription, type CityDescriptionProps } from "@components/molecules/cityCard/components/cityDescription"; interface CityCardProps { children: ReactNode; @@ -36,13 +24,9 @@ export const CityCard = ({ children, index, numCards }: CityCardProps) => { }; const Image = (props: CityImageProps) => ; -const Period = ({ children }: CityPeriodProps) => ( - {children} -); +const Period = ({ children }: CityPeriodProps) => {children}; const Title = ({ children }: CityTitleProps) => {children}; -const Description = ({ children }: CityDescriptionProps) => ( - {children} -); +const Description = ({ children }: CityDescriptionProps) => {children}; CityCard.Period = Period; CityCard.Title = Title; diff --git a/src/ui/components/molecules/cityCard/components/cityImage/CityImage.tsx b/src/ui/components/molecules/cityCard/components/cityImage/CityImage.tsx index 99ce54a5..1897c03e 100644 --- a/src/ui/components/molecules/cityCard/components/cityImage/CityImage.tsx +++ b/src/ui/components/molecules/cityCard/components/cityImage/CityImage.tsx @@ -4,11 +4,5 @@ import "./city-image.css"; export type CityImageProps = Pick; export const CityImage = ({ src, alt }: CityImageProps) => ( - {alt} + {alt} ); diff --git a/src/ui/components/molecules/testimonial/components/testimonialDescription/testimonialDescription.tsx b/src/ui/components/molecules/testimonial/components/testimonialDescription/testimonialDescription.tsx index a41083ca..49fb438c 100644 --- a/src/ui/components/molecules/testimonial/components/testimonialDescription/testimonialDescription.tsx +++ b/src/ui/components/molecules/testimonial/components/testimonialDescription/testimonialDescription.tsx @@ -5,8 +5,6 @@ export interface TestimonialDescriptionProps { children: ReactNode; } -export const TestimonialDescription = ({ - children, -}: TestimonialDescriptionProps) => ( +export const TestimonialDescription = ({ children }: TestimonialDescriptionProps) => (

      {children}

      ); diff --git a/src/ui/components/molecules/testimonial/components/testimonialImage/testimonialImage.tsx b/src/ui/components/molecules/testimonial/components/testimonialImage/testimonialImage.tsx index cea3de7f..56733476 100644 --- a/src/ui/components/molecules/testimonial/components/testimonialImage/testimonialImage.tsx +++ b/src/ui/components/molecules/testimonial/components/testimonialImage/testimonialImage.tsx @@ -4,11 +4,5 @@ import "./testimonial-image.css"; export type TestimonialImageProps = Pick; export const TestimonialImage = ({ src, alt }: TestimonialImageProps) => ( - {alt} + {alt} ); diff --git a/src/ui/components/molecules/testimonial/components/testimonialQuote/testimonialQuote.tsx b/src/ui/components/molecules/testimonial/components/testimonialQuote/testimonialQuote.tsx index 45338aa0..a62ea94d 100644 --- a/src/ui/components/molecules/testimonial/components/testimonialQuote/testimonialQuote.tsx +++ b/src/ui/components/molecules/testimonial/components/testimonialQuote/testimonialQuote.tsx @@ -8,11 +8,7 @@ export interface TestimonialQuoteProps { export const TestimonialQuote = ({ children }: TestimonialQuoteProps) => (
      - {"Quote"} + {"Quote"}
      {children}
      ); diff --git a/src/ui/components/molecules/testimonial/testimonial.tsx b/src/ui/components/molecules/testimonial/testimonial.tsx index 34723e12..e7355927 100644 --- a/src/ui/components/molecules/testimonial/testimonial.tsx +++ b/src/ui/components/molecules/testimonial/testimonial.tsx @@ -25,24 +25,14 @@ interface TestimonialProps { export const Testimonial = ({ children }: TestimonialProps) => { const { isActive } = useSwiperSlide(); - return ( -
      - {children} -
      - ); + return
      {children}
      ; }; const Image = (props: TestimonialImageProps) => ; -const Quote = ({ children }: TestimonialQuoteProps) => ( - {children} -); +const Quote = ({ children }: TestimonialQuoteProps) => {children}; -const Author = ({ children }: TestimonialAuthorProps) => ( - {children} -); +const Author = ({ children }: TestimonialAuthorProps) => {children}; const Description = ({ children }: TestimonialDescriptionProps) => ( {children} diff --git a/src/ui/components/molecules/testimonialsSlider/TestimonialsSlider.tsx b/src/ui/components/molecules/testimonialsSlider/TestimonialsSlider.tsx index 1912c2b8..478e38c3 100644 --- a/src/ui/components/molecules/testimonialsSlider/TestimonialsSlider.tsx +++ b/src/ui/components/molecules/testimonialsSlider/TestimonialsSlider.tsx @@ -1,12 +1,6 @@ import React from "react"; import { Swiper, SwiperSlide } from "swiper/react"; -import { - A11y, - Keyboard, - Navigation, - Pagination, - Virtual, -} from "swiper/modules"; +import { A11y, Keyboard, Navigation, Pagination, Virtual } from "swiper/modules"; import { Testimonial } from "@components/molecules/testimonial"; import type { SwiperOptions } from "swiper/types"; import { TestimonialsNavigation } from "src/ui/components/molecules/testimonialsSlider/components/testimonialsNavigation"; @@ -46,29 +40,19 @@ export const TestimonialsSlider = () => { Ferran Buireu - Careen red ensign marooned Pirate Round Buccaneer spirits yard - Corsair pink aye. Galleon scuppers gabion lanyard trysail fluke to - go on account Sea Legs Brethren of the Coast keelhaul. Tender - topsail cable cog Yellow Jack fathom broadside snow clipper - quarter. + Careen red ensign marooned Pirate Round Buccaneer spirits yard Corsair pink aye. Galleon scuppers gabion + lanyard trysail fluke to go on account Sea Legs Brethren of the Coast keelhaul. Tender topsail cable cog + Yellow Jack fathom broadside snow clipper quarter. - + role Ferran Buireu - - Bla bla Bla bla Bla bla Bla bla Bla bla Bla bla Bla bla - - + Bla bla Bla bla Bla bla Bla bla Bla bla Bla bla Bla bla + Role @@ -76,16 +60,11 @@ export const TestimonialsSlider = () => { Ferran Buireu - Careen red ensign marooned Pirate Round Buccaneer spirits yard - Corsair pink aye. Galleon scuppers gabion lanyard trysail fluke to - go on account Sea Legs Brethren of the Coast keelhaul. Tender - topsail cable cog Yellow Jack fathom broadside snow clipper - quarter. + Careen red ensign marooned Pirate Round Buccaneer spirits yard Corsair pink aye. Galleon scuppers gabion + lanyard trysail fluke to go on account Sea Legs Brethren of the Coast keelhaul. Tender topsail cable cog + Yellow Jack fathom broadside snow clipper quarter. - + Role @@ -93,16 +72,11 @@ export const TestimonialsSlider = () => { Ferran Buireu - Careen red ensign marooned Pirate Round Buccaneer spirits yard - Corsair pink aye. Galleon scuppers gabion lanyard trysail fluke to - go on account Sea Legs Brethren of the Coast keelhaul. Tender - topsail cable cog Yellow Jack fathom broadside snow clipper - quarter. + Careen red ensign marooned Pirate Round Buccaneer spirits yard Corsair pink aye. Galleon scuppers gabion + lanyard trysail fluke to go on account Sea Legs Brethren of the Coast keelhaul. Tender topsail cable cog + Yellow Jack fathom broadside snow clipper quarter. - + Role @@ -110,16 +84,11 @@ export const TestimonialsSlider = () => { Ferran Buireu - Careen red ensign marooned Pirate Round Buccaneer spirits yard - Corsair pink aye. Galleon scuppers gabion lanyard trysail fluke to - go on account Sea Legs Brethren of the Coast keelhaul. Tender - topsail cable cog Yellow Jack fathom broadside snow clipper - quarter. + Careen red ensign marooned Pirate Round Buccaneer spirits yard Corsair pink aye. Galleon scuppers gabion + lanyard trysail fluke to go on account Sea Legs Brethren of the Coast keelhaul. Tender topsail cable cog + Yellow Jack fathom broadside snow clipper quarter. - + Role @@ -127,16 +96,11 @@ export const TestimonialsSlider = () => { Ferran Buireu - Careen red ensign marooned Pirate Round Buccaneer spirits yard - Corsair pink aye. Galleon scuppers gabion lanyard trysail fluke to - go on account Sea Legs Brethren of the Coast keelhaul. Tender - topsail cable cog Yellow Jack fathom broadside snow clipper - quarter. + Careen red ensign marooned Pirate Round Buccaneer spirits yard Corsair pink aye. Galleon scuppers gabion + lanyard trysail fluke to go on account Sea Legs Brethren of the Coast keelhaul. Tender topsail cable cog + Yellow Jack fathom broadside snow clipper quarter. - + Role diff --git a/src/ui/components/organisms/aboutLatestArticles/AboutLatestArticles.astro b/src/ui/components/organisms/aboutLatestArticles/AboutLatestArticles.astro index c7282c60..a19cc5bf 100644 --- a/src/ui/components/organisms/aboutLatestArticles/AboutLatestArticles.astro +++ b/src/ui/components/organisms/aboutLatestArticles/AboutLatestArticles.astro @@ -4,13 +4,7 @@ import { getCollection } from "astro:content"; import "./about-latest-articles.css"; import { AboutLatestArticlesSlider } from "@components/molecules/aboutLatestArticlesSlider"; const articles = await getCollection("articles"); -articles - .sort( - (a, b) => - new Date(b.data.publishDate).valueOf() - - new Date(a.data.publishDate).valueOf(), - ) - .splice(4); +articles.sort((a, b) => new Date(b.data.publishDate).valueOf() - new Date(a.data.publishDate).valueOf()).splice(4); ---
      diff --git a/src/ui/components/organisms/contactForm/ContactForm.tsx b/src/ui/components/organisms/contactForm/ContactForm.tsx index 07a1c353..dd69d271 100644 --- a/src/ui/components/organisms/contactForm/ContactForm.tsx +++ b/src/ui/components/organisms/contactForm/ContactForm.tsx @@ -62,49 +62,41 @@ export const ContactForm = () => { [executeRecaptcha], ); - const resetForm = useCallback( - () => setFormStatus(FormStatus.INITIAL), - [formStatus], - ); + const resetForm = useCallback(() => setFormStatus(FormStatus.INITIAL), [formStatus]); - const submitForm = useCallback( - async (data: FormData, event: FormEvent) => { - event.preventDefault(); - if (!submitRef.current) return; + const submitForm = useCallback(async (data: FormData, event: FormEvent) => { + event.preventDefault(); + if (!submitRef.current) return; - try { - setFormStatus(FormStatus.LOADING); - const requestParams: RequestInit = { - ...CONTACT_FORM_REQUEST_PARAMETERS, - body: encode({ ...data }), - }; + try { + setFormStatus(FormStatus.LOADING); + const requestParams: RequestInit = { + ...CONTACT_FORM_REQUEST_PARAMETERS, + body: encode({ ...data }), + }; - const response = await fetch(`/api/contact-form`, requestParams); + const response = await fetch(`/api/contact-form`, requestParams); - if (response.ok) { - flyPlane(submitRef.current); - setTimeout(() => { - setFormStatus(FormStatus.SUCCESS); - reset(); - }, 2000); - } else { - throw new Error("Failed to submit form"); - } - } catch (error) { - setFormStatus(FormStatus.ERROR); + if (response.ok) { + flyPlane(submitRef.current); + setTimeout(() => { + setFormStatus(FormStatus.SUCCESS); + reset(); + }, 2000); + } else { + throw new Error("Failed to submit form"); } - }, - [], - ); + } catch (error) { + setFormStatus(FormStatus.ERROR); + } + }, []); return ( <> {formStatus !== FormStatus.SUCCESS ? (
      - handleSubmit((data) => verifyRecaptcha(data, event))(event) - } + onSubmit={(event) => handleSubmit((data) => verifyRecaptcha(data, event))(event)} >

      My name is

      @@ -118,11 +110,7 @@ export const ContactForm = () => { - {errors.name && ( -

      - {errors.name.message} -

      - )} + {errors.name &&

      {errors.name.message}

      }

      and my email is

      @@ -136,15 +124,11 @@ export const ContactForm = () => { - {errors.email && ( -

      - {errors.email.message} -

      - )} + {errors.email &&

      {errors.email.message}

      }

      - I look forward to hearing from you within the next 24 hours to - discuss further.
      I have a message for you, + I look forward to hearing from you within the next 24 hours to discuss further.
      I have a message for + you,