diff --git a/api/src/schema.graphql b/api/src/schema.graphql index 526081cc..a9f2ebe1 100644 --- a/api/src/schema.graphql +++ b/api/src/schema.graphql @@ -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 diff --git a/ui/src/Pages/AlbumPage/AlbumPage.js b/ui/src/Pages/AlbumPage/AlbumPage.js index 385179fb..575bcf2d 100644 --- a/ui/src/Pages/AlbumPage/AlbumPage.js +++ b/ui/src/Pages/AlbumPage/AlbumPage.js @@ -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 diff --git a/ui/src/Pages/AllAlbumsPage/AlbumsPage.js b/ui/src/Pages/AllAlbumsPage/AlbumsPage.js index 62f407c7..6b24a023 100644 --- a/ui/src/Pages/AllAlbumsPage/AlbumsPage.js +++ b/ui/src/Pages/AllAlbumsPage/AlbumsPage.js @@ -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 { diff --git a/ui/src/Pages/PhotosPage/PhotosPage.js b/ui/src/Pages/PhotosPage/PhotosPage.js index 0ee4c3d5..09b23389 100644 --- a/ui/src/Pages/PhotosPage/PhotosPage.js +++ b/ui/src/Pages/PhotosPage/PhotosPage.js @@ -6,7 +6,7 @@ import PhotoGallery from '../../PhotoGallery' const photoQuery = gql` query allPhotosPage { - myPhotos { + myPhotos(orderBy: title_desc) { id title thumbnail { diff --git a/ui/src/PhotoGallery.js b/ui/src/PhotoGallery.js index 9aa81b73..600218a3 100644 --- a/ui/src/PhotoGallery.js +++ b/ui/src/PhotoGallery.js @@ -66,9 +66,12 @@ const PhotoGallery = ({ activeIndex = -1, photos, loading, onSelectImage }) => { photoElements = photos.map((photo, index) => { const active = activeIndex == index - const minWidth = Math.floor( - (photo.thumbnail.width / photo.thumbnail.height) * 200 - ) + let minWidth = 100 + if (photo.thumbnail) { + minWidth = Math.floor( + (photo.thumbnail.width / photo.thumbnail.height) * 200 + ) + } return (