mirror of
https://github.com/ente-io/ente.git
synced 2025-08-12 17:20:37 +00:00
Remove dead code from cast
This commit is contained in:
parent
a5c3aff54b
commit
47a7042d55
@ -1,57 +0,0 @@
|
|||||||
// import { CollectionDownloadProgressAttributes } from 'components/Collections/CollectionDownloadProgress';
|
|
||||||
// import { CollectionSelectorAttributes } from 'components/Collections/CollectionSelector';
|
|
||||||
// import { TimeStampListItem } from 'components/PhotoList';
|
|
||||||
import { User } from "@ente/shared/user/types";
|
|
||||||
import { Collection } from "types/collection";
|
|
||||||
import { EnteFile } from "types/file";
|
|
||||||
|
|
||||||
export type SelectedState = {
|
|
||||||
[k: number]: boolean;
|
|
||||||
ownCount: number;
|
|
||||||
count: number;
|
|
||||||
collectionID: number;
|
|
||||||
};
|
|
||||||
export type SetFiles = React.Dispatch<React.SetStateAction<EnteFile[]>>;
|
|
||||||
export type SetCollections = React.Dispatch<React.SetStateAction<Collection[]>>;
|
|
||||||
export type SetLoading = React.Dispatch<React.SetStateAction<boolean>>;
|
|
||||||
// export type SetCollectionSelectorAttributes = React.Dispatch<
|
|
||||||
// React.SetStateAction<CollectionSelectorAttributes>
|
|
||||||
// >;
|
|
||||||
// export type SetCollectionDownloadProgressAttributes = React.Dispatch<
|
|
||||||
// React.SetStateAction<CollectionDownloadProgressAttributes>
|
|
||||||
// >;
|
|
||||||
|
|
||||||
export type MergedSourceURL = {
|
|
||||||
original: string;
|
|
||||||
converted: string;
|
|
||||||
};
|
|
||||||
export enum UploadTypeSelectorIntent {
|
|
||||||
normalUpload,
|
|
||||||
import,
|
|
||||||
collectPhotos,
|
|
||||||
}
|
|
||||||
export type GalleryContextType = {
|
|
||||||
thumbs: Map<number, string>;
|
|
||||||
files: Map<number, MergedSourceURL>;
|
|
||||||
showPlanSelectorModal: () => void;
|
|
||||||
setActiveCollectionID: (collectionID: number) => void;
|
|
||||||
syncWithRemote: (force?: boolean, silent?: boolean) => Promise<void>;
|
|
||||||
setBlockingLoad: (value: boolean) => void;
|
|
||||||
setIsInSearchMode: (value: boolean) => void;
|
|
||||||
// photoListHeader: TimeStampListItem;
|
|
||||||
openExportModal: () => void;
|
|
||||||
authenticateUser: (callback: () => void) => void;
|
|
||||||
user: User;
|
|
||||||
userIDToEmailMap: Map<number, string>;
|
|
||||||
emailList: string[];
|
|
||||||
openHiddenSection: (callback?: () => void) => void;
|
|
||||||
isClipSearchResult: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export enum CollectionSelectorIntent {
|
|
||||||
upload,
|
|
||||||
add,
|
|
||||||
move,
|
|
||||||
restore,
|
|
||||||
unhide,
|
|
||||||
}
|
|
@ -17,7 +17,6 @@ import {
|
|||||||
FileMagicMetadata,
|
FileMagicMetadata,
|
||||||
FilePublicMagicMetadata,
|
FilePublicMagicMetadata,
|
||||||
} from "types/file";
|
} from "types/file";
|
||||||
import { SelectedState } from "types/gallery";
|
|
||||||
import { isArchivedFile } from "utils/magicMetadata";
|
import { isArchivedFile } from "utils/magicMetadata";
|
||||||
|
|
||||||
import { CustomError } from "@ente/shared/error";
|
import { CustomError } from "@ente/shared/error";
|
||||||
@ -32,44 +31,6 @@ import { isPlaybackPossible } from "utils/photoFrame";
|
|||||||
|
|
||||||
const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000;
|
const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000;
|
||||||
|
|
||||||
export enum FILE_OPS_TYPE {
|
|
||||||
DOWNLOAD,
|
|
||||||
FIX_TIME,
|
|
||||||
ARCHIVE,
|
|
||||||
UNARCHIVE,
|
|
||||||
HIDE,
|
|
||||||
TRASH,
|
|
||||||
DELETE_PERMANENTLY,
|
|
||||||
}
|
|
||||||
|
|
||||||
export function groupFilesBasedOnCollectionID(files: EnteFile[]) {
|
|
||||||
const collectionWiseFiles = new Map<number, EnteFile[]>();
|
|
||||||
for (const file of files) {
|
|
||||||
if (!collectionWiseFiles.has(file.collectionID)) {
|
|
||||||
collectionWiseFiles.set(file.collectionID, []);
|
|
||||||
}
|
|
||||||
collectionWiseFiles.get(file.collectionID).push(file);
|
|
||||||
}
|
|
||||||
return collectionWiseFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedFileIds(selectedFiles: SelectedState) {
|
|
||||||
const filesIDs: number[] = [];
|
|
||||||
for (const [key, val] of Object.entries(selectedFiles)) {
|
|
||||||
if (typeof val === "boolean" && val) {
|
|
||||||
filesIDs.push(Number(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Set(filesIDs);
|
|
||||||
}
|
|
||||||
export function getSelectedFiles(
|
|
||||||
selected: SelectedState,
|
|
||||||
files: EnteFile[],
|
|
||||||
): EnteFile[] {
|
|
||||||
const selectedFilesIDs = getSelectedFileIds(selected);
|
|
||||||
return files.filter((file) => selectedFilesIDs.has(file.id));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function sortFiles(files: EnteFile[], sortAsc = false) {
|
export function sortFiles(files: EnteFile[], sortAsc = false) {
|
||||||
// sort based on the time of creation time of the file,
|
// sort based on the time of creation time of the file,
|
||||||
// for files with same creation time, sort based on the time of last modification
|
// for files with same creation time, sort based on the time of last modification
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
import { logError } from "@ente/shared/sentry";
|
import { logError } from "@ente/shared/sentry";
|
||||||
import { FILE_TYPE } from "constants/file";
|
import { FILE_TYPE } from "constants/file";
|
||||||
import { EnteFile } from "types/file";
|
import { EnteFile } from "types/file";
|
||||||
import { MergedSourceURL } from "types/gallery";
|
|
||||||
|
export type MergedSourceURL = {
|
||||||
|
original: string;
|
||||||
|
converted: string;
|
||||||
|
};
|
||||||
|
|
||||||
const WAIT_FOR_VIDEO_PLAYBACK = 1 * 1000;
|
const WAIT_FOR_VIDEO_PLAYBACK = 1 * 1000;
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ export interface ElectronAPIsType {
|
|||||||
exists: (path: string) => Promise<boolean>;
|
exists: (path: string) => Promise<boolean>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** TODO: AUDIT below this */
|
||||||
exists: (path: string) => boolean;
|
exists: (path: string) => boolean;
|
||||||
checkExistsAndCreateDir: (dirPath: string) => Promise<void>;
|
checkExistsAndCreateDir: (dirPath: string) => Promise<void>;
|
||||||
saveStreamToDisk: (
|
saveStreamToDisk: (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user