Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
700 changes: 97 additions & 603 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"comlink": "^4.4.2",
"command-exists": "^1.2.9",
"convert-units": "^3.0.0-beta.7",
"copy-to-clipboard": "^3.3.3",
"date-fns": "^4.1.0",
"glob": "^11.0.0",
"jsroot": "^7.8.2",
Expand All @@ -36,12 +37,11 @@
"notistack": "^3.0.2",
"object-hash": "^3.0.0",
"pyodide": "^0.27.4",
"react": "^18.3.1",
"react": "^19.1.0",
"react-async-script": "^1.2.0",
"react-copy-to-clipboard": "^5.1.0",
"react-countdown": "^2.3.6",
"react-dnd": "^16.0.1",
"react-dom": "^18.3.1",
"react-dom": "^19.1.0",
"react-hooks-visible": "^1.1.1",
"react-scripts": "5.0.1",
"set-interval-async": "^3.0.3",
Expand Down Expand Up @@ -206,10 +206,9 @@
},
"devDependencies": {
"@total-typescript/ts-reset": "^0.6.1",
"@types/react": "^19.1.2",
"@types/node": "^22.14.1",
"@types/react": "^18.3.13",
"@types/react-async-script": "^1.2.5",
"@types/react-copy-to-clipboard": "^5.0.7",
"@types/selenium-webdriver": "^4.1.28",
"@types/three": "^0.175.0",
"cross-env": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/JsRoot/hook/useJsRootCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const useJsRootCanvas = (redrawParam: string) => {
const [isVisible, setIsVisible] = useState(false);
const visibleRef = useRef(isVisible);
const { width: resizeWidth, height: resizeHeight } = useResizeObserver({
ref: containerEl
ref: containerEl as React.RefObject<HTMLDivElement>
});

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/PythonConverter/PythonConverterService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const PYODIDE_LOADED = 'PYODIDE_LOADED';
* There can be only one instance of PythonConverter in the whole application.
*/
const PythonConverter = (props: PythonConverterProps) => {
const workerRef = useRef<Comlink.Remote<PythonWorker>>();
const workerRef = useRef<Comlink.Remote<PythonWorker> | null>(null);

useEffect(() => {
workerRef.current = Comlink.wrap<PythonWorker>(
Expand Down
6 changes: 3 additions & 3 deletions src/ThreeEditor/components/Editor/SceneEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../../css/main.css';

import { AppBar, Box } from '@mui/material';
import CircularProgress from '@mui/material/CircularProgress';
import { useEffect, useRef } from 'react';
import { RefObject,useEffect, useRef } from 'react';
import * as THREE from 'three';

import { useStore } from '../../../services/StoreService';
Expand All @@ -27,11 +27,11 @@ interface SceneEditorProps {
}

function SceneEditor(props: SceneEditorProps) {
const wrapperElementRef = useRef<HTMLDivElement>(null);
const wrapperElementRef = useRef<HTMLElement>(null);
const { yaptideEditor, initializeEditor } = useStore();
const containerEl = useRef<HTMLDivElement>(null);

useKeyboardEditorControls(yaptideEditor, wrapperElementRef);
useKeyboardEditorControls(yaptideEditor, wrapperElementRef as RefObject<HTMLElement>);

useEffect(() => {
if (containerEl.current) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ export function SidebarTreeItem(props: {
return (
<>
<Box
ref={ref => objectRefs.current.set(object.uuid, ref! as HTMLDivElement)}
ref={(ref: HTMLDivElement | null) => {
if (ref) {
objectRefs.current.set(object.uuid, ref);
} else {
objectRefs.current.delete(object.uuid);
}
}}
sx={{
'marginLeft': ({ spacing }) => spacing(depth * 2.5),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function ZoneManagerPanel(props: BooleanZoneManagerPanelProps) {
);

/*------------------------------------BooleanZone-------------------------------------*/
const zoneRef = useRef<BooleanZone>();
const zoneRef = useRef<BooleanZone | null>(null);

useEffect(() => {
zoneRef.current = zone;
Expand Down
45 changes: 45 additions & 0 deletions src/WrapperApp/components/CopyToClipboard/CopyToClipboard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import copy from 'copy-to-clipboard';
import PropTypes from 'prop-types';
import React from 'react';

export default class CopyToClipboard extends React.PureComponent {
static propTypes = {
text: PropTypes.string.isRequired,
children: PropTypes.element.isRequired,
onCopy: PropTypes.func,
options: PropTypes.shape({
debug: PropTypes.bool,
message: PropTypes.string,
format: PropTypes.string
})
};

static defaultProps = {
onCopy: undefined,
options: undefined
};

onClick = event => {
const { text, onCopy, children, options } = this.props;

const elem = React.Children.only(children);

const result = copy(text, options);

if (onCopy) {
onCopy(text, result);
}

// Bypass onClick if it was present
if (elem && elem.props && typeof elem.props.onClick === 'function') {
elem.props.onClick(event);
}
};

render() {
const { text: _text, onCopy: _onCopy, options: _options, children, ...props } = this.props;
const elem = React.Children.only(children);

return React.cloneElement(elem, { ...props, onClick: this.onClick });
}
}
2 changes: 1 addition & 1 deletion src/WrapperApp/components/Results/Results3D.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import { Box, Button, Stack, Typography } from '@mui/material';
import { CopyToClipboard } from 'react-copy-to-clipboard';

import { Page3D } from '../../../JsRoot/GraphData';
import CopyToClipboard from '../CopyToClipboard/CopyToClipboard';

export function Result3D(props: { page: Page3D; title?: string }) {
const { page, title } = props;
Expand Down
44 changes: 22 additions & 22 deletions src/WrapperApp/components/Simulation/SimulationCardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,28 +186,28 @@ export function PaginatedSimulationCardGrid({
isAccordion={isAccordion}
simulations={simulations}
layout={layout}
header={(accordion: SimulationAccordionProps) =>
SimulationBackendHeader({
title,
subtitle,
accordion,
sx: {
header={(accordion: SimulationAccordionProps) => (
<SimulationBackendHeader
title={title}
subtitle={subtitle}
accordion={accordion}
sx={{
mb: ({ spacing }: Theme) => spacing(0)
},
children,
...pageData
})
}
footer={() =>
SimulationPaginationFooter({
...pageData,
stickTo: 'bottom',
sx: {
}}
{...pageData}>
{children}
</SimulationBackendHeader>
)}
footer={() => (
<SimulationPaginationFooter
{...pageData}
stickTo='bottom'
sx={{
mt: ({ spacing }: Theme) => spacing(0),
zIndex: ({ zIndex }: Theme) => zIndex.appBar
}
})
}
}}
/>
)}
{...other}
/>
);
Expand Down Expand Up @@ -266,8 +266,8 @@ export function PaginatedSimulationsFromBackend({

type AccordionCardGridProps = {
isAccordion: boolean;
header?: FC<SimulationAccordionProps>;
footer?: FC<{}>;
header?: (props: SimulationAccordionProps) => React.ReactNode;
footer?: () => React.ReactNode;
} & SimulationCardGridProps;

export function AccordionCardGrid({
Expand Down Expand Up @@ -320,7 +320,7 @@ export function AccordionCardGrid({
simulations={simulations}
{...other}
/>
{footer && footer({})}
{footer && footer()}
</AccordionDetails>
</Accordion>
);
Expand Down
18 changes: 11 additions & 7 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import './index.css';

import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';

import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
const container = document.getElementById('root');

if (container) {
const root = createRoot(container);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
}

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
Expand Down
Loading