mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: homepage
This commit is contained in:
1 parent
1d44ecab18
commit
d9688f6051
18 files changed
+303
-153
No files matched your search
@@ -1,19 +1,17 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { assertSecret, DEFAULT_LOCALE, localizedStrings } from '@blitzkit/core';
|
||||
|
||||
const BRANCH_NAMES: Record<string, string> = {
|
||||
dev: 'beta',
|
||||
opentest: 'opentest',
|
||||
preview: 'preview',
|
||||
};
|
||||
|
||||
export function resolveBranchName() {
|
||||
export function resolveBranchName(locale = DEFAULT_LOCALE) {
|
||||
const strings = localizedStrings[locale];
|
||||
const secret = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH);
|
||||
|
||||
if (
|
||||
assertSecret(import.meta.env.MODE) === 'development' &&
|
||||
secret === 'dev'
|
||||
) {
|
||||
return 'dev';
|
||||
return strings.common.branches.local;
|
||||
} else {
|
||||
return BRANCH_NAMES[secret] as string | undefined;
|
||||
return (strings.common.branches as Record<string, string>)[secret] as
|
||||
| string
|
||||
| undefined;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { DEFAULT_LOCALE, localizedStrings } from '@blitzkit/core';
|
||||
|
||||
export function getStrings(locale: string = DEFAULT_LOCALE) {
|
||||
return localizedStrings[locale];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export function literals(string: string, literals: string[]) {
|
||||
return literals.reduce((accumulator, literal, index) => {
|
||||
return accumulator.replace(`%s${index + 1}`, literal);
|
||||
}, string);
|
||||
}
|
||||
Reference in new issue
Block a user