Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix linter

Steven15646a898919
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index 9d6bfcd20..2aaee3971 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -54,9 +54,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
const { userGeneralSetting } = useAuth();
// Get default visibility from user settings
- const defaultVisibility = userGeneralSetting?.memoVisibility
- ? convertVisibilityFromString(userGeneralSetting.memoVisibility)
- : undefined;
+ const defaultVisibility = userGeneralSetting?.memoVisibility ? convertVisibilityFromString(userGeneralSetting.memoVisibility) : undefined;
useMemoInit(editorRef, memoName, cacheKey, currentUser?.name ?? "", autoFocus, defaultVisibility);
diff --git a/web/src/components/MemoView/components/metadata/AttachmentCard.tsx b/web/src/components/MemoView/components/metadata/AttachmentCard.tsx
index ce0efe758..2aadfb76c 100644
--- a/web/src/components/MemoView/components/metadata/AttachmentCard.tsx
+++ b/web/src/components/MemoView/components/metadata/AttachmentCard.tsx
@@ -1,6 +1,6 @@
import { cn } from "@/lib/utils";
import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb";
-import { getAttachmentType, getAttachmentUrl, getColorspace } from "@/utils/attachment";
+import { getAttachmentType, getAttachmentUrl } from "@/utils/attachment";
interface AttachmentCardProps {
attachment: Attachment;
@@ -25,14 +25,7 @@ const AttachmentCard = ({ attachment, onClick, className }: AttachmentCardProps)
}
if (attachmentType === "video/*") {
- return (
- <video
- src={sourceUrl}
- className={cn("w-full h-full object-cover rounded-lg", className)}
- controls
- preload="metadata"
- />
- );
+ return <video src={sourceUrl} className={cn("w-full h-full object-cover rounded-lg", className)} controls preload="metadata" />;
}
return null;
diff --git a/web/src/components/MemoView/components/metadata/AttachmentList.tsx b/web/src/components/MemoView/components/metadata/AttachmentList.tsx
index 7783725fc..c60db187f 100644
--- a/web/src/components/MemoView/components/metadata/AttachmentList.tsx
+++ b/web/src/components/MemoView/components/metadata/AttachmentList.tsx
@@ -131,7 +131,6 @@ const AttachmentList = ({ attachments }: AttachmentListProps) => {
onOpenChange={(open: boolean) => setPreviewImage((prev) => ({ ...prev, open }))}
imgUrls={previewImage.urls}
initialIndex={previewImage.index}
- mimeType={previewImage.mimeType}
/>
</>
);
diff --git a/web/src/components/PreviewImageDialog.tsx b/web/src/components/PreviewImageDialog.tsx
index 9bcf424ca..4787c892e 100644
--- a/web/src/components/PreviewImageDialog.tsx
+++ b/web/src/components/PreviewImageDialog.tsx
@@ -2,19 +2,16 @@ import { X } from "lucide-react";
import React, { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent } from "@/components/ui/dialog";
-import { getColorspace } from "@/utils/attachment";
interface Props {
open: boolean;
onOpenChange: (open: boolean) => void;
imgUrls: string[];
initialIndex?: number;
- mimeType?: string; // MIME type for HDR detection
}
-function PreviewImageDialog({ open, onOpenChange, imgUrls, initialIndex = 0, mimeType }: Props) {
+function PreviewImageDialog({ open, onOpenChange, imgUrls, initialIndex = 0 }: Props) {
const [currentIndex, setCurrentIndex] = useState(initialIndex);
- const colorspace = mimeType ? getColorspace(mimeType) : undefined;
// Update current index when initialIndex prop changes
useEffect(() => {
@@ -83,7 +80,6 @@ function PreviewImageDialog({ open, onOpenChange, imgUrls, initialIndex = 0, mim
draggable={false}
loading="eager"
decoding="async"
- {...(colorspace && { colorSpace: colorspace as unknown as string })}
/>
</div>
diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx
index 126cda062..7d137fe34 100644
--- a/web/src/components/Settings/PreferencesSection.tsx
+++ b/web/src/components/Settings/PreferencesSection.tsx
@@ -82,10 +82,7 @@ const PreferencesSection = () => {
<SettingGroup title={t("setting.preference")} showSeparator>
<SettingRow label={t("setting.preference-section.default-memo-visibility")}>
- <Select
- value={setting.memoVisibility || "PRIVATE"}
- onValueChange={handleDefaultMemoVisibilityChanged}
- >
+ <Select value={setting.memoVisibility || "PRIVATE"} onValueChange={handleDefaultMemoVisibilityChanged}>
<SelectTrigger className="min-w-fit">
<div className="flex items-center gap-2">
<VisibilityIcon visibility={convertVisibilityFromString(setting.memoVisibility)} />
diff --git a/web/src/utils/attachment.ts b/web/src/utils/attachment.ts
index d78f04cf5..5f3f1c64e 100644
--- a/web/src/utils/attachment.ts
+++ b/web/src/utils/attachment.ts
@@ -52,34 +52,3 @@ export const isMidiFile = (mimeType: string): boolean => {
const isPSD = (t: string) => {
return t === "image/vnd.adobe.photoshop" || t === "image/x-photoshop" || t === "image/photoshop";
};
-
-// HDR-capable MIME types that support wide color gamut
-export const HDR_CAPABLE_FORMATS = [
- "image/heic",
- "image/heif",
- "image/webp",
- "image/png", // PNG can contain ICC profiles for wide gamut
- "image/jpeg", // JPEG can support extended color via profiles
- "video/mp4", // Can contain HDR tracks
- "video/quicktime", // Can contain HDR tracks
- "video/x-matroska", // Can contain HDR tracks
- "video/webm", // VP9 Profile 2 for HDR
-];
-
-// isHDRCapable returns true if the MIME type supports HDR/wide color gamut.
-export const isHDRCapable = (mimeType: string): boolean => {
- return HDR_CAPABLE_FORMATS.some((format) => mimeType.startsWith(format));
-};
-
-// getColorspace returns the appropriate colorspace attribute for wide gamut images.
-// Returns "display-p3" for HDR-capable formats, undefined for standard images.
-export const getColorspace = (mimeType: string): string | undefined => {
- return isHDRCapable(mimeType) ? "display-p3" : undefined;
-};
-
-// supportsHDR checks if the browser supports wide color gamut display.
-// Uses CSS.supports() to detect color-gamut capability.
-export const supportsHDR = (): boolean => {
- if (typeof CSS === "undefined") return false;
- return CSS.supports("(color-gamut: srgb)") && CSS.supports("(color-gamut: p3)");
-};