linter-passing
This commit is contained in:
parent
89450336e7
commit
8364acb85b
|
@ -11,6 +11,7 @@ import { useSession } from '../../context/session'
|
||||||
import { locale } from '../../stores/ui'
|
import { locale } from '../../stores/ui'
|
||||||
import { translit } from '../../utils/ru2en'
|
import { translit } from '../../utils/ru2en'
|
||||||
import { SearchField } from '../_shared/SearchField'
|
import { SearchField } from '../_shared/SearchField'
|
||||||
|
import { scrollHandler } from '../../utils/scroll'
|
||||||
|
|
||||||
type AllAuthorsPageSearchParams = {
|
type AllAuthorsPageSearchParams = {
|
||||||
by: '' | 'name' | 'shouts' | 'rating'
|
by: '' | 'name' | 'shouts' | 'rating'
|
||||||
|
@ -21,7 +22,7 @@ type Props = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PAGE_SIZE = 20
|
const PAGE_SIZE = 20
|
||||||
const ALPHABET = Array.from('@АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ')
|
const ALPHABET = [...'@АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ']
|
||||||
|
|
||||||
export const AllAuthorsView = (props: Props) => {
|
export const AllAuthorsView = (props: Props) => {
|
||||||
const { sortedAuthors } = useAuthorsStore({ authors: props.authors })
|
const { sortedAuthors } = useAuthorsStore({ authors: props.authors })
|
||||||
|
@ -77,16 +78,6 @@ export const AllAuthorsView = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
const scrollHandler = (elemId) => {
|
|
||||||
const anchor = document.querySelector('#' + elemId)
|
|
||||||
// console.debug(elemId)
|
|
||||||
if (anchor) {
|
|
||||||
window.scrollTo({
|
|
||||||
top: anchor.getBoundingClientRect().top - 100,
|
|
||||||
behavior: 'smooth'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const [searchResults, setSearchResults] = createSignal<Author[]>([])
|
const [searchResults, setSearchResults] = createSignal<Author[]>([])
|
||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
const searchAuthors = (value) => {
|
const searchAuthors = (value) => {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { locale } from '../../stores/ui'
|
||||||
import { translit } from '../../utils/ru2en'
|
import { translit } from '../../utils/ru2en'
|
||||||
import styles from '../../styles/AllTopics.module.scss'
|
import styles from '../../styles/AllTopics.module.scss'
|
||||||
import { SearchField } from '../_shared/SearchField'
|
import { SearchField } from '../_shared/SearchField'
|
||||||
|
import { scrollHandler } from '../../utils/scroll'
|
||||||
|
|
||||||
type AllTopicsPageSearchParams = {
|
type AllTopicsPageSearchParams = {
|
||||||
by: 'shouts' | 'authors' | 'title' | ''
|
by: 'shouts' | 'authors' | 'title' | ''
|
||||||
|
@ -20,7 +21,7 @@ type AllTopicsViewProps = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PAGE_SIZE = 20
|
const PAGE_SIZE = 20
|
||||||
const ALPHABET = Array.from('#АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ')
|
const ALPHABET = [...'#АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ']
|
||||||
|
|
||||||
export const AllTopicsView = (props: AllTopicsViewProps) => {
|
export const AllTopicsView = (props: AllTopicsViewProps) => {
|
||||||
const { searchParams, changeSearchParam } = useRouter<AllTopicsPageSearchParams>()
|
const { searchParams, changeSearchParam } = useRouter<AllTopicsPageSearchParams>()
|
||||||
|
@ -114,16 +115,6 @@ export const AllTopicsView = (props: AllTopicsViewProps) => {
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const scrollHandler = (elemId) => {
|
|
||||||
const anchor = document.querySelector('#' + elemId)
|
|
||||||
// console.debug(elemId)
|
|
||||||
if (anchor) {
|
|
||||||
window.scrollTo({
|
|
||||||
top: anchor.getBoundingClientRect().top - 100,
|
|
||||||
behavior: 'smooth'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div class={clsx(styles.allTopicsPage, 'container')}>
|
<div class={clsx(styles.allTopicsPage, 'container')}>
|
||||||
<div class="shift-content">
|
<div class="shift-content">
|
||||||
|
|
|
@ -13,8 +13,8 @@ export const initClient = (options) => {
|
||||||
console.info('[graphql] devmode detected')
|
console.info('[graphql] devmode detected')
|
||||||
return localClient(options)
|
return localClient(options)
|
||||||
} else return createClient(options)
|
} else return createClient(options)
|
||||||
} catch (e) {
|
} catch (error) {
|
||||||
console.error(e)
|
console.error(error)
|
||||||
return localClient(options)
|
return localClient(options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,3 +14,14 @@ export const restoreScrollPosition = () => {
|
||||||
left: scrollPosition.left
|
left: scrollPosition.left
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const scrollHandler = (elemId) => {
|
||||||
|
const anchor = document.querySelector('#' + elemId)
|
||||||
|
// console.debug(elemId)
|
||||||
|
if (anchor) {
|
||||||
|
window.scrollTo({
|
||||||
|
top: anchor.getBoundingClientRect().top - 100,
|
||||||
|
behavior: 'smooth'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user