fix: bundle translations

This commit is contained in:
Carlos Valente
2025-09-03 17:09:28 +02:00
committed by Carlos Valente
parent 8d2d8ef979
commit ec1df8b958
6 changed files with 12 additions and 79 deletions
+4
View File
@@ -34,6 +34,10 @@ e2e/tests/fixtures/tmp/*
build/
dist/
# bundled assets
translations.json
override.css
# working stuff
**/TODO.md
+2 -1
View File
@@ -121,7 +121,8 @@
"from": "../server/src/user/",
"to": "extraResources/user/",
"filter": [
"**/*"
"**/*",
"*{.ts}"
]
}
]
+2 -6
View File
@@ -1,8 +1,8 @@
import { existsSync } from 'fs';
import { writeFile } from 'node:fs/promises';
import { defaultCss } from '../src/user/styles/bundledCss';
import path from 'path';
import { defaultCss } from '../src/user/styles/bundledCss';
/**
* Script to write contents of bundledCss to override.css
*/
@@ -11,10 +11,6 @@ async function bundleCss() {
const stylesDir = path.resolve(process.cwd(), 'src', 'user', 'styles');
const cssFile = path.resolve(stylesDir, 'override.css');
if (!existsSync(cssFile)) {
throw new Error('File does not exist');
}
await writeFile(cssFile, defaultCss, { encoding: 'utf8' });
} catch (error) {
console.error('Failed writing to CSS file: ', error);
+2 -6
View File
@@ -1,8 +1,8 @@
import { existsSync } from 'fs';
import { writeFile } from 'node:fs/promises';
import { defaultTranslation } from '../src/user/translations/bundledTranslation';
import path from 'path';
import { defaultTranslation } from '../src/user/translations/bundledTranslations.js';
/**
* Script to write contents of default translation to translation.json
*/
@@ -11,10 +11,6 @@ async function bundleTranslation() {
const translationDir = path.resolve(process.cwd(), 'src', 'user', 'translations');
const translationsFile = path.resolve(translationDir, 'translations.json');
if (!existsSync(translationsFile)) {
throw new Error('File does not exist');
}
await writeFile(translationsFile, defaultTranslation, { encoding: 'utf8' });
} catch (error) {
console.error('Failed writing to translations file: ', error);
+2
View File
@@ -53,6 +53,8 @@ export function getAppDataPath(): string {
* │ │ ├─ override.css
* │ ├─ logo/
* │ │ ├─ logo.png
* │ ├─ translations/
* │ │ ├─ translations.json
*/
/** resolve file URL in both CJS and ESM (build and dev) */
-66
View File
@@ -1,66 +0,0 @@
/**
* This CSS file allows user customisation of the UI
* We expose some CSS properties to facilitate this (see below in :root)
* In the cases where this is missing, you can add your selectors here
*/
:root {
/** Background colour for the views */
--background-color-override: #ececec;
/** Main text colour for the views */
--color-override: #101010;
/** Text colour for the views */
--secondary-color-override: #404040;
/** Accent text colour, used on active elements */
--accent-color-override: #fa5656;
/** Label text colour, used on active elements */
--label-color-override: #6c6c6c;
/** Timer text colour */
--timer-color-override: #202020;
--timer-warning-color-override: #ffbc56;
--timer-danger-color-override: #e69000;
--timer-overtime-color-override: #fa5656;
--timer-pending-color-override: #578AF4;
/** Background for card elements on background */
--card-background-color-override: #fff;
/** Font used for all text in views */
--font-family-override: 'Open Sans';
/** Colour used for external message and aux timer in /timer */
--external-color-override: #161616;
/** View specific features: /backstage */
/** ---- Background highlight for blink behaviour */
--card-background-color-blink-override: #339e4e;
/** ---- Colour used for progress bar background */
--timer-progress-bg-override: #fff;
/** ---- Colour used for progress bar progress */
--timer-progress-override: #202020;
/** View specific features: /op */
--operator-customfield-font-size-override: 1.25rem;
--operator-running-bg-override: #339e4e;
/** View specific features: /studio */
--studio-active: #101010;
--studio-idle: #cfcfcf;
--studio-active-label: #101010;
--studio-idle-label: #595959;
--studio-overtime: #101010;
}
/**
* You can inspect the page in your browser and add the selectors here.
* In the below example, we change the colour of the overlay message in the stage-timer view.
*/
.stage-timer > .message-overlay--active > div {
color: red;
}