1
Fork 0

Fix UI tests

This commit is contained in:
viktorstrate 2021-09-25 14:47:54 +02:00
parent e7dbe0868d
commit 2c0baa6bdf
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
4 changed files with 192 additions and 112 deletions

View File

@ -30,7 +30,7 @@ const Gallery = styled.div`
}
`
const PhotoFiller = styled.div`
export const PhotoFiller = styled.div`
height: 200px;
flex-grow: 999999;
`

View File

@ -1,6 +1,7 @@
import React from 'react'
import { Link } from 'react-router-dom'
import { MediaThumbnail } from '../photoGallery/MediaThumbnail'
import { PhotoFiller } from '../photoGallery/PhotoGallery'
import {
toggleFavoriteAction,
useMarkFavoriteMutation,
@ -72,9 +73,9 @@ const TimelineGroupAlbum = ({
<Link to={`/album/${albumID}`} className="hover:underline">
{albumTitle}
</Link>
<div className="flex flex-wrap items-center h-[210px] relative -mx-1 pr-4 overflow-hidden">
<div className="flex flex-wrap items-center relative -mx-1 pr-4 overflow-hidden">
{mediaElms}
{/* {itemsBubble} */}
<PhotoFiller />
</div>
</div>
)

View File

@ -144,102 +144,171 @@ describe('timeline gallery reducer', () => {
media: -1,
},
timelineGroups: [
// {
// date: '2020-12-13T00:00:00Z',
// albums: [
// {
// id: '522',
// title: 'random',
// media: [
// {
// __typename: 'Media',
// id: '1058',
// title: '122A2876.jpg',
// type: MediaType.Photo,
// thumbnail: {
// __typename: 'MediaURL',
// url: 'http://localhost:4001/photo/thumbnail_122A2876_jpg_Kp1U80vD.jpg',
// width: 1024,
// height: 682,
// },
// highRes: {
// __typename: 'MediaURL',
// url: 'http://localhost:4001/photo/122A2876_5cSPMiKL.jpg',
// width: 6720,
// height: 4480,
// },
// videoWeb: null,
// favorite: false,
// album: { __typename: 'Album', id: '522', title: 'random' },
// date: '2020-12-13T18:03:40Z',
// },
// ],
// },
// ],
// },
// {
// date: '2020-11-25T00:00:00Z',
// albums: [
// {
// id: '523',
// title: 'another_album',
// media: [
// {
// __typename: 'Media',
// id: '1059',
// title: '122A2630-Edit.jpg',
// type: MediaType.Photo,
// thumbnail: {
// __typename: 'MediaURL',
// url: 'http://localhost:4001/photo/thumbnail_122A2630-Edit_jpg_pwjtMkpy.jpg',
// width: 1024,
// height: 682,
// },
// highRes: {
// __typename: 'MediaURL',
// url: 'http://localhost:4001/photo/122A2630-Edit_ySQWFAgE.jpg',
// width: 6177,
// height: 4118,
// },
// videoWeb: null,
// favorite: false,
// album: {
// __typename: 'Album',
// id: '523',
// title: 'another_album',
// },
// date: '2020-11-25T16:14:33Z',
// },
// {
// __typename: 'Media',
// id: '1060',
// title: '122A2785-2.jpg',
// type: MediaType.Photo,
// thumbnail: {
// __typename: 'MediaURL',
// url: 'http://localhost:4001/photo/thumbnail_122A2785-2_jpg_CevmxEXf.jpg',
// width: 1024,
// height: 1024,
// },
// highRes: {
// __typename: 'MediaURL',
// url: 'http://localhost:4001/photo/122A2785-2_mCnWjLdb.jpg',
// width: 884,
// height: 884,
// },
// videoWeb: null,
// favorite: false,
// album: {
// __typename: 'Album',
// id: '523',
// title: 'another_album',
// },
// date: '2020-11-25T16:43:59Z',
// },
// ],
// },
// ],
// },
{
date: '2020-12-13T00:00:00Z',
albums: [
{
id: '522',
media: [
{
__typename: 'Media',
album: {
__typename: 'Album',
id: '522',
title: 'random',
},
date: '2020-12-13T18:03:40Z',
favorite: false,
highRes: {
__typename: 'MediaURL',
height: 4480,
url: 'http://localhost:4001/photo/122A2876_5cSPMiKL.jpg',
width: 6720,
},
id: '1058',
thumbnail: {
__typename: 'MediaURL',
height: 682,
url: 'http://localhost:4001/photo/thumbnail_122A2876_jpg_Kp1U80vD.jpg',
width: 1024,
},
title: '122A2876.jpg',
type: 'Photo',
videoWeb: null,
},
],
title: 'random',
},
],
},
{
date: '2020-11-25T00:00:00Z',
albums: [
{
id: '523',
title: 'another_album',
media: [
{
__typename: 'Media',
album: {
__typename: 'Album',
id: '523',
title: 'another_album',
},
date: '2020-11-25T16:14:33Z',
favorite: false,
highRes: {
__typename: 'MediaURL',
height: 4118,
url: 'http://localhost:4001/photo/122A2630-Edit_ySQWFAgE.jpg',
width: 6177,
},
id: '1059',
thumbnail: {
__typename: 'MediaURL',
height: 682,
url: 'http://localhost:4001/photo/thumbnail_122A2630-Edit_jpg_pwjtMkpy.jpg',
width: 1024,
},
title: '122A2630-Edit.jpg',
type: 'Photo',
videoWeb: null,
},
{
__typename: 'Media',
album: {
__typename: 'Album',
id: '523',
title: 'another_album',
},
date: '2020-11-25T16:43:59Z',
favorite: false,
highRes: {
__typename: 'MediaURL',
height: 884,
url: 'http://localhost:4001/photo/122A2785-2_mCnWjLdb.jpg',
width: 884,
},
id: '1060',
thumbnail: {
__typename: 'MediaURL',
height: 1024,
url: 'http://localhost:4001/photo/thumbnail_122A2785-2_jpg_CevmxEXf.jpg',
width: 1024,
},
title: '122A2785-2.jpg',
type: 'Photo',
videoWeb: null,
},
],
},
{
id: '522',
title: 'random',
media: [
{
__typename: 'Media',
album: {
__typename: 'Album',
id: '522',
title: 'random',
},
date: '2020-11-25T16:14:33Z',
favorite: false,
highRes: {
__typename: 'MediaURL',
height: 4118,
url: 'http://localhost:4001/photo/122A2630-Edit_em9g89qg.jpg',
width: 6177,
},
id: '1056',
thumbnail: {
__typename: 'MediaURL',
height: 682,
url: 'http://localhost:4001/photo/thumbnail_122A2630-Edit_jpg_aJPCSDDl.jpg',
width: 1024,
},
title: '122A2630-Edit.jpg',
type: 'Photo',
videoWeb: null,
},
],
},
],
},
{
date: '2020-11-09T00:00:00Z',
albums: [
{
id: '522',
title: 'random',
media: [
{
__typename: 'Media',
id: '1054',
title: '122A2559.jpg',
type: MediaType.Photo,
thumbnail: {
__typename: 'MediaURL',
url: 'http://localhost:4001/photo/thumbnail_122A2559_jpg_MsOJtPi8.jpg',
width: 1024,
height: 712,
},
highRes: {
__typename: 'MediaURL',
url: 'http://localhost:4001/photo/122A2559_FDsQHuBN.jpg',
width: 6246,
height: 4346,
},
videoWeb: null,
favorite: false,
album: { __typename: 'Album', id: '522', title: 'random' },
date: '2020-11-09T15:38:09Z',
},
],
},
],
},
],
})
})
@ -291,20 +360,20 @@ describe('timeline gallery reducer', () => {
media: 0,
},
out: {
date: 0,
date: 1,
album: 0,
media: 1,
media: 0,
},
},
{
name: 'next album',
in: {
date: 0,
date: 1,
album: 0,
media: 1,
},
out: {
date: 0,
date: 1,
album: 1,
media: 0,
},
@ -312,12 +381,12 @@ describe('timeline gallery reducer', () => {
{
name: 'next date',
in: {
date: 0,
date: 1,
album: 1,
media: 1,
media: 0,
},
out: {
date: 1,
date: 2,
album: 0,
media: 0,
},
@ -325,12 +394,12 @@ describe('timeline gallery reducer', () => {
{
name: 'reached end',
in: {
date: 1,
date: 2,
album: 0,
media: 0,
},
out: {
date: 1,
date: 2,
album: 0,
media: 0,
},
@ -390,12 +459,12 @@ describe('timeline gallery reducer', () => {
{
name: 'previous album',
in: {
date: 0,
date: 1,
album: 1,
media: 0,
},
out: {
date: 0,
date: 1,
album: 0,
media: 1,
},
@ -403,12 +472,12 @@ describe('timeline gallery reducer', () => {
{
name: 'previous date',
in: {
date: 1,
date: 2,
album: 0,
media: 0,
},
out: {
date: 0,
date: 1,
album: 1,
media: 0,
},

View File

@ -2,6 +2,7 @@ import React from 'react'
import { myTimeline_myTimeline } from './__generated__/myTimeline'
import { TimelineGroup, TimelineGroupAlbum } from './TimelineGallery'
import { GalleryAction } from '../photoGallery/photoGalleryReducer'
import { isNil } from '../../helpers/utils'
export interface TimelineMediaIndex {
date: number
@ -245,6 +246,15 @@ function convertMediaToTimelineGroups(
nextAlbum.media.push(media)
}
if (!isNil(nextAlbum)) {
albums.push(nextAlbum)
timelineGroups.push({
date: albums[0].media[0].date.replace(/\d{2}:\d{2}:\d{2}/, '00:00:00'),
albums: albums,
})
}
return timelineGroups
}