1
Fork 0
- Fixed issue that prevented favorites toggle to switch on on the Photos page
- The favorites toggle is moved on left
This commit is contained in:
stz184 2020-09-26 02:18:30 +03:00
parent 9212ac52eb
commit 85a8dbedb0
3 changed files with 21 additions and 22 deletions

View File

@ -52,21 +52,21 @@ function AlbumPage({ match }) {
)
const toggleFavorites = refetch => {
const onlyFavorites = !onlyFavorites
const newState = !onlyFavorites
if (
(refetchNeededAll && !onlyFavorites) ||
(refetchNeededFavorites && onlyFavorites)
(refetchNeededAll && !newState) ||
(refetchNeededFavorites && newState)
) {
refetch({ id: albumId, onlyFavorites: onlyFavorites }).then(() => {
refetch({ id: albumId, onlyFavorites: newState }).then(() => {
if (onlyFavorites) {
refetchNeededFavorites = false
} else {
refetchNeededAll = false
}
setOnlyFavorites(onlyFavorites)
setOnlyFavorites(newState)
})
} else {
setOnlyFavorites(onlyFavorites)
setOnlyFavorites(newState)
}
history.replaceState(
{},

View File

@ -44,8 +44,7 @@ const photoQuery = gql`
`
const FavoritesCheckbox = styled(Checkbox)`
float: right;
margin: 0.5rem 0 0 1rem;
margin: 0.5rem 0 0 0;
`
class PhotosPage extends Component {

View File

@ -34,9 +34,7 @@ const StyledIcon = styled(Icon)`
`
const FavoritesCheckbox = styled(Checkbox)`
float: right;
padding-left: 10px;
margin-top: 0.5rem;
margin-bottom: 16px;
`
const SettingsIcon = props => {
@ -103,16 +101,18 @@ const AlbumTitle = ({
}
return (
<Header>
<Breadcrumb>{breadcrumbSections}</Breadcrumb>
{title}
{authToken() && (
<SettingsIcon
onClick={() => {
updateSidebar(<AlbumSidebar albumId={album.id} />)
}}
/>
)}
<>
<Header>
<Breadcrumb>{breadcrumbSections}</Breadcrumb>
{title}
{authToken() && (
<SettingsIcon
onClick={() => {
updateSidebar(<AlbumSidebar albumId={album.id} />)
}}
/>
)}
</Header>
{authToken() && showFavoritesToggle && (
<FavoritesCheckbox
toggle
@ -122,7 +122,7 @@ const AlbumTitle = ({
onChange={setOnlyFavorites}
/>
)}
</Header>
</>
)
}