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

Configurable styles #1953

Merged
merged 70 commits into from Sep 8, 2023
Merged

Configurable styles #1953

merged 70 commits into from Sep 8, 2023

Conversation

TheSlimvReal
Copy link
Collaborator

@TheSlimvReal TheSlimvReal commented Aug 1, 2023

see issue: #1949

Generally it is possible to use CSS variables to change the theme colors as well as the font family/style etc.

Colors

Here we have to assign a variable to each hue which is a bit cumbersome and also raises the question, how these values are generated (probably a user would just want to choose one color and all others should be derived from it).
To pick the colors according to an Material Design Color Palette is also not super straight forward.
There is no official API but some reverse engineered solutions (thread, solution 1 (npm package), solution 2 (newer npm package), solution 3 (code snippet)).
Alternatively, we could refer to a tool like this and allow user to copy paste the result from it.

Fonts

Changing the font works just like changing the colors but is much easier as we only need one variable for the font family.
The problem is where do we get the fonts from (dynamically)?
Most pages and the Angular Material docs use the Google Fonts API, which is however not GDPR compliant (IP is sent to Google).
We either have to download the fonts beforehand and include them statically which may result in outdated fonts and also reduces flexibility or use a nginx reverse proxy which which also doesn't seem to be the best idea (see this thread).
I would therefore recommend not to allow choosing a different font (I have never seen a website that allows to change a font).

Migration

  • existing site settings in Config entity need to be migrated to own entity -> Site settings migration ndb-admin#5
  • Existing default/user_app permissions need to be extended with read permissions for SiteSettings entity and manager permissions with update

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

Deployed to https://pr-1953.aam-digital.net/

@TheSlimvReal TheSlimvReal linked an issue Aug 1, 2023 that may be closed by this pull request
7 tasks
Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work overall :-)

Regarding style I notice that our accented buttons (primary action bottom right; Save buttons) now have black text/icons with, I think, a bit less contrast.

src/app/core/site-settings/site-settings.service.ts Outdated Show resolved Hide resolved
src/app/core/site-settings/site-settings.ts Outdated Show resolved Hide resolved
src/app/core/site-settings/site-settings.service.ts Outdated Show resolved Hide resolved
src/app/core/site-settings/site-settings.ts Show resolved Hide resolved
src/app/core/site-settings/site-settings.ts Outdated Show resolved Hide resolved
src/app/core/site-settings/site-settings.ts Outdated Show resolved Hide resolved
# Conflicts:
#	src/app/child-dev-project/children/child-block/child-block.component.html
#	src/app/core/analytics/analytics.service.ts
#	src/app/core/entity-components/entity-utils/dynamic-form-components/edit-photo/edit-photo.component.html
#	src/app/core/language/language.service.ts
#	src/app/core/ui/ui/ui.component.html
#	src/app/core/ui/ui/ui.component.ts
#	src/app/features/location/map-utils.ts
#	src/index.html
#	src/styles/themes/ndb-theme.scss
#	src/styles/variables/_ndb-light-theme.scss
@sleidig sleidig linked an issue Aug 17, 2023 that may be closed by this pull request
A200: var(--primary-A200, map-get(mat.$orange-palette, A200)),
A400: var(--primary-A400, map-get(mat.$orange-palette, A400)),
A700: var(--primary-A700, map-get(mat.$orange-palette, A700)),
contrast: map-get(mat.$orange-palette, contrast)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contrast colors are not configurable and not adjusted based on the selected theme.

@TheSlimvReal TheSlimvReal marked this pull request as ready for review August 28, 2023 10:48
@TheSlimvReal
Copy link
Collaborator Author

Should we also store the settings in the local storage in order to already apply them on startup?

Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the import module still has an orange background in some part. Otherwise looks and works great. Code also looks pretty good.

Great work, @TheSlimvReal ! :-)

src/app/core/site-settings/site-settings.ts Outdated Show resolved Hide resolved
src/app/core/analytics/analytics.service.spec.ts Outdated Show resolved Hide resolved
src/app/core/config/config-fix.ts Outdated Show resolved Hide resolved
src/app/core/entity/latest-entity.ts Outdated Show resolved Hide resolved
translationService.initDefaultLanguage();
// Making locales enum available at runtime
enumService["cacheEnum"](availableLocales);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks dangerous to me ... but I can't think of another solution that is anywhere close to being that simple 🤔

src/app/core/site-settings/site-settings.service.ts Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug B 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested, cleaned up and reviewed

@sleidig sleidig merged commit 5bc0b08 into master Sep 8, 2023
8 of 11 checks passed
@sleidig sleidig deleted the configurable_styles branch September 8, 2023 12:21
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.24.0-master.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

sleidig added a commit that referenced this pull request Sep 13, 2023
this enables user-configured "white-label" design of the system in custom colors
MIGRATION NECESSARY: see PR #1953
closes #1949

---------
This functionality has been developed for the project “codo”.
codo is developed under the projects “Landungsbrücken – Patenschaften in Hamburg stärken” and “openTransfer Patenschaften”. It is funded through the program “Menschen stärken Menschen” by the German Federal Ministry of Family Affairs, Senior Citizens, Women and Youth.
More information at https://github.com/codo-mentoring

“Landungsbrücken – Patenschaften in Hamburg stärken” is a project of BürgerStiftung Hamburg in cooperation with the Mentor.Ring Hamburg. With a mix of networking opportunities, capacity building and financial support the project strengthens Hamburg’s scene of mentoring projects since its founding in 2016.

The “Stiftung Bürgermut” foundation since 2007 supports the digital and real exchange of experiences and connections of active citizens. Within the federal program “Menschen stärken Menschen” the foundation as part of its program “openTransfer Patenschaften” offers support services for connecting, spreading and upskilling mentoring organisations across Germany.


Diese Funktion wurde entwickelt für das Projekt codo.
codo wird entwickelt im Rahmen der Projekte Landungsbrücken – Patenschaften in Hamburg stärken und openTransfer Patenschaften. Er ist gefördert durch das Bundesprogramm Menschen stärken Menschen des Bundesministeriums für Familie, Senioren, Frauen und Jugend.
Mehr Informationen unter https://github.com/codo-mentoring

“Landungsbrücken – Patenschaften in Hamburg stärken” ist ein Projekt der BürgerStiftung Hamburg in Kooperation mit dem Mentor.Ring Hamburg. Mit einer Mischung aus Vernetzungsangeboten, Qualifizierungsmaßnahmen und finanzieller Förderung stärkt das Projekt die Hamburger Szene der Patenschaftsprojekte seit der Gründung im Jahr 2016.

Die Stiftung Bürgermut fördert seit 2007 den digitalen und realen Erfahrungsaustausch und die Vernetzung von engagierten Bürger:innen. Innerhalb des Bundesprogramms „Menschen stärken Menschen” bietet die Stiftung im Rahmen ihres Programms openTransfer Patenschaften Unterstützungsleistungen zur Vernetzung, Verbreitung und Qualifizierung von Patenschafts- und Mentoringorganisationen bundesweit.

Co-authored-by: codo-mentoring <117934638+codo-mentoring@users.noreply.github.com>
Co-authored-by: Sebastian <sebastian@aam-digital.com>
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.

Allow users to upload their own organisation logo Configurable styling of platform (white-labeling)
3 participants