mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: localize tank search
This commit is contained in:
1 parent
06cbe1e733
commit
ade6ec8af1
5 files changed
+21
-6
No files matched your search
@@ -731,6 +731,11 @@
|
||||
"count_singular": "1 tank",
|
||||
"count_plural": "%s1 tanks",
|
||||
"sorting_by": "Sorting by %s1",
|
||||
"no_tanks_found": {
|
||||
"body": "No tanks found.",
|
||||
"search_again": "Try searching again.",
|
||||
"clear_filters": "Try clearing filters."
|
||||
},
|
||||
"sort": {
|
||||
"meta.none": "none",
|
||||
"survivability.health": "health",
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { DEFAULT_LOCALE } from '@blitzkit/core';
|
||||
import { Link, type LinkProps } from '@radix-ui/themes';
|
||||
import type { LocaleAcceptorProps } from '../hooks/useLocale';
|
||||
|
||||
type LinkI18nProps = LinkProps & LocaleAcceptorProps;
|
||||
|
||||
export function LinkI18n({ locale, href, ...props }: LinkI18nProps) {
|
||||
const prefix = locale === undefined ? '' : `/${locale}`;
|
||||
const prefix =
|
||||
locale === undefined || locale === DEFAULT_LOCALE ? '' : `/${locale}`;
|
||||
|
||||
return (
|
||||
<Link href={href?.startsWith('/') ? `${prefix}${href}` : href} {...props} />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Flex, Link, Text } from '@radix-ui/themes';
|
||||
import { useLocale } from '../../../hooks/useLocale';
|
||||
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
||||
|
||||
interface NoResultsProps {
|
||||
@@ -6,10 +7,12 @@ interface NoResultsProps {
|
||||
}
|
||||
|
||||
export function NoResults({ type = 'filters' }: NoResultsProps) {
|
||||
const { strings } = useLocale();
|
||||
|
||||
return (
|
||||
<Flex flexGrow="1" align="center" justify="center">
|
||||
<Text color="gray">
|
||||
No tanks found.{' '}
|
||||
{strings.website.common.tank_search.no_tanks_found.body}.{' '}
|
||||
<Link
|
||||
href="#"
|
||||
underline="always"
|
||||
@@ -18,7 +21,9 @@ export function NoResults({ type = 'filters' }: NoResultsProps) {
|
||||
$tankFilters.set(initialTankFilters);
|
||||
}}
|
||||
>
|
||||
{type === 'filters' ? 'Try clearing filters' : 'Try searching again'}
|
||||
{type === 'filters'
|
||||
? strings.website.common.tank_search.no_tanks_found.clear_filters
|
||||
: strings.website.common.tank_search.no_tanks_found.search_again}
|
||||
</Link>
|
||||
.
|
||||
</Text>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Flex, Separator, Text } from '@radix-ui/themes';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { useMemo } from 'react';
|
||||
import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions';
|
||||
import { useLocale } from '../../../hooks/useLocale';
|
||||
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
||||
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||
import { $tankopediaSort } from '../../../stores/tankopediaSort';
|
||||
@@ -27,6 +28,7 @@ export function RecentlyViewed() {
|
||||
}),
|
||||
[filters],
|
||||
);
|
||||
const { strings } = useLocale();
|
||||
|
||||
if (recentlyViewed.length === 0 || sort.by !== 'meta.none' || hasFilters) {
|
||||
return null;
|
||||
@@ -35,7 +37,7 @@ export function RecentlyViewed() {
|
||||
return (
|
||||
<Flex direction="column" gap="2" mt="2" mb="6">
|
||||
<Text color="gray" align="center">
|
||||
Recently viewed
|
||||
{strings.website.common.tank_search.recent}
|
||||
</Text>
|
||||
<TankCardWrapper>
|
||||
{recentlyViewed.map((id) => (
|
||||
|
||||
@@ -6,18 +6,19 @@ import Footer from '../components/Footer.astro';
|
||||
import Navbar from '../components/Navbar.astro';
|
||||
import Party3 from '../components/Party3.astro';
|
||||
import './base.css';
|
||||
import { DEFAULT_LOCALE } from '@blitzkit/core';
|
||||
|
||||
export interface Props {
|
||||
noFooter?: boolean;
|
||||
}
|
||||
|
||||
const { noFooter } = Astro.props;
|
||||
const { locale } = Astro.params;
|
||||
const locale = Astro.params.locale ?? DEFAULT_LOCALE;
|
||||
const { pathname } = Astro.url;
|
||||
const isRoot = pathname === '/';
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<html lang={locale}>
|
||||
<head>
|
||||
{
|
||||
isRoot && (
|
||||
|
||||
Reference in new issue
Block a user