mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 07:43:49 +01:00
migrated embed
This commit is contained in:
98 files changed
+1979
-1376
No files matched your search
@@ -0,0 +1,137 @@
|
||||
---
|
||||
import { CheckIcon, StarFilledIcon } from "@radix-ui/react-icons";
|
||||
import { Badge } from "../../../components/Badge";
|
||||
import ColorScale from "../../../components/ColorScale.astro";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
import type { Color } from "../../../ui/color";
|
||||
|
||||
export { getStaticPaths } from "./index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
|
||||
const variants = ["solid", "soft", "surface", "outline"] as const;
|
||||
const sizes = ["minor", "regular"] as const;
|
||||
const colors = [undefined, "gray", "red", "amber", "green"] as const;
|
||||
const iconLayouts = ["leading", "trailing", "both", "icon only"] as const;
|
||||
const extraColors = ["red", "amber", "green"] satisfies Color[];
|
||||
---
|
||||
|
||||
<BaseLayout accent="blue" {locale}>
|
||||
{
|
||||
extraColors.map((color) => (
|
||||
<>
|
||||
<ColorScale {color} />
|
||||
<ColorScale {color} alpha />
|
||||
</>
|
||||
))
|
||||
}
|
||||
|
||||
<div class="page">
|
||||
<h1>Badge</h1>
|
||||
|
||||
{
|
||||
sizes.map((size) => (
|
||||
<section>
|
||||
<h2>size="{size}"</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th />
|
||||
{variants.map((variant) => (
|
||||
<th>{variant}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{colors.map((color) => (
|
||||
<tr>
|
||||
<th>{color ?? "accent"}</th>
|
||||
{variants.map((variant) => (
|
||||
<td>
|
||||
<Badge {color} {variant} {size}>
|
||||
Badge
|
||||
</Badge>
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
))
|
||||
}
|
||||
|
||||
{
|
||||
sizes.map((size) => (
|
||||
<section>
|
||||
<h2>size="{size}" with icons</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th />
|
||||
{iconLayouts.map((layout) => (
|
||||
<th>{layout}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{variants.map((variant) => (
|
||||
<tr>
|
||||
<th>{variant}</th>
|
||||
|
||||
<td>
|
||||
<Badge {variant} {size}>
|
||||
<StarFilledIcon />
|
||||
Badge
|
||||
</Badge>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Badge {variant} {size}>
|
||||
Badge
|
||||
<CheckIcon />
|
||||
</Badge>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Badge {variant} {size}>
|
||||
<StarFilledIcon />
|
||||
Badge
|
||||
<CheckIcon />
|
||||
</Badge>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Badge {variant} {size}>
|
||||
<StarFilledIcon />
|
||||
</Badge>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</BaseLayout>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
padding: var(--space-7);
|
||||
}
|
||||
|
||||
table {
|
||||
border-spacing: var(--space-5) var(--space-4);
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
color: var(--gray-11);
|
||||
}
|
||||
</style>
|
||||
-16
@@ -1,5 +1,4 @@
|
||||
---
|
||||
import { AstroSeo } from "@astrolib/seo";
|
||||
import { readFile } from "fs/promises";
|
||||
import { mixStaticPaths } from "../../../../../../core/blitzkit/mixStaticPaths";
|
||||
import BaseLayout from "../../../../../../layouts/BaseLayout.astro";
|
||||
@@ -29,23 +28,8 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
});
|
||||
|
||||
const { content, locale } = Astro.props;
|
||||
|
||||
const title = content.split("\n")[0].replace("# ", "");
|
||||
---
|
||||
|
||||
<AstroSeo
|
||||
title={title}
|
||||
description={title}
|
||||
canonical={Astro.url.href}
|
||||
openGraph={{
|
||||
url: Astro.url.href,
|
||||
title,
|
||||
description: title,
|
||||
site_name: "BlitzKit",
|
||||
}}
|
||||
twitter={{ cardType: "summary_large_image" }}
|
||||
/>
|
||||
|
||||
<BaseLayout {locale}>
|
||||
<Page content={content} />
|
||||
</BaseLayout>
|
||||
@@ -1,10 +1,8 @@
|
||||
---
|
||||
import { AstroSeo } from "@astrolib/seo";
|
||||
import { MagicWandIcon, StarFilledIcon } from "@radix-ui/react-icons";
|
||||
import { Flex, Heading, Link } from "@radix-ui/themes";
|
||||
import { compareVersions } from "compare-versions";
|
||||
import { PageWrapper } from "../../../../../components/PageWrapper";
|
||||
import { getStrings } from "../../../../../core/i18n/getStrings";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../../index.astro";
|
||||
@@ -13,7 +11,6 @@ export { getStaticPaths } from "../../index.astro";
|
||||
const ROOT = "../../../../../../../../docs/changelogs/";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
const strings = getStrings(locale);
|
||||
const versions = Object.keys(
|
||||
import.meta.glob("../../../../../../../../docs/changelogs/*.md", {
|
||||
eager: true,
|
||||
@@ -24,19 +21,6 @@ const versions = Object.keys(
|
||||
.reverse();
|
||||
---
|
||||
|
||||
<AstroSeo
|
||||
title={strings.website.docs.patches.name}
|
||||
description={strings.website.docs.patches.seo_description}
|
||||
canonical={Astro.url.href}
|
||||
openGraph={{
|
||||
url: Astro.url.href,
|
||||
title: strings.website.docs.patches.name,
|
||||
description: strings.website.docs.patches.seo_description,
|
||||
site_name: "BlitzKit",
|
||||
}}
|
||||
twitter={{ cardType: "summary_large_image" }}
|
||||
/>
|
||||
|
||||
<BaseLayout {locale}>
|
||||
<PageWrapper align="center">
|
||||
<Heading mt="6" mb="4">BlitzKit patches</Heading>
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
---
|
||||
import { AstroSeo } from "@astrolib/seo";
|
||||
import { capitalize } from "lodash-es";
|
||||
import { embedConfigurations } from "../../../../../constants/embeds";
|
||||
import { mixStaticPaths } from "../../../../../core/blitzkit/mixStaticPaths";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
return Object.keys(embedConfigurations).map((embed) => ({
|
||||
params: { embed: embed as keyof typeof embedConfigurations },
|
||||
}));
|
||||
});
|
||||
|
||||
const name = capitalize(Astro.params.embed);
|
||||
const title = `BlitzKit - ${name} embed`;
|
||||
const description = `BlitzKit ${name} embeds for streaming World of Tanks Blitz with extreme customization`;
|
||||
const { locale } = Astro.props;
|
||||
---
|
||||
|
||||
<AstroSeo
|
||||
title={title}
|
||||
description={description}
|
||||
canonical={Astro.url.href}
|
||||
openGraph={{
|
||||
url: Astro.url.href,
|
||||
title,
|
||||
description,
|
||||
site_name: "BlitzKit",
|
||||
}}
|
||||
twitter={{ cardType: "summary_large_image" }}
|
||||
/>
|
||||
|
||||
<style is:global>
|
||||
@keyframes fade-out-border {
|
||||
from {
|
||||
outline: 1rem solid #ff0000ff;
|
||||
}
|
||||
to {
|
||||
outline: 0.75rem solid #ff000000;
|
||||
}
|
||||
}
|
||||
|
||||
.preview-container-animated {
|
||||
animation: fade-out-border 0.5s linear;
|
||||
}
|
||||
|
||||
.preview-container-animated:hover {
|
||||
outline: 1rem solid #ff000080;
|
||||
}
|
||||
</style>
|
||||
|
||||
<BaseLayout {locale}>
|
||||
<Page {locale} client:load embed={Astro.params.embed} />
|
||||
</BaseLayout>
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
.page {
|
||||
display: flex;
|
||||
gap: var(--space-4);
|
||||
|
||||
box-sizing: border-box;
|
||||
padding: var(--space-4);
|
||||
padding-left: 0;
|
||||
|
||||
@media screen and (max-width: 80rem) {
|
||||
padding-left: var(--space-4);
|
||||
}
|
||||
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
height: 100%;
|
||||
max-width: 20rem;
|
||||
}
|
||||
|
||||
.controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-bottom: var(--space-3);
|
||||
}
|
||||
|
||||
.exports {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3);
|
||||
|
||||
margin-bottom: var(--space-4);
|
||||
}
|
||||
|
||||
.customize {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.option {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
|
||||
.control {
|
||||
flex: 1;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
&[data-one-liner="true"] {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
|
||||
.control {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-pad="true"] {
|
||||
padding-bottom: var(--space-4);
|
||||
}
|
||||
}
|
||||
|
||||
.stage {
|
||||
flex: 1;
|
||||
|
||||
position: sticky;
|
||||
top: var(--space-4);
|
||||
|
||||
height: calc(100dvh - 2 * var(--space-4));
|
||||
}
|
||||
|
||||
.window {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
border-radius: var(--space-3);
|
||||
box-shadow: var(--shadow-subtle);
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
padding: var(--space-3);
|
||||
padding-left: var(--space-4);
|
||||
|
||||
background-color: var(--gray-2);
|
||||
}
|
||||
|
||||
.preview {
|
||||
flex: 1;
|
||||
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
+177
-205
@@ -6,8 +6,8 @@ import {
|
||||
TimerIcon,
|
||||
WidthIcon,
|
||||
} from "@radix-ui/react-icons";
|
||||
import { Box, Button, Flex, Heading, ScrollArea, Text } from "@radix-ui/themes";
|
||||
import { useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { Button } from "../../../../../components/Button";
|
||||
import { CopyButton } from "../../../../../components/CopyButton";
|
||||
import { Boolean } from "../../../../../components/Embeds/Boolean";
|
||||
import { Color } from "../../../../../components/Embeds/Color";
|
||||
@@ -21,19 +21,25 @@ import { Size } from "../../../../../components/Embeds/Size";
|
||||
import { SizeWithout0 } from "../../../../../components/Embeds/SizeWithout0";
|
||||
import { Slider } from "../../../../../components/Embeds/Slider";
|
||||
import { TextController } from "../../../../../components/Embeds/TextController";
|
||||
import { PageWrapper } from "../../../../../components/PageWrapper";
|
||||
import { Heading } from "../../../../../components/Heading";
|
||||
import { IconButton } from "../../../../../components/IconButton";
|
||||
import {
|
||||
Scroller,
|
||||
ScrollerOrientation,
|
||||
} from "../../../../../components/Scroller";
|
||||
import { Text } from "../../../../../components/Text";
|
||||
import {
|
||||
embedConfigurations,
|
||||
extractEmbedConfigDefaults,
|
||||
} from "../../../../../constants/embeds";
|
||||
import { NAVBAR_HEIGHT } from "../../../../../constants/navbar";
|
||||
import {
|
||||
LocaleProvider,
|
||||
useLocale,
|
||||
type LocaleAcceptorProps,
|
||||
} from "../../../../../hooks/useLocale";
|
||||
import { useStrings } from "../../../../../hooks/useStrings";
|
||||
import { EmbedState, type EmbedConfig } from "../../../../../stores/embedState";
|
||||
import { EmbedItemType } from "../../../../../stores/embedState/constants";
|
||||
import styles from "./_index.module.css";
|
||||
|
||||
export interface EmbedPreviewControllerProps {
|
||||
configKey: string;
|
||||
@@ -58,10 +64,10 @@ export function Page({ embed, locale }: PageProps & LocaleAcceptorProps) {
|
||||
function Content({ embed }: PageProps) {
|
||||
const config = embedConfigurations[embed] as EmbedConfig;
|
||||
const [backgroundImage, setBackgroundImage] = useState(
|
||||
"/assets/images/backgrounds/embed-default.webp",
|
||||
"/media/embed-default.webp",
|
||||
);
|
||||
const fileInput = useRef<HTMLInputElement>(null!);
|
||||
const { strings } = useLocale();
|
||||
const strings = useStrings();
|
||||
|
||||
useEffect(() => {
|
||||
fileInput.current = document.createElement("input");
|
||||
@@ -76,213 +82,179 @@ function Content({ embed }: PageProps) {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PageWrapper padding="0" maxWidth="104rem" color="red">
|
||||
<Flex>
|
||||
<ScrollArea
|
||||
scrollbars="vertical"
|
||||
style={{ height: "100%", maxWidth: 320 }}
|
||||
>
|
||||
<Flex direction="column" gap="2" p="4">
|
||||
<Import />
|
||||
<div className={styles.page}>
|
||||
<div className={styles.stage}>
|
||||
<div className={styles.window}>
|
||||
<div className={styles.toolbar}>
|
||||
<Text lowContrast>{strings.embed.preview.title}</Text>
|
||||
|
||||
<Heading>
|
||||
{strings.website.tools.embed.configuration.export.title}
|
||||
</Heading>
|
||||
<Text size="2" color="gray" mb="2">
|
||||
{strings.website.tools.embed.configuration.export.description}
|
||||
</Text>
|
||||
<Button
|
||||
variant="outline"
|
||||
color="gray"
|
||||
onClick={() => fileInput.current?.click()}
|
||||
>
|
||||
<ImageIcon />
|
||||
{strings.embed.preview.upload}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Flex mb="6" gap="2" wrap="wrap">
|
||||
<GenerateURL embed={embed} />
|
||||
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() =>
|
||||
"body { margin: 0; background-color: transparent; overflow: hidden; }"
|
||||
}
|
||||
>
|
||||
<CodeIcon />
|
||||
{strings.website.tools.embed.configuration.export.css}
|
||||
</CopyButton>
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() => `${EmbedState.state.width}`}
|
||||
>
|
||||
<WidthIcon />
|
||||
{strings.website.tools.embed.configuration.export.width}
|
||||
</CopyButton>
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() => `${EmbedState.state.height}`}
|
||||
>
|
||||
<HeightIcon />
|
||||
{strings.website.tools.embed.configuration.export.height}
|
||||
</CopyButton>
|
||||
<CopyButton variant="outline" copy={() => "1"}>
|
||||
<TimerIcon />
|
||||
{strings.website.tools.embed.configuration.export.framerate}
|
||||
</CopyButton>
|
||||
</Flex>
|
||||
|
||||
<Flex justify="between" align="center">
|
||||
<Heading>
|
||||
{strings.website.tools.embed.configuration.customize.title}
|
||||
</Heading>
|
||||
<Button
|
||||
color="red"
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
EmbedState.set(EmbedState.initial);
|
||||
}}
|
||||
>
|
||||
<ResetIcon />{" "}
|
||||
{strings.website.tools.embed.configuration.customize.reset}
|
||||
</Button>
|
||||
</Flex>
|
||||
<Text size="2" color="gray" mb="2">
|
||||
{strings.website.tools.embed.configuration.customize.description}
|
||||
</Text>
|
||||
|
||||
{Object.keys(config).map((configKey) => {
|
||||
const item = config[configKey];
|
||||
let control: ReactNode;
|
||||
let oneLiner = false;
|
||||
|
||||
switch (item.type) {
|
||||
case EmbedItemType.Boolean: {
|
||||
control = <Boolean configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Color: {
|
||||
control = <Color configKey={configKey} />;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Radius: {
|
||||
control = <Radius configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Size: {
|
||||
control = <Size configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.SizeWithout0: {
|
||||
control = <SizeWithout0 configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Slider: {
|
||||
control = <Slider configKey={configKey} config={item} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.String: {
|
||||
control = <TextController configKey={configKey} />;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.RichText: {
|
||||
control = <RichText configKey={configKey} />;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Enum: {
|
||||
control = <Enum configKey={configKey} config={item} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Flex
|
||||
key={configKey}
|
||||
direction={oneLiner ? undefined : "column"}
|
||||
gap={oneLiner ? "2" : "1"}
|
||||
justify={oneLiner ? "between" : undefined}
|
||||
mb={oneLiner ? "2" : "4"}
|
||||
pb={item.pad ? "6" : undefined}
|
||||
>
|
||||
<Text>
|
||||
{
|
||||
(
|
||||
strings.website.tools.embed.types[embed]
|
||||
.options as Record<string, string>
|
||||
)[configKey]
|
||||
}
|
||||
</Text>
|
||||
<Flex
|
||||
gap="2"
|
||||
align="center"
|
||||
flexGrow="1"
|
||||
justify={oneLiner ? "end" : undefined}
|
||||
>
|
||||
{control}
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
</ScrollArea>
|
||||
|
||||
<Box
|
||||
p="4"
|
||||
flexGrow="1"
|
||||
position="sticky"
|
||||
top={`${NAVBAR_HEIGHT}px`}
|
||||
height={`calc(100vh - ${NAVBAR_HEIGHT}px)`}
|
||||
>
|
||||
<Flex
|
||||
direction="column"
|
||||
height="100%"
|
||||
<div
|
||||
className={styles.preview}
|
||||
style={{
|
||||
borderRadius: "var(--radius-3)",
|
||||
overflow: "hidden",
|
||||
boxShadow: "var(--shadow-3)",
|
||||
background: `url(${backgroundImage}) center / cover no-repeat`,
|
||||
}}
|
||||
>
|
||||
<Flex
|
||||
justify="between"
|
||||
align="center"
|
||||
p="2"
|
||||
pl="3"
|
||||
style={{
|
||||
backgroundColor: "var(--color-panel-solid)",
|
||||
<PreviewWrapper name={embed} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Scroller
|
||||
orientation={ScrollerOrientation.Vertical}
|
||||
className={styles.sidebar}
|
||||
>
|
||||
<div className={styles.controls}>
|
||||
<Import />
|
||||
|
||||
<Heading size="3" weight="bold">
|
||||
{strings.embed.configuration.export.title}
|
||||
</Heading>
|
||||
<Text size="minor" lowContrast className={styles.description}>
|
||||
{strings.embed.configuration.export.description}
|
||||
</Text>
|
||||
|
||||
<div className={styles.exports}>
|
||||
<GenerateURL embed={embed} />
|
||||
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() =>
|
||||
"body { margin: 0; background-color: transparent; overflow: hidden; }"
|
||||
}
|
||||
>
|
||||
<CodeIcon />
|
||||
{strings.embed.configuration.export.css}
|
||||
</CopyButton>
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() => `${EmbedState.state.width}`}
|
||||
>
|
||||
<WidthIcon />
|
||||
{strings.embed.configuration.export.width}
|
||||
</CopyButton>
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() => `${EmbedState.state.height}`}
|
||||
>
|
||||
<HeightIcon />
|
||||
{strings.embed.configuration.export.height}
|
||||
</CopyButton>
|
||||
<CopyButton variant="outline" copy={() => "1"}>
|
||||
<TimerIcon />
|
||||
{strings.embed.configuration.export.framerate}
|
||||
</CopyButton>
|
||||
</div>
|
||||
|
||||
<div className={styles.customize}>
|
||||
<Heading size="3" weight="bold">
|
||||
{strings.embed.configuration.customize.title}
|
||||
</Heading>
|
||||
<IconButton
|
||||
color="red"
|
||||
variant="ghost"
|
||||
size="minor"
|
||||
onClick={() => {
|
||||
EmbedState.set(EmbedState.initial);
|
||||
}}
|
||||
>
|
||||
<Text color="gray">
|
||||
{strings.website.tools.embed.preview.title}
|
||||
</Text>
|
||||
<ResetIcon />
|
||||
</IconButton>
|
||||
</div>
|
||||
<Text size="minor" lowContrast className={styles.description}>
|
||||
{strings.embed.configuration.customize.description}
|
||||
</Text>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
color="gray"
|
||||
onClick={() => fileInput.current?.click()}
|
||||
{Object.keys(config).map((configKey) => {
|
||||
const item = config[configKey];
|
||||
let control: ReactNode;
|
||||
let oneLiner = false;
|
||||
|
||||
switch (item.type) {
|
||||
case EmbedItemType.Boolean: {
|
||||
control = <Boolean configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Color: {
|
||||
control = <Color configKey={configKey} />;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Radius: {
|
||||
control = <Radius configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Size: {
|
||||
control = <Size configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.SizeWithout0: {
|
||||
control = <SizeWithout0 configKey={configKey} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Slider: {
|
||||
control = <Slider configKey={configKey} config={item} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.String: {
|
||||
control = <TextController configKey={configKey} />;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.RichText: {
|
||||
control = <RichText configKey={configKey} />;
|
||||
break;
|
||||
}
|
||||
|
||||
case EmbedItemType.Enum: {
|
||||
control = <Enum configKey={configKey} config={item} />;
|
||||
oneLiner = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
key={configKey}
|
||||
className={styles.option}
|
||||
data-one-liner={oneLiner}
|
||||
data-pad={item.pad}
|
||||
>
|
||||
<ImageIcon /> {strings.website.tools.embed.preview.upload}
|
||||
</Button>
|
||||
</Flex>
|
||||
|
||||
<Box
|
||||
flexGrow="1"
|
||||
style={{
|
||||
background: `url(${backgroundImage}) center / cover no-repeat`,
|
||||
}}
|
||||
position="relative"
|
||||
overflow="hidden"
|
||||
>
|
||||
<PreviewWrapper name={embed} />
|
||||
</Box>
|
||||
</Flex>
|
||||
</Box>
|
||||
</Flex>
|
||||
</PageWrapper>
|
||||
<Text>
|
||||
{
|
||||
(
|
||||
strings.embed.types[embed].options as Record<
|
||||
string,
|
||||
string
|
||||
>
|
||||
)[configKey]
|
||||
}
|
||||
</Text>
|
||||
<div className={styles.control}>{control}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Scroller>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
---
|
||||
import EmbedLayout from "../../../../../../layouts/EmbedLayout.astro";
|
||||
import type { getStaticPaths } from "../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
---
|
||||
|
||||
<EmbedLayout>
|
||||
<Page {locale} client:only="react" embed={Astro.params.embed} />
|
||||
</EmbedLayout>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
.embed {
|
||||
overflow: hidden;
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,5 @@
|
||||
import { Box } from "@radix-ui/themes";
|
||||
import { useMemo } from "react";
|
||||
import { parse } from "urlon";
|
||||
import { BlitzKitTheme } from "../../../../../../components/BlitzKitTheme";
|
||||
import {
|
||||
embedConfigurations,
|
||||
embedRenderers,
|
||||
@@ -17,6 +15,7 @@ import {
|
||||
type ExtractEmbedConfigTypes,
|
||||
} from "../../../../../../stores/embedState";
|
||||
import { useEmbedStateCurry } from "../../../../../../stores/embedState/utilities";
|
||||
import styles from "./_index.module.css";
|
||||
|
||||
interface PageProps {
|
||||
embed: keyof typeof embedConfigurations;
|
||||
@@ -51,10 +50,11 @@ function Content({ embed }: PageProps) {
|
||||
const height = useEmbedState("height");
|
||||
|
||||
return (
|
||||
<BlitzKitTheme style={{ background: "transparent" }}>
|
||||
<Box width={`${width}px`} height={`${height}px`} overflow="hidden">
|
||||
<Renderer />
|
||||
</Box>
|
||||
</BlitzKitTheme>
|
||||
<div
|
||||
className={styles.embed}
|
||||
style={{ width: `${width}px`, height: `${height}px` }}
|
||||
>
|
||||
<Renderer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
---
|
||||
import ColorScale from "../../../../../../components/ColorScale.astro";
|
||||
import EmbedLayout from "../../../../../../layouts/EmbedLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale, embed } = Astro.props;
|
||||
---
|
||||
|
||||
<EmbedLayout {locale}>
|
||||
<ColorScale color="red" />
|
||||
|
||||
<Page {locale} client:only="react" {embed} />
|
||||
</EmbedLayout>
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
|
||||
import { embedConfigurations } from "../../../../../constants/embeds";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
return (
|
||||
Object.keys(embedConfigurations) as (keyof typeof embedConfigurations)[]
|
||||
).map((embed) => ({
|
||||
params: { embed },
|
||||
props: { embed },
|
||||
}));
|
||||
});
|
||||
|
||||
const { locale, embed } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout {locale} accent="red">
|
||||
<Page {locale} client:load {embed} />
|
||||
</BaseLayout>
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import ToolLayout from "../../../../layouts/ToolLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
---
|
||||
|
||||
<ToolLayout {locale} tool={tools.embed}>
|
||||
<Page {locale} />
|
||||
</ToolLayout>
|
||||
@@ -0,0 +1,49 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-6);
|
||||
}
|
||||
|
||||
.intro {
|
||||
margin-top: var(--space-3);
|
||||
}
|
||||
|
||||
.embeds {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.embed {
|
||||
display: block;
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
}
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
border-radius: var(--space-4);
|
||||
background-color: var(--gray-2);
|
||||
box-shadow: var(--shadow-subtle);
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: var(--space-3);
|
||||
}
|
||||
|
||||
.preview {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
width: 20rem;
|
||||
height: 20rem;
|
||||
|
||||
background-image: url(/media/embed-default.webp);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
import { Box, Flex, Link, Text } from "@radix-ui/themes";
|
||||
import { PreviewWrapper } from "../../../../components/Embeds/PreviewWrapper";
|
||||
import { Link } from "../../../../components/Link";
|
||||
import { LinkI18n } from "../../../../components/LinkI18n";
|
||||
import { PageWrapper } from "../../../../components/PageWrapper";
|
||||
import { Text } from "../../../../components/Text";
|
||||
import { discordLink } from "../../../../config/socials";
|
||||
import { embedConfigurations } from "../../../../constants/embeds";
|
||||
import { Var } from "../../../../core/radix/var";
|
||||
import {
|
||||
type LocaleAcceptorProps,
|
||||
LocaleProvider,
|
||||
useLocale,
|
||||
} from "../../../../hooks/useLocale";
|
||||
import { useStrings } from "../../../../hooks/useStrings";
|
||||
import styles from "./_index.module.css";
|
||||
|
||||
export function Page({ locale }: LocaleAcceptorProps) {
|
||||
return (
|
||||
@@ -19,74 +21,50 @@ export function Page({ locale }: LocaleAcceptorProps) {
|
||||
}
|
||||
|
||||
function Content() {
|
||||
const { locale, strings } = useLocale();
|
||||
const locale = useLocale();
|
||||
const strings = useStrings();
|
||||
|
||||
return (
|
||||
<PageWrapper color="red">
|
||||
<Text align="center" mt="3">
|
||||
{strings.website.tools.embed.coming_soon}{" "}
|
||||
<Link
|
||||
underline="always"
|
||||
href="https://discord.gg/nDt7AjGJQH"
|
||||
target="_blank"
|
||||
>
|
||||
{strings.website.tools.embed.suggest}
|
||||
<div className={styles.content}>
|
||||
<Text align="center" className={styles.intro}>
|
||||
{strings.embed.coming_soon}{" "}
|
||||
<Link href={discordLink} target="_blank">
|
||||
{strings.embed.suggest}
|
||||
</Link>
|
||||
</Text>
|
||||
|
||||
<Flex justify="center">
|
||||
<div className={styles.embeds}>
|
||||
{Object.keys(embedConfigurations).map((embed) => (
|
||||
<LinkI18n
|
||||
key={embed}
|
||||
locale={locale}
|
||||
href={`/embed/${embed}`}
|
||||
color="gray"
|
||||
highContrast
|
||||
style={{
|
||||
width: "fit-content",
|
||||
height: "fit-content",
|
||||
}}
|
||||
underline="hover"
|
||||
className={styles.embed}
|
||||
>
|
||||
<Flex
|
||||
direction="column"
|
||||
overflow="hidden"
|
||||
style={{
|
||||
borderRadius: Var("radius-4"),
|
||||
backgroundColor: Var("color-panel-solid"),
|
||||
boxShadow: Var("shadow-3"),
|
||||
}}
|
||||
>
|
||||
<Flex justify="center" p="2">
|
||||
<div className={styles.card}>
|
||||
<div className={styles.title}>
|
||||
<Text>
|
||||
{
|
||||
strings.website.tools.embed.types[
|
||||
embed as keyof typeof strings.website.tools.embed.types
|
||||
strings.embed.types[
|
||||
embed as keyof typeof strings.embed.types
|
||||
].name
|
||||
}
|
||||
</Text>
|
||||
</Flex>
|
||||
</div>
|
||||
|
||||
<Box
|
||||
width="20rem"
|
||||
height="20rem"
|
||||
overflow="hidden"
|
||||
position="relative"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url(/assets/images/backgrounds/embed-default.webp)",
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
}}
|
||||
>
|
||||
<div className={styles.preview}>
|
||||
<PreviewWrapper
|
||||
naked
|
||||
name={embed as keyof typeof embedConfigurations}
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
</div>
|
||||
</div>
|
||||
</LinkI18n>
|
||||
))}
|
||||
</Flex>
|
||||
</PageWrapper>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../constants/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout {locale} accent="red">
|
||||
<ToolBanner {locale} tool={tools.embed} />
|
||||
|
||||
<Page {locale} />
|
||||
</BaseLayout>
|
||||
@@ -1,4 +1,5 @@
|
||||
.content {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
height: 100dvh;
|
||||
background-color: black;
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import { Page } from "./_index";
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
|
||||
// TODO: the tank search popup is complete unreviewed AI slop, write a proper system for it manually
|
||||
---
|
||||
|
||||
<BaseLayout accent="blue" {locale} solidNavbar>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
import { AstroSeo } from "@astrolib/seo";
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { api } from "../../../api/dynamic";
|
||||
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
|
||||
import { AesonPlug } from "../../../components/AesonPlug";
|
||||
import HelpTranslate from "../../../components/HelpTranslate.astro";
|
||||
@@ -20,7 +18,6 @@ const MAX_TOOLS_PER_ROW = 2;
|
||||
|
||||
const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT);
|
||||
const { locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
const rows: Tool[][] = [];
|
||||
|
||||
for (const id in tools) {
|
||||
@@ -49,19 +46,6 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => {
|
||||
});
|
||||
---
|
||||
|
||||
<AstroSeo
|
||||
title="BlitzKit"
|
||||
description={strings.website.home.seo_description}
|
||||
canonical={Astro.url.href}
|
||||
openGraph={{
|
||||
url: Astro.url.href,
|
||||
title: "BlitzKit",
|
||||
description: strings.website.home.seo_description,
|
||||
site_name: "BlitzKit",
|
||||
}}
|
||||
twitter={{ cardType: "summary_large_image" }}
|
||||
/>
|
||||
|
||||
<BaseLayout accent="blue" {locale}>
|
||||
<!-- <HomeHero {locale} /> -->
|
||||
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
---
|
||||
import { AstroSeo } from "@astrolib/seo";
|
||||
import { getStrings } from "../../../../core/i18n/getStrings";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
|
||||
const strings = getStrings(locale);
|
||||
---
|
||||
|
||||
<AstroSeo
|
||||
title={strings.website.settings.title}
|
||||
description={strings.website.settings.description}
|
||||
/>
|
||||
|
||||
<BaseLayout {locale}>
|
||||
<Page {locale} client:load />
|
||||
</BaseLayout>
|
||||
@@ -3,6 +3,7 @@ import { DiscordLogoIcon, HomeIcon } from "@radix-ui/react-icons";
|
||||
import { Button, Flex, Heading, Link, Text } from "@radix-ui/themes";
|
||||
import { LinkI18n } from "../../components/LinkI18n";
|
||||
import { PageWrapper } from "../../components/PageWrapper";
|
||||
import { discordLink } from "../../config/socials";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "./_index";
|
||||
@@ -18,12 +19,14 @@ const { locale } = Astro.props;
|
||||
<Flex mt="4" gap="2">
|
||||
<LinkI18n {locale} href="/">
|
||||
<Button>
|
||||
<HomeIcon /> Home
|
||||
<HomeIcon />
|
||||
Home
|
||||
</Button>
|
||||
</LinkI18n>
|
||||
<Link href="https://discord.gg/nDt7AjGJQH">
|
||||
<Link href={discordLink}>
|
||||
<Button variant="outline">
|
||||
<DiscordLogoIcon /> Discord
|
||||
<DiscordLogoIcon />
|
||||
Discord
|
||||
</Button>
|
||||
</Link>
|
||||
</Flex>
|
||||
|
||||
Reference in new issue
Block a user