mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 10:23:54 +00:00
feat: UI access for custom views (#2020)
* style: consistent casing on menu * refactor: bundle demo from code * feat: allow uploading custom views
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import { writeFile } from 'node:fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
import { defaultCss } from '../src/user/styles/bundledCss';
|
||||
|
||||
/**
|
||||
* Script to write contents of bundledCss to override.css
|
||||
*/
|
||||
async function bundleCss() {
|
||||
try {
|
||||
const stylesDir = path.resolve(process.cwd(), 'src', 'user', 'styles');
|
||||
const cssFile = path.resolve(stylesDir, 'override.css');
|
||||
|
||||
await writeFile(cssFile, defaultCss, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
console.error('Failed writing to CSS file: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
bundleCss();
|
||||
@@ -0,0 +1,31 @@
|
||||
import path from 'path';
|
||||
|
||||
import { defaultCss } from '../src/bundle/bundledCss';
|
||||
import { defaultDemoHtml } from '../src/bundle/bundledDemoHtml';
|
||||
import { defaultTranslation } from '../src/bundle/bundledTranslations';
|
||||
import { ensureDirectory, writeToFile } from '../src/utils/fileManagement';
|
||||
|
||||
const srcDir = path.resolve(process.cwd(), 'src');
|
||||
|
||||
const bundles = [
|
||||
{ file: path.resolve(srcDir, 'user', 'styles', 'override.css'), content: defaultCss, label: 'CSS' },
|
||||
{
|
||||
file: path.resolve(srcDir, 'user', 'translations', 'translations.json'),
|
||||
content: defaultTranslation,
|
||||
label: 'Translation',
|
||||
},
|
||||
{ file: path.resolve(srcDir, 'external', 'demo', 'index.html'), content: defaultDemoHtml, label: 'Demo HTML' },
|
||||
];
|
||||
|
||||
async function bundleDefaults() {
|
||||
for (const { file, content, label } of bundles) {
|
||||
try {
|
||||
ensureDirectory(path.dirname(file));
|
||||
await writeToFile(file, content, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
console.error(`Failed writing ${label} file: `, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bundleDefaults();
|
||||
@@ -1,20 +0,0 @@
|
||||
import { writeFile } from 'node:fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
import { defaultTranslation } from '../src/user/translations/bundledTranslations.js';
|
||||
|
||||
/**
|
||||
* Script to write contents of default translation to translation.json
|
||||
*/
|
||||
async function bundleTranslation() {
|
||||
try {
|
||||
const translationDir = path.resolve(process.cwd(), 'src', 'user', 'translations');
|
||||
const translationsFile = path.resolve(translationDir, 'translations.json');
|
||||
|
||||
await writeFile(translationsFile, defaultTranslation, { encoding: 'utf8' });
|
||||
} catch (error) {
|
||||
console.error('Failed writing to translations file: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
bundleTranslation();
|
||||
Reference in New Issue
Block a user