mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
branch names
This commit is contained in:
1 parent
c5bb537bf2
commit
5bda754b6e
10 files changed
+22
-124
No files matched your search
@@ -12,7 +12,7 @@ export interface Props {
|
||||
}
|
||||
|
||||
const gameDefinitions = await api.gameDefinitions();
|
||||
const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_BRANCH);
|
||||
const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT);
|
||||
const { locale } = Astro.props;
|
||||
const strings = getStrings(locale);
|
||||
---
|
||||
@@ -135,7 +135,7 @@ const strings = getStrings(locale);
|
||||
<Flex direction="column" gap="1" flexGrow="1" flexBasis="0" align="end">
|
||||
<Text size="2" color="gray">BlitzKit</Text>
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH !== "preview" && (
|
||||
environment !== "preview" && (
|
||||
<Text size="2" color="gray">
|
||||
WoTB
|
||||
</Text>
|
||||
@@ -149,14 +149,14 @@ const strings = getStrings(locale);
|
||||
{packageJson.version}
|
||||
</Code>
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH !== "preview" && (
|
||||
environment !== "preview" && (
|
||||
<Code size="2" color="gray">
|
||||
{gameDefinitions.version}
|
||||
</Code>
|
||||
)
|
||||
}
|
||||
<Code size="2" color="gray">
|
||||
{PUBLIC_ASSET_BRANCH}
|
||||
{environment}
|
||||
</Code>
|
||||
</Flex>
|
||||
</Flex>
|
||||
@@ -168,7 +168,7 @@ const strings = getStrings(locale);
|
||||
</Code>
|
||||
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH !== "preview" && (
|
||||
environment !== "preview" && (
|
||||
<>
|
||||
<Text size="2" color="gray">
|
||||
WoTB
|
||||
@@ -182,7 +182,7 @@ const strings = getStrings(locale);
|
||||
|
||||
<Text size="2" color="gray">CDN</Text>
|
||||
<Code size="2" color="gray">
|
||||
{PUBLIC_ASSET_BRANCH}
|
||||
{environment}
|
||||
</Code>
|
||||
</Flex>
|
||||
</Flex>
|
||||
@@ -5,7 +5,7 @@ import { Button, Code, Flex, Link, Text } from "@radix-ui/themes";
|
||||
export function Plugs() {
|
||||
const promoteOpentest =
|
||||
assertSecret(import.meta.env.PUBLIC_PROMOTE_OPENTEST) === "true" &&
|
||||
assertSecret(import.meta.env.PUBLIC_BRANCH) !== "opentest";
|
||||
assertSecret(import.meta.env.PUBLIC_ENVIRONMENT) !== "opentest";
|
||||
const promotions = [promoteOpentest];
|
||||
|
||||
if (promotions.every((promotion) => !promotion)) return null;
|
||||
|
||||
@@ -15,7 +15,7 @@ const tankDefinitions = await api.tankDefinitions();
|
||||
export function CalloutsSection() {
|
||||
const tank = Duel.use((state) => state.protagonist.tank);
|
||||
const promoteAeson =
|
||||
assertSecret(import.meta.env.PUBLIC_BRANCH) === "preview";
|
||||
assertSecret(import.meta.env.PUBLIC_ENVIRONMENT) === "preview";
|
||||
|
||||
useEffect(() => {
|
||||
TankopediaPersistent.mutate((draft) => {
|
||||
|
||||
@@ -3,19 +3,12 @@ import { STRINGS } from "@blitzkit/i18n";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
|
||||
export function resolveBranchName(locale: string = locales.default) {
|
||||
if (!(locale in STRINGS)) throw new Error(`Unsupported locale: ${locale}`);
|
||||
|
||||
const strings = STRINGS[locale];
|
||||
const secret = assertSecret(import.meta.env.PUBLIC_BRANCH);
|
||||
const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT);
|
||||
|
||||
if (
|
||||
assertSecret(import.meta.env.MODE) === "development" &&
|
||||
secret === "dev"
|
||||
) {
|
||||
return strings.common.branches.local;
|
||||
} else {
|
||||
return (strings.common.branches as Record<string, string>)[secret] as
|
||||
| string
|
||||
| undefined;
|
||||
}
|
||||
if (environment === "production") return undefined;
|
||||
|
||||
return strings.common.branches[
|
||||
environment as keyof typeof strings.common.branches
|
||||
];
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import { getStaticPaths as _getStaticPaths } from "../_index";
|
||||
|
||||
const MAX_TOOLS_PER_ROW = 2;
|
||||
|
||||
const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_BRANCH);
|
||||
const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT);
|
||||
const { locale } = Astro.props;
|
||||
const strings = getStrings(locale);
|
||||
const rows: Tool[][] = [];
|
||||
@@ -88,7 +88,7 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => {
|
||||
<Plugs client:idle />
|
||||
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH === "preview" && (
|
||||
environment === "preview" && (
|
||||
<Flex justify="center" my="8" px="4">
|
||||
<AesonPlug />
|
||||
</Flex>
|
||||
|
||||
Reference in new issue
Block a user