Skip to content

Commit

Permalink
Merge branch 'main' into feat/compute-superminority
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinred committed Sep 9, 2024
2 parents c7e182b + d6c7d0f commit 088ac22
Show file tree
Hide file tree
Showing 35 changed files with 458 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# YouTube keys for getting videos & info from channel
# YouTube
YOUTUBE_CHANNEL_ID=
YOUTUBE_API_KEY=
# Simplecast
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: installing_yarn
run: yarn install
- name: formatting
run: yarn format
run: yarn format:check
stage:
name: Test linting...
needs: Format
Expand All @@ -37,4 +37,4 @@ jobs:
- name: installing_yarn & lint
run: |
yarn install
yarn run lint
yarn lint
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
yarn format
yarn format:check
yarn lint
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const moduleExports = () => {
.getAll("url-redirects", {
apiKey:
process.env.NEXT_PUBLIC_BUILDER_API_KEY ||
"983ae1dad0ba4ca4ac6dd4ac310edee1",
"ce0c7323a97a4d91bd0baa7490ec9139",
options: { noTargeting: true },
cachebust: true,
})
Expand Down
15 changes: 4 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "solana-com",
"private": true,
"description": "The solana.com website",
"version": "3.0.0",
"author": "Solana Maintainers",
Expand Down Expand Up @@ -70,27 +69,21 @@
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^9.0.11",
"next-sitemap": "^4.2.3",
"next-transpile-modules": "^10.0.1",
"postcss": "^8.4.38",
"postcss-preset-env": "^9.5.14",
"prettier": "^3.2.5",
"svg-react-loader": "^0.4.6",
"typescript": "^5.4.5"
},
"scripts": {
"build": "echo 'Building solana-com...' && next build",
"build": "next build",
"dev": "next",
"develop": "yarn dev",
"start": "next start",
"format": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md,scss}\"",
"format:fix": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,scss}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md,scss}\"",
"format:all": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,scss}\"",
"lint": "next lint",
"lint:fix": "yarn lint --fix",
"vdev": "vercel dev --debug",
"lint:fix": "next lint --fix",
"postbuild": "next-sitemap",
"prepare": "husky"
},
"msw": {
"workerDirectory": "public"
}
}
3 changes: 2 additions & 1 deletion public/locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "الأسئلة المتكررة",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/el/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "Συχνές Ερωτήσεις",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/id/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/it/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/ja/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/ko/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/nl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/pl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "Często zadawane pytania",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/pt/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "Perguntas Frequentes",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/ru/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/tr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/uk/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "FAQ",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/vi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "Câu hỏi thường gặp",
"tickets": "Tickets",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@
"faq": "常见问题",
"tickets": "门票",
"sponsors": "Sponsors",
"speakers": "Speakers"
"speakers": "Speakers",
"schedule": "Schedule"
},
"page": {
"side-events": {
Expand Down
24 changes: 17 additions & 7 deletions src/components/ModalLauncher/ModalLauncher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { useEffect, useState, useRef, createElement } from "react";
import {
useEffect,
useState,
useRef,
createElement,
useCallback,
useMemo,
} from "react";
import { useRouter } from "next/router";
import { Modal, CloseButton } from "react-bootstrap";
import ArtistsAndCreatorsNewsletter from "../newsletter/artistsAndCreators";
Expand All @@ -10,11 +17,14 @@ const ModalLauncher = () => {
const [modalLaunchId, setModalLaunchId] = useState("default");
const modalActionCompleted = useRef(false);

const modalMapping = {
artistAndCreatorsNewsletter: ArtistsAndCreatorsNewsletter,
};
const modalMapping = useMemo(
() => ({
artistAndCreatorsNewsletter: ArtistsAndCreatorsNewsletter,
}),
[],
);

const modalCloseHandler = () => {
const modalCloseHandler = useCallback(() => {
// if the modal action is not complete, track bounce
if (!modalActionCompleted.current && typeof window.gtag !== "undefined") {
window.gtag("event", "modal_bounce", {
Expand All @@ -37,7 +47,7 @@ const ModalLauncher = () => {
undefined,
{ shallow: true },
);
};
}, [modalLaunchId, router]);

useEffect(() => {
const { modalLaunch, modalLaunchId } = router.query;
Expand Down Expand Up @@ -68,7 +78,7 @@ const ModalLauncher = () => {
setShowModal(false);
setModalComponent(null);
}
}, [router.query]);
}, [router.query, modalCloseHandler, modalMapping]);

return (
<Modal
Expand Down
18 changes: 15 additions & 3 deletions src/components/blog/PostCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ const PostCard = ({ post, index, isFirstPage, variant = "primary" }) => {
height={1073}
/>
</Link>
<h2 className="post-card-title secondary">{post?.data?.title}</h2>
<h2 className="post-card-title secondary">
{typeof post?.data?.title === "string"
? post.data.title
: post?.data?.title?.Default}
</h2>
</div>
<Link to={url} className="post-card-button">
{t("blog.read-article")}
Expand Down Expand Up @@ -198,7 +202,11 @@ const PostCard = ({ post, index, isFirstPage, variant = "primary" }) => {
<small className="d-block post-card-date">
<PublishedAt publishedDateString={publishedDate} />
</small>
<h2 className="post-card-title">{post?.data?.title}</h2>
<h2 className="post-card-title">
{typeof post?.data?.title === "string"
? post.data.title
: post?.data?.title?.Default}
</h2>
<p className="post-card-excerpt">{excerpt}</p>
</div>
</div>
Expand Down Expand Up @@ -232,7 +240,11 @@ const PostCard = ({ post, index, isFirstPage, variant = "primary" }) => {
<span className="d-block post-card-date">
<PublishedAt publishedDateString={publishedDate} />
</span>
<h2 className="post-card-title">{post?.data?.title}</h2>
<h2 className="post-card-title">
{typeof post?.data?.title === "string"
? post.data.title
: post?.data?.title?.Default}
</h2>
<p className="post-card-excerpt">{excerpt}</p>
</div>
) : (
Expand Down
8 changes: 4 additions & 4 deletions src/components/news/CategorySelection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState, useEffect } from "react";
import { useRef, useState, useEffect, useCallback } from "react";
import styles from "./CategorySelection.module.scss";
import classNames from "classnames";
import { SwitcherButtons } from "@solana-foundation/solana-lib";
Expand Down Expand Up @@ -29,7 +29,7 @@ const CategorySelection = ({
return arr.length; // Return -1 if the sum never exceeds maxNumber
};

const updateDisplayedItems = () => {
const updateDisplayedItems = useCallback(() => {
const containerWidth = categoryContainer.current.offsetWidth;
const dropdownWidth = moreCategoriesLabel?.length * 10 + 70; // 70 = padding + ~margin
maxDisplayItems.current = findExceedingIndex(
Expand All @@ -45,7 +45,7 @@ const CategorySelection = ({
setDisplayCategories(categories);
setMoreCategories([]);
}
};
}, [buttonWidths, moreCategoriesLabel, categories]); // Added 'categories' to dependencies

// estimate the widths of the category buttons on initial render
// note: can't rely on actual widths because some buttons are stored in the dropdown and are not accessible
Expand All @@ -66,7 +66,7 @@ const CategorySelection = ({
return () => {
window.removeEventListener("resize", updateDisplayedItems);
};
}, [buttonWidths]);
}, [buttonWidths, updateDisplayedItems]);

return (
<>
Expand Down
Loading

0 comments on commit 088ac22

Please sign in to comment.