-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: React Examples Components (DT-7024) #49
Changes from 1 commit
31b7d09
bdd3856
1163339
f55e099
65753c8
099c385
c17368c
03fd5b6
543a482
0547305
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
<!doctype html> | ||
<html> | ||
<body> | ||
EXAMPLES | ||
<br /> | ||
<ul> | ||
<li><a href="/dzi">Deep Zoom Image</a><br /></li> | ||
<li><a href="/omezarr">OMEZARR</a><br /></li> | ||
<li><a href="/layers">Layers</a><br /></li> | ||
</ul> | ||
<div id="app"></div> | ||
<script | ||
type="module" | ||
src="/src/index.tsx" | ||
></script> | ||
</body> | ||
</html> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,31 @@ | ||
import React from 'react'; | ||
import { SliceViewLayer } from './ui/slice-ui'; | ||
import type { Demo } from './layers'; | ||
import { AnnotationGrid } from './ui/annotation-grid'; | ||
import { ContactSheetUI } from './ui/contact-sheet'; | ||
import { ScatterplotUI } from './ui/scatterplot-ui'; | ||
import { Button } from '@czi-sds/components'; | ||
import { BrowserRouter, Route, Routes } from 'react-router'; | ||
import { Home } from './home'; | ||
import { TwoClientsPOC } from './dzi/double'; | ||
import { OmezarrDemo } from './omezarr/app'; | ||
|
||
export function AppUi(props: { demo: Demo }) { | ||
const { demo } = props; | ||
export function App() { | ||
console.log('app'); | ||
return ( | ||
<div> | ||
<Button | ||
onClick={() => { | ||
demo.requestSnapshot(3000); | ||
}} | ||
> | ||
{'📸'} | ||
</Button> | ||
<label>{`Layer ${demo.selectedLayer}`}</label> | ||
<Button | ||
onClick={() => { | ||
demo.selectLayer(demo.selectedLayer - 1); | ||
}} | ||
> | ||
{'<-'} | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
demo.selectLayer(demo.selectedLayer + 1); | ||
}} | ||
> | ||
{'->'} | ||
</Button> | ||
<LayerUi demo={demo} /> | ||
</div> | ||
<BrowserRouter> | ||
<Routes> | ||
<Route | ||
index | ||
element={<Home />} | ||
/> | ||
<Route | ||
path="/dzi" | ||
element={<TwoClientsPOC />} | ||
/> | ||
<Route | ||
path="/omezarr" | ||
element={<OmezarrDemo />} | ||
/> | ||
{/* <Route | ||
path="/layers" | ||
element={<LayersDemo />} | ||
/> */} | ||
</Routes> | ||
</BrowserRouter> | ||
); | ||
} | ||
function LayerUi(props: { demo: Demo }) { | ||
const { demo } = props; | ||
const layer = demo.layers[demo.selectedLayer]; | ||
if (layer) { | ||
switch (layer.type) { | ||
case 'annotationGrid': | ||
return <AnnotationGrid demo={demo} />; | ||
case 'volumeGrid': | ||
return <ContactSheetUI demo={demo} />; | ||
case 'volumeSlice': | ||
return <SliceViewLayer demo={demo} />; | ||
case 'scatterplot': | ||
case 'scatterplotGrid': | ||
return <ScatterplotUI demo={demo} />; | ||
default: | ||
return null; | ||
} | ||
} | ||
return <SliceViewLayer demo={props.demo} />; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
|
||
export function Home() { | ||
return ( | ||
<> | ||
EXAMPLES | ||
<br /> | ||
<ul> | ||
<li> | ||
<a href="/dzi">Deep Zoom Image</a> | ||
<br /> | ||
</li> | ||
<li> | ||
<a href="/omezarr">OMEZARR</a> | ||
<br /> | ||
</li> | ||
{/* layers is not in the AC to be converted to a react component | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's at least let it render like it was, since there's a good Markdown page explaining how to use it in the docs still so we want it working. |
||
maybe we'll convert it at some point though so I'll leave this here | ||
<li> | ||
<a href="/layers">Layers</a> | ||
<br /> | ||
</li> */} | ||
</ul> | ||
</> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createRoot } from 'react-dom/client'; | ||
import { App } from './app'; | ||
import React from 'react'; | ||
|
||
const container = document.getElementById('app'); | ||
const root = createRoot(container!); | ||
root.render(<App />); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,70 @@ | ||||||
import type { ColumnRequest } from '~/common/loaders/scatterplot/scatterbrain-loader'; | ||||||
import type { AnnotationGridConfig } from '~/data-sources/annotation/annotation-grid'; | ||||||
import type { ZarrSliceConfig } from '~/data-sources/ome-zarr/planar-slice'; | ||||||
import type { ZarrSliceGridConfig } from '~/data-sources/ome-zarr/slice-grid'; | ||||||
import type { ScatterplotGridConfig, ScatterPlotGridSlideConfig } from '~/data-sources/scatterplot/dynamic-grid'; | ||||||
|
||||||
const slide32 = 'MQ1B9QBZFIPXQO6PETJ'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok this whole file is unused - it was nice that it was pulled out of the code for the layers example logic, but the types got a bit messed up. |
||||||
const colorByGene: ColumnRequest = { name: '88', type: 'QUANTITATIVE' }; | ||||||
const scottpoc = 'https://tissuecyte-ome-zarr-poc.s3.amazonaws.com/40_128_128/1145081396'; | ||||||
|
||||||
export const examples: Record<string, any> = { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont erase types with any... |
||||||
['reconstructed']: { | ||||||
colorBy: colorByGene, | ||||||
type: 'ScatterPlotGridConfig', | ||||||
url: 'https://bkp-2d-visualizations-stage.s3.amazonaws.com/wmb_ccf_04112024-20240419205547/4STCSZBXHYOI0JUUA3M/ScatterBrain.json', | ||||||
} as ScatterplotGridConfig, | ||||||
['oneSlide']: { | ||||||
colorBy: colorByGene, | ||||||
slideId: slide32, | ||||||
type: 'ScatterPlotGridSlideConfig', | ||||||
url: 'https://bkp-2d-visualizations-stage.s3.amazonaws.com/wmb_ccf_04112024-20240419205547/4STCSZBXHYOI0JUUA3M/ScatterBrain.json', | ||||||
} as ScatterPlotGridSlideConfig, | ||||||
['tissueCyte396']: { | ||||||
type: 'ZarrSliceGridConfig', | ||||||
gamut: { | ||||||
R: { index: 0, gamut: { max: 600, min: 0 } }, | ||||||
G: { index: 1, gamut: { max: 500, min: 0 } }, | ||||||
B: { index: 2, gamut: { max: 400, min: 0 } }, | ||||||
}, | ||||||
plane: 'xy', | ||||||
slices: 142, | ||||||
url: scottpoc, | ||||||
} as ZarrSliceGridConfig, | ||||||
['tissueCyteSlice']: { | ||||||
type: 'zarrSliceConfig', | ||||||
gamut: { | ||||||
R: { index: 0, gamut: { max: 600, min: 0 } }, | ||||||
G: { index: 1, gamut: { max: 500, min: 0 } }, | ||||||
B: { index: 2, gamut: { max: 400, min: 0 } }, | ||||||
}, | ||||||
plane: 'xy', | ||||||
planeParameter: 0.5, | ||||||
url: scottpoc, | ||||||
} as ZarrSliceConfig, | ||||||
['versa1']: { | ||||||
url: 'https://neuroglancer-vis-prototype.s3.amazonaws.com/VERSA/scratch/0500408166/', | ||||||
type: 'ZarrSliceGridConfig', | ||||||
gamut: { | ||||||
R: { index: 0, gamut: { max: 20, min: 0 } }, | ||||||
G: { index: 1, gamut: { max: 20, min: 0 } }, | ||||||
B: { index: 2, gamut: { max: 20, min: 0 } }, | ||||||
}, | ||||||
plane: 'xy', | ||||||
slices: 4, | ||||||
} as ZarrSliceGridConfig, | ||||||
['structureAnnotation']: { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happened here? why do these all have [' '] wrappings? |
||||||
type: 'AnnotationGridConfig', | ||||||
url: 'https://bkp-2d-visualizations-stage.s3.amazonaws.com/wmb_ccf_04112024-20240419205547/4STCSZBXHYOI0JUUA3M/ScatterBrain.json', | ||||||
levelFeature: '73GVTDXDEGE27M2XJMT', | ||||||
annotationUrl: | ||||||
'https://stage-sfs.brain.devlims.org/api/v1/Annotation/4STCSZBXHYOI0JUUA3M/v3/TLOKWCL95RU03D9PETG/', | ||||||
stroke: { | ||||||
opacity: 1, | ||||||
overrideColor: [1, 0, 0, 1] as const, | ||||||
}, | ||||||
fill: { | ||||||
opacity: 0.7, | ||||||
}, | ||||||
} as AnnotationGridConfig, | ||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { createRoot } from 'react-dom/client'; | ||
import { AppUi } from './app'; | ||
import { OmezarrDemo } from './app'; | ||
|
||
const uiroot = createRoot(document.getElementById('main')!); | ||
uiroot.render(AppUi()); | ||
uiroot.render(OmezarrDemo()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are a handful of static, independant pages worth pulling in this dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it does let us delete the kinda gross repetetative {demo-name.html} files....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep it, seems fine