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

feat: support light/dark background branding #298

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,18 @@ value in the `BENTOV2_AUTH_CLIENT_ID` environment variable. On local instances,
this is set to `local_bentov2` by default.


## 7. *Production only:* set up translations for Bento-Public
## 7. *Production only:* set up translations and branding

Now that Bento Public has been initialized by either `./bentoctl.bash init-all` or `./bentoctl.bash init-web public`,
adjust the default translation set as necessary:
Now that Bento Public and Web have been initialized by either `./bentoctl.bash init-all` or
`./bentoctl.bash init-web <public|web>`, translation files and branding (logos) can be configured as necessary.

**For branding (logos)**, copy files to the following paths:

* A logo which works on dark backgrounds should be placed at `lib/public/branding.png` and `lib/web/branding.png`.
* A logo which works on light backgrounds should be placed at `lib/public/branding.lightbg.png`. This is primarily
useful for Beacon Network.

**For translations** (which apply only to Bento Public), adjust the default translation set as necessary:

```js
// lib/public/translations/<en|fr>.json
Expand Down
26 changes: 26 additions & 0 deletions docs/migrating_to_18.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# Migrating to Bento v18

TODO


## 1. Stop and update services

```bash
./bentoctl.bash stop
./bentoctl.bash pull
```


## 2. Set up light and dark-background branding for Bento Public

* Make sure `lib/public/branding.png` and `lib/web/branding.png` are images which work on dark backgrounds.
* **If you have a light-background logo to add:** put this file at `lib/public/branding.lightbg.png`.
* **If you do not have a light-background logo:** run `./bentoctl.bash init-web public` to copy the Bento logo to the
above location, or copy `branding.png` to `branding.lightbg.png`


TODO


## TODO. Restart services

```bash
./bentoctl.bash start
```
File renamed without changes
1 change: 1 addition & 0 deletions lib/public/docker-compose.public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- ${PWD}/lib/public/fr_about.html:/bento-public/dist/public/fr_about.html:ro

- ${PWD}/lib/public/branding.png:/bento-public/dist/public/assets/branding.png:ro
- ${PWD}/lib/public/branding.lightbg.png:/bento-public/dist/public/assets/branding.lightbg.png:ro
healthcheck:
test: [ "CMD", "curl", "http://localhost:${BENTO_PUBLIC_INTERNAL_PORT}/service-info" ]
timeout: ${BENTO_HEALTHCHECK_TIMEOUT}
Expand Down
21 changes: 15 additions & 6 deletions py_bentoctl/other_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def init_web(service: str, force: bool):

def _init_web_public(force: bool):
root_path = pathlib.Path.cwd()
etc_path = root_path / "etc"

# Init lib dir
public_path = (root_path / "lib" / "public")
Expand All @@ -46,33 +47,41 @@ def _init_web_public(force: bool):

# About html page (English)
_file_copy(
(root_path / "etc" / "default.en_about.html"),
(etc_path / "default.en_about.html"),
(public_path / "en_about.html"),
force=force,
)

# About html page (French)
_file_copy(
(root_path / "etc" / "default.fr_about.html"),
(etc_path / "default.fr_about.html"),
(public_path / "fr_about.html"),
force=force,
)

# Branding image
# - dark background / default
_file_copy(
(root_path / "etc" / "default.public.branding.png"),
(etc_path / "default.branding.png"),
(public_path / "branding.png"),
force=force,
)
# - light background
_file_copy(
(etc_path / "default.branding.lightbg.png"),
(public_path / "branding.lightbg.png"),
force=force,
)

# English translations
_file_copy(
(root_path / "etc" / "templates" / "translations" / "en.example.json"),
(etc_path / "templates" / "translations" / "en.example.json"),
(translation_path / "en.json"),
force=force,
)
# French translations
_file_copy(
(root_path / "etc" / "templates" / "translations" / "fr.example.json"),
(etc_path / "templates" / "translations" / "fr.example.json"),
(translation_path / "fr.json"),
force=force,
)
Expand All @@ -99,7 +108,7 @@ def _init_web_private(force: bool):
web_path = (root_path / "lib" / "web")
web_path.mkdir(parents=True, exist_ok=True)

src_branding = (root_path / "etc" / "default.branding.png")
src_branding = (root_path / "etc" / "default.branding.darkbg.png")
dst_branding = (web_path / "branding.png")

if dst_branding.is_file():
Expand Down
Loading