This commit is contained in:
Manav Rathi
2025-02-27 11:12:04 +05:30
parent 06b84e8067
commit 7fc03a71e7
3 changed files with 5 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ Plan of action:
and photos/FileInfo to deal with the @/new/photos imports here.
*/
import { assertionFailed } from "@/base/assert";
import { LinkButtonUndecorated } from "@/base/components/LinkButton";
import { type ButtonishProps } from "@/base/components/mui";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
@@ -225,6 +226,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
onSelectPerson?.(personID);
if (!file) {
if (open) assertionFailed();
return <></>;
}

View File

@@ -189,7 +189,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
<Button>Test</Button>
<FileInfo
{...fileInfoVisibilityProps}
file={activeAnnotatedFile.file}
file={activeAnnotatedFile?.file}
exif={activeFileExif}
onSelectCollection={handleSelectCollection}
onSelectPerson={handleSelectPerson}

View File

@@ -221,7 +221,7 @@ export class FileViewerPhotoSwipe {
// The above condition implies that annotation can never be
// undefined, but it doesn't seem to be enough to convince
// TypeScript. Writing the condition in a more unnatural way
// `(annotation && annotation?.fileID == file.id)` works, but
// `(!(annotation && annotation?.fileID == file.id))` works, but
// instead we use a non-null assertion here.
annotation: annotation!,
};
@@ -231,7 +231,7 @@ export class FileViewerPhotoSwipe {
const withCurrentAnnotatedFile =
(cb: (af: AnnotatedFile) => void) => () =>
cb(currentFileAnnotation());
cb(currentAnnotatedFile());
// Provide data about slides to PhotoSwipe via callbacks
// https://photoswipe.com/data-sources/#dynamically-generated-data