feat(web): remove upload file limit with rxjs and improve import size (#1743)

* feat(web): remove upload file limit with rxjs

* refactor: remove exif

* refactor: remove unused code

* fix: import lodash-es instead of lodash

* refactor: optimize import
This commit is contained in:
Alex 2023-02-13 13:18:11 -06:00 committed by GitHub
parent 37cfac27b8
commit 2c1aab154a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 66 deletions

View file

@ -1,7 +1,7 @@
import { AssetGridState } from '$lib/models/asset-grid-state';
import { calculateViewportHeightByNumberOfAsset } from '$lib/utils/viewport-utils';
import { api, AssetCountByTimeBucketResponseDto } from '@api';
import lodash from 'lodash-es';
import { sumBy, flatMap } from 'lodash-es';
import { writable } from 'svelte/store';
/**
@ -46,7 +46,7 @@ function createAssetStore() {
// Update timeline height based on calculated bucket height
assetGridState.update((state) => {
state.timelineHeight = lodash.sumBy(state.buckets, (d) => d.bucketHeight);
state.timelineHeight = sumBy(state.buckets, (d) => d.bucketHeight);
return state;
});
};
@ -77,7 +77,7 @@ function createAssetStore() {
assetGridState.update((state) => {
const bucketIndex = state.buckets.findIndex((b) => b.bucketDate === bucket);
state.buckets[bucketIndex].assets = assets;
state.assets = lodash.flatMap(state.buckets, (b) => b.assets);
state.assets = flatMap(state.buckets, (b) => b.assets);
return state;
});
@ -100,7 +100,7 @@ function createAssetStore() {
if (state.buckets[bucketIndex].assets.length === 0) {
_removeBucket(state.buckets[bucketIndex].bucketDate);
}
state.assets = lodash.flatMap(state.buckets, (b) => b.assets);
state.assets = flatMap(state.buckets, (b) => b.assets);
return state;
});
};
@ -109,7 +109,7 @@ function createAssetStore() {
assetGridState.update((state) => {
const bucketIndex = state.buckets.findIndex((b) => b.bucketDate === bucketDate);
state.buckets.splice(bucketIndex, 1);
state.assets = lodash.flatMap(state.buckets, (b) => b.assets);
state.assets = flatMap(state.buckets, (b) => b.assets);
return state;
});
};
@ -147,7 +147,7 @@ function createAssetStore() {
const assetIndex = state.buckets[bucketIndex].assets.findIndex((a) => a.id === assetId);
state.buckets[bucketIndex].assets[assetIndex].isFavorite = isFavorite;
state.assets = lodash.flatMap(state.buckets, (b) => b.assets);
state.assets = flatMap(state.buckets, (b) => b.assets);
return state;
});
};