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)
@ -82,7 +82,7 @@ export const Header = (props: Props) => {
if (!(fixed() || modal())) { if (!(fixed() || modal())) {
window.scrollTo(0, windowScrollTop) window.scrollTo(0, windowScrollTop)
if(mainContent) mainContent.style.marginTop = '' if (mainContent) mainContent.style.marginTop = ''
} }
}) })
@ -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

@ -21,7 +21,7 @@ export const Link = (props: Props) => {
> >
<ConditionalWrapper <ConditionalWrapper
condition={props.href === `/${loc.pathname}`} condition={props.href === `/${loc.pathname}`}
wrapper={(children) => <A href={props.href||'/'}>{children}</A>} wrapper={(children) => <A href={props.href || '/'}>{children}</A>}
> >
<span <span
class={clsx('cursorPointer linkReplacement', { [styles.mainNavigationItemActive]: props.active })} class={clsx('cursorPointer linkReplacement', { [styles.mainNavigationItemActive]: props.active })}

View File

@ -120,7 +120,7 @@ export const AllAuthors = (props: Props) => {
<div class="row"> <div class="row">
<div class="col-lg-20 col-xl-18"> <div class="col-lg-20 col-xl-18">
<ul class={clsx('nodash', styles.alphabet)}> <ul class={clsx('nodash', styles.alphabet)}>
<For each={[...(alphabet()||[])]}> <For each={[...(alphabet() || [])]}>
{(letter, index) => ( {(letter, index) => (
<li> <li>
<Show when={letter in byLetterFiltered()} fallback={letter}> <Show when={letter in byLetterFiltered()} fallback={letter}>
@ -143,7 +143,7 @@ export const AllAuthors = (props: Props) => {
<For each={sortedKeys() || []}> <For each={sortedKeys() || []}>
{(letter) => ( {(letter) => (
<div class={clsx(styles.group, 'group')}> <div class={clsx(styles.group, 'group')}>
<h2 id={`letter-${alphabet()?.indexOf(letter)||''}`}>{letter}</h2> <h2 id={`letter-${alphabet()?.indexOf(letter) || ''}`}>{letter}</h2>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-20"> <div class="col-lg-20">

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)