Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

conv

Manav Rathi16d2539bbf12
diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.ts
index 6fe5ca9c01..f0e58f74d9 100644
--- a/web/apps/photos/src/services/collectionService.ts
+++ b/web/apps/photos/src/services/collectionService.ts
@@ -8,12 +8,12 @@ import {
CollectionMagicMetadata,
CollectionMagicMetadataProps,
CollectionPublicMagicMetadata,
+ CollectionSubType,
type CollectionType,
CreatePublicAccessTokenRequest,
EncryptedCollection,
PublicURL,
RemoveFromCollectionRequest,
- CollectionSubType,
UpdatePublicURL,
} from "@/media/collection";
import { EncryptedMagicMetadata, EnteFile } from "@/media/file";
diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.ts
index 409ecb2598..4d87dad5a5 100644
--- a/web/apps/photos/src/utils/file/index.ts
+++ b/web/apps/photos/src/utils/file/index.ts
@@ -316,7 +316,7 @@ async function downloadFileDesktop(
}
export const isImageOrVideo = (fileType: FileType) =>
- [FileType.image, FileType.video].includes(fileType);
+ fileType == FileType.image || fileType == FileType.video;
export const getArchivedFiles = (files: EnteFile[]) => {
return files.filter(isArchivedFile).map((file) => file.id);
diff --git a/web/packages/media/file-type.ts b/web/packages/media/file-type.ts
index bb8ceeede3..e8dcf6b2c9 100644
--- a/web/packages/media/file-type.ts
+++ b/web/packages/media/file-type.ts
@@ -1,9 +1,18 @@
-/** The type of an {@link EnteFile}. */
-export enum FileType {
- /** An image (e.g. JPEG). */
- image = 0,
- /** A video (e.g. MP4). */
- video = 1,
+/**
+ * The type of an {@link EnteFile}.
+ *
+ * This is an object containing symbolic constant. There is also an eraseable
+ * TypeScript type type with the same name, {@link FileType}.
+ */
+export const FileType = {
+ /**
+ * An image (e.g. JPEG).
+ */
+ image: 0,
+ /**
+ * A video (e.g. MP4).
+ */
+ video: 1,
/**
* A live photo, aka motion photo.
*
@@ -11,7 +20,7 @@ export enum FileType {
* before and after when the image was taken. We preserve it as a zip
* containing both the parts.
*/
- livePhoto = 2,
+ livePhoto: 2,
/**
* An unknown file type.
*
@@ -20,8 +29,16 @@ export enum FileType {
* deal with the scenario that an EnteFile's type can be different from one
* of the above.
*/
- other = 3,
-}
+ other: 3,
+} as const;
+
+/**
+ * The type of an {@link EnteFile}.
+ *
+ * This is an eraseable TypeScript type. There is also a {@link FileType} object
+ * with the same name that contains the corresponding symbolic constants.
+ */
+export type FileType = (typeof FileType)[keyof typeof FileType];
export interface FileTypeInfo {
fileType: FileType;