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