From 2486ab19c31a283b98c94f5c4cf4f2ffb6280446 Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Fri, 25 Oct 2024 13:05:50 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20Update=20social=20media=20links?= =?UTF-8?q?,=20refactor=20to=20use=20constants=20through=20site=20codebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminSiteServer/mockSiteRouter.tsx | 6 +- baker/SiteBaker.tsx | 2 +- site/DataInsightsIndexPage.tsx | 2 +- site/SiteConstants.ts | 63 +++++++++++++++ site/SiteFooter.tsx | 71 +++++------------ site/gdocs/OwidGdocPage.tsx | 2 +- site/gdocs/pages/Homepage.tsx | 120 +++++------------------------ site/gdocs/utils.tsx | 7 -- 8 files changed, 110 insertions(+), 163 deletions(-) diff --git a/adminSiteServer/mockSiteRouter.tsx b/adminSiteServer/mockSiteRouter.tsx index 647c97a3d8a..6cf086bf5ce 100644 --- a/adminSiteServer/mockSiteRouter.tsx +++ b/adminSiteServer/mockSiteRouter.tsx @@ -70,8 +70,10 @@ import { getPlainRouteNonIdempotentWithRWTransaction, getPlainRouteWithROTransaction, } from "./plainRouterHelpers.js" -import { DEFAULT_LOCAL_BAKE_DIR } from "../site/SiteConstants.js" -import { DATA_INSIGHTS_ATOM_FEED_NAME } from "../site/gdocs/utils.js" +import { + DEFAULT_LOCAL_BAKE_DIR, + DATA_INSIGHTS_ATOM_FEED_NAME, +} from "../site/SiteConstants.js" import { renderMultiDimDataPageBySlug } from "../baker/MultiDimBaker.js" import { KnexReadonlyTransaction, diff --git a/baker/SiteBaker.tsx b/baker/SiteBaker.tsx index e9641a3cfa1..6612688eadc 100644 --- a/baker/SiteBaker.tsx +++ b/baker/SiteBaker.tsx @@ -109,7 +109,7 @@ import { } from "../db/model/Gdoc/GdocFactory.js" import { getBakePath } from "@ourworldindata/components" import { GdocAuthor, getMinimalAuthors } from "../db/model/Gdoc/GdocAuthor.js" -import { DATA_INSIGHTS_ATOM_FEED_NAME } from "../site/gdocs/utils.js" +import { DATA_INSIGHTS_ATOM_FEED_NAME } from "../site/SiteConstants.js" import { getRedirectsFromDb } from "../db/model/Redirect.js" import { getTombstones } from "../db/model/GdocTombstone.js" import { bakeAllMultiDimDataPages } from "./MultiDimBaker.js" diff --git a/site/DataInsightsIndexPage.tsx b/site/DataInsightsIndexPage.tsx index bc5e3c10ad9..1c77a98247f 100644 --- a/site/DataInsightsIndexPage.tsx +++ b/site/DataInsightsIndexPage.tsx @@ -11,7 +11,7 @@ import { DataInsightsIndexPageContent, _OWID_DATA_INSIGHTS_INDEX_PAGE_DATA, } from "./DataInsightsIndexPageContent.js" -import { DATA_INSIGHT_ATOM_FEED_PROPS } from "./gdocs/utils.js" +import { DATA_INSIGHT_ATOM_FEED_PROPS } from "./SiteConstants.js" import { DebugProvider } from "./gdocs/DebugContext.js" import { Html } from "./Html.js" diff --git a/site/SiteConstants.ts b/site/SiteConstants.ts index 47dbc3d8515..89713063a74 100644 --- a/site/SiteConstants.ts +++ b/site/SiteConstants.ts @@ -1,3 +1,13 @@ +import { faRss } from "@fortawesome/free-solid-svg-icons" +import { + faXTwitter, + faFacebookSquare, + faInstagram, + faThreads, + faLinkedin, + faBluesky, +} from "@fortawesome/free-brands-svg-icons" + // See https://cdnjs.cloudflare.com/polyfill/ for a list of all supported features const polyfillFeatures = [ "es2019", // Array.flat, Array.flatMap, Object.fromEntries, ... @@ -24,8 +34,61 @@ export const SMALL_BREAKPOINT_MEDIA_QUERY = "(max-width: 768px)" export const TOUCH_DEVICE_MEDIA_QUERY = "(hover: none), (pointer: coarse), (pointer: none)" +export const DATA_INSIGHTS_ATOM_FEED_NAME = "atom-data-insights.xml" + +export const DATA_INSIGHT_ATOM_FEED_PROPS = { + title: "Atom feed for Daily Data Insights", + href: `https://ourworldindata.org/${DATA_INSIGHTS_ATOM_FEED_NAME}`, +} + export const DEFAULT_TOMBSTONE_REASON = "Our World in Data is designed to be an evergreen publication. This " + "means that when a page cannot be updated due to outdated data or " + "missing information, we prefer to remove it rather than present " + "incomplete or inaccurate research and data to our readers." + +export const SOCIALS = [ + { + title: "X", + url: "https://x.com/ourworldindata", + icon: faXTwitter, + }, + { + title: "Instagram", + url: "https://www.instagram.com/ourworldindata/", + icon: faInstagram, + }, + { + title: "Threads", + url: "https://www.threads.net/@ourworldindata", + icon: faThreads, + }, + { + title: "Facebook", + url: "https://facebook.com/ourworldindata", + icon: faFacebookSquare, + }, + { + title: "LinkedIn", + url: "https://www.linkedin.com/company/ourworldindata", + icon: faLinkedin, + }, + { + title: "Bluesky", + url: "https://bsky.app/profile/ourworldindata.bsky.social", + icon: faBluesky, + }, +] + +export const RSS_FEEDS = [ + { + title: "Research & Writing RSS Feed", + url: "/atom.xml", + icon: faRss, + }, + { + title: "Daily Data Insights RSS Feed", + url: `/${DATA_INSIGHTS_ATOM_FEED_NAME}`, + icon: faRss, + }, +] diff --git a/site/SiteFooter.tsx b/site/SiteFooter.tsx index 27fd4893580..e17488b26aa 100644 --- a/site/SiteFooter.tsx +++ b/site/SiteFooter.tsx @@ -4,6 +4,7 @@ import { faAngleRight } from "@fortawesome/free-solid-svg-icons" import { SiteFooterContext } from "@ourworldindata/utils" import { viteAssetsForSite } from "./viteUtils.js" import { ScriptLoadErrorDetector } from "./NoJSDetector.js" +import { RSS_FEEDS, SOCIALS } from "./SiteConstants.js" interface SiteFooterProps { hideDonate?: boolean @@ -132,40 +133,16 @@ export const SiteFooter = (props: SiteFooterProps) => ( Data Catalog - -
diff --git a/site/gdocs/OwidGdocPage.tsx b/site/gdocs/OwidGdocPage.tsx index de9bb2d7ad3..8cb03506ba0 100644 --- a/site/gdocs/OwidGdocPage.tsx +++ b/site/gdocs/OwidGdocPage.tsx @@ -19,7 +19,7 @@ import { EnrichedBlockText, IMAGES_DIRECTORY, } from "@ourworldindata/types" -import { DATA_INSIGHT_ATOM_FEED_PROPS } from "./utils.js" +import { DATA_INSIGHT_ATOM_FEED_PROPS } from "../SiteConstants.js" import { Html } from "../Html.js" declare global { diff --git a/site/gdocs/pages/Homepage.tsx b/site/gdocs/pages/Homepage.tsx index 23747479fd8..3d0a539099c 100644 --- a/site/gdocs/pages/Homepage.tsx +++ b/site/gdocs/pages/Homepage.tsx @@ -1,11 +1,5 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js" -import { faRss } from "@fortawesome/free-solid-svg-icons" -import { - faXTwitter, - faFacebookSquare, - faInstagram, - faThreads, -} from "@fortawesome/free-brands-svg-icons" + import React from "react" import { NewsletterSubscriptionContext } from "../../newsletter.js" import { NewsletterSubscriptionForm } from "../../NewsletterSubscription.js" @@ -16,7 +10,7 @@ import { OwidGdocHomepageContent, } from "@ourworldindata/types" import { SiteNavigationStatic } from "../../SiteNavigation.js" -import { DATA_INSIGHTS_ATOM_FEED_NAME } from "../utils.js" +import { RSS_FEEDS, SOCIALS } from "../../SiteConstants.js" export interface HomepageProps { content: OwidGdocHomepageContent @@ -40,99 +34,23 @@ const SocialSection = () => {

Follow us

diff --git a/site/gdocs/utils.tsx b/site/gdocs/utils.tsx index 6df8c15d190..b4ea2343544 100644 --- a/site/gdocs/utils.tsx +++ b/site/gdocs/utils.tsx @@ -255,10 +255,3 @@ export function getShortPageCitation( authors: authors, })} (${publishedAt?.getFullYear()}) - “${title}”` } - -export const DATA_INSIGHTS_ATOM_FEED_NAME = "atom-data-insights.xml" - -export const DATA_INSIGHT_ATOM_FEED_PROPS = { - title: "Atom feed for Daily Data Insights", - href: `https://ourworldindata.org/${DATA_INSIGHTS_ATOM_FEED_NAME}`, -} From d4e2a26d392ed5cbc16da221df6e63c5eee87363 Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Mon, 28 Oct 2024 11:58:17 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20add=20columns=20to=20social=20m?= =?UTF-8?q?edia=20box=20on=20homepage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/gdocs/pages/Homepage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/gdocs/pages/Homepage.tsx b/site/gdocs/pages/Homepage.tsx index 3d0a539099c..4621177ee50 100644 --- a/site/gdocs/pages/Homepage.tsx +++ b/site/gdocs/pages/Homepage.tsx @@ -33,7 +33,7 @@ const SocialSection = () => {

Follow us

-
    +
      {[...SOCIALS, ...RSS_FEEDS].map(({ title, url, icon }) => (