Biome reported 229 diagnostics after aligning the config with
bsi-ni.brain.riken.jp. Fix them all so `biome check` passes clean
without per-rule overrides.
- replace `any` in LokiJS queries with an `ItemFilter` interface and
a single `asLokiQuery()` cast, matching bsi-ni
- type the XOOPS redirect maps as
`Record<string, { key: string; isNumber: boolean }>`
- use `ItemSubTypes<string>` instead of `any` for sub item types
- join author lists with `.join(', ')` instead of index-keyed nodes
- give list elements stable keys derived from their own data
- return `React.ReactNode` from `ListBase.renderBody()`
- drop the temporary `noArrayIndexKey` override from biome.json
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { useLocation, useNavigate } from 'react-router';
|
|
import type { MultiLang } from '../../config';
|
|
|
|
interface Props {
|
|
lang: MultiLang;
|
|
}
|
|
|
|
const SelectLang = (props: Props) => {
|
|
const { lang } = props;
|
|
const location = useLocation();
|
|
const navigate = useNavigate();
|
|
const langs: MultiLang[] = ['en', 'ja'];
|
|
const titles = {
|
|
en: 'English',
|
|
ja: 'Japanese',
|
|
};
|
|
return (
|
|
<div>
|
|
<select
|
|
value={lang}
|
|
onChange={(e) => {
|
|
const xlang = e.target.value;
|
|
const params = new URLSearchParams(location.search);
|
|
params.set('ml_lang', xlang);
|
|
const url = `${location.pathname}?${params.toString()}`;
|
|
navigate(url);
|
|
}}
|
|
>
|
|
{langs.map((xlang) => {
|
|
return (
|
|
<option key={xlang} value={xlang}>
|
|
{titles[xlang]}
|
|
</option>
|
|
);
|
|
})}
|
|
</select>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default SelectLang;
|