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

GUI Module #4463

Open
johnbotris opened this issue Aug 4, 2022 · 2 comments
Open

GUI Module #4463

johnbotris opened this issue Aug 4, 2022 · 2 comments
Assignees
Labels
maintenance dependency updates, key renewals, code cleanup

Comments

@johnbotris
Copy link
Contributor

johnbotris commented Aug 4, 2022

As part of our goal of extracting parts of the code base to improve code sharing (see: #3194) We want to create a module for base GUI components.

This should mostly be moving the contents of src/gui/base into it's own module.

Things to consider as part of this:

  • all global singletons need to be not referenced from these components (namely: styles, theme, sizes, lang, but also others)
    • Some ideas for dealing with lang
      • pass in only resolved strings rather than translation keys to base components, pass in date formatters. This could lead to lots of annoying boilerplate
      • define a global interface (TextProvider and Formatter or something). GUI module expects some global singleton to be defined which implements the interface, and the implementation is done by the app. (would reduce the boilerplate and amount of changes done during the implementation, but we would have to define the interface in both the main and admin clients (probably not a huge problem)
    • theme, sizes, styles might be made obsolete by Use css variables instead of generating CSS #4215
    • any other model singletons just need to be replaced with injection (no need for new interfaces, just pass in whatever data was required from them in the first place)
  • Look around for other good base component candidates that might no be in src/gui/base
  • Update the Icon code generator in the next repo
  • Consider UI component cleanup #2559, some improvements might fall out in the process
@johnbotris johnbotris added the maintenance dependency updates, key renewals, code cleanup label Aug 4, 2022
@johnbotris johnbotris added this to the Technical tasks milestone Aug 4, 2022
@charlag
Copy link
Contributor

charlag commented Aug 8, 2022

While I think CSS variables would be even better (hopefully not slower) I think some singletons don't even hurt that much. styles, theme, sizes can all just live in GUI module. We did the same with crypto and randomizer where it arguably makes even less sense.

I think providing some translation provider to the GUI module during init is also a good idea.

@charlag
Copy link
Contributor

charlag commented Mar 23, 2023

A bit on how themes can be injected into gui library:
https://mui.com/joy-ui/customization/approaches/

@rezbyte rezbyte self-assigned this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance dependency updates, key renewals, code cleanup
Projects
None yet
Development

No branches or pull requests

3 participants