From b8fc41280f6c386776c817092945b7f0a636453f Mon Sep 17 00:00:00 2001 From: Fadi Shawki Date: Tue, 23 Apr 2024 21:37:45 +0200 Subject: [PATCH] Move some stuff around --- .../src/lib/organizations/ORGANIZATIONS.ts | 13 ++ orbitmines.com/src/lib/paper/Paper.tsx | 143 +++++++++++++++--- orbitmines.com/src/routes/Root.tsx | 24 +-- .../archive/2024.02.NGI.GrantProposal.tsx | 10 +- .../2024.02.OrbitMines_as_a_Game_Project.tsx | 18 +-- .../routes/papers/2022.OnIntelligibility.tsx | 9 +- .../src/routes/papers/2023.OnOrbits.tsx | 9 +- .../src/routes/profiles/Profile.tsx | 142 ----------------- .../profiles/fadi-shawki/FadiShawki.tsx | 3 +- 9 files changed, 152 insertions(+), 219 deletions(-) delete mode 100644 orbitmines.com/src/routes/profiles/Profile.tsx diff --git a/orbitmines.com/src/lib/organizations/ORGANIZATIONS.ts b/orbitmines.com/src/lib/organizations/ORGANIZATIONS.ts index 12e10fd..604e36b 100755 --- a/orbitmines.com/src/lib/organizations/ORGANIZATIONS.ts +++ b/orbitmines.com/src/lib/organizations/ORGANIZATIONS.ts @@ -482,4 +482,17 @@ ORGANIZATIONS.orbitmines_research.profile = { ] } +export const PLATFORMS = [ + ORGANIZATIONS.github.key, + ORGANIZATIONS.twitter.key, + ORGANIZATIONS.discord.key, + ORGANIZATIONS.linkedin.key, + ORGANIZATIONS.orcid.key, + ORGANIZATIONS.instagram.key, + ORGANIZATIONS.youtube.key, + ORGANIZATIONS.twitch.key, + ORGANIZATIONS.mastodon.key, + ORGANIZATIONS.facebook.key, +] + export default ORGANIZATIONS; \ No newline at end of file diff --git a/orbitmines.com/src/lib/paper/Paper.tsx b/orbitmines.com/src/lib/paper/Paper.tsx index 63db732..7e32508 100644 --- a/orbitmines.com/src/lib/paper/Paper.tsx +++ b/orbitmines.com/src/lib/paper/Paper.tsx @@ -1,7 +1,14 @@ import React, {Fragment, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {Helmet} from "react-helmet"; import {useLocation, useNavigate, useSearchParams} from "react-router-dom"; -import ORGANIZATIONS, {Content, ExternalProfile, SVG, TOrganization, TProfile} from "../organizations/ORGANIZATIONS"; +import ORGANIZATIONS, { + Content, + ExternalProfile, + PLATFORMS, + SVG, + TOrganization, + TProfile +} from "../organizations/ORGANIZATIONS"; import _, {uniqueId} from "lodash"; import {Button, Classes, Divider, H1, H3, H4, H6, Icon, IconSize, Intent, Popover, Tag} from "@blueprintjs/core"; import {toJpeg} from "html-to-image"; @@ -20,6 +27,121 @@ import JetBrainsMonoBold from "../fonts/JetBrainsMono/ttf/JetBrainsMono-Bold.ttf import {renderToStaticMarkup} from "react-dom/server"; import {Document, Font, Image, Page, Path, PDFViewer, Svg, Text, View} from "@react-pdf/renderer"; +export const Profile = ({profile, children}: {profile: TProfile} & Children) => { + const location = useLocation(); + + const paper: Omit = { + title: profile.title ?? profile.name, + subtitle: profile.subtitle, + date: profile.date, + pdf: { + fonts: [JetBrainsMono, BlueprintIcons20, BlueprintIcons16], + }, + authors: [{ + ...profile, + external: profile.external?.filter((profile) => PLATFORMS.includes(profile.organization.key)) + }], + Reference: (props: {}) => (<>), + exclude_footnotes: true + } + + const {title, subtitle, authors} = paper; + + const url = { + base: `https://orbitmines.com${location.pathname.replace(/\/$/, "")}`, + pdf: `https://orbitmines.com${location.pathname.replace(/\/$/, "")}.pdf`, + }; + const description = value(subtitle); + + // Google Scholar: https://scholar.google.com.au/intl/en/scholar/inclusion.html#indexing + + // The Open Graph Protocol // https://ogp.me/ + const OpenGraph = () => ( + + + + + + + + {/**/} + + {/**/} + {/**/} + + + + + + + ) + + // https://schema.org/Article + const Schemaorg = () => ( + + + + ) + + const Twitter = () => ( + + + + + + ); + + return
+ + {value(title)} + + + + + + + + {children} + +
+} + export const renderPdfRendererElement: DereferencedElementRenderer = (element: Element, parent: Element | undefined, initialProps: any) => { const isTopLevel = parent === undefined; const tagName = element.tagName.toLowerCase(); @@ -1210,16 +1332,7 @@ export const Author = (props: TProfile & { filter?: Predicate}) {(external || []).filter(filter ? filter : () => true).map(profile => - } - minimal - interactive - multiline - > - - {profile.display} - - + )} @@ -1271,13 +1384,7 @@ export const ThumbnailPage = () => { organizations: [ORGANIZATIONS.orbitmines_research], authors: [{ ...PROFILES.fadi_shawki, - external: PROFILES.fadi_shawki.external?.filter((profile) => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.youtube.key, - ORGANIZATIONS.twitch.key, - ].includes(profile.organization.key)) + external: PROFILES.fadi_shawki.external?.filter((profile) => PLATFORMS.includes(profile.organization.key)) }], draft: false, Reference: (props: {}) => (<>), diff --git a/orbitmines.com/src/routes/Root.tsx b/orbitmines.com/src/routes/Root.tsx index 18080d7..af0d18b 100644 --- a/orbitmines.com/src/routes/Root.tsx +++ b/orbitmines.com/src/routes/Root.tsx @@ -1,7 +1,7 @@ import React from 'react'; import logo from "../lib/organizations/orbitmines/logo/orbitmines.logo.3000x1000.png"; import {H3, Tag} from "@blueprintjs/core"; -import ORGANIZATIONS from "../lib/organizations/ORGANIZATIONS"; +import ORGANIZATIONS, {PLATFORMS} from "../lib/organizations/ORGANIZATIONS"; import {PROFILES} from "./profiles/profiles"; import {Helmet} from "react-helmet"; import {ON_INTELLIGIBILITY} from "./papers/2022.OnIntelligibility"; @@ -62,21 +62,9 @@ const Root = () => { - {(profile?.external || []).filter(profile => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.linkedin.key, - ORGANIZATIONS.gitlab.key, - ORGANIZATIONS.instagram.key, - ORGANIZATIONS.instagram.key, - ORGANIZATIONS.youtube.key, - ORGANIZATIONS.twitch.key, - ORGANIZATIONS.mastodon.key, - ORGANIZATIONS.facebook.key, - ].includes(profile.organization.key)).map(profile => + {(profile?.external || []).filter(profile => PLATFORMS.includes(profile.organization.key)).map(profile => - + )} @@ -136,11 +124,7 @@ const Root = () => { /> - [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ].includes(profile.organization.key)}/> + PLATFORMS.includes(profile.organization.key)}/> }; diff --git a/orbitmines.com/src/routes/archive/2024.02.NGI.GrantProposal.tsx b/orbitmines.com/src/routes/archive/2024.02.NGI.GrantProposal.tsx index 80d9b6c..0ef115e 100644 --- a/orbitmines.com/src/routes/archive/2024.02.NGI.GrantProposal.tsx +++ b/orbitmines.com/src/routes/archive/2024.02.NGI.GrantProposal.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import ORGANIZATIONS, {Content, Viewed} from "../../lib/organizations/ORGANIZATIONS"; +import ORGANIZATIONS, {Content, PLATFORMS, Viewed} from "../../lib/organizations/ORGANIZATIONS"; import Paper, { Arc, BR, @@ -27,13 +27,7 @@ export const _2024_02_NGI_GRANT_PROPOSAL: Content = { organizations: [ORGANIZATIONS.orbitmines_research], authors: [{ ...PROFILES.fadi_shawki, - external: PROFILES.fadi_shawki.external?.filter((profile) => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.mastodon.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.orcid.key, - ].includes(profile.organization.key)) + external: PROFILES.fadi_shawki.external?.filter((profile) => PLATFORMS.includes(profile.organization.key)) }], }, status: Viewed.VIEWED, found_at: "2024", viewed_at: "January, 2024" } diff --git a/orbitmines.com/src/routes/archive/2024.02.OrbitMines_as_a_Game_Project.tsx b/orbitmines.com/src/routes/archive/2024.02.OrbitMines_as_a_Game_Project.tsx index 02f5e4f..dca6a13 100644 --- a/orbitmines.com/src/routes/archive/2024.02.OrbitMines_as_a_Game_Project.tsx +++ b/orbitmines.com/src/routes/archive/2024.02.OrbitMines_as_a_Game_Project.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import ORGANIZATIONS, {Content, Viewed} from "../../lib/organizations/ORGANIZATIONS"; +import ORGANIZATIONS, {Content, PLATFORMS, Viewed} from "../../lib/organizations/ORGANIZATIONS"; import {useNavigate} from "react-router-dom"; import Paper, { Arc, @@ -31,15 +31,7 @@ export const _2024_02_ORBITMINES_AS_A_GAME_PROJECT: Content = { organizations: [ORGANIZATIONS.orbitmines_research], authors: [{ ...PROFILES.fadi_shawki, - external: PROFILES.fadi_shawki.external?.filter((profile) => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.instagram.key, - ORGANIZATIONS.linkedin.key, - ORGANIZATIONS.mastodon.key, - ORGANIZATIONS.orcid.key, - ].includes(profile.organization.key)) + external: PROFILES.fadi_shawki.external?.filter((profile) => PLATFORMS.includes(profile.organization.key)) }], }, status: Viewed.VIEWED, found_at: "2024", viewed_at: "February, 2024" } @@ -300,11 +292,7 @@ const _2024_02_OrbitMines_as_a_Game_Project = () => { /> - [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ].includes(profile.organization.key)}/> + PLATFORMS.includes(profile.organization.key)}/> } diff --git a/orbitmines.com/src/routes/papers/2022.OnIntelligibility.tsx b/orbitmines.com/src/routes/papers/2022.OnIntelligibility.tsx index cf264d8..593e8ec 100755 --- a/orbitmines.com/src/routes/papers/2022.OnIntelligibility.tsx +++ b/orbitmines.com/src/routes/papers/2022.OnIntelligibility.tsx @@ -1,7 +1,7 @@ import React from 'react'; import REFERENCES from "../profiles/fadi-shawki/fadi_shawki"; -import ORGANIZATIONS, {Content, Viewed} from "../../lib/organizations/ORGANIZATIONS"; +import ORGANIZATIONS, {Content, PLATFORMS, Viewed} from "../../lib/organizations/ORGANIZATIONS"; import {useNavigate} from "react-router-dom"; import Paper, { BR, @@ -33,12 +33,7 @@ export const ON_INTELLIGIBILITY: Content = { reference: { organizations: [ORGANIZATIONS.orbitmines_research], authors: [{ ...PROFILES.fadi_shawki, - external: PROFILES.fadi_shawki.external?.filter((profile) => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.orcid.key, - ].includes(profile.organization.key)) + external: PROFILES.fadi_shawki.external?.filter((profile) => PLATFORMS.includes(profile.organization.key)) }], published: [ORGANIZATIONS.orbitmines_research], link: "https://orbitmines.com/papers/on-intelligibility", diff --git a/orbitmines.com/src/routes/papers/2023.OnOrbits.tsx b/orbitmines.com/src/routes/papers/2023.OnOrbits.tsx index 21fe3a5..6ce5c4d 100644 --- a/orbitmines.com/src/routes/papers/2023.OnOrbits.tsx +++ b/orbitmines.com/src/routes/papers/2023.OnOrbits.tsx @@ -1,5 +1,5 @@ import React, {useCallback, useEffect, useRef, useState} from 'react'; -import ORGANIZATIONS, {Content, Viewed} from "../../lib/organizations/ORGANIZATIONS"; +import ORGANIZATIONS, {Content, PLATFORMS, Viewed} from "../../lib/organizations/ORGANIZATIONS"; import {useNavigate, useSearchParams} from "react-router-dom"; import Paper, { BR, @@ -59,12 +59,7 @@ export const ON_ORBITS: Content = { organizations: [ORGANIZATIONS.orbitmines_research], authors: [{ ...PROFILES.fadi_shawki, - external: PROFILES.fadi_shawki.external?.filter((profile) => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.orcid.key, - ].includes(profile.organization.key)) + external: PROFILES.fadi_shawki.external?.filter((profile) => PLATFORMS.includes(profile.organization.key)) }], }, status: Viewed.VIEWED, found_at: "2023", viewed_at: "December, 2023" } diff --git a/orbitmines.com/src/routes/profiles/Profile.tsx b/orbitmines.com/src/routes/profiles/Profile.tsx deleted file mode 100644 index f677617..0000000 --- a/orbitmines.com/src/routes/profiles/Profile.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import React from 'react'; -import {Helmet} from "react-helmet"; -import {useLocation} from "react-router-dom"; -import { - PaperProps, - PaperView, - Children, - value, - JetBrainsMono, - BlueprintIcons20, - BlueprintIcons16 -} from "../../lib/paper/Paper"; -import ORGANIZATIONS, {TProfile} from "../../lib/organizations/ORGANIZATIONS"; - -const Profile = ({profile, children}: {profile: TProfile} & Children) => { - const location = useLocation(); - - const paper: Omit = { - title: profile.title ?? profile.name, - subtitle: profile.subtitle, - date: profile.date, - pdf: { - fonts: [JetBrainsMono, BlueprintIcons20, BlueprintIcons16], - }, - authors: [{ - ...profile, - external: profile.external?.filter((profile) => [ - ORGANIZATIONS.github.key, - ORGANIZATIONS.twitter.key, - ORGANIZATIONS.discord.key, - ORGANIZATIONS.linkedin.key, - ORGANIZATIONS.orcid.key, - ORGANIZATIONS.gitlab.key, - ORGANIZATIONS.instagram.key, - ORGANIZATIONS.youtube.key, - ORGANIZATIONS.twitch.key, - ORGANIZATIONS.mastodon.key, - ORGANIZATIONS.facebook.key, - ].includes(profile.organization.key)) - }], - Reference: (props: {}) => (<>), - exclude_footnotes: true - } - - const {title, subtitle, authors} = paper; - - const url = { - base: `https://orbitmines.com${location.pathname.replace(/\/$/, "")}`, - pdf: `https://orbitmines.com${location.pathname.replace(/\/$/, "")}.pdf`, - }; - const description = value(subtitle); - - // Google Scholar: https://scholar.google.com.au/intl/en/scholar/inclusion.html#indexing - - // The Open Graph Protocol // https://ogp.me/ - const OpenGraph = () => ( - - - - - - - - {/**/} - - {/**/} - {/**/} - - - - - - - ) - - // https://schema.org/Article - const Schemaorg = () => ( - - - - ) - - const Twitter = () => ( - - - - - - ); - - return
- - {value(title)} - - - - - - - - {children} - -
-} - -export default Profile; \ No newline at end of file diff --git a/orbitmines.com/src/routes/profiles/fadi-shawki/FadiShawki.tsx b/orbitmines.com/src/routes/profiles/fadi-shawki/FadiShawki.tsx index 865f292..50bb4ab 100755 --- a/orbitmines.com/src/routes/profiles/fadi-shawki/FadiShawki.tsx +++ b/orbitmines.com/src/routes/profiles/fadi-shawki/FadiShawki.tsx @@ -2,11 +2,10 @@ import React from 'react'; import {ARTICLES_2021, ARTICLES_2022, ARTICLES_2023, ARTICLES_2024} from "./fadi_shawki"; import ORGANIZATIONS, {Viewed} from "../../../lib/organizations/ORGANIZATIONS"; import {PROFILES} from "../profiles"; -import Profile from "../Profile"; import {ON_INTELLIGIBILITY} from "../../papers/2022.OnIntelligibility"; import {CanvasContainer, ON_ORBITS} from "../../papers/2023.OnOrbits"; import {_2024_02_ORBITMINES_AS_A_GAME_PROJECT} from "../../archive/2024.02.OrbitMines_as_a_Game_Project"; -import {Arc, Section, Reference, Category} from "../../../lib/paper/Paper"; +import {Arc, Section, Reference, Category, Profile} from "../../../lib/paper/Paper"; const FadiShawki = () => { const profile = PROFILES.fadi_shawki;