|
@@ -75,8 +75,11 @@ const DeadCenter = styled.div`
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
`;
|
|
`;
|
|
|
|
|
|
-const ListContainer = styled.div`
|
|
|
|
- display: flex;
|
|
|
|
|
|
+const ListContainer = styled.div<{columns: number}>`
|
|
|
|
+ display: grid;
|
|
|
|
+ grid-template-columns: repeat(${props => props.columns}, 1fr);
|
|
|
|
+ grid-column-gap: 8px;
|
|
|
|
+ padding: 0 8px;
|
|
max-width: 100%;
|
|
max-width: 100%;
|
|
color: #fff;
|
|
color: #fff;
|
|
|
|
|
|
@@ -94,13 +97,12 @@ const ListContainer = styled.div`
|
|
`;
|
|
`;
|
|
|
|
|
|
const DateContainer = styled.div`
|
|
const DateContainer = styled.div`
|
|
- padding: 0 4px;
|
|
|
|
|
|
+ padding-top: 15px;
|
|
`;
|
|
`;
|
|
|
|
|
|
export default function Gallery(props) {
|
|
export default function Gallery(props) {
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const [loading, setLoading] = useState(false);
|
|
const [loading, setLoading] = useState(false);
|
|
- const [reload, setReload] = useState(0);
|
|
|
|
const [collections, setCollections] = useState<collection[]>([]);
|
|
const [collections, setCollections] = useState<collection[]>([]);
|
|
const [collectionLatestFile, setCollectionLatestFile] = useState<
|
|
const [collectionLatestFile, setCollectionLatestFile] = useState<
|
|
collectionLatestFile[]
|
|
collectionLatestFile[]
|
|
@@ -113,6 +115,7 @@ export default function Gallery(props) {
|
|
maxSpreadZoom: 5,
|
|
maxSpreadZoom: 5,
|
|
});
|
|
});
|
|
const fetching: { [k: number]: boolean } = {};
|
|
const fetching: { [k: number]: boolean } = {};
|
|
|
|
+ const [sinceTime, setSinceTime] = useState(0);
|
|
|
|
|
|
const [progress, setProgress] = useState(0)
|
|
const [progress, setProgress] = useState(0)
|
|
|
|
|
|
@@ -150,16 +153,9 @@ export default function Gallery(props) {
|
|
}
|
|
}
|
|
setCollectionLatestFile(collectionLatestFile);
|
|
setCollectionLatestFile(collectionLatestFile);
|
|
setFavItemIds(favItemIds);
|
|
setFavItemIds(favItemIds);
|
|
-
|
|
|
|
|
|
+ setSinceTime((new Date()).getTime());
|
|
props.setUploadButtonView(true);
|
|
props.setUploadButtonView(true);
|
|
}
|
|
}
|
|
- if (!data || loading) {
|
|
|
|
- return (
|
|
|
|
- <div className='text-center'>
|
|
|
|
- <Spinner animation='border' variant='primary' />
|
|
|
|
- </div>
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
|
|
const updateUrl = (index: number) => (url: string) => {
|
|
const updateUrl = (index: number) => (url: string) => {
|
|
data[index] = {
|
|
data[index] = {
|
|
@@ -272,6 +268,14 @@ export default function Gallery(props) {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ if (!data || loading) {
|
|
|
|
+ return (
|
|
|
|
+ <div className='text-center'>
|
|
|
|
+ <Spinner animation='border' variant='primary' />
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
const selectCollection = (id?: string) => {
|
|
const selectCollection = (id?: string) => {
|
|
const href = `/gallery?collection=${id || ''}`;
|
|
const href = `/gallery?collection=${id || ''}`;
|
|
router.push(href, undefined, { shallow: true });
|
|
router.push(href, undefined, { shallow: true });
|
|
@@ -308,7 +312,7 @@ export default function Gallery(props) {
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
<LoadingBar
|
|
<LoadingBar
|
|
- color='#f11946'
|
|
|
|
|
|
+ color='##007bff'
|
|
progress={progress}
|
|
progress={progress}
|
|
onLoaderFinished={() => setProgress(0)}
|
|
onLoaderFinished={() => setProgress(0)}
|
|
/>
|
|
/>
|
|
@@ -386,34 +390,27 @@ export default function Gallery(props) {
|
|
<List
|
|
<List
|
|
itemSize={(index) =>
|
|
itemSize={(index) =>
|
|
timeStampList[index].itemType === ITEM_TYPE.TIME
|
|
timeStampList[index].itemType === ITEM_TYPE.TIME
|
|
- ? 30
|
|
|
|
|
|
+ ? 45
|
|
: 200
|
|
: 200
|
|
}
|
|
}
|
|
height={height}
|
|
height={height}
|
|
width={width}
|
|
width={width}
|
|
itemCount={timeStampList.length}
|
|
itemCount={timeStampList.length}
|
|
- key={`${router.query.collection}-${columns}`}
|
|
|
|
|
|
+ key={`${router.query.collection}-${columns}-${sinceTime}`}
|
|
>
|
|
>
|
|
{({ index, style }) => {
|
|
{({ index, style }) => {
|
|
- return (
|
|
|
|
- <ListItem style={style}>
|
|
|
|
- <ListContainer>
|
|
|
|
- {timeStampList[index].itemType ===
|
|
|
|
- ITEM_TYPE.TIME ? (
|
|
|
|
- <DateContainer>
|
|
|
|
- {timeStampList[index].date}
|
|
|
|
- </DateContainer>
|
|
|
|
- ) : (
|
|
|
|
- timeStampList[index].items.map((item, idx) => {
|
|
|
|
- return getThumbnail(
|
|
|
|
- filteredData,
|
|
|
|
- timeStampList[index].itemStartIndex + idx
|
|
|
|
- );
|
|
|
|
- })
|
|
|
|
- )}
|
|
|
|
- </ListContainer>
|
|
|
|
- </ListItem>
|
|
|
|
- );
|
|
|
|
|
|
+ return (<ListItem style={style}>
|
|
|
|
+ <ListContainer columns={timeStampList[index].itemType === ITEM_TYPE.TIME
|
|
|
|
+ ? 1 : columns}>
|
|
|
|
+ {
|
|
|
|
+ timeStampList[index].itemType === ITEM_TYPE.TIME
|
|
|
|
+ ? <DateContainer>{timeStampList[index].date}</DateContainer>
|
|
|
|
+ : timeStampList[index].items.map((item, idx) =>{
|
|
|
|
+ return getThumbnail(filteredData, timeStampList[index].itemStartIndex + idx);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ </ListContainer>
|
|
|
|
+ </ListItem>);
|
|
}}
|
|
}}
|
|
</List>
|
|
</List>
|
|
);
|
|
);
|