diff --git a/api/graphql/models/album.go b/api/graphql/models/album.go index a58f622c..eaa759f8 100644 --- a/api/graphql/models/album.go +++ b/api/graphql/models/album.go @@ -95,7 +95,7 @@ func (a *Album) Thumbnail(db *gorm.DB) (*Media, error) { SELECT id FROM sub_albums ) AND media.id IN ( SELECT media_id FROM media_urls WHERE media_urls.media_id = media.id - ) LIMIT 1 + ) ORDER BY id LIMIT 1 `, a.ID).Find(&media).Error; err != nil { return nil, err } diff --git a/api/graphql/resolvers/album.go b/api/graphql/resolvers/album.go index 88970793..b89388e9 100644 --- a/api/graphql/resolvers/album.go +++ b/api/graphql/resolvers/album.go @@ -175,7 +175,6 @@ func (r *mutationResolver) ResetAlbumCover(ctx context.Context, albumID int) (*m return actions.ResetAlbumCover(r.Database, user, albumID) } -// Takes media.id, finds parent album, sets album.cover_id to media.id (must be a more efficient way of doing this, but it works) func (r *mutationResolver) SetAlbumCover(ctx context.Context, mediaID int) (*models.Album, error) { user := auth.UserFromContext(ctx) if user == nil { diff --git a/ui/src/components/sidebar/AlbumSidebar.tsx b/ui/src/components/sidebar/AlbumSidebar.tsx index 47ea5c50..17b74af5 100644 --- a/ui/src/components/sidebar/AlbumSidebar.tsx +++ b/ui/src/components/sidebar/AlbumSidebar.tsx @@ -7,6 +7,7 @@ import { getAlbumSidebar, getAlbumSidebarVariables, } from './__generated__/getAlbumSidebar' +import { SidebarAlbumCover } from './AlbumCovers' const albumQuery = gql` query getAlbumSidebar($id: ID!) { @@ -46,6 +47,9 @@ const AlbumSidebar = ({ albumId }: AlbumSidebarProps) => { {/*

{data.album.title}

*/} +
+ +
) } diff --git a/ui/src/components/sidebar/MediaSidebar.tsx b/ui/src/components/sidebar/MediaSidebar.tsx index 051f0979..a4ad814c 100644 --- a/ui/src/components/sidebar/MediaSidebar.tsx +++ b/ui/src/components/sidebar/MediaSidebar.tsx @@ -26,6 +26,7 @@ import { import { sidebarDownloadQuery_media_downloads } from './__generated__/sidebarDownloadQuery' import SidebarHeader from './SidebarHeader' +import { SidebarPhotoCover } from './AlbumCovers' const SIDEBAR_MEDIA_QUERY = gql` query sidebarPhoto($id: ID!) { @@ -365,6 +366,9 @@ const SidebarContent = ({ media, hidePreview }: SidebarContentProps) => { +
+ +
) } diff --git a/ui/src/components/sidebar/Sharing.tsx b/ui/src/components/sidebar/Sharing.tsx index 5caa6401..c2ccb800 100644 --- a/ui/src/components/sidebar/Sharing.tsx +++ b/ui/src/components/sidebar/Sharing.tsx @@ -34,8 +34,6 @@ import { import { authToken } from '../../helpers/authentication' import { SidebarSection, SidebarSectionTitle } from './SidebarComponents' -import { SidebarPhotoCover, SidebarAlbumCover } from './AlbumCovers' - import { ReactComponent as LinkIcon } from './icons/shareLinkIcon.svg' import { ReactComponent as CopyIcon } from './icons/shareCopyIcon.svg' import { ReactComponent as DeleteIcon } from './icons/shareDeleteIcon.svg' @@ -433,54 +431,36 @@ const SidebarShare = ({ ) } - let coverPhotoSection - if (isPhoto) { - coverPhotoSection = ( -
- -
- ) - } else { - coverPhotoSection = ( -
- -
- ) - } - return ( -
- - - {t('sidebar.sharing.title', 'Sharing options')} - -
- - {optionsRows} - - - - - -
- -
-
-
- {coverPhotoSection} -
+ + + {t('sidebar.sharing.title', 'Sharing options')} + +
+ + {optionsRows} + + + + + +
+ +
+
+
) }