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

Widget ConfigControls #562

Closed
pklaschka opened this issue May 9, 2021 · 0 comments · Fixed by #681
Closed

Widget ConfigControls #562

pklaschka opened this issue May 9, 2021 · 0 comments · Fixed by #681
Assignees
Labels
🔨 enhancement New feature or request 🎩 telestion-client-common Everything related to the telestion-client-common.
Milestone

Comments

@pklaschka
Copy link
Member

We already have the types for our abstraction layer for widget-specific configuration. Especially for the current development in the Daedalus 2 project, it would be great if we could add its implementation soon. 😃

For the types, please see

export interface BaseConfigControlsProps<P extends GenericProps = GenericProps>
.

Within the documentation of the types, there's even a small example of what we thought about how they should be used:

function ConfigControls({
  currentProps, onUpdate
}: ConfigControlsProps): ReactNode {
  // local state to not "flood" global store with changes (performance)
  const [value, setValue] = useState(currentProps.value);
  return (
    <div>
      <input type="text" value={value} onChange={event => setValue(event.target.value)} />
      <button onClick={() => onUpdate({ value })} />
    </div>
  );
}

I genuinely believe that this is the right amount of abstraction for implementing widget-specific configuration since it allows widget developers to easily add dynamically configurable properties to their widgets without sacrificing the depth of configuration options (after all, any JSONSerializable configuration can be passed to onUpdate).

@pklaschka pklaschka added 🔨 enhancement New feature or request 🎩 telestion-client-common Everything related to the telestion-client-common. labels May 9, 2021
@pklaschka pklaschka added this to the v0.15.0 milestone May 9, 2021
@fussel178 fussel178 modified the milestones: v0.15.0, v0.16.0 Jun 3, 2021
fussel178 added a commit that referenced this issue Jun 18, 2021
…he exported `ConfigControls` for every widget.

Closes #562
fussel178 added a commit that referenced this issue Jun 21, 2021
…he exported `ConfigControls` for every widget.

Closes #562
fussel178 added a commit that referenced this issue Jun 23, 2021
…he exported `ConfigControls` for every widget.

Closes #562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 enhancement New feature or request 🎩 telestion-client-common Everything related to the telestion-client-common.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants