import React from 'react';
import connect from 'ui/connect';
import {Section} from 'ui/components/Section';
import {constant} from 'lstream';
import ls from './ObjectExplorer.less';
import cx from 'classnames';
import {MShell} from 'cad/model/mshell';
import {MDatum} from 'cad/model/mdatum';
import mapContext from 'ui/mapContext';
import decoratorChain from 'ui/decoratorChain';
import {MOpenFaceShell} from "cad/model/mopenFace";
export default connect(streams => streams.craft.models.map(models => ({models})))
(function ObjectExplorer({models}) { // eslint-disable-line no-unexpected-multiline
return
{models.map(m => {
if (m instanceof MOpenFaceShell) {
return
} else if (m instanceof MShell) {
return
} else if (m instanceof MDatum) {
return ;
} else {
return null;
}
})}
});
function EdgeSection({edge}) {
return
{edge.adjacentFaces.map(f => )}
}
function FaceSection({face}) {
return
{(face.productionInfo && face.productionInfo.role) &&
role: {face.productionInfo.role}}/>}
{(face.productionInfo && face.productionInfo.originatedFromPrimitive) &&
origin: {face.productionInfo.originatedFromPrimitive}}/>}
{face.edges && }
;
}
function SketchesList({face}) {
return {''}}>
{face.sketchObjects.map(o => {o.id + ':' + o.sketchPrimitive.constructor.name}
)}
;
}
const ModelSection = decoratorChain(
mapContext((ctx, props) => ({
select: () => ctx.services.pickControl.pick(props.model)
})),
connect((streams, props) => (streams.selection[props.type] || constant([])).map(selection => ({selection}))))
( // eslint-disable-line no-unexpected-multiline
function ModelSection({model, type, typeLabel, selection, select, ...props}) {
const labelClasses = cx(ls.modelLabel, {
[ls.selected]: selection.indexOf(model.id) !== -1
});
const label =
{typeLabel||type} {model.id}
;
return ;
}
);
function OpenFaceSection({shell}) {
return
;
}