This commit is contained in:
Untone 2024-07-05 16:35:13 +03:00
parent bff5de0c8e
commit a767ce7fd1
5 changed files with 14 additions and 11 deletions

View File

@ -41,7 +41,7 @@ export const Header = (props: Props) => {
const { t, lang } = useLocalize() const { t, lang } = useLocalize()
const { modal } = useUI() const { modal } = useUI()
const { requireAuthentication } = useSession() const { requireAuthentication } = useSession()
const [searchParams, ] = useSearchParams<HeaderSearchParams>() const [searchParams] = useSearchParams<HeaderSearchParams>()
const { sortedTopics: topics } = useTopics() const { sortedTopics: topics } = useTopics()
const [randomTopics, setRandomTopics] = createSignal<Topic[]>([]) const [randomTopics, setRandomTopics] = createSignal<Topic[]>([])
const [getIsScrollingBottom, setIsScrollingBottom] = createSignal(false) const [getIsScrollingBottom, setIsScrollingBottom] = createSignal(false)
@ -101,7 +101,10 @@ export const Header = (props: Props) => {
}) })
}) })
const scrollToComments = (event: MouseEvent & { currentTarget: HTMLDivElement; target: Element }, value: boolean) => { const scrollToComments = (
event: MouseEvent & { currentTarget: HTMLDivElement; target: Element },
value: boolean
) => {
event.preventDefault() event.preventDefault()
props.scrollToComments?.(value) props.scrollToComments?.(value)
} }
@ -190,7 +193,7 @@ export const Header = (props: Props) => {
</div> </div>
</div> </div>
<div class={clsx('col-md-5 col-xl-4 col-auto', styles.mainLogo)}> <div class={clsx('col-md-5 col-xl-4 col-auto', styles.mainLogo)}>
<A href='/'> <A href="/">
<img src="/logo.svg" alt={t('Discours')} /> <img src="/logo.svg" alt={t('Discours')} />
</A> </A>
</div> </div>

View File

@ -87,7 +87,7 @@ export const LocalizeProvider = (props: { children: JSX.Element }) => {
try { try {
return i18next.t(...args) return i18next.t(...args)
} catch (_) { } catch (_) {
return args?.length > 0 ? args[0] as string : '' return args?.length > 0 ? (args[0] as string) : ''
} }
}) as i18n['t'], }) as i18n['t'],
lang, lang,

View File

@ -12,7 +12,7 @@ TimeAgo.addLocale(ruTime)
class AutoKeyMap extends Map<string, string> { class AutoKeyMap extends Map<string, string> {
get(key: string): string { get(key: string): string {
return super.get(key) ?? key; return super.get(key) ?? key
} }
} }
@ -20,7 +20,7 @@ export const i18nextInit = async (lng = 'ru') => {
if (!i18next.isInitialized) { if (!i18next.isInitialized) {
console.debug('[i18next] initializing...') console.debug('[i18next] initializing...')
const enAutoKeyMap = new AutoKeyMap(Object.entries(en)); const enAutoKeyMap = new AutoKeyMap(Object.entries(en))
await i18next await i18next
.use(HttpApi) .use(HttpApi)
@ -39,7 +39,7 @@ export const i18nextInit = async (lng = 'ru') => {
interpolation: { interpolation: {
escapeValue: false escapeValue: false
}, },
parseMissingKeyHandler: (key) => key parseMissingKeyHandler: (key: string) => key
}) })
} else if (i18next.language !== lng) { } else if (i18next.language !== lng) {
await i18next.changeLanguage(lng) await i18next.changeLanguage(lng)