1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2025-01-01 16:37:39 +01:00

Fix translation bug

This commit is contained in:
mrjvs 2023-12-06 22:08:53 +01:00
parent d0dca6b853
commit e28d118bf4

View file

@ -1,4 +1,5 @@
import { useCallback, useRef, useState } from "react"; import { useCallback, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import Sticky from "react-sticky-el"; import Sticky from "react-sticky-el";
import { SearchBarInput } from "@/components/form/SearchBar"; import { SearchBarInput } from "@/components/form/SearchBar";
@ -15,7 +16,8 @@ export interface HeroPartProps {
} }
export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) { export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) {
const { t } = useRandomTranslation(); const { t: randomT } = useRandomTranslation();
const { t } = useTranslation();
const [search, setSearch, setSearchUnFocus] = searchParams; const [search, setSearch, setSearchUnFocus] = searchParams;
const [, setShowBg] = useState(false); const [, setShowBg] = useState(false);
const bannerSize = useBannerSize(); const bannerSize = useBannerSize();
@ -32,7 +34,7 @@ export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) {
if (hour < 12) time = "morning"; if (hour < 12) time = "morning";
else if (hour < 19) time = "day"; else if (hour < 19) time = "day";
const title = t(`home.titles.${time}`); const title = randomT(`home.titles.${time}`);
const inputRef = useRef<HTMLInputElement>(null); const inputRef = useRef<HTMLInputElement>(null);
useSlashFocus(inputRef); useSlashFocus(inputRef);
@ -56,7 +58,7 @@ export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) {
onChange={setSearch} onChange={setSearch}
value={search} value={search}
onUnFocus={setSearchUnFocus} onUnFocus={setSearchUnFocus}
placeholder={t("home.search.placeholder")} placeholder={t("home.search.placeholder") ?? ""}
/> />
</Sticky> </Sticky>
</div> </div>