Add sorting and filters
This commit is contained in:
parent
3560c2cae8
commit
7c714449f9
|
@ -3,7 +3,7 @@ enum Role {
|
||||||
User
|
User
|
||||||
}
|
}
|
||||||
|
|
||||||
type User @hasRole(roles: [Admin]) {
|
type User {
|
||||||
id: ID!
|
id: ID!
|
||||||
username: String!
|
username: String!
|
||||||
albums: [Album] @relation(name: "OWNS", direction: "OUT")
|
albums: [Album] @relation(name: "OWNS", direction: "OUT")
|
||||||
|
@ -12,7 +12,7 @@ type User @hasRole(roles: [Admin]) {
|
||||||
admin: Boolean
|
admin: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type Album @hasRole(roles: [Admin]) {
|
type Album {
|
||||||
id: ID!
|
id: ID!
|
||||||
title: String
|
title: String
|
||||||
photos: [Photo] @relation(name: "CONTAINS", direction: "OUT")
|
photos: [Photo] @relation(name: "CONTAINS", direction: "OUT")
|
||||||
|
@ -31,7 +31,7 @@ type PhotoURL {
|
||||||
height: Int
|
height: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type Photo @hasRole(roles: [Admin]) {
|
type Photo {
|
||||||
id: ID!
|
id: ID!
|
||||||
title: String
|
title: String
|
||||||
# Local filepath for the photo
|
# Local filepath for the photo
|
||||||
|
|
|
@ -10,7 +10,7 @@ const albumQuery = gql`
|
||||||
query albumQuery($id: ID) {
|
query albumQuery($id: ID) {
|
||||||
album(id: $id) {
|
album(id: $id) {
|
||||||
title
|
title
|
||||||
subAlbums {
|
subAlbums(orderBy: title_asc) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
photos {
|
photos {
|
||||||
|
@ -19,7 +19,7 @@ const albumQuery = gql`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
photos {
|
photos(orderBy: title_desc) {
|
||||||
id
|
id
|
||||||
thumbnail {
|
thumbnail {
|
||||||
url
|
url
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { Query } from 'react-apollo'
|
||||||
|
|
||||||
const getAlbumsQuery = gql`
|
const getAlbumsQuery = gql`
|
||||||
query getMyAlbums {
|
query getMyAlbums {
|
||||||
myAlbums(filter: { parentAlbum: null }) {
|
myAlbums(filter: { parentAlbum: null }, orderBy: title_asc) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
photos {
|
photos {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import PhotoGallery from '../../PhotoGallery'
|
||||||
|
|
||||||
const photoQuery = gql`
|
const photoQuery = gql`
|
||||||
query allPhotosPage {
|
query allPhotosPage {
|
||||||
myPhotos {
|
myPhotos(orderBy: title_desc) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
thumbnail {
|
thumbnail {
|
||||||
|
|
|
@ -66,9 +66,12 @@ const PhotoGallery = ({ activeIndex = -1, photos, loading, onSelectImage }) => {
|
||||||
photoElements = photos.map((photo, index) => {
|
photoElements = photos.map((photo, index) => {
|
||||||
const active = activeIndex == index
|
const active = activeIndex == index
|
||||||
|
|
||||||
const minWidth = Math.floor(
|
let minWidth = 100
|
||||||
(photo.thumbnail.width / photo.thumbnail.height) * 200
|
if (photo.thumbnail) {
|
||||||
)
|
minWidth = Math.floor(
|
||||||
|
(photo.thumbnail.width / photo.thumbnail.height) * 200
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PhotoContainer
|
<PhotoContainer
|
||||||
|
|
Loading…
Reference in New Issue