mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: migrate urls
This commit is contained in:
1 parent
165a9cd719
commit
b90b355f8f
18 files changed
+37
-44
No files matched your search
Vendored
+1
@@ -132,6 +132,7 @@
|
||||
"outdir",
|
||||
"outfile",
|
||||
"ownedtanks",
|
||||
"padder",
|
||||
"partytown",
|
||||
"PIXELFORMAT",
|
||||
"playerachievements",
|
||||
|
||||
@@ -107,8 +107,8 @@ export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
|
||||
if (!tank) return '';
|
||||
|
||||
const name = `[${tank.name}](<https://blitzkit.app/tools/tankopedia/${
|
||||
tank.id
|
||||
const name = `[${tank.name}](<https://blitzkit.app/tanks/${
|
||||
tank.slug
|
||||
}>)`;
|
||||
const next =
|
||||
data.next_price === null
|
||||
|
||||
@@ -78,7 +78,7 @@ export const ownedTanksCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
)
|
||||
.map(
|
||||
(tank) =>
|
||||
`[${flags[tank.nation]} ${markdownEscape(unwrap(tank.name))}](<https://blitzkit.app/tools/tankopedia/${tank.id}>)`,
|
||||
`[${flags[tank.nation]} ${markdownEscape(unwrap(tank.name))}](<https://blitzkit.app/tanks/${tank.slug}>)`,
|
||||
);
|
||||
const lines = [title, ...tankList];
|
||||
|
||||
|
||||
@@ -10,16 +10,16 @@ message TankDefinitions {
|
||||
|
||||
message TankDefinition {
|
||||
required uint32 id = 1;
|
||||
map<uint32, uint32> roles = 2;
|
||||
required bool fixed_camouflage = 4;
|
||||
repeated int32 camouflages = 5;
|
||||
repeated int32 ancestors = 6;
|
||||
repeated int32 successors = 7;
|
||||
repeated Crew crew = 8;
|
||||
required uint32 health = 9;
|
||||
required string nation = 10;
|
||||
required I18nString name = 11;
|
||||
optional I18nString name_full = 12;
|
||||
required string slug = 2;
|
||||
map<uint32, uint32> roles = 3;
|
||||
required bool fixed_camouflage = 5;
|
||||
repeated int32 camouflages = 6;
|
||||
repeated int32 ancestors = 7;
|
||||
repeated int32 successors = 8;
|
||||
repeated Crew crew = 9;
|
||||
required uint32 health = 10;
|
||||
required string nation = 11;
|
||||
required I18nString name = 12;
|
||||
required TankType type = 13;
|
||||
required uint32 max_consumables = 14;
|
||||
required uint32 max_provisions = 15;
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function popularTanks() {
|
||||
fieldName: 'pagePath',
|
||||
stringFilter: {
|
||||
matchType: 'BEGINS_WITH',
|
||||
value: '/tools/tankopedia/',
|
||||
value: '/tanks/',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -43,7 +43,7 @@ export async function popularTanks() {
|
||||
(row) =>
|
||||
row.dimensionValues &&
|
||||
row.dimensionValues[0].value &&
|
||||
row.dimensionValues[0].value !== '/tools/tankopedia/' &&
|
||||
row.dimensionValues[0].value !== '/tanks/' &&
|
||||
row.metricValues &&
|
||||
row.metricValues[0].value,
|
||||
)
|
||||
|
||||
@@ -105,7 +105,7 @@ export function TankCard({ index, tank }: TankCardProps) {
|
||||
return (
|
||||
<StickyColumnHeaderCell>
|
||||
<Flex direction="column" align="center" justify="between" gap="2">
|
||||
<TankControl index={index} key={tank.id} id={tank.id} />
|
||||
<TankControl index={index} key={tank.id} slug={tank.slug} />
|
||||
|
||||
<Flex
|
||||
ref={draggable}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { TankSearch } from '../TankSearch';
|
||||
|
||||
interface TankControlProps {
|
||||
index: number;
|
||||
id: number;
|
||||
slug: string;
|
||||
}
|
||||
|
||||
const [provisionDefinitions, modelDefinitions] = await Promise.all([
|
||||
@@ -19,7 +19,7 @@ const [provisionDefinitions, modelDefinitions] = await Promise.all([
|
||||
awaitableModelDefinitions,
|
||||
]);
|
||||
|
||||
export function TankControl({ index, id }: TankControlProps) {
|
||||
export function TankControl({ index, slug }: TankControlProps) {
|
||||
const { locale } = useLocale();
|
||||
const [switchTankDialogOpen, setSwitchTankDialogOpen] = useState(false);
|
||||
const mutateCompareEphemeral = CompareEphemeral.useMutation();
|
||||
@@ -79,11 +79,7 @@ export function TankControl({ index, id }: TankControlProps) {
|
||||
</Dialog.Content>
|
||||
</Dialog.Root>
|
||||
|
||||
<LinkI18n
|
||||
locale={locale}
|
||||
href={`/tools/tankopedia/${id}`}
|
||||
target="_blank"
|
||||
>
|
||||
<LinkI18n locale={locale} href={`/tanks/${slug}`} target="_blank">
|
||||
<IconButton variant="ghost">
|
||||
<ExternalLinkIcon />
|
||||
</IconButton>
|
||||
|
||||
@@ -141,7 +141,7 @@ const strings = getStrings(locale);
|
||||
(branch) =>
|
||||
branch !== assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH),
|
||||
);
|
||||
const selected = Astro.url.pathname.includes(`/tools/${tool.id}`);
|
||||
const selected = Astro.url.pathname.includes(`/${tool.id}`);
|
||||
const toolStrings =
|
||||
strings.website.tools[
|
||||
(tool.stringsId ??
|
||||
@@ -157,7 +157,7 @@ const strings = getStrings(locale);
|
||||
color="gray"
|
||||
highContrast={selected}
|
||||
size="2"
|
||||
href={`/tools/${tool.id}`}
|
||||
href={`/${tool.id}`}
|
||||
underline="hover"
|
||||
>
|
||||
{toolStrings.name}
|
||||
@@ -227,12 +227,12 @@ const strings = getStrings(locale);
|
||||
color="gray"
|
||||
highContrast
|
||||
style={{ display: 'contents' }}
|
||||
href={`/tools/${tool.id}`}
|
||||
href={`/${tool.id}`}
|
||||
>
|
||||
<Box
|
||||
style={{
|
||||
borderRadius: Var('radius-2'),
|
||||
backgroundImage: `url(/assets/images/tools/${tool.id}.webp)`,
|
||||
backgroundImage: `url(/assets/images/${tool.id}.webp)`,
|
||||
backgroundSize: '200%',
|
||||
backgroundPosition: 'right center',
|
||||
}}
|
||||
|
||||
@@ -73,7 +73,7 @@ export const TankCard = forwardRef<HTMLSpanElement, TankCardProps>(
|
||||
locale={locale}
|
||||
className="link"
|
||||
underline="hover"
|
||||
href={provideLink ? `/tools/tankopedia/${tank.id}` : '#'}
|
||||
href={provideLink ? `/tanks/${tank.slug}` : '#'}
|
||||
onClick={(event) => {
|
||||
if (!provideLink) event.preventDefault();
|
||||
}}
|
||||
|
||||
@@ -18,11 +18,7 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
|
||||
width={{ initial: '144px', sm: '240px' }}
|
||||
style={{ overflow: 'hidden' }}
|
||||
>
|
||||
<LinkI18n
|
||||
locale={locale}
|
||||
href={`/tools/tankopedia/${tank.id}`}
|
||||
tabIndex={-1}
|
||||
>
|
||||
<LinkI18n locale={locale} href={`/tanks/${tank.slug}`} tabIndex={-1}>
|
||||
<img
|
||||
alt={unwrap(tank.name)}
|
||||
draggable={false}
|
||||
@@ -48,7 +44,7 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
|
||||
highContrast={tank.type === TankType.RESEARCHABLE}
|
||||
underline="hover"
|
||||
wrap="nowrap"
|
||||
href={`/tools/tankopedia/${tank.id}`}
|
||||
href={`/tanks/${tank.slug}`}
|
||||
style={{
|
||||
paddingLeft: 'var(--space-2)',
|
||||
display: 'flex',
|
||||
|
||||
@@ -18,7 +18,7 @@ export function QuickLink({ topResult }: QuickLinkProps) {
|
||||
|
||||
return (
|
||||
<TextField.Slot>
|
||||
<LinkI18n locale={locale} href={`/tools/tankopedia/${topResult.id}`}>
|
||||
<LinkI18n locale={locale} href={`/tanks/${topResult.slug}`}>
|
||||
<Button variant="ghost">
|
||||
{unwrap(topResult.name)} <CaretRightIcon />
|
||||
</Button>
|
||||
|
||||
@@ -57,7 +57,7 @@ export function SearchBar({ topResult, skeleton, onSelect }: SearchBarProps) {
|
||||
if (onSelect) {
|
||||
onSelect(topResult);
|
||||
} else {
|
||||
window.location.href = `/tools/tankopedia/${topResult.id}`;
|
||||
window.location.href = `/tanks/${topResult.slug}`;
|
||||
}
|
||||
},
|
||||
[topResult],
|
||||
|
||||
+4
-1
@@ -135,7 +135,10 @@ function ModuleButton({
|
||||
);
|
||||
|
||||
return isTank ? (
|
||||
<LinkI18n locale={locale} href={`/tools/tankopedia/${unlock.id}`}>
|
||||
<LinkI18n
|
||||
locale={locale}
|
||||
href={`/tanks/${tankDefinitions.tanks[unlock.id].slug}`}
|
||||
>
|
||||
{button}
|
||||
</LinkI18n>
|
||||
) : (
|
||||
|
||||
@@ -46,7 +46,7 @@ export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
||||
return (
|
||||
<LinkI18n
|
||||
locale={locale}
|
||||
href={`/tools/tankopedia/${id}`}
|
||||
href={`/tanks/${tankDefinitions.tanks[id].slug}`}
|
||||
key={id}
|
||||
style={{
|
||||
textDecoration: 'none',
|
||||
|
||||
@@ -12,7 +12,7 @@ export function Share() {
|
||||
<CopyButton
|
||||
variant="outline"
|
||||
copy={() =>
|
||||
`${location.origin}/tools/tier-list?${generateTierListParams(rows)}`
|
||||
`${location.origin}/tier-list?${generateTierListParams(rows)}`
|
||||
}
|
||||
>
|
||||
<Share2Icon /> {strings.website.tools.tier_list.buttons.share}
|
||||
|
||||
@@ -61,7 +61,7 @@ const toolStrings =
|
||||
{locale}
|
||||
className="link"
|
||||
underline="none"
|
||||
href={disabled ? '#' : (tool.href ?? `/tools/${tool.id}`)}
|
||||
href={disabled ? '#' : (tool.href ?? `/${tool.id}`)}
|
||||
target={tool.href ? '_blank' : undefined}
|
||||
>
|
||||
<Box
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export function pushTankopediaPath(id: number) {
|
||||
window.history.pushState(null, '', `/tools/tankopedia/${id}`);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ function Content() {
|
||||
>
|
||||
<LinkI18n
|
||||
locale={locale}
|
||||
href={`/tools/embed/${embed}`}
|
||||
href={`/embed/${embed}`}
|
||||
color="gray"
|
||||
highContrast
|
||||
style={{
|
||||
|
||||
Reference in new issue
Block a user