This commit is contained in:
Pushkar Anand 2020-11-07 21:13:00 +05:30
parent 9a0adc1e1e
commit 623d115019
5 changed files with 48 additions and 8 deletions

View file

@ -21,6 +21,8 @@
"react-bootstrap": "^1.3.0",
"react-dom": "16.13.1",
"react-photoswipe": "^1.3.0",
"react-window": "^1.8.5",
"react-window-infinite-loader": "^1.0.5",
"scrypt-js": "^3.0.1",
"styled-components": "^5.2.0",
"yup": "^0.29.3"
@ -30,6 +32,8 @@
"@types/libsodium-wrappers": "^0.7.8",
"@types/node": "^14.6.4",
"@types/react": "^16.9.49",
"@types/react-window": "^1.8.2",
"@types/react-window-infinite-loader": "^1.0.3",
"@types/styled-components": "^5.1.3",
"@types/yup": "^0.29.7",
"babel-plugin-styled-components": "^1.11.1",

View file

@ -8,9 +8,11 @@ import PreviewCard from './components/PreviewCard';
import { getActualKey } from 'utils/common/key';
import styled from 'styled-components';
import { PhotoSwipeGallery } from 'react-photoswipe';
import InfiniteLoader from 'react-window-infinite-loader';
import { FixedSizeGrid as Grid } from 'react-window';
const Container = styled.div`
max-width: 1260px;
max-width: 1000px;
display: flex;
flex-wrap: wrap;
margin: 0 auto;
@ -21,10 +23,14 @@ const Container = styled.div`
}
`;
const PAGE_SIZE = 12;
const COLUMNS = 3;
export default function Gallery() {
const router = useRouter();
const [loading, setLoading] = useState(false);
const [data, setData] = useState<file[]>();
const [total, setTotal] = useState(1);
useEffect(() => {
const key = getKey(SESSION_KEYS.ENCRYPTION_KEY);

View file

@ -64,7 +64,7 @@ const getCollectionKey = async (collection: collection, key: Uint8Array) => {
}
const getCollections = async (token: string, sinceTime: string, key: Uint8Array): Promise<collection[]> => {
const resp = await HTTPService.get(`http://localhost/collections/`, {
const resp = await HTTPService.get(`${ENDPOINT}/collections/`, {
'token': token,
'sinceTime': sinceTime,
});
@ -84,7 +84,7 @@ export const getFiles = async (sinceTime: string, token: string, limit: string,
if (collection.key == null) {
continue;
}
const resp = await HTTPService.get(`${ENDPOINT}/collections/diff/`, {
const resp = await HTTPService.get(`${ENDPOINT}/collections/diff`, {
'collectionID': collection.id.toString(), sinceTime, token, limit,
});

View file

@ -1,6 +1,3 @@
export const getEndpoint = () => {
const dev = process.env.NODE_ENV === 'development';
const apiEndpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT || "https://api.staging.ente.io";
const endpoint = !dev ? apiEndpoint : '/api';
return endpoint;
return "https://api.staging.ente.io";
}

View file

@ -965,7 +965,7 @@
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-transform-typescript" "^7.10.4"
"@babel/runtime@7.11.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
"@babel/runtime@7.11.2", "@babel/runtime@^7.0.0", "@babel/runtime@^7.10.5", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==
@ -1161,6 +1161,21 @@
dependencies:
"@types/react" "*"
"@types/react-window-infinite-loader@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@types/react-window-infinite-loader/-/react-window-infinite-loader-1.0.3.tgz#fade6e7c625a348e83c4e1f0c897736537bc7f8c"
integrity sha512-P+XLcLxH23dwDJgPr571vUL79n++pHweCaCa5XocyxEt9YqdV627F6TCM//2zoUbGw/JnT94F8kSJ7/ijcUSIg==
dependencies:
"@types/react" "*"
"@types/react-window" "*"
"@types/react-window@*", "@types/react-window@^1.8.2":
version "1.8.2"
resolved "https://registry.yarnpkg.com/@types/react-window/-/react-window-1.8.2.tgz#a5a6b2762ce73ffaab7911ee1397cf645f2459fe"
integrity sha512-gP1xam68Wc4ZTAee++zx6pTdDAH08rAkQrWm4B4F/y6hhmlT9Mgx2q8lTCXnrPHXsr15XjRN9+K2DLKcz44qEQ==
dependencies:
"@types/react" "*"
"@types/react@*", "@types/react@^16.9.11", "@types/react@^16.9.35", "@types/react@^16.9.49":
version "16.9.49"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.49.tgz#09db021cf8089aba0cdb12a49f8021a69cce4872"
@ -3833,6 +3848,11 @@ media-typer@0.3.0:
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
"memoize-one@>=3.1.1 <6":
version "5.1.1"
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0"
integrity sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA==
memory-fs@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
@ -4918,6 +4938,19 @@ react-transition-group@^4.4.1:
loose-envify "^1.4.0"
prop-types "^15.6.2"
react-window-infinite-loader@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/react-window-infinite-loader/-/react-window-infinite-loader-1.0.5.tgz#6fe094d538a88978c2c9b623052bc50cb28c2abc"
integrity sha512-IcPIq8lADK3zsAcqoLqQGyduicqR6jWkiK2VUX5sKSI9X/rou6OWlOEexnGyujdNTG7hSG8OVBFEhLSDs4qrxg==
react-window@^1.8.5:
version "1.8.5"
resolved "https://registry.yarnpkg.com/react-window/-/react-window-1.8.5.tgz#a56b39307e79979721021f5d06a67742ecca52d1"
integrity sha512-HeTwlNa37AFa8MDZFZOKcNEkuF2YflA0hpGPiTT9vR7OawEt+GZbfM6wqkBahD3D3pUjIabQYzsnY/BSJbgq6Q==
dependencies:
"@babel/runtime" "^7.0.0"
memoize-one ">=3.1.1 <6"
react@16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"