-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Summary
Add the legend panel (currently only in the graph view) to the schema graph view. Include a disclaimer message at the top of the legend content informing users that the schema was discovered by sampling and may not be 100% accurate. Persist the open/closed state of the legend separately for each view using localforage.
Background
The graph view (GraphViewer.tsx) has a Legend component that displays vertex type symbols and labels using useDisplayVertexTypeConfigs. The schema graph view (SchemaGraph.tsx) currently has no legend. The schema discovery disclaimer currently lives as an InfoTooltip in SchemaGraphToolbar.tsx:
This schema was implicitly discovered by sampling the structure of the data and may not represent the complete schema.
This tooltip will be replaced by the disclaimer text in the legend.
Requirements
1. Extract and reuse the Legend component
- Extract the
Legendcomponent fromGraphViewer.tsxinto a shared location (e.g.,src/components/) - The legend displays vertex type icons and display labels from
useDisplayVertexTypeConfigs
2. Add legend to the schema graph view
- Add a legend toggle button to
SchemaGraphToolbar.tsx - Render the legend panel overlaying the schema graph in
SchemaGraph.tsx, similar to how it overlays inGraphViewer.tsx
3. Add schema discovery disclaimer to the schema legend
- At the top of the legend content (above the vertex type list), add text informing the user that the schema was discovered by sampling and may not be complete
- Use the existing message: "This schema was implicitly discovered by sampling the structure of the data and may not represent the complete schema."
- Remove the
InfoTooltipfromSchemaGraphToolbar.tsxsince the message moves to the legend
4. Persist legend open/closed state via localforage
- Create two new persisted atoms in
storageAtoms.tsusingatomWithLocalForage:graphViewLegendOpenAtom— for the graph view legend (default:false)schemaViewLegendOpenAtom— for the schema view legend (default:true, open by default for new users)
- Replace the local
useStateinGraphViewer.tsxwith thegraphViewLegendOpenAtom - Use
schemaViewLegendOpenAtominSchemaGraph.tsx
Relevant Files
packages/graph-explorer/src/modules/GraphViewer/GraphViewer.tsx— current Legend component and graph viewpackages/graph-explorer/src/modules/SchemaGraph/SchemaGraph.tsx— schema graph viewpackages/graph-explorer/src/modules/SchemaGraph/SchemaGraphToolbar.tsx— toolbar with InfoTooltip to removepackages/graph-explorer/src/core/StateProvider/storageAtoms.ts— localforage-backed atomspackages/graph-explorer/src/core/StateProvider/atomWithLocalForage.ts— atom factory for localforage persistence
Parent Issue
Part of #685