;
- projects: Record;
- writings: Record;
+export type Publication = {
+ title: string;
+ date: string;
+ journal: string;
+ authors: string[];
+ href: string;
+ description: string;
+};
+
+export interface Data {
+ experience: Record;
+ projects: Record;
+ writings: Record;
+ publications: Record,
}
diff --git a/src/utils/Tween.js b/src/utils/Tween.js
deleted file mode 100644
index 3fd1f19b..00000000
--- a/src/utils/Tween.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export const onCompleteAll = (tweens) =>
- Promise.all(
- tweens
- .filter((_) => _)
- .map(
- (tween) => new Promise((resolve) => tween.onComplete(resolve).start())
- )
- );
diff --git a/src/utils/Two.js b/src/utils/Two.js
deleted file mode 100644
index 8530d15a..00000000
--- a/src/utils/Two.js
+++ /dev/null
@@ -1,189 +0,0 @@
-import Two from 'two.js';
-
-const PI = Math.PI;
-const HALF_PI = PI / 2;
-
-const createShape = (shape, props) => {
- const {
- fill = 'transparent',
- fillOpacity = 1,
- opacity = 1,
- rotate = 0,
- stroke = 'transparent',
- strokeWidth = 0,
- translate,
- } = props;
-
- const { top, left, width, height } = shape.getBoundingClientRect();
-
- const cx = left + width / 2;
- const cy = top + height / 2;
-
- if (translate) {
- shape.center();
- shape.translation.set(cx, cy);
- }
-
- shape.fill = fill;
- shape.fillOpacity = fillOpacity;
- shape.stroke = stroke;
- shape.linewidth = strokeWidth;
- shape.opacity = opacity;
- shape.rotation = rotate;
-
- return shape;
-};
-
-export const addClassName = (shape, className) => {
- shape.domElement = shape.domElement || document.getElementById(shape.id);
- className.split(' ').forEach((className) => {
- shape.domElement.classList.add(className);
- });
- return shape;
-};
-
-export const setAttribute = (shape, attribute, value) => {
- shape.domElement = shape.domElement || document.getElementById(shape.id);
- shape.domElement.setAttribute(attribute, value);
- return shape;
-};
-
-export const setClassName = (shape, className) =>
- setAttribute(shape, 'class', className);
-
-export const createArc = (props) => {
- return createShape(
- new Two.Path(arcsToAnchors([props]), false, false, true),
- props
- );
-};
-
-export const createCircle = (props) => {
- return createShape(new Two.Circle(props.x, props.y, props.radius), props);
-};
-
-export const createEllipse = (props) => {
- return createShape(
- new Two.Ellipsie(props.x, props.y, props.width, props.height),
- props
- );
-};
-
-export const createGroup = (props = {}) => {
- const group = new Two.Group();
-
- if (props.x !== undefined && props.y !== undefined) {
- group.translation.set(props.x, props.y);
- }
-
- return group;
-};
-
-export const createLine = (props) => {
- return createShape(
- new Two.Path(
- props.vertices.map(([x, y]) => new Two.Vector(x, y)),
- false,
- props.curved
- ),
- props
- );
-};
-
-export const createPolygon = (props) => {
- return createShape(
- new Two.Path(
- props.vertices.map(([x, y]) => new Two.Vector(x, y)),
- true,
- props.curved
- ),
- props
- );
-};
-
-export const createPolygonArc = (props) => {
- return createShape(
- new Two.Path(arcsToAnchors(props.arcs, true), true, false, true),
- props
- );
-};
-
-export const createText = (text, props) => {
- return createShape(new Two.Text(text, props.x, props.y, props), props);
-};
-
-export const createTriangle = (props) => {
- return createShape(
- new Two.Path(
- [
- new Two.Vector(props.x, props.y - props.height / 2),
- new Two.Vector(props.x + props.width / 2, props.y + props.height / 2),
- new Two.Vector(props.x - props.width / 2, props.y + props.height / 2),
- ],
- true
- ),
- props
- );
-};
-
-const arcsToAnchors = (arcs, closed) => {
- const R = Two.Resolution * 3;
- const anchors = Array.from({ length: R * arcs.length }).map(
- () => new Two.Anchor()
- );
-
- for (let i = 0; i < arcs.length; i++) {
- const { a1, a2, cx, cy, radius } = arcs[i];
-
- for (let j = 0; j < R; j++) {
- const anchorIndex = i * R + j;
- const anchor = anchors[anchorIndex];
- const theta = (j / (R - 1)) * (a2 - a1) + a1;
-
- if (i === 0 && j === 0) {
- anchor.command = Two.Commands.move;
- } else {
- anchor.command = Two.Commands.curve;
- }
-
- anchor.x = cx + radius * Math.cos(theta);
- anchor.y = cy + radius * Math.sin(theta);
-
- if (anchor.controls) {
- anchor.controls.left.clear();
- anchor.controls.right.clear();
- }
-
- if (anchor.command === Two.Commands.curve) {
- const amp = (radius * ((a2 - a1) / R)) / PI;
-
- if (j !== 0) {
- anchor.controls.left.x = amp * Math.cos(theta - HALF_PI);
- anchor.controls.left.y = amp * Math.sin(theta - HALF_PI);
- }
-
- if (j !== R - 1) {
- anchor.controls.right.x = amp * Math.cos(theta + HALF_PI);
- anchor.controls.right.y = amp * Math.sin(theta + HALF_PI);
- }
- }
- }
- }
-
- if (closed) {
- anchors[anchors.length - 1].x = anchors[0].x;
- anchors[anchors.length - 1].y = anchors[0].y;
- }
-
- return anchors;
-};
-
-export const onMouseDownGlobal = () => {
- document.body.style.userSelect = 'none';
- document.body.style.webkitUserDrag = 'none';
-};
-
-export const onMouseUpGlobal = () => {
- document.body.style.userSelect = null;
- document.body.style.webkitUserDrag = null;
-};
diff --git a/src/utils/moveEvent.js b/src/utils/moveEvent.js
deleted file mode 100644
index 69c77e1d..00000000
--- a/src/utils/moveEvent.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export default (event) =>
- event.touches
- ? {
- clientX: event.touches[0].clientX,
- clientY: event.touches[0].clientY,
- target: event.target,
- }
- : {
- clientX: event.clientX,
- clientY: event.clientY,
- target: event.target,
- };
diff --git a/src/utils/useEnforcedTheme.ts b/src/utils/useEnforcedTheme.ts
new file mode 100644
index 00000000..e4c3d91c
--- /dev/null
+++ b/src/utils/useEnforcedTheme.ts
@@ -0,0 +1,18 @@
+import { TypeTheme } from "preshape";
+import { useEffect, useRef } from "react";
+import { useLayoutContext } from "../components/Root";
+
+const useEnforcedTheme = (theme: TypeTheme) => {
+ const { onChangeTheme, theme: currentTheme, } = useLayoutContext();
+ const refPreviousTheme = useRef(currentTheme);
+
+ useEffect(() => {
+ onChangeTheme(theme);
+
+ return () => {
+ onChangeTheme(refPreviousTheme.current);
+ };
+ }, []);
+};
+
+export default useEnforcedTheme;
diff --git a/tsconfig.json b/tsconfig.json
index 7837fa50..1acf5943 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
- "baseUrl": "./",
"esModuleInterop": true,
"jsx": "react",
"module": "esnext",
diff --git a/yarn.lock b/yarn.lock
index 33d0345a..1fab461f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1641,6 +1641,11 @@
dependencies:
"@types/node" "*"
+"@types/file-saver@*":
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/@types/file-saver/-/file-saver-2.0.5.tgz#9ee342a5d1314bb0928375424a2f162f97c310c7"
+ integrity sha512-zv9kNf3keYegP5oThGLaPk8E081DFDuwfqjtiTzm6PoxChdJ1raSuADf2YGCVIyrSynLrgc8JWv296s7Q7pQSQ==
+
"@types/fs-extra@^8.0.1":
version "8.1.0"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.0.tgz#1114834b53c3914806cd03b3304b37b3bd221a4d"
@@ -1807,6 +1812,11 @@
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"
integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==
+"@types/uuid@*":
+ version "8.3.4"
+ resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
+ integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==
+
"@typescript-eslint/eslint-plugin@^5.13.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.16.0.tgz#78f246dd8d1b528fc5bfca99a8a64d4023a3d86d"
@@ -5488,6 +5498,11 @@ file-entry-cache@^6.0.1:
dependencies:
flat-cache "^3.0.4"
+file-saver@^2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-2.0.5.tgz#d61cfe2ce059f414d899e9dd6d4107ee25670c38"
+ integrity sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==
+
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
@@ -8352,12 +8367,7 @@ lodash.without@~4.4.0:
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=
-lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0:
- version "4.17.15"
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
- integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
-
-lodash@^4.17.21:
+lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -10963,10 +10973,10 @@ prepend-http@^1.0.1:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
-preshape@^12.0.1:
- version "12.0.1"
- resolved "https://registry.yarnpkg.com/preshape/-/preshape-12.0.1.tgz#3cb5bbf5953b056c19867fefc54e869ee729593f"
- integrity sha512-QWO4/AJhOBaA9ePFCh6T6lwGf9mggH+hfldU1yKBPazxJRLtpPVUikDH4CLKVsEMA6wGpQkaSU/TZCl1Df2y5A==
+preshape@^13.0.0:
+ version "13.0.0"
+ resolved "https://registry.yarnpkg.com/preshape/-/preshape-13.0.0.tgz#20f14478330f39efeccaa9eb3ace9a39261994cf"
+ integrity sha512-lW4dgXioRtlGDpsYD0bJNEI5z2GRZ0knI0Z4DJ4hcLXtKXNJeoXOIx5melacGovJ9lbCAw1g6OJjWGO/01Kb6w==
dependencies:
brace "^0.11.1"
classnames "^2.2.5"