Skip to content

Commit 03c2848

Browse files
committed
disable links for book and tag buttons in list mode on mobile
1 parent 9344ecb commit 03c2848

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/IndexLayout.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {Link } from 'react-router-dom'
33
import {Button, Dropdown, Badge} from 'react-bootstrap'
44
import {ListGroup} from 'react-bootstrap'
55
import {useState, useEffect} from 'react'
6+
import {isMobile} from 'react-device-detect'
67
import IndexSearchForm from './IndexSearchForm'
78
import BoostSettingsModal from './BoostSettingsModal'
89
import SelectedItemsModal from './SelectedItemsModal'
@@ -426,10 +427,10 @@ export default function IndexLayout(props) {
426427
</>}
427428

428429
{(tune.books && tune.books.length > 0) && <span style={{ marginRight:'1em', float:'right'}} >
429-
{tune.books.map(function(book,count) {if (props.currentTuneBook && props.currentTuneBook === book) {return null} else { return <Button onClick={function() { props.setCurrentTuneBook(book); props.setFilter(''); props.forceRefresh()}} key={book} variant="primary" style={{color:'white', marginRight:'0.1em', fontSize:'0.5em'}} >{book}</Button>}})}
430+
{tune.books.map(function(book,count) {if (props.currentTuneBook && props.currentTuneBook === book) {return null} else { return <Button disabled={isMobile} onClick={function() { if (!isMobile) { props.setCurrentTuneBook(book); props.setFilter(''); props.forceRefresh()} }} key={book} variant="primary" style={{color:'white', marginRight:'0.1em', fontSize:'0.5em'}} >{book}</Button>}})}
430431
</span>}
431432
{(Array.isArray(tune.tags) && tune.tags.length > 0) && <span style={{ marginRight:'1em', float:'right'}} >
432-
{tune.tags.map(function(tag,count) { return props.tagFilter.indexOf(tag) === -1 ? <Button key={tag} variant="info" onClick={function() { props.setTagFilter([tag]); props.setFilter(''); props.forceRefresh()}} style={{marginRight:'0.1em', fontSize:'0.5em'}} >{tag}</Button> : ''})}
433+
{tune.tags.map(function(tag,count) { return props.tagFilter.indexOf(tag) === -1 ? <Button disabled={isMobile} key={tag} variant="info" onClick={function() { if (!isMobile) { props.setTagFilter([tag]); props.setFilter(''); props.forceRefresh()} }} style={{marginRight:'0.1em', fontSize:'0.5em'}} >{tag}</Button> : ''})}
433434
</span>}
434435
{(Object.keys(filtered).length > 0 && Object.keys(filtered).length < LIST_PROTECTION_LIMIT) && <>
435436
{tune.key && <Button style={{ marginRight:'1em', float:'right'}} variant={'outline-success'} >{tune.key}</Button>}

0 commit comments

Comments
 (0)