format project

This commit is contained in:
Kurt Hutten
2021-08-08 19:55:05 +10:00
parent 802ea61639
commit 078c79d8ee
5 changed files with 23 additions and 12 deletions

View File

@@ -1,7 +1,9 @@
let timeoutId = 0 let timeoutId = 0
const DelayedPingAnimation = ({isLoading: isLoading}: {isLoading: boolean}) => { const DelayedPingAnimation = ({
isLoading: isLoading,
}: {
isLoading: boolean
}) => {
const [showLoading, setShowLoading] = React.useState(false) const [showLoading, setShowLoading] = React.useState(false)
React.useEffect(() => { React.useEffect(() => {
if (!isLoading && showLoading) { if (!isLoading && showLoading) {
@@ -18,11 +20,12 @@ const DelayedPingAnimation = ({isLoading: isLoading}: {isLoading: boolean}) => {
} }
}, [isLoading]) }, [isLoading])
if (showLoading && isLoading) return ( if (showLoading && isLoading)
<div className="inset-0 absolute flex items-center justify-center"> return (
<div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div> <div className="inset-0 absolute flex items-center justify-center">
</div> <div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div>
) </div>
)
return null return null
} }

View File

@@ -7,7 +7,7 @@ import { requestRender } from 'src/helpers/hooks/useIdeState'
import texture from './dullFrontLitMetal.png' import texture from './dullFrontLitMetal.png'
import { TextureLoader } from 'three/src/loaders/TextureLoader' import { TextureLoader } from 'three/src/loaders/TextureLoader'
import Customizer from 'src/components/Customizer/Customizer' import Customizer from 'src/components/Customizer/Customizer'
import DelayedPingAnimation from 'src/components/DelayedPingAnimation/DelayedPingAnimation' import DelayedPingAnimation from 'src/components/DelayedPingAnimation/DelayedPingAnimation'
const loader = new TextureLoader() const loader = new TextureLoader()
const colorMap = loader.load(texture) const colorMap = loader.load(texture)

View File

@@ -129,7 +129,11 @@ export const render: DefaultKernelExport['render'] = async ({
scriptWorker.postMessage({ action: 'init', baseURI, alias: [] }) scriptWorker.postMessage({ action: 'init', baseURI, alias: [] })
} }
if (parameters && currentParameters && JSON.stringify(parameters) !== JSON.stringify(currentParameters)) { if (
parameters &&
currentParameters &&
JSON.stringify(parameters) !== JSON.stringify(currentParameters)
) {
// we are not evaluating code, but reacting to parameters change // we are not evaluating code, but reacting to parameters change
scriptWorker.postMessage({ scriptWorker.postMessage({
action: 'updateParams', action: 'updateParams',

View File

@@ -160,7 +160,7 @@ export function genParams(
if (inp.getAttribute('live') === '1') _callback('live') if (inp.getAttribute('live') === '1') _callback('live')
}) })
if (inp.getAttribute('live') !== '1') if (inp.getAttribute('live') !== '1')
inp.addEventListener('change', ()=>_callback('change')) inp.addEventListener('change', () => _callback('change'))
}) })
function groupClick(evt) { function groupClick(evt) {

View File

@@ -175,7 +175,11 @@ export const useIdeState = (): [State, (actionOrThunk: any) => any] => {
case 'updateCode': case 'updateCode':
return { ...state, code: payload } return { ...state, code: payload }
case 'healthyRender': case 'healthyRender':
const currentParameters = (payload.currentParameters && Object.keys(payload.currentParameters).length) ? payload.currentParameters : state.currentParameters const currentParameters =
payload.currentParameters &&
Object.keys(payload.currentParameters).length
? payload.currentParameters
: state.currentParameters
return { return {
...state, ...state,
objectData: { objectData: {