mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: prep builder
This commit is contained in:
1 parent
8373fb1b7a
commit
8c14c3d093
20 files changed
+45
-422
No files matched your search
@@ -1,12 +1,13 @@
|
||||
import { assertSecret } from './assertSecret';
|
||||
|
||||
const repo = assertSecret(import.meta.env.PUBLIC_ASSET_REPO);
|
||||
const branch = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH);
|
||||
const fastUser = assertSecret(import.meta.env.PUBLIC_ASSET_FAST_USER);
|
||||
const fastRepo = assertSecret(import.meta.env.PUBLIC_ASSET_FAST_REPO);
|
||||
|
||||
export function asset(path: string) {
|
||||
return branch === 'main'
|
||||
? `https://${fastUser}.github.io/${fastRepo}/${path}`
|
||||
: `https://raw.githubusercontent.com/${repo}/${branch}/${path}`;
|
||||
return assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH) === 'main'
|
||||
? `https://${assertSecret(
|
||||
import.meta.env.PUBLIC_ASSET_FAST_USER,
|
||||
)}.github.io/${assertSecret(
|
||||
import.meta.env.PUBLIC_ASSET_FAST_REPO,
|
||||
)}/${path}`
|
||||
: `https://raw.githubusercontent.com/${assertSecret(
|
||||
import.meta.env.PUBLIC_ASSET_REPO,
|
||||
)}/${assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH)}/${path}`;
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
// @ts-check
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
import react from '@astrojs/react';
|
||||
|
||||
export default defineConfig({
|
||||
integrations: [react()],
|
||||
integrations: [react(), sitemap()],
|
||||
devToolbar: { enabled: false },
|
||||
outDir: '../../dist/website',
|
||||
|
||||
prefetch: true,
|
||||
site: 'https://blitzkit.app',
|
||||
});
|
||||
@@ -5,7 +5,8 @@
|
||||
"dev": "astro dev",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
"astro": "astro",
|
||||
"lint": "astro check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/partytown": "^2.1.4",
|
||||
@@ -23,6 +24,7 @@
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/react": "^19.1.5",
|
||||
"@types/react-dom": "^19.1.5",
|
||||
"@types/semver": "^7.7.0",
|
||||
"@types/three": "^0.160.0",
|
||||
"astro": "^5.8.0",
|
||||
"immer": "^10.1.1",
|
||||
@@ -31,6 +33,7 @@
|
||||
"minimatch": "^10.0.1",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"semver": "^7.7.2",
|
||||
"three": "^0.169.0",
|
||||
"zustand": "^4.5.5"
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export function Checks({ localeData }: LocaleAcceptorProps) {
|
||||
* Wargaming: 14 (refresh: 7)
|
||||
*/
|
||||
function Content() {
|
||||
const localeData = useLocale();
|
||||
const { locale } = useLocale();
|
||||
const logins = App.use((state) => state.logins);
|
||||
const mutateApp = App.useMutation();
|
||||
const appStore = App.useStore();
|
||||
@@ -128,17 +128,11 @@ function Content() {
|
||||
<Text>
|
||||
This website utilizes cookies to perform analytics and personalize
|
||||
your experience. You can learn more through{' '}
|
||||
<LinkI18n
|
||||
localeData={localeData}
|
||||
href="/docs/legal/privacy-policy"
|
||||
>
|
||||
<LinkI18n locale={locale} href="/docs/legal/privacy-policy">
|
||||
our privacy policy
|
||||
</LinkI18n>
|
||||
. By using BlitzKit, you also agree to our{' '}
|
||||
<LinkI18n
|
||||
localeData={localeData}
|
||||
href="/docs/legal/terms-of-service"
|
||||
>
|
||||
<LinkI18n locale={locale} href="/docs/legal/terms-of-service">
|
||||
terms of service
|
||||
</LinkI18n>
|
||||
.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
---
|
||||
import { assertSecret, fetchGameDefinitions } from '@blitzkit/core';
|
||||
import { Box, Code, Flex, Heading, Link, Text } from '@radix-ui/themes';
|
||||
import packageJson from '../../../../package.json';
|
||||
import { getStrings } from '../core/i18n/getStrings';
|
||||
@@ -10,8 +9,6 @@ interface Props {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const gameDefinitions = await fetchGameDefinitions();
|
||||
const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH);
|
||||
const { locale } = Astro.props;
|
||||
const localeData = { locale };
|
||||
const strings = await getStrings(locale);
|
||||
@@ -83,7 +80,7 @@ const strings = await getStrings(locale);
|
||||
sm: 'start',
|
||||
}}
|
||||
>
|
||||
<LinkI18n {localeData} href="/docs/about/credits" color="gray">
|
||||
<LinkI18n {locale} href="/docs/about/credits" color="gray">
|
||||
{strings.website.footer.about.credits}
|
||||
</LinkI18n>
|
||||
<Link
|
||||
@@ -100,7 +97,7 @@ const strings = await getStrings(locale);
|
||||
>
|
||||
{strings.website.footer.about.github}
|
||||
</Link>
|
||||
<LinkI18n {localeData} href="/docs/patches" color="gray">
|
||||
<LinkI18n {locale} href="/docs/patches" color="gray">
|
||||
{strings.website.footer.about.patches}
|
||||
</LinkI18n>
|
||||
</Flex>
|
||||
@@ -120,14 +117,10 @@ const strings = await getStrings(locale);
|
||||
>
|
||||
<Heading size="3">{strings.website.footer.legal.title}</Heading>
|
||||
<Flex direction="column">
|
||||
<LinkI18n {localeData} href="/docs/legal/privacy-policy" color="gray">
|
||||
<LinkI18n {locale} href="/docs/legal/privacy-policy" color="gray">
|
||||
{strings.website.footer.legal.privacy}
|
||||
</LinkI18n>
|
||||
<LinkI18n
|
||||
{localeData}
|
||||
href="/docs/legal/terms-of-service"
|
||||
color="gray"
|
||||
>
|
||||
<LinkI18n {locale} href="/docs/legal/terms-of-service" color="gray">
|
||||
{strings.website.footer.legal.terms}
|
||||
</LinkI18n>
|
||||
</Flex>
|
||||
@@ -138,30 +131,12 @@ const strings = await getStrings(locale);
|
||||
<Flex gap="5" display={{ initial: 'flex', sm: 'none' }}>
|
||||
<Flex direction="column" justify="between" align="end">
|
||||
<Text size="2" color="gray">BlitzKit</Text>
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH !== 'preview' && (
|
||||
<Text size="2" color="gray">
|
||||
WoTB
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
<Text size="2" color="gray">CDN</Text>
|
||||
</Flex>
|
||||
|
||||
<Flex direction="column" justify="between" align="start">
|
||||
<Code size="2" color="gray">
|
||||
{packageJson.version}
|
||||
</Code>
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH !== 'preview' && (
|
||||
<Code size="2" color="gray">
|
||||
{gameDefinitions.version}
|
||||
</Code>
|
||||
)
|
||||
}
|
||||
<Code size="2" color="gray">
|
||||
{PUBLIC_ASSET_BRANCH}
|
||||
</Code>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -170,23 +145,5 @@ const strings = await getStrings(locale);
|
||||
<Code size="2" color="gray">
|
||||
{packageJson.version}
|
||||
</Code>
|
||||
|
||||
{
|
||||
PUBLIC_ASSET_BRANCH !== 'preview' && (
|
||||
<>
|
||||
<Text size="2" color="gray">
|
||||
WoTB
|
||||
</Text>
|
||||
<Code size="2" color="gray">
|
||||
{gameDefinitions.version}
|
||||
</Code>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
<Text size="2" color="gray">CDN</Text>
|
||||
<Code size="2" color="gray">
|
||||
{PUBLIC_ASSET_BRANCH}
|
||||
</Code>
|
||||
</Flex>
|
||||
</Flex>
|
||||
@@ -1,14 +1,12 @@
|
||||
import locales from '@blitzkit/i18n/locales.json' with { type: 'json' };
|
||||
import { Link, type LinkProps } from '@radix-ui/themes';
|
||||
import type { LocaleAcceptorProps } from '../hooks/useLocale';
|
||||
|
||||
export function LinkI18n({
|
||||
localeData,
|
||||
locale,
|
||||
href,
|
||||
...props
|
||||
}: LinkProps & LocaleAcceptorProps) {
|
||||
const prefix =
|
||||
localeData.locale === locales.default ? '' : `/${localeData.locale}`;
|
||||
}: LinkProps & { locale: string }) {
|
||||
const prefix = locale === locales.default ? '' : `/${locale}`;
|
||||
|
||||
return (
|
||||
<Link href={href?.startsWith('/') ? `${prefix}${href}` : href} {...props} />
|
||||
|
||||
@@ -18,7 +18,6 @@ export interface Props {
|
||||
}
|
||||
|
||||
const { integrated, locale } = Astro.props;
|
||||
const localeData = { locale };
|
||||
const toolsFiltered = tools.filter((tool) => tool.enabled);
|
||||
const branchName = resolveBranchName();
|
||||
const isBranchNamed = branchName !== undefined;
|
||||
@@ -107,7 +106,7 @@ const strings = await getStrings(locale);
|
||||
<Flex gap="4" direction="column" maxWidth="80rem" width="100%">
|
||||
<Flex align="center">
|
||||
<LinkI18n
|
||||
{localeData}
|
||||
{locale}
|
||||
color="gray"
|
||||
highContrast
|
||||
href="/"
|
||||
@@ -146,7 +145,7 @@ const strings = await getStrings(locale);
|
||||
|
||||
return (
|
||||
<LinkI18n
|
||||
{localeData}
|
||||
{locale}
|
||||
weight={selected ? 'medium' : 'regular'}
|
||||
color="gray"
|
||||
highContrast={selected}
|
||||
@@ -175,7 +174,7 @@ const strings = await getStrings(locale);
|
||||
</Link>
|
||||
|
||||
<LinkI18n
|
||||
{localeData}
|
||||
{locale}
|
||||
style={{ display: 'flex', alignContent: 'center' }}
|
||||
color="gray"
|
||||
href="/settings"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { CaretRightIcon } from '@radix-ui/react-icons';
|
||||
import { Box, Button, Code, Flex, Heading, Text } from '@radix-ui/themes';
|
||||
import { Box, Button, Flex, Heading, Text } from '@radix-ui/themes';
|
||||
import type { Tool } from '../constants/tools';
|
||||
import { getStrings } from '../core/i18n/getStrings';
|
||||
import { LinkI18n } from './LinkI18n';
|
||||
@@ -102,16 +101,7 @@ const toolStrings =
|
||||
size={{ initial: '3', sm: tool.significant ? '4' : '3' }}
|
||||
color="gray"
|
||||
>
|
||||
{
|
||||
disabled ? (
|
||||
<>
|
||||
Unavailable on{' '}
|
||||
<Code>{assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH)}</Code>
|
||||
</>
|
||||
) : (
|
||||
toolStrings.description
|
||||
)
|
||||
}
|
||||
{toolStrings.description}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { assertSecret } from 'packages/core/src';
|
||||
import { prerelease } from 'semver';
|
||||
import packageJSON from '../../../../../package.json';
|
||||
|
||||
export function resolveBranchName() {
|
||||
if (assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH) === 'main') {
|
||||
return undefined;
|
||||
}
|
||||
const components = prerelease(packageJSON.version);
|
||||
|
||||
return import.meta.env.PUBLIC_ASSET_BRANCH;
|
||||
if (components === null) return undefined;
|
||||
|
||||
return components[0];
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import { PageWrapper } from '../components/PageWrapper';
|
||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
||||
|
||||
const locale = locales.default;
|
||||
const localeData = { locale };
|
||||
---
|
||||
|
||||
<BaseLayout {locale}>
|
||||
@@ -16,7 +15,7 @@ const localeData = { locale };
|
||||
<Text color="gray">Where would you like to go?</Text>
|
||||
|
||||
<Flex mt="4" gap="2">
|
||||
<LinkI18n {localeData} href="/">
|
||||
<LinkI18n {locale} href="/">
|
||||
<Button>
|
||||
<HomeIcon /> Home
|
||||
</Button>
|
||||
|
||||
@@ -31,7 +31,7 @@ export function Page({ localeData }: LocaleAcceptorProps) {
|
||||
}
|
||||
|
||||
function Content() {
|
||||
const { gameStrings, strings } = useLocale();
|
||||
const { gameStrings } = useLocale();
|
||||
const groups = useMemo(() => {
|
||||
const avatars = allAvatars
|
||||
.map((id) => {
|
||||
|
||||
Reference in new issue
Block a user