fix(ui): UI issues & styling coherence (#4910)
* fix: ui issues and styles * fix linter
This commit is contained in:
@@ -228,7 +228,7 @@ const AlbumDetails = (props) => {
|
|||||||
let notes =
|
let notes =
|
||||||
albumInfo?.notes?.replace(new RegExp('<.*>', 'g'), '') || record.notes
|
albumInfo?.notes?.replace(new RegExp('<.*>', 'g'), '') || record.notes
|
||||||
|
|
||||||
if (notes !== undefined) {
|
if (notes) {
|
||||||
notes += '..'
|
notes += '..'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ const AlbumDetails = (props) => {
|
|||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{isDesktop && (
|
{isDesktop && notes && (
|
||||||
<Collapse
|
<Collapse
|
||||||
collapsedHeight={'2.75em'}
|
collapsedHeight={'2.75em'}
|
||||||
in={expanded}
|
in={expanded}
|
||||||
@@ -364,7 +364,7 @@ const AlbumDetails = (props) => {
|
|||||||
{!isDesktop && record['comment'] && (
|
{!isDesktop && record['comment'] && (
|
||||||
<CollapsibleComment record={record} />
|
<CollapsibleComment record={record} />
|
||||||
)}
|
)}
|
||||||
{!isDesktop && (
|
{!isDesktop && notes && (
|
||||||
<div className={classes.notes}>
|
<div className={classes.notes}>
|
||||||
<Collapse collapsedHeight={'1.5em'} in={expanded} timeout={'auto'}>
|
<Collapse collapsedHeight={'1.5em'} in={expanded} timeout={'auto'}>
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -4,18 +4,26 @@ import FavoriteIcon from '@material-ui/icons/Favorite'
|
|||||||
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder'
|
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder'
|
||||||
import IconButton from '@material-ui/core/IconButton'
|
import IconButton from '@material-ui/core/IconButton'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
|
import clsx from 'clsx'
|
||||||
import { useToggleLove } from './useToggleLove'
|
import { useToggleLove } from './useToggleLove'
|
||||||
import { useRecordContext } from 'react-admin'
|
import { useRecordContext } from 'react-admin'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { isDateSet } from '../utils/validations'
|
import { isDateSet } from '../utils/validations'
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles(
|
||||||
|
{
|
||||||
love: {
|
love: {
|
||||||
color: (props) => props.color,
|
color: (props) => props.color,
|
||||||
visibility: (props) =>
|
visibility: (props) =>
|
||||||
props.visible === false ? 'hidden' : props.loved ? 'visible' : 'inherit',
|
props.visible === false
|
||||||
|
? 'hidden'
|
||||||
|
: props.loved
|
||||||
|
? 'visible'
|
||||||
|
: 'inherit',
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
|
{ name: 'NDLoveButton' },
|
||||||
|
)
|
||||||
|
|
||||||
export const LoveButton = ({
|
export const LoveButton = ({
|
||||||
resource,
|
resource,
|
||||||
@@ -25,9 +33,11 @@ export const LoveButton = ({
|
|||||||
component: Button,
|
component: Button,
|
||||||
addLabel,
|
addLabel,
|
||||||
disabled,
|
disabled,
|
||||||
|
className,
|
||||||
|
record: recordProp,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const record = useRecordContext(rest) || {}
|
const record = useRecordContext({ record: recordProp }) || {}
|
||||||
const classes = useStyles({ color, visible, loved: record.starred })
|
const classes = useStyles({ color, visible, loved: record.starred })
|
||||||
const [toggleLove, loading] = useToggleLove(resource, record)
|
const [toggleLove, loading] = useToggleLove(resource, record)
|
||||||
|
|
||||||
@@ -48,7 +58,7 @@ export const LoveButton = ({
|
|||||||
onClick={handleToggleLove}
|
onClick={handleToggleLove}
|
||||||
size={'small'}
|
size={'small'}
|
||||||
disabled={disabled || loading || record.missing}
|
disabled={disabled || loading || record.missing}
|
||||||
className={classes.love}
|
className={clsx(classes.love, className)}
|
||||||
title={
|
title={
|
||||||
isDateSet(record.starredAt)
|
isDateSet(record.starredAt)
|
||||||
? new Date(record.starredAt).toLocaleString()
|
? new Date(record.starredAt).toLocaleString()
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import { useDispatch } from 'react-redux'
|
|||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
user: {},
|
user: {},
|
||||||
|
button: {
|
||||||
|
color: 'inherit',
|
||||||
|
},
|
||||||
avatar: {
|
avatar: {
|
||||||
width: theme.spacing(4),
|
width: theme.spacing(4),
|
||||||
height: theme.spacing(4),
|
height: theme.spacing(4),
|
||||||
@@ -72,12 +75,11 @@ const UserMenu = (props) => {
|
|||||||
<div className={classes.user}>
|
<div className={classes.user}>
|
||||||
<Tooltip title={label && translate(label, { _: label })}>
|
<Tooltip title={label && translate(label, { _: label })}>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
className={classes.button}
|
||||||
aria-label={label && translate(label, { _: label })}
|
aria-label={label && translate(label, { _: label })}
|
||||||
aria-owns={open ? 'menu-appbar' : null}
|
aria-owns={open ? 'menu-appbar' : null}
|
||||||
aria-haspopup={true}
|
aria-haspopup={true}
|
||||||
color="inherit"
|
|
||||||
onClick={handleMenu}
|
onClick={handleMenu}
|
||||||
size={'small'}
|
|
||||||
>
|
>
|
||||||
{loaded && identity.avatar ? (
|
{loaded && identity.avatar ? (
|
||||||
<Avatar
|
<Avatar
|
||||||
|
|||||||
Reference in New Issue
Block a user