Temporarily remove next/previous web controls

This commit is contained in:
Jackson Harper
2023-10-16 17:51:28 +08:00
parent a537252db3
commit 74b25a23ac

View File

@ -79,30 +79,30 @@ export default function Home(): JSX.Element {
}, [articleData?.article.article])
const goNextOrHome = useCallback(() => {
const listStr = localStorage.getItem('library-slug-list')
if (article && listStr && viewerData?.me) {
const libraryList = JSON.parse(listStr) as string[]
const idx = libraryList.findIndex((slug) => slug == article.slug)
if (idx != -1 && idx < libraryList.length - 1) {
const nextSlug = libraryList[idx + 1] as string
router.push(`/${viewerData?.me.profile.username}/${nextSlug}`)
return
}
}
// const listStr = localStorage.getItem('library-slug-list')
// if (article && listStr && viewerData?.me) {
// const libraryList = JSON.parse(listStr) as string[]
// const idx = libraryList.findIndex((slug) => slug == article.slug)
// if (idx != -1 && idx < libraryList.length - 1) {
// const nextSlug = libraryList[idx + 1] as string
// router.push(`/${viewerData?.me.profile.username}/${nextSlug}`)
// return
// }
// }
router.push(`/home`)
}, [router, viewerData, article])
const goPreviousOrHome = useCallback(() => {
const listStr = localStorage.getItem('library-slug-list')
if (article && listStr && viewerData?.me) {
const libraryList = JSON.parse(listStr) as string[]
const idx = libraryList.findIndex((slug) => slug == article.slug)
if (idx > 0) {
const previousSlug = libraryList[idx - 1] as string
router.push(`/${viewerData?.me.profile.username}/${previousSlug}`)
return
}
}
// const listStr = localStorage.getItem('library-slug-list')
// if (article && listStr && viewerData?.me) {
// const libraryList = JSON.parse(listStr) as string[]
// const idx = libraryList.findIndex((slug) => slug == article.slug)
// if (idx > 0) {
// const previousSlug = libraryList[idx - 1] as string
// router.push(`/${viewerData?.me.profile.username}/${previousSlug}`)
// return
// }
// }
router.push(`/home`)
}, [router, viewerData, article])
@ -418,24 +418,24 @@ export default function Home(): JSX.Element {
shortcut: ['i'],
perform: () => setShowEditModal(true),
},
{
id: 'go_previous',
section: 'Article',
name: 'Go to Previous',
shortcut: ['g', 'p'],
perform: () => {
document.dispatchEvent(new Event('goPreviousOrHome'))
},
},
{
id: 'go_next',
section: 'Article',
name: 'Go to Next',
shortcut: ['g', 'n'],
perform: () => {
document.dispatchEvent(new Event('goNextOrHome'))
},
},
// {
// id: 'go_previous',
// section: 'Article',
// name: 'Go to Previous',
// shortcut: ['g', 'p'],
// perform: () => {
// document.dispatchEvent(new Event('goPreviousOrHome'))
// },
// },
// {
// id: 'go_next',
// section: 'Article',
// name: 'Go to Next',
// shortcut: ['g', 'n'],
// perform: () => {
// document.dispatchEvent(new Event('goNextOrHome'))
// },
// },
],
[readerSettings, showHighlightsModal]
)