Skip to content

Commit

Permalink
Upgrade packages and made compatibility to support React v18
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Apr 18, 2022
1 parent 3b00402 commit ea619c8
Show file tree
Hide file tree
Showing 10 changed files with 572 additions and 400 deletions.
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tasks:
- init: yarn
command: yarn dev
command: yarn dev --host
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@
},
"dependencies": {
"@fontsource/poppins": "^4.5.0",
"@headlessui/react": "^1.4.3",
"@headlessui/react": "^0.0.0-insiders.b4a4e0b",
"@tonejs/midi": "^2.0.28",
"jszip": "^3.7.1",
"localforage": "^1.10.0",
"pako": "^2.0.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.0.0-rc.3",
"react-dom": "^18.0.0-rc.3",
"react-icons": "^4.3.1",
"react-router-dom": "^6.0.2",
"webmidi": "^3.0.16",
"zustand": "^3.7.0"
"react-router-dom": "^6.3.0",
"webmidi": "^3.0.19",
"zustand": "^4.0.0-rc.0"
},
"devDependencies": {
"@types/pako": "^1.0.3",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@types/react": "^18.0.5",
"@types/react-dom": "^18.0.1",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"@vitejs/plugin-react": "^1.1.4",
"@vitejs/plugin-react": "^1.3.1",
"autoprefixer": "^10.4.2",
"dotenv": "^14.2.0",
"dotenv-cli": "^5.1.0",
"eslint": "^8.7.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react": "^7.29.4",
"postcss": "^8.4.6",
"release-it": "^14.14.0",
"tailwindcss": "^3.0.23",
"typescript": "^4.5.4",
"user-agent-data-types": "^0.2.0",
"vite": "^2.7.13",
"vite": "^2.9.5",
"vite-plugin-pwa": "^0.11.13"
},
"author": {
Expand Down
12 changes: 2 additions & 10 deletions src/components/ProjectPlay.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {
ClickEventFunctionProps,
ContextEventFunctionProps
ClickEventFunctionProps
} from "@/components/Launchpad";

import Launchpad from "@/components/Launchpad";
Expand All @@ -12,7 +11,6 @@ import {

export default function ProjectPlay () {
const project = useCurrentProjectStore(state => state.data);
console.log(project);

const handlePadDown: ClickEventFunctionProps = (padId, launchpadId, padElement) => {
padElement.style.backgroundColor = getHexFromVelocity(3);
Expand All @@ -23,15 +21,11 @@ export default function ProjectPlay () {
padElement.removeAttribute("style");
};

const handleContextMenu: ContextEventFunctionProps = (padId, launchpadId, event) => {
console.log(event.currentTarget);
};

if (!project) return (
<p>Loading project data...</p>
);

console.info("[RENDER][/:slug][ProjectPlay]");
/** Debug */ console.info("[RENDER][/:slug][ProjectPlay]");

return (
<div className="
Expand All @@ -55,8 +49,6 @@ export default function ProjectPlay () {
layout="programmer"
onPadDown={handlePadDown}
onPadUp={handlePadUp}

onContextMenu={handleContextMenu}
/>
</div>
<button className="rounded-full bg-gray-600 p-2"></button>
Expand Down
15 changes: 10 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import ReactDOM from "react-dom/client";

// Fonts
import "@fontsource/poppins/latin-300.css";
Expand Down Expand Up @@ -28,7 +28,13 @@ import ImportProjectModal from "@/components/ImportProjectModal";
import CreateProjectModal from "@/components/CreateProjectModal";
// import LpadderWrongVersionModal from "./components/LpadderWrongVersionModal";

ReactDOM.render(
/** Mount point of the React app. */
const container = document.getElementById("root");
if (!container) throw new Error("Failed to find the root element.");

// Create the root and render the app.
const root = ReactDOM.createRoot(container);
root.render(
<React.StrictMode>
<BrowserRouter>
<Routes>
Expand All @@ -43,6 +49,5 @@ ReactDOM.render(
<ReloadPrompt />
<ImportProjectModal />
<CreateProjectModal />
</React.StrictMode>,
document.getElementById("root")
);
</React.StrictMode>
);
20 changes: 10 additions & 10 deletions src/pages/projects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,18 @@ export default function Projects () {
};

const unsubcribe = useCurrentProjectStore.subscribe(state => {
project_slug.current = state.slug;

if (!state.slug) {
showMenuBarComponents(false);
}
if (!state.slug) showMenuBarComponents(false);
else {
showMenuBarComponents(true);

// Configure shortcuts.
document.addEventListener("keydown", saveShortcut);
console.info("[/][useEffect][CTRL+S] Configured shortcut.");
// Reconfigure shortcuts only when the slug changes.
if (project_slug.current !== state.slug) {
document.addEventListener("keydown", saveShortcut);
console.info("[/][useEffect][CTRL+S] Configured shortcut.");
}
}

project_slug.current = state.slug;

/** Show the save button only when project isn't globally saved. */
if (!projectSaveButtonRef.current) return;
Expand All @@ -277,7 +277,7 @@ export default function Projects () {
document.removeEventListener("keydown", saveShortcut);
console.info("[/][useEffect][CTRL+S] Unconfigured shortcut.");

return unsubcribe();
unsubcribe();
};
}, []);

Expand Down Expand Up @@ -372,7 +372,7 @@ export default function Projects () {
/>

<div
className="w-screen h-screen"
className="h-screen"
onContextMenu={(e) => /** Prevent context menu. */ e.preventDefault()}
>
<header
Expand Down
2 changes: 1 addition & 1 deletion src/pages/utilities/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const UtilitiesHome = () => {
// Routes for `/utilities`.
export default function Utilities () {
return (
<div className="relative w-screen min-h-screen">
<div className="relative min-h-screen">
<UtilitiesHeader />

<main className="relative p-4 h-full">
Expand Down
Loading

0 comments on commit ea619c8

Please sign in to comment.