Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
I
iTasks-SDK
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 7
    • Merge Requests 7
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • clean-and-itasks
  • iTasks-SDK
  • Issues
  • #427

Closed
Open
Opened Nov 13, 2020 by Camil Staps@cstaps🚀Owner

Editor modifier to provide feedback (e.g. error icons)

We currently have the following editor modifiers to easily add error icons/tooltips on editors:

mapEditorWriteError :: !(wb -> MaybeErrorString w) !(Editor r wb) -> Editor r (?w)
withDynamicHintAttributesWithError :: !String !(Editor r (MaybeError String w)) -> Editor r (?w)

There is one clear difference in the API: the first takes a mapping function while the second works on a MaybeError String w editor. This may be useful when working directly on a custom leaf editor, although to be honest I just didn't think about the signature when I added it.

More importantly the behaviour is different: the first will set only error icons, while the second creates an editor that always has an icon and is more like the generic editors in its behaviour: when the value is valid a success icon; when the value is invalid but untouched an info icon; otherwise an error icon. The behaviour of the first is useful to avoid having an enormous amount of icons. However, when there is content right of the editor it is UI-wise better to always show an icon to avoid moving that content when adding/removing the icon. So I think it would be nice to have both behaviours available, but it is not clear from the signatures which function has which behaviour.

Can we try to synchronize these two (and withDynamicHintAttributes as well)? Perhaps with an option parameter to withDynamicHintAttributesWithError:

:: DynamicTooltipOptions
    = OnlyErrorTooltip
    | AllTooltips !String // The string is a description of the type, for in the success and info tooltip

withDynamicHintAttributesWithError :: !DynamicTooltipOptions !(Editor r (MaybeError String w)) -> Editor r (?w)
mapEditorWriteError :: !DynamicTooltipOptions !(wb -> MaybeErrorString w) !(Editor r wb) -> Editor r (?w)

(At this point mapEditorWriteError would be a simple wrapper around mapEditorWrite and withDynamicHintAttributesWithError.)

There are of course other ways to encode the options, e.g.:

:: DynamicTooltipOption
    | AllTooltips
    | NoInfoTooltip | NoSuccessTooltip | NoErrorTooltip
    | OnlyInfoTooltip | OnlySuccessTooltip | OnlyErrorTooltip
    | TypeDescription !String

withDynamicHintAttributesWithError :: ![DynamicTooltipOption] !(Editor r (MaybeError String w)) -> Editor r (?w)

This particular one seems overly complicated to me though.

@baslijns @smichels

(Side note: if we're going to change the type of withDynamicHintAttributes(WithError) that may also be a good moment to rename it to use Tooltip instead of Hint (!510 (merged)). I think we can also drop Dynamic and Attributes: withTooltips(WithError).)

Edited Dec 10, 2020 by Camil Staps
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: clean-and-itasks/iTasks-SDK#427