MIT-Center-for-Collective-Intelligence / 1Ontology

Apache License 2.0
0 stars 0 forks source link

Refactor src/pages/Ontology.tsx to use Grid and more Component-like structures to isolate logic handling #60

Closed stevenrick closed 2 weeks ago

stevenrick commented 1 month ago

The Ontology.tsx super component is really difficult to follow (and thus will be hard to maintain/debug). It would be really useful for us to refactor this into a better component rich structure with things like useEffect only being used where absolutely needed at a per-component level.

My read is that we can separate out the following features as separate functions / components:

a lot of these are sort of "components" already, but with a lot of logic still here in the Ontology component. If anything we should abstract out state to being a shared reference that passes from parent (Ontology) to all children (the components). Passing state update functions instead of managing everything in one place should be easier in the long run as state is centralized without needing all the logic to live here too.

it would also help to use a more structured Grid for layout rather than lots of Box and Container and Section elements which do not convey a clean sense of structure or order. a grid layout lets us be more precise with where things are expected to be around the screen.