import React, { cloneElement, isValidElement, useState } from 'react' import { BooleanField, Datagrid, DatagridBody, DatagridRow, DateField, NumberField, Show, SimpleShowLayout, TextField, } from 'react-admin' import { ArtistLinkField, DurationField, RangeField, SimpleList, } from '../common' import { useMediaQuery } from '@material-ui/core' import AlbumContextMenu from '../common/AlbumContextMenu' const AlbumDetails = (props) => { return ( ) } const AlbumDatagridRow = ({ children, ...rest }) => { const [visible, setVisible] = useState(false) const childCount = React.Children.count(children) return ( setVisible(true)} onMouseLeave={() => setVisible(false)} {...rest} > {React.Children.map( children, (child, index) => child && isValidElement(child) && (index < childCount - 1 ? child : cloneElement(child, { visible, ...rest, })) )} ) } const AlbumDatagridBody = (props) => ( } /> ) const AlbumDatagrid = (props) => ( } /> ) const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => { const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md')) const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs')) return isXsmall ? ( r.name} secondaryText={(r) => r.albumArtist} tertiaryText={(r) => ( <>     )} linkType={'show'} rightIcon={(r) => } {...rest} /> ) : ( } rowClick={'show'} {...rest}> {isDesktop && } {isDesktop && } {isDesktop && } ) } export default AlbumListView