Skip to content
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: Add API for setting field colors for JSON nodes #422

Conversation

Nathan-Bransby-NMT
Copy link

@Nathan-Bransby-NMT Nathan-Bransby-NMT commented Oct 31, 2024

Fixes #417

Add support for setting different field colors for JSON nodes via an API.

  • API Endpoint

    • Create a new API endpoint in src/pages/api/fieldColors.ts to handle setting and getting field colors.
  • Dynamic Color Handling

    • Add getDynamicTextColor function in src/containers/Editor/components/views/GraphView/CustomNode/styles.tsx to handle dynamic colors from the API.
    • Update TextRenderer component in src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer.tsx to use fieldColors prop for rendering colors.
    • Pass fieldColors prop to TextRenderer component in src/containers/Editor/components/views/GraphView/CustomNode/index.tsx.
  • Fetch Field Colors

    • Fetch field colors from the new API endpoint in src/containers/Editor/components/views/GraphView/index.tsx and pass them to CustomNode component.

Fixes #417

Add support for setting different field colors for JSON nodes via an API.

* **API Endpoint**
  - Create a new API endpoint in `src/pages/api/fieldColors.ts` to handle setting and getting field colors.

* **Dynamic Color Handling**
  - Add `getDynamicTextColor` function in `src/containers/Editor/components/views/GraphView/CustomNode/styles.tsx` to handle dynamic colors from the API.
  - Update `TextRenderer` component in `src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer.tsx` to use `fieldColors` prop for rendering colors.
  - Pass `fieldColors` prop to `TextRenderer` component in `src/containers/Editor/components/views/GraphView/CustomNode/index.tsx`.

* **Fetch Field Colors**
  - Fetch field colors from the new API endpoint in `src/containers/Editor/components/views/GraphView/index.tsx` and pass them to `CustomNode` component.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/AykutSarac/jsoncrack.com/issues/417?shareId=XXXX-XXXX-XXXX-XXXX).
@Nathan-Bransby-NMT Nathan-Bransby-NMT deleted the feature--node-field-color-api branch October 31, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can JsonCrack support setting different field colors for json nodes?
1 participant