mirror of
https://github.com/immich-app/immich.git
synced 2025-06-05 02:07:36 +02:00
* Added selection icon to thumbnail * Added micro-interaction and video file indication * Added page to add page * Added image viewer * navigate assets * Added separate component for viewing the video file * Added FFmpeg modules * Added correct content-type header for serving image file * Added loading spinner
34 lines
863 B
TypeScript
34 lines
863 B
TypeScript
import { writable, derived } from 'svelte/store';
|
|
import { getRequest } from '$lib/api';
|
|
import type { ImmichAsset } from '$lib/models/immich-asset'
|
|
import lodash from 'lodash-es';
|
|
import moment from 'moment';
|
|
|
|
export const assets = writable<ImmichAsset[]>([]);
|
|
|
|
export const assetsGroupByDate = derived(assets, ($assets) => {
|
|
|
|
try {
|
|
return lodash.chain($assets)
|
|
.groupBy((a) => moment(a.createdAt).format('ddd, MMM DD'))
|
|
.sortBy((group) => $assets.indexOf(group[0]))
|
|
.value();
|
|
} catch (e) {
|
|
console.log("error deriving state assets", e)
|
|
return []
|
|
}
|
|
|
|
})
|
|
|
|
export const flattenAssetGroupByDate = derived(assetsGroupByDate, ($assetsGroupByDate) => {
|
|
return $assetsGroupByDate.flat();
|
|
})
|
|
|
|
export const getAssetsInfo = async (accessToken: string) => {
|
|
const res = await getRequest('asset', accessToken);
|
|
|
|
assets.set(res);
|
|
|
|
}
|
|
|