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

Tag: use colorField to define the tag color #874

Merged
merged 3 commits into from
Feb 6, 2025
Merged

Conversation

ecarreras
Copy link
Member

This pull request includes several enhancements to the Tag component in the src/widgets/custom/Tag.tsx file. The main changes involve adding new hooks and context to handle network requests and dynamic color updates for tags.

Enhancements to Tag component:

  • Imports Update:

    • Added useContext, useState, useEffect, and useCallback from React.
    • Imported useNetworkRequest hook, ConnectionProvider, and FormContext for handling network requests and form context.
  • State and Context Integration:

    • Introduced readObjects and cancelReadObjectsRequest using useNetworkRequest to fetch data.
    • Integrated FormContext to access form field values.
  • Dynamic Color Update:

    • Added a useState hook to manage the tag color state.
    • Implemented updateColor function using useCallback to fetch and set the tag color based on the ooui.colorField.
    • Added a useEffect hook to call updateColor whenever ooui.colorField changes.

These changes enhance the functionality of the Tag component by allowing it to dynamically update its color based on the context and network data.

Related

@ecarreras ecarreras added enhancement New feature or request widget labels Feb 6, 2025
@ecarreras ecarreras self-assigned this Feb 6, 2025
@ecarreras ecarreras merged commit 6e2a357 into v2 Feb 6, 2025
1 check passed
@ecarreras ecarreras deleted the 69649/tag-field-color branch February 6, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant