Skip to content

Commit

Permalink
Move some stuff around
Browse files Browse the repository at this point in the history
  • Loading branch information
FadiShawki committed Apr 23, 2024
1 parent 8a8ba56 commit b8fc412
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 219 deletions.
13 changes: 13 additions & 0 deletions orbitmines.com/src/lib/organizations/ORGANIZATIONS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
143 changes: 125 additions & 18 deletions orbitmines.com/src/lib/paper/Paper.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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<PaperProps, 'children'> = {
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 = () => (
<Helmet>
<meta property="og:type" content="profile" />
<meta property="og:title" content={value(title)} />
<meta property="og:url" content={url.base} />
<meta property="og:description" content={description} />

<meta property="og:image" content={profile.picture} />
{/*<meta property="og:image:secure_url" content={profile.picture} />*/}
<meta property="og:image:type" content="image/jpeg" />
{/*<meta property="og:image:width" content="400" />*/}
{/*<meta property="og:image:height" content="300" />*/}
<meta property="og:image:alt" content="Profile picture" />

<meta property="og:profile:first_name" content={profile.first_name} />
<meta property="og:profile:last_name" content={profile.last_name} />
<meta property="og:profile:username" content={profile.profile} />
</Helmet>
)

// https://schema.org/Article
const Schemaorg = () => (
<Helmet>
<script type="application/ld+json">{JSON.stringify([{
"@context": "https://schema.org",
"@type": "Person",
"name": profile.name,
"email": profile.email,
"givenName": profile.first_name,
"familyName": profile.last_name,
"url": `https://orbitmines.com/profiles/${profile.profile}`,
"image": profile.picture,
}, {
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://orbitmines.com",
"logo": "https://www.example.com/images/logo.png"
}, {
// Can have multiple breadcrumbs
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Profiles",
"item": "https://orbitmines.com/profiles"
},{
"@type": "ListItem",
"position": 2,
"name": profile.name
}]

// TODO https://developers.google.com/search/docs/appearance/structured-data/dataset
// TODO https://developers.google.com/search/docs/appearance/structured-data/event
// TODO https://developers.google.com/search/docs/appearance/structured-data/image-license-metadata
// todo https://developers.google.com/search/docs/appearance/structured-data/math-solvers
// todo https://developers.google.com/search/docs/appearance/structured-data/software-app
// todo https://developers.google.com/search/docs/appearance/structured-data/book
// TODO https://developers.google.com/search/docs/appearance/structured-data/faqpage
}])}</script>
</Helmet>
)

const Twitter = () => (<Helmet>
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:creator" content="@_FadiShawki" />
<meta property="twitter:title" content={value(title)} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={profile.picture} />
</Helmet>);

return <div>
<Helmet>
<title lang="en">{value(title)}</title>
<meta name="description" content={description} />
</Helmet>
<OpenGraph/>
<Schemaorg/>
<Twitter/>

<PaperView {...paper}>
{children}
</PaperView>
</div>
}

export const renderPdfRendererElement: DereferencedElementRenderer = (element: Element, parent: Element | undefined, initialProps: any) => {
const isTopLevel = parent === undefined;
const tagName = element.tagName.toLowerCase();
Expand Down Expand Up @@ -1210,16 +1332,7 @@ export const Author = (props: TProfile & { filter?: Predicate<ExternalProfile>})
<Row center="xs" className="child-px-2">
{(external || []).filter(filter ? filter : () => true).map(profile => <Col>
<a href={profile.link} target="_blank">
<Tag
icon={<CustomIcon icon={profile.organization.key} size={20}/>}
minimal
interactive
multiline
>
<Row middle="xs" className="px-2" style={{fontSize: '0.8rem'}}>
{profile.display}
</Row>
</Tag>
<CustomIcon icon={profile.organization.key} size={16}/>
</a>
</Col>)}
</Row>
Expand Down Expand Up @@ -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: {}) => (<></>),
Expand Down
24 changes: 4 additions & 20 deletions orbitmines.com/src/routes/Root.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -62,21 +62,9 @@ const Root = () => {

<Col xs={12}>
<Row center="xs" className="child-px-1">
{(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 => <Col>
{(profile?.external || []).filter(profile => PLATFORMS.includes(profile.organization.key)).map(profile => <Col>
<a href={profile.link} target="_blank">
<CustomIcon icon={profile.organization.key} size={20}/>
<CustomIcon icon={profile.organization.key} size={16}/>
</a>
</Col>)}
</Row>
Expand Down Expand Up @@ -136,11 +124,7 @@ const Root = () => {
/>
</CanvasContainer>

<Author {...PROFILES.fadi_shawki} filter={(profile) => [
ORGANIZATIONS.github.key,
ORGANIZATIONS.twitter.key,
ORGANIZATIONS.discord.key,
].includes(profile.organization.key)}/>
<Author {...PROFILES.fadi_shawki} filter={(profile) => PLATFORMS.includes(profile.organization.key)}/>
</Layer>
</div>
};
Expand Down
10 changes: 2 additions & 8 deletions orbitmines.com/src/routes/archive/2024.02.NGI.GrantProposal.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -300,11 +292,7 @@ const _2024_02_OrbitMines_as_a_Game_Project = () => {
/>
</CanvasContainer>

<Author {...PROFILES.fadi_shawki} filter={(profile) => [
ORGANIZATIONS.github.key,
ORGANIZATIONS.twitter.key,
ORGANIZATIONS.discord.key,
].includes(profile.organization.key)}/>
<Author {...PROFILES.fadi_shawki} filter={(profile) => PLATFORMS.includes(profile.organization.key)}/>
</Arc>
</Paper>
}
Expand Down
9 changes: 2 additions & 7 deletions orbitmines.com/src/routes/papers/2022.OnIntelligibility.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 2 additions & 7 deletions orbitmines.com/src/routes/papers/2023.OnOrbits.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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"
}
Expand Down
Loading

0 comments on commit b8fc412

Please sign in to comment.