From f99a97b78b900752af8e8c4349d1ae7208e79436 Mon Sep 17 00:00:00 2001 From: Adnan Wahab Date: Mon, 14 Oct 2024 18:54:56 -0700 Subject: [PATCH] simplify --- data/odyssey/module_list.json | 2 +- index.html | 9 +++++ infra/scripts/course_gen_step_2.js | 25 ++++++++------ views/odyssey/PowerPoints.tsx | 15 +++++++-- views/odyssey/TeleGuidance.tsx | 54 ++++++++++++++++++++++++++++++ views/odyssey/robotics-odyssey.tsx | 2 +- vite.config.js | 5 ++- 7 files changed, 96 insertions(+), 16 deletions(-) diff --git a/data/odyssey/module_list.json b/data/odyssey/module_list.json index cf4ecc519..a7e464675 100644 --- a/data/odyssey/module_list.json +++ b/data/odyssey/module_list.json @@ -183,7 +183,7 @@ }, "Real World Applications": { "pages": [ - { "name": "cat robot ", "path": "/applications/feeding-cats" }, + { "name": "cat robot ", "path": "/applications/feeding-cats" } ] } diff --git a/index.html b/index.html index 47b4d926d..40a5db23b 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,16 @@ CSS 3D Perspective Animation + diff --git a/infra/scripts/course_gen_step_2.js b/infra/scripts/course_gen_step_2.js index 506aed99b..5ce1c1911 100644 --- a/infra/scripts/course_gen_step_2.js +++ b/infra/scripts/course_gen_step_2.js @@ -1,6 +1,6 @@ import { OpenAI } from 'openai'; import { join } from 'path'; -import { existsSync, readdirSync } from 'fs'; +import { existsSync, readdirSync, readFileSync } from 'fs'; const openai_api_key = process.env.OPENAI_KEY; @@ -81,21 +81,26 @@ async function processChunk(folderName, index) { // }); // const processed = parseGPT(chatCompletion); const outputFilePath = join(input_dir, folderName, `${index}.md`); + let dummy_path = "data/course_intermediate/" + folderName + "/" + index + ".md"; await Bun.write(outputFilePath, processed); } async function processAllFilesInDirectory(directoryPath) { - const folders = readdirSync(directoryPath).filter( - (folder) => existsSync(join(directoryPath, folder)) && - !existsSync(join(directoryPath, folder, 'index.md')) - ); + const module_list = JSON.parse(readFileSync(join(directoryPath, 'module_list.json'))); + console.log(JSON.stringify(module_list)); + // const folders = readdirSync(directoryPath).filter( + // (folder) => existsSync(join(directoryPath, folder)) && + // !existsSync(join(directoryPath, folder, 'index.md')) + // ); const startTime = Date.now(); - for (const folder of folders) { - for (let index = 0; index < 10; index++) { - await processChunk(folder, index); - } - } + // for (const folder of folders) { + // for (let index = 0; index < 10; index++) { + // await processChunk(folder, index); + // } + // } const endTime = Date.now(); + const outputFilePath = join(directoryPath, 'output.json'); + await Bun.write(outputFilePath, JSON.stringify(module_list)); console.log(`processing all files in directory took ${endTime - startTime} milliseconds`); } diff --git a/views/odyssey/PowerPoints.tsx b/views/odyssey/PowerPoints.tsx index 56df0351f..f8121048a 100644 --- a/views/odyssey/PowerPoints.tsx +++ b/views/odyssey/PowerPoints.tsx @@ -1,6 +1,8 @@ // import text from "./human_robot.txt" // https://www.jasper.ai/ +import reflectNotionHomage from '../../static/reflect_notion_homage.png'; + //seuqelitis //metal gear solid - explain war // fallouit - war never changes - @@ -9,7 +11,8 @@ // import Box from './Box'; function PowerPoint() { - return ( + return ([ + , - ); + >, + , + , + +]); // mega man x // current status quo - founder of way mo - hoe noe robots will eat us - people are ivevil wow // current status quo - raina borrows 5k - vote - sshould raina give eggnog his 5k back? she says "barf" and "i need space" --- her friends say "hes toxic ---- hes tocxic -" -- but sodiam and naicnin diff --git a/views/odyssey/TeleGuidance.tsx b/views/odyssey/TeleGuidance.tsx index 555f74479..bea505644 100644 --- a/views/odyssey/TeleGuidance.tsx +++ b/views/odyssey/TeleGuidance.tsx @@ -42,6 +42,58 @@ function Livekit() { // import notebook2 from "@roboticsuniversity/robotics-hardware"; + +function Whiteboard() { + const canvasRef = useRef(null); + const [isDrawing, setIsDrawing] = useState(false); + + useEffect(() => { + const canvas = canvasRef.current; + const context = canvas.getContext("2d"); + + const startDrawing = ({ nativeEvent }) => { + const { offsetX, offsetY } = nativeEvent; + context.beginPath(); + context.moveTo(offsetX, offsetY); + setIsDrawing(true); + }; + + const draw = ({ nativeEvent }) => { + if (!isDrawing) return; + const { offsetX, offsetY } = nativeEvent; + context.lineTo(offsetX, offsetY); + context.stroke(); + }; + + const stopDrawing = () => { + context.closePath(); + setIsDrawing(false); + }; + + canvas.addEventListener("mousedown", startDrawing); + canvas.addEventListener("mousemove", draw); + canvas.addEventListener("mouseup", stopDrawing); + canvas.addEventListener("mouseout", stopDrawing); + + return () => { + canvas.removeEventListener("mousedown", startDrawing); + canvas.removeEventListener("mousemove", draw); + canvas.removeEventListener("mouseup", stopDrawing); + canvas.removeEventListener("mouseout", stopDrawing); + }; + }, [isDrawing]); + + return ( + + ); +} + + function RoboticsHardware() { const viewofModuleNameRef = useRef(); @@ -66,6 +118,8 @@ function RoboticsHardware() { return ( <> + +

Credit:{" "} diff --git a/views/odyssey/robotics-odyssey.tsx b/views/odyssey/robotics-odyssey.tsx index 1ba166e69..cc012fc15 100644 --- a/views/odyssey/robotics-odyssey.tsx +++ b/views/odyssey/robotics-odyssey.tsx @@ -30,7 +30,7 @@ function RoboticsOdyssey() { {" "} {" "}

- {/* */} +