IDE redesign, initial implementation #362

Merged
Irev-Dev merged 17 commits from kurt/update-ide-panel-toolbar-360 into main 2021-06-15 10:05:03 +02:00
7 changed files with 19 additions and 20 deletions
Showing only changes of commit d781c94027 - Show all commits

View File

@@ -1,14 +1,13 @@
import { useContext } from 'react'
import { Menu } from '@headlessui/react'
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
import Svg from 'src/components/Svg/Svg'
import { useRender } from 'src/components/IdeWrapper/useRender'
import {makeStlDownloadHandler, PullTitleFromFirstLine} from './helpers'
const EditorMenu = () => {
Irev-Dev commented 2021-06-14 02:21:24 +02:00 (Migrated from github.com)
Review

image

![image](https://user-images.githubusercontent.com/29681384/121826268-436c6680-ccfa-11eb-9b06-ba4d61270ab5.png)
franknoirot commented 2021-06-14 15:18:09 +02:00 (Migrated from github.com)
Review

Did you do all these snippet images manually? They're very helpful!

Did you do all these snippet images manually? They're very helpful!
Irev-Dev commented 2021-06-15 10:02:26 +02:00 (Migrated from github.com)
Review

:)
Yeah I did.
CContext is super important when trying to look at other's code. You could have figured this out yourself but 20x quicker for me to add a few screen shots.

:) Yeah I did. CContext is super important when trying to look at other's code. You could have figured this out yourself but 20x quicker for me to add a few screen shots.
const handleRender = useRender()
const { state, thunkDispatch } = useContext(IdeContext)
const { state, thunkDispatch } = useIdeContext()
const handleStlDownload = makeStlDownloadHandler({
type: state.objectData?.type,
geometry: state.objectData?.data,

View File

@@ -1,9 +1,10 @@
import { makeEncodedLink } from './helpers'
import { copyTextToClipboard } from 'src/helpers/clipboard'
import {useIdeContext} from 'src/helpers/hooks/useIdeContext'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
Irev-Dev commented 2021-06-14 02:29:31 +02:00 (Migrated from github.com)
Review

image

![image](https://user-images.githubusercontent.com/29681384/121826523-65b2b400-ccfb-11eb-8c97-3d9b03505ea8.png)
const FullScriptEncoding = () => {
const {state} = useIdeContext()
const { state } = useIdeContext()
const encodedLink = makeEncodedLink(state.code)
return (
<>

View File

@@ -1,10 +1,10 @@
import { useContext, useEffect } from 'react'
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
import { useEffect } from 'react'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
import { matchEditorVsDarkTheme } from 'src/components/IdeEditor'
import PanelToolbar from 'src/components/PanelToolbar'
const IdeConsole = () => {
const { state } = useContext(IdeContext)
const { state } = useIdeContext()
useEffect(() => {
const element = document.querySelector('.console-tile .mosaic-window-body')
if (element) {

View File

@@ -1,6 +1,6 @@
import { useContext, useRef, useEffect } from 'react'
import { useRef, useEffect } from 'react'
import { Mosaic, MosaicWindow } from 'react-mosaic-component'
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
import { requestRender } from 'src/helpers/hooks/useIdeState'
import IdeEditor from 'src/components/IdeEditor'
import IdeViewer from 'src/components/IdeViewer'
@@ -15,7 +15,7 @@ const ELEMENT_MAP = {
}
const IdeContainer = () => {
const { state, thunkDispatch } = useContext(IdeContext)
const { state, thunkDispatch } = useIdeContext()
const viewerDOM = useRef(null)
const debounceTimeoutId = useRef

View File

@@ -1,5 +1,5 @@
import { useContext, Suspense, lazy } from 'react'
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
import { Suspense, lazy } from 'react'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
import { makeCodeStoreKey } from 'src/helpers/hooks/useIdeState'
import { requestRender } from 'src/helpers/hooks/useIdeState'
const Editor = lazy(() => import('@monaco-editor/react'))
@@ -12,7 +12,7 @@ export const matchEditorVsDarkTheme = {
}
const IdeEditor = () => {
const { state, thunkDispatch } = useContext(IdeContext)
const { state, thunkDispatch } = useIdeContext()
const ideTypeToLanguageMap = {
cadQuery: 'python',
openScad: 'cpp',

View File

@@ -1,5 +1,5 @@
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
import { useRef, useState, useEffect, useContext } from 'react'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
import { useRef, useState, useEffect } from 'react'
import {
Canvas,
extend,
@@ -138,7 +138,7 @@ function Sphere(props) {
)
}
const IdeViewer = () => {
const { state, thunkDispatch } = useContext(IdeContext)
const { state, thunkDispatch } = useIdeContext()
const [isDragging, setIsDragging] = useState(false)
const [image, setImage] = useState()

View File

@@ -1,10 +1,9 @@
import { makeCodeStoreKey } from 'src/helpers/hooks/useIdeState'
import { requestRender } from 'src/helpers/hooks/useIdeState'
import { useContext } from 'react'
import { IdeContext } from 'src/pages/DevIdePage/DevIdePage'
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
export const useRender = () => {
const { state, thunkDispatch } = useContext(IdeContext)
const { state, thunkDispatch } = useIdeContext()
return () => {
thunkDispatch((dispatch, getState) => {
const state = getState()