Un-triple-eq some unambiguious string comparisons
This commit is contained in:
@@ -53,7 +53,7 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
|
||||
//
|
||||
// Override, otherwise tsc complains about unknown property `chrome`.
|
||||
// eslint-disable-next-line @typescript-eslint/dot-notation
|
||||
setBrowserCanCast(typeof window["chrome"] !== "undefined");
|
||||
setBrowserCanCast(typeof window["chrome"] != "undefined");
|
||||
}, []);
|
||||
|
||||
const onSubmit: SingleInputFormProps["callback"] = async (
|
||||
@@ -77,7 +77,7 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (view === "auto") {
|
||||
if (view == "auto") {
|
||||
loadCast().then(async (cast) => {
|
||||
const instance = cast.framework.CastContext.getInstance();
|
||||
try {
|
||||
|
||||
@@ -1034,7 +1034,7 @@ const ManageParticipant: React.FC<ManageParticipantProps> = ({
|
||||
let contentText;
|
||||
let buttonText;
|
||||
|
||||
if (newRole === "VIEWER") {
|
||||
if (newRole == "VIEWER") {
|
||||
contentText = (
|
||||
<Trans
|
||||
i18nKey="change_permission_to_viewer"
|
||||
@@ -1043,7 +1043,7 @@ const ManageParticipant: React.FC<ManageParticipantProps> = ({
|
||||
);
|
||||
|
||||
buttonText = t("confirm_convert_to_viewer");
|
||||
} else if (newRole === "COLLABORATOR") {
|
||||
} else if (newRole == "COLLABORATOR") {
|
||||
contentText = t("change_permission_to_collaborator", {
|
||||
selectedEmail,
|
||||
});
|
||||
@@ -1124,7 +1124,7 @@ const ManageParticipant: React.FC<ManageParticipantProps> = ({
|
||||
label={"Viewer"}
|
||||
startIcon={<PhotoIcon />}
|
||||
endIcon={
|
||||
selectedParticipant.role === "VIEWER" && (
|
||||
selectedParticipant.role == "VIEWER" && (
|
||||
<DoneIcon />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ export const FileList: React.FC<FileListProps> = ({
|
||||
};
|
||||
|
||||
const handleRangeSelect = (index: number) => () => {
|
||||
if (typeof rangeStart !== "undefined" && rangeStart !== index) {
|
||||
if (typeof rangeStart != "undefined" && rangeStart !== index) {
|
||||
const direction =
|
||||
(index - rangeStart) / Math.abs(index - rangeStart);
|
||||
let checked = true;
|
||||
|
||||
@@ -93,7 +93,7 @@ export const FixCreationTime: React.FC<FixCreationTimeProps> = ({
|
||||
}}
|
||||
>
|
||||
{message && <Typography>{message}</Typography>}
|
||||
{step === "running" && <Progress {...progress} />}
|
||||
{step == "running" && <Progress {...progress} />}
|
||||
<OptionsForm {...{ step: step, onSubmit, onClose }} />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
@@ -172,7 +172,7 @@ const OptionsForm: React.FC<OptionsFormProps> = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
{(step === undefined || step === "completed-with-errors") && (
|
||||
{(step === undefined || step == "completed-with-errors") && (
|
||||
<form onSubmit={handleSubmit}>
|
||||
<FormControl>
|
||||
<FormLabel>{t("fix_creation_time_options")}</FormLabel>
|
||||
|
||||
@@ -1271,7 +1271,7 @@ const DefaultOptions: React.FC<UploadOptionsProps> = ({
|
||||
label={t("folder")}
|
||||
onClick={() => onSelect("folders")}
|
||||
/>
|
||||
{intent !== "collect" && (
|
||||
{intent != "collect" && (
|
||||
<RowButton
|
||||
startIcon={<GoogleIcon />}
|
||||
endIcon={<ChevronRightIcon />}
|
||||
|
||||
@@ -290,7 +290,7 @@ function UploadProgressDialog() {
|
||||
<UploadProgressHeader />
|
||||
{(uploadPhase == "uploading" || uploadPhase == "done") && (
|
||||
<DialogContent sx={{ "&&&": { px: 0 } }}>
|
||||
{uploadPhase === "uploading" && <InProgressSection />}
|
||||
{uploadPhase == "uploading" && <InProgressSection />}
|
||||
<ResultSection
|
||||
uploadResult="uploaded"
|
||||
sectionTitle={t("SUCCESSFUL_UPLOADS")}
|
||||
|
||||
@@ -222,7 +222,7 @@ const WatchEntry: React.FC<WatchEntryProps> = ({ watch, removeWatch }) => {
|
||||
return (
|
||||
<SpacedRow sx={{ overflow: "hidden", flexShrink: 0 }}>
|
||||
<Stack direction="row" sx={{ overflow: "hidden", gap: 1.5 }}>
|
||||
{watch.collectionMapping === "root" ? (
|
||||
{watch.collectionMapping == "root" ? (
|
||||
<Tooltip title={t("uploaded_to_single_collection")}>
|
||||
<FolderOpenIcon color="secondary" />
|
||||
</Tooltip>
|
||||
|
||||
@@ -376,7 +376,7 @@ const Page: React.FC = () => {
|
||||
}, [collectionNamerAttributes]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof activeCollectionID === "undefined" || !router.isReady) {
|
||||
if (typeof activeCollectionID == "undefined" || !router.isReady) {
|
||||
return;
|
||||
}
|
||||
let collectionURL = "";
|
||||
@@ -641,7 +641,7 @@ const Page: React.FC = () => {
|
||||
setFilesDownloadProgressAttributesList((prev) => {
|
||||
const attributes = prev?.find((attr) => attr.id === id);
|
||||
const updatedAttributes =
|
||||
typeof value === "function"
|
||||
typeof value == "function"
|
||||
? value(attributes)
|
||||
: { ...attributes, ...value };
|
||||
const updatedAttributesList = attributes
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function PublicCollectionGallery() {
|
||||
setFilesDownloadProgressAttributesList((prev) => {
|
||||
const attributes = prev?.find((attr) => attr.id === id);
|
||||
const updatedAttributes =
|
||||
typeof value === "function"
|
||||
typeof value == "function"
|
||||
? value(attributes)
|
||||
: { ...attributes, ...value };
|
||||
const updatedAttributesList = attributes
|
||||
@@ -181,7 +181,7 @@ export default function PublicCollectionGallery() {
|
||||
|
||||
useEffect(() => {
|
||||
const currentURL = new URL(window.location.href);
|
||||
if (currentURL.pathname !== "/") {
|
||||
if (currentURL.pathname != "/") {
|
||||
router.replace(
|
||||
{
|
||||
pathname: "/shared-albums",
|
||||
|
||||
@@ -246,7 +246,7 @@ class FolderWatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.action === "upload") {
|
||||
if (event.action == "upload") {
|
||||
const paths = pathsToUpload(event.filePaths, watch);
|
||||
if (paths.length == 0) {
|
||||
skip("none of the files need uploading");
|
||||
|
||||
@@ -78,7 +78,7 @@ export async function downloadFile(file: EnteFile) {
|
||||
function getSelectedFileIds(selectedFiles: SelectedState) {
|
||||
const filesIDs: number[] = [];
|
||||
for (const [key, val] of Object.entries(selectedFiles)) {
|
||||
if (typeof val === "boolean" && val) {
|
||||
if (typeof val == "boolean" && val) {
|
||||
filesIDs.push(Number(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export const handleSelectCreator =
|
||||
) =>
|
||||
({ id, ownerID }: { id: number; ownerID: number }, index?: number) =>
|
||||
(checked: boolean) => {
|
||||
if (typeof index !== "undefined") {
|
||||
if (typeof index != "undefined") {
|
||||
if (checked) {
|
||||
setRangeStart(index);
|
||||
} else {
|
||||
|
||||
@@ -147,7 +147,7 @@ export const isPasskeyRecoveryEnabled = async () => {
|
||||
{ "X-Auth-Token": token },
|
||||
);
|
||||
|
||||
if (typeof resp.data === "undefined") {
|
||||
if (typeof resp.data == "undefined") {
|
||||
throw Error("request failed");
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ const configurePasskeyRecovery = async (
|
||||
{ "X-Auth-Token": token },
|
||||
);
|
||||
|
||||
if (typeof resp.data === "undefined") {
|
||||
if (typeof resp.data == "undefined") {
|
||||
throw Error("request failed");
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -236,7 +236,7 @@ export const RowButton: React.FC<RowButtonProps> = ({
|
||||
<Stack direction="row" sx={{ py: "14px", gap: "10px" }}>
|
||||
{startIcon && startIcon}
|
||||
<Box sx={{ px: "2px" }}>
|
||||
{typeof label !== "string" ? (
|
||||
{typeof label != "string" ? (
|
||||
label
|
||||
) : caption ? (
|
||||
<Stack
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* assigns development when running the `next dev` command, or production for
|
||||
* all other commands.
|
||||
*/
|
||||
export const isDevBuild = process.env.NODE_ENV === "development";
|
||||
export const isDevBuild = process.env.NODE_ENV == "development";
|
||||
|
||||
/**
|
||||
* `true` if we're running in the default global context (aka the main thread)
|
||||
@@ -25,7 +25,7 @@ export const isDevBuild = process.env.NODE_ENV === "development";
|
||||
* Note that this cannot be a constant, otherwise it'll get inlined during SSR
|
||||
* with the wrong value.
|
||||
*/
|
||||
export const haveWindow = () => typeof window !== "undefined";
|
||||
export const haveWindow = () => typeof window != "undefined";
|
||||
|
||||
/**
|
||||
* Return true if we are running in a [Web
|
||||
@@ -34,4 +34,4 @@ export const haveWindow = () => typeof window !== "undefined";
|
||||
* Note that this cannot be a constant, otherwise it'll get inlined during SSR
|
||||
* with the wrong value.
|
||||
*/
|
||||
export const inWorker = () => typeof importScripts === "function";
|
||||
export const inWorker = () => typeof importScripts == "function";
|
||||
|
||||
@@ -115,7 +115,7 @@ export const logToDisk = (message: string) => {
|
||||
localStorage.setItem(lsKey, JSON.stringify({ logs }));
|
||||
} catch (e) {
|
||||
console.error("Failed to persist log", e);
|
||||
if (e instanceof Error && e.name === "QuotaExceededError") {
|
||||
if (e instanceof Error && e.name == "QuotaExceededError") {
|
||||
localStorage.removeItem(lsKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ export function isPinnedCollection(item: Collection) {
|
||||
!item ||
|
||||
!item.magicMetadata ||
|
||||
!item.magicMetadata.data ||
|
||||
typeof item.magicMetadata.data === "string" ||
|
||||
typeof item.magicMetadata.data.order === "undefined"
|
||||
typeof item.magicMetadata.data == "string" ||
|
||||
typeof item.magicMetadata.data.order == "undefined"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export async function updateMagicMetadata<T>(
|
||||
originalMagicMetadata = getNewMagicMetadata<T>();
|
||||
}
|
||||
|
||||
if (typeof originalMagicMetadata?.data === "string") {
|
||||
if (typeof originalMagicMetadata?.data == "string") {
|
||||
// TODO: When converting this (and other parses of magic metadata) to
|
||||
// use zod, remember to use passthrough.
|
||||
//
|
||||
|
||||
@@ -174,7 +174,7 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({
|
||||
};
|
||||
|
||||
const handleDragStart: React.MouseEventHandler = (e) => {
|
||||
if (currentTab !== "crop") return;
|
||||
if (currentTab != "crop") return;
|
||||
|
||||
const rect = cropBoxRef.current!.getBoundingClientRect();
|
||||
const offsetX = e.pageX - rect.left - rect.width / 2;
|
||||
@@ -292,7 +292,7 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({
|
||||
}, [brightness, contrast, blur, saturation, invert, canvasRef, fileURL]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentTab !== "crop") return;
|
||||
if (currentTab != "crop") return;
|
||||
resetCropBox();
|
||||
setShowControlsDrawer(false);
|
||||
}, [currentTab]);
|
||||
@@ -601,7 +601,7 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
|
||||
{currentTab === "crop" && (
|
||||
{currentTab == "crop" && (
|
||||
<FreehandCropRegion
|
||||
cropBox={cropBox}
|
||||
ref={cropBoxRef}
|
||||
@@ -609,7 +609,7 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
{currentTab === "crop" && (
|
||||
{currentTab == "crop" && (
|
||||
<CenteredFlex marginTop="1rem">
|
||||
<Button
|
||||
color="accent"
|
||||
@@ -670,7 +670,7 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({
|
||||
onClick={() => void loadCanvas()}
|
||||
/>
|
||||
</RowButtonGroup>
|
||||
{currentTab === "crop" && (
|
||||
{currentTab == "crop" && (
|
||||
<CropMenu
|
||||
{...menuProps}
|
||||
previewScale={previewCanvasScale}
|
||||
@@ -679,8 +679,8 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = ({
|
||||
resetCropBox={resetCropBox}
|
||||
/>
|
||||
)}
|
||||
{currentTab === "transform" && <TransformMenu {...menuProps} />}
|
||||
{currentTab === "colors" && (
|
||||
{currentTab == "transform" && <TransformMenu {...menuProps} />}
|
||||
{currentTab == "colors" && (
|
||||
<ColoursMenu
|
||||
brightness={brightness}
|
||||
contrast={contrast}
|
||||
@@ -1096,7 +1096,7 @@ const TransformMenu: React.FC<CommonMenuProps> = ({
|
||||
|
||||
context.save();
|
||||
|
||||
if (direction === "horizontal") {
|
||||
if (direction == "horizontal") {
|
||||
context.translate(canvas.width, 0);
|
||||
context.scale(-1, 1);
|
||||
} else {
|
||||
@@ -1174,10 +1174,10 @@ const TransformMenu: React.FC<CommonMenuProps> = ({
|
||||
const createRotationHandler = (rotation: "left" | "right") => () => {
|
||||
try {
|
||||
setCanvasLoading(true);
|
||||
rotateCanvas(canvasRef.current!, rotation === "left" ? -90 : 90);
|
||||
rotateCanvas(canvasRef.current!, rotation == "left" ? -90 : 90);
|
||||
rotateCanvas(
|
||||
originalSizeCanvasRef.current!,
|
||||
rotation === "left" ? -90 : 90,
|
||||
rotation == "left" ? -90 : 90,
|
||||
);
|
||||
setCanvasLoading(false);
|
||||
setTransformationPerformed(true);
|
||||
|
||||
@@ -567,7 +567,7 @@ const PlanRow: React.FC<PlanRowProps> = ({ plan, onPlanSelect, disabled }) => {
|
||||
<Typography variant="h6">{plan.price}</Typography>
|
||||
<Typography variant="small" sx={{ opacity: 0.7 }}>
|
||||
{`/ ${
|
||||
plan.period === "month"
|
||||
plan.period == "month"
|
||||
? t("month_short")
|
||||
: t("year")
|
||||
}`}
|
||||
|
||||
@@ -1433,7 +1433,7 @@ const findCoverFiles = (
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const coverID = collection.pubMagicMetadata?.data?.coverID;
|
||||
if (typeof coverID === "number" && coverID > 0) {
|
||||
if (typeof coverID == "number" && coverID > 0) {
|
||||
coverFile = collectionFiles.find(({ id }) => id === coverID);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useEffect, useState } from "react";
|
||||
*/
|
||||
export const useIsOffline = () => {
|
||||
const [offline, setOffline] = useState(
|
||||
typeof window !== "undefined" && !window.navigator.onLine,
|
||||
typeof window != "undefined" && !window.navigator.onLine,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -143,7 +143,7 @@ export default function SingleInputForm(props: SingleInputFormProps) {
|
||||
input: {
|
||||
autoComplete:
|
||||
props.disableAutoComplete ||
|
||||
props.fieldType === "password"
|
||||
props.fieldType == "password"
|
||||
? "off"
|
||||
: "on",
|
||||
endAdornment: props.fieldType ===
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function VerifyMasterPasswordForm({
|
||||
log.error("failed to derive key", e);
|
||||
throw Error(CustomError.WEAK_DEVICE);
|
||||
}
|
||||
if (!keyAttributes && typeof getKeyAttributes === "function") {
|
||||
if (!keyAttributes && typeof getKeyAttributes == "function") {
|
||||
keyAttributes = await getKeyAttributes(kek);
|
||||
}
|
||||
if (!keyAttributes) {
|
||||
|
||||
@@ -27,10 +27,10 @@ export const removeData = (key: LocalStorageKey) =>
|
||||
export const getData = (key: LocalStorageKey) => {
|
||||
try {
|
||||
if (
|
||||
typeof localStorage === "undefined" ||
|
||||
typeof key === "undefined" ||
|
||||
typeof localStorage.getItem(key) === "undefined" ||
|
||||
localStorage.getItem(key) === "undefined"
|
||||
typeof localStorage == "undefined" ||
|
||||
typeof key == "undefined" ||
|
||||
typeof localStorage.getItem(key) == "undefined" ||
|
||||
localStorage.getItem(key) == "undefined"
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user