Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(mobile): align confirmation flows and detail theme

tianma-if2650150f6dd2
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index 5b5965b3..c07384e4 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -13,6 +13,7 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
import { SessionProvider } from "../src/lib/session";
import { MobileThemeProvider, useMobileTheme } from "../src/lib/mobile-theme";
import { MobileLocaleProvider } from "../src/lib/mobile-locale";
+import { AppDialogProvider } from "../src/components/AppDialogProvider";
void SplashScreen.preventAutoHideAsync();
@@ -70,26 +71,28 @@ export default function RootLayout() {
<MobileLocaleProvider>
<ThemedApp>
<SafeAreaProvider>
- <PersistQueryClientProvider
- client={queryClient}
- persistOptions={{
- buster: "native-cache-v1",
- dehydrateOptions: {
- shouldDehydrateQuery: (query) => {
- const section = query.queryKey[1];
- const isOfflineReadableData = section === "notebooks" || section === "memos" || section === "memo";
+ <AppDialogProvider>
+ <PersistQueryClientProvider
+ client={queryClient}
+ persistOptions={{
+ buster: "native-cache-v1",
+ dehydrateOptions: {
+ shouldDehydrateQuery: (query) => {
+ const section = query.queryKey[1];
+ const isOfflineReadableData = section === "notebooks" || section === "memos" || section === "memo";
- return query.state.status === "success" && isOfflineReadableData;
+ return query.state.status === "success" && isOfflineReadableData;
+ },
},
- },
- maxAge: MOBILE_CACHE_MAX_AGE,
- persister,
- }}
- >
- <SessionProvider>
- <Stack screenOptions={{ headerShown: false }} />
- </SessionProvider>
- </PersistQueryClientProvider>
+ maxAge: MOBILE_CACHE_MAX_AGE,
+ persister,
+ }}
+ >
+ <SessionProvider>
+ <Stack screenOptions={{ headerShown: false }} />
+ </SessionProvider>
+ </PersistQueryClientProvider>
+ </AppDialogProvider>
</SafeAreaProvider>
</ThemedApp>
</MobileLocaleProvider>
diff --git a/apps/mobile/src/components/AppDialogProvider.tsx b/apps/mobile/src/components/AppDialogProvider.tsx
new file mode 100644
index 00000000..f8201fe9
--- /dev/null
+++ b/apps/mobile/src/components/AppDialogProvider.tsx
@@ -0,0 +1,235 @@
+import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
+import { Modal, StyleSheet, View, type AlertButton } from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { AlertTriangle, ShieldCheck, X } from "./icons";
+import { Pressable, Text } from "./LocalizedText";
+import { registerAppDialogPresenter, type AppDialogRequest } from "./app-dialog-controller";
+import { translateCurrentMobileText } from "../lib/mobile-locale";
+import { resolveMobileThemeStyles, useMobileTheme } from "../lib/mobile-theme";
+
+export const AppDialogProvider = ({ children }: { children: ReactNode }) => {
+ const { resolvedTheme } = useMobileTheme();
+ const insets = useSafeAreaInsets();
+ const styles = useMemo(() => resolveMobileThemeStyles(baseStyles, resolvedTheme), [resolvedTheme]);
+ const [request, setRequest] = useState<AppDialogRequest | null>(null);
+
+ useEffect(() => registerAppDialogPresenter(setRequest), []);
+
+ const buttons = useMemo(() => {
+ if (!request) {
+ return [];
+ }
+ return request.buttons?.length
+ ? request.buttons
+ : [{ text: translateCurrentMobileText("确定") } satisfies AlertButton];
+ }, [request]);
+ const cancelButton = buttons.find((button) => button.style === "cancel");
+ const destructive = buttons.some((button) => button.style === "destructive");
+ const primary = !destructive && Boolean(request?.buttons?.some((button) => button.style !== "cancel"));
+
+ const dismiss = useCallback((invokeCancel = false) => {
+ const activeRequest = request;
+ setRequest(null);
+ if (invokeCancel) {
+ cancelButton?.onPress?.();
+ }
+ activeRequest?.options?.onDismiss?.();
+ }, [cancelButton, request]);
+
+ const selectButton = (button: AlertButton) => {
+ setRequest(null);
+ button.onPress?.();
+ };
+
+ return (
+ <>
+ {children}
+ <Modal
+ animationType="fade"
+ onRequestClose={() => dismiss(Boolean(cancelButton))}
+ transparent
+ visible={Boolean(request)}
+ >
+ <View style={[styles.backdrop, { paddingBottom: Math.max(20, insets.bottom + 12), paddingTop: Math.max(20, insets.top + 12) }]}>
+ <Pressable
+ accessibilityLabel="关闭对话框"
+ accessibilityRole="button"
+ onPress={() => {
+ if (request?.options?.cancelable !== false) {
+ dismiss(Boolean(cancelButton));
+ }
+ }}
+ style={StyleSheet.absoluteFill}
+ />
+ <View accessibilityViewIsModal style={styles.dialog}>
+ <Pressable
+ accessibilityLabel="关闭"
+ accessibilityRole="button"
+ onPress={() => dismiss(Boolean(cancelButton))}
+ style={styles.closeButton}
+ >
+ <X color="#64748b" size={18} />
+ </Pressable>
+ <View style={styles.header}>
+ <View style={[
+ styles.iconCircle,
+ destructive ? styles.iconCircleDanger : primary ? styles.iconCirclePrimary : styles.iconCircleNeutral,
+ ]}>
+ {destructive
+ ? <AlertTriangle color="#be123c" size={20} />
+ : <ShieldCheck color={primary ? "#047857" : "#64748b"} size={20} />}
+ </View>
+ <View style={styles.copy}>
+ <Text accessibilityRole="header" style={styles.title}>{request?.title ?? ""}</Text>
+ {request?.message ? <Text style={styles.description}>{request.message}</Text> : null}
+ </View>
+ </View>
+ <View style={styles.footer}>
+ {[...buttons].reverse().map((button, index) => {
+ const isDestructive = button.style === "destructive";
+ const isCancel = button.style === "cancel";
+ return (
+ <Pressable
+ accessibilityRole="button"
+ key={`${button.text ?? "button"}-${index}`}
+ onPress={() => selectButton(button)}
+ style={[
+ styles.button,
+ isDestructive ? styles.buttonDanger : isCancel ? styles.buttonOutline : styles.buttonPrimary,
+ ]}
+ >
+ <Text style={[
+ styles.buttonText,
+ isDestructive ? styles.buttonTextDanger : isCancel ? styles.buttonTextOutline : styles.buttonTextPrimary,
+ ]}>
+ {button.text ?? translateCurrentMobileText("确定")}
+ </Text>
+ </Pressable>
+ );
+ })}
+ </View>
+ </View>
+ </View>
+ </Modal>
+ </>
+ );
+};
+
+const baseStyles = StyleSheet.create({
+ backdrop: {
+ alignItems: "center",
+ backgroundColor: "rgba(15, 23, 42, 0.42)",
+ flex: 1,
+ justifyContent: "center",
+ paddingHorizontal: 16,
+ },
+ dialog: {
+ backgroundColor: "#ffffff",
+ borderColor: "#e2e8f0",
+ borderRadius: 12,
+ borderWidth: 1,
+ elevation: 16,
+ maxWidth: 448,
+ overflow: "hidden",
+ shadowColor: "#0f172a",
+ shadowOffset: { width: 0, height: 12 },
+ shadowOpacity: 0.22,
+ shadowRadius: 24,
+ width: "100%",
+ },
+ header: {
+ alignItems: "flex-start",
+ borderBottomColor: "#e2e8f0",
+ borderBottomWidth: 1,
+ flexDirection: "row",
+ gap: 16,
+ paddingBottom: 20,
+ paddingLeft: 20,
+ paddingRight: 52,
+ paddingTop: 20,
+ },
+ closeButton: {
+ alignItems: "center",
+ borderRadius: 6,
+ height: 36,
+ justifyContent: "center",
+ position: "absolute",
+ right: 10,
+ top: 10,
+ width: 36,
+ zIndex: 2,
+ },
+ iconCircle: {
+ alignItems: "center",
+ borderRadius: 999,
+ height: 40,
+ justifyContent: "center",
+ width: 40,
+ },
+ iconCircleDanger: {
+ backgroundColor: "#fff1f2",
+ },
+ iconCircleNeutral: {
+ backgroundColor: "#f1f5f9",
+ },
+ iconCirclePrimary: {
+ backgroundColor: "#ecfdf5",
+ },
+ copy: {
+ flex: 1,
+ minWidth: 0,
+ },
+ title: {
+ color: "#0f172a",
+ fontSize: 16,
+ fontWeight: "700",
+ lineHeight: 22,
+ },
+ description: {
+ color: "#64748b",
+ fontSize: 14,
+ lineHeight: 20,
+ marginTop: 4,
+ },
+ footer: {
+ backgroundColor: "#f8fafc",
+ borderTopColor: "#f1f5f9",
+ borderTopWidth: 1,
+ gap: 8,
+ paddingHorizontal: 20,
+ paddingVertical: 16,
+ },
+ button: {
+ alignItems: "center",
+ borderRadius: 7,
+ borderWidth: 1,
+ justifyContent: "center",
+ minHeight: 42,
+ paddingHorizontal: 16,
+ },
+ buttonPrimary: {
+ backgroundColor: "#0f172a",
+ borderColor: "#0f172a",
+ },
+ buttonDanger: {
+ backgroundColor: "#e11d48",
+ borderColor: "#e11d48",
+ },
+ buttonOutline: {
+ backgroundColor: "#ffffff",
+ borderColor: "#cbd5e1",
+ },
+ buttonText: {
+ fontSize: 14,
+ fontWeight: "700",
+ },
+ buttonTextPrimary: {
+ color: "#ffffff",
+ },
+ buttonTextDanger: {
+ color: "#ffffff",
+ },
+ buttonTextOutline: {
+ color: "#0f172a",
+ },
+});
diff --git a/apps/mobile/src/components/LocalizedText.tsx b/apps/mobile/src/components/LocalizedText.tsx
index 074e6a52..b5f317a0 100644
--- a/apps/mobile/src/components/LocalizedText.tsx
+++ b/apps/mobile/src/components/LocalizedText.tsx
@@ -9,6 +9,7 @@ import {
type TextProps,
} from "react-native";
import { translateCurrentMobileText, useMobileLocale } from "../lib/mobile-locale";
+import { presentAppDialog } from "./app-dialog-controller";
const translateChildren = (children: ReactNode, translate: (value: string) => string): ReactNode =>
Children.map(children, (child) => {
@@ -61,11 +62,16 @@ export const Pressable = forwardRef<ComponentRef<typeof NativePressable>, Pressa
Pressable.displayName = "LocalizedPressable";
export const Alert = {
- alert: (...[title, message, buttons, options]: Parameters<typeof NativeAlert.alert>) =>
- NativeAlert.alert(
- translateCurrentMobileText(title),
- message ? translateCurrentMobileText(message) : message,
- buttons?.map((button) => ({ ...button, text: button.text ? translateCurrentMobileText(button.text) : button.text })),
- options
- ),
+ alert: (...[title, message, buttons, options]: Parameters<typeof NativeAlert.alert>) => {
+ const translatedTitle = translateCurrentMobileText(title);
+ const translatedMessage = message ? translateCurrentMobileText(message) : message;
+ const translatedButtons = buttons?.map((button) => ({
+ ...button,
+ text: button.text ? translateCurrentMobileText(button.text) : button.text,
+ }));
+ if (presentAppDialog({ title: translatedTitle, message: translatedMessage, buttons: translatedButtons, options })) {
+ return;
+ }
+ NativeAlert.alert(translatedTitle, translatedMessage, translatedButtons, options);
+ },
};
diff --git a/apps/mobile/src/components/app-dialog-controller.test.ts b/apps/mobile/src/components/app-dialog-controller.test.ts
new file mode 100644
index 00000000..4f51f1c9
--- /dev/null
+++ b/apps/mobile/src/components/app-dialog-controller.test.ts
@@ -0,0 +1,27 @@
+import { afterEach, describe, expect, it } from "bun:test";
+import { presentAppDialog, registerAppDialogPresenter, type AppDialogRequest } from "./app-dialog-controller";
+
+let unregister: (() => void) | null = null;
+
+afterEach(() => {
+ unregister?.();
+ unregister = null;
+});
+
+describe("app dialog controller", () => {
+ it("routes a dialog request to the active native presenter", () => {
+ const requests: AppDialogRequest[] = [];
+ unregister = registerAppDialogPresenter((request) => requests.push(request));
+
+ expect(presentAppDialog({ title: "Delete?", message: "Cannot be undone." })).toBe(true);
+ expect(requests).toEqual([{ title: "Delete?", message: "Cannot be undone." }]);
+ });
+
+ it("falls back when the provider is not mounted", () => {
+ unregister = registerAppDialogPresenter(() => undefined);
+ unregister();
+ unregister = null;
+
+ expect(presentAppDialog({ title: "Notice" })).toBe(false);
+ });
+});
diff --git a/apps/mobile/src/components/app-dialog-controller.ts b/apps/mobile/src/components/app-dialog-controller.ts
new file mode 100644
index 00000000..7a9b6c7b
--- /dev/null
+++ b/apps/mobile/src/components/app-dialog-controller.ts
@@ -0,0 +1,29 @@
+import type { AlertButton, AlertOptions } from "react-native";
+
+export type AppDialogRequest = {
+ buttons?: AlertButton[];
+ message?: string;
+ options?: AlertOptions;
+ title: string;
+};
+
+type AppDialogPresenter = (request: AppDialogRequest) => void;
+
+let presenter: AppDialogPresenter | null = null;
+
+export const registerAppDialogPresenter = (nextPresenter: AppDialogPresenter) => {
+ presenter = nextPresenter;
+ return () => {
+ if (presenter === nextPresenter) {
+ presenter = null;
+ }
+ };
+};
+
+export const presentAppDialog = (request: AppDialogRequest) => {
+ if (!presenter) {
+ return false;
+ }
+ presenter(request);
+ return true;
+};
diff --git a/apps/mobile/src/components/icons.tsx b/apps/mobile/src/components/icons.tsx
index fabc0f97..61fac384 100644
--- a/apps/mobile/src/components/icons.tsx
+++ b/apps/mobile/src/components/icons.tsx
@@ -15,6 +15,7 @@ const createIcon = (name: FeatherName) => {
};
export const Archive = createIcon("archive");
+export const AlertTriangle = createIcon("alert-triangle");
export const BookOpen = createIcon("book-open");
export const Bold = createIcon("bold");
export const Check = createIcon("check");
diff --git a/apps/mobile/src/lib/mobile-locale.tsx b/apps/mobile/src/lib/mobile-locale.tsx
index e5b54887..42db728b 100644
--- a/apps/mobile/src/lib/mobile-locale.tsx
+++ b/apps/mobile/src/lib/mobile-locale.tsx
@@ -18,6 +18,7 @@ type TranslationPair = { source: string; target: string; pattern?: RegExp; place
const mobileOnlyTranslations = new Map<string, string>([
["返回", "Back"],
+ ["关闭对话框", "Close dialog"],
["切换到深色模式", "Switch to dark mode"],
["切换到浅色模式", "Switch to light mode"],
["完成编辑", "Finish editing"],
@@ -33,6 +34,25 @@ const mobileOnlyTranslations = new Map<string, string>([
["加载失败", "Failed to load"],
["请稍后重试", "Please try again later"],
["重试", "Retry"],
+ ["图片上传失败", "Image upload failed"],
+ ["请检查网络连接后重试", "Check your connection and try again"],
+ ["退出新建笔记?", "Exit the new note?"],
+ ["内容已自动保存为本地草稿,下次新建时会继续恢复。", "The content is saved as a local draft and will be restored the next time you create a note."],
+ ["继续编辑", "Keep editing"],
+ ["放弃草稿", "Discard draft"],
+ ["保留并退出", "Keep and exit"],
+ ["丢弃本地变更?", "Discard local changes?"],
+ ["此操作会移除这条待同步记录,不会修改服务端笔记。", "This removes the queued local change without modifying the server note."],
+ ["丢弃", "Discard"],
+ ["正在同步新笔记", "New note is syncing"],
+ ["首次同步完成后即可上传本地图片;图片链接现在就可以直接粘贴到正文。", "Local images can be uploaded after the first sync. Image links can already be pasted into the note."],
+ ["保存更改?", "Save changes?"],
+ ["当前笔记有未保存修改。", "This note has unsaved changes."],
+ ["放弃修改", "Discard changes"],
+ ["无法打开资源", "Unable to open resource"],
+ ["系统没有可用应用打开此链接。", "No installed app can open this link."],
+ ["密码已更新", "Password updated"],
+ ["下次登录请使用新密码。", "Use the new password the next time you sign in."],
["编辑笔记", "Edit note"],
["所在笔记本", "Notebook"],
["笔记标题", "Note title"],
diff --git a/apps/mobile/src/screens/WorkspaceScreen.tsx b/apps/mobile/src/screens/WorkspaceScreen.tsx
index 13b9687c..1ee1813f 100644
--- a/apps/mobile/src/screens/WorkspaceScreen.tsx
+++ b/apps/mobile/src/screens/WorkspaceScreen.tsx
@@ -884,21 +884,26 @@ export const WorkspaceScreen = () => {
};
const handleDeleteMemo = (memo: MemoDetail) => {
- Alert.alert(memoView === "trash" ? "永久删除笔记?" : "删除笔记?", memoView === "trash" ? "此操作不可撤销。" : "笔记会移动到回收站。", [
+ const permanent = memoView === "trash" || memo.isDeleted;
+ if (!permanent) {
+ deleteMemoMutation.mutate({ memo, permanent: false });
+ return;
+ }
+ Alert.alert("永久删除笔记", "这个操作不可恢复。", [
{ text: "取消", style: "cancel" },
{
- text: memoView === "trash" ? "永久删除" : "删除",
+ text: "永久删除",
style: "destructive",
- onPress: () => deleteMemoMutation.mutate({ memo, permanent: memoView === "trash" }),
+ onPress: () => deleteMemoMutation.mutate({ memo, permanent: true }),
},
]);
};
const handleEmptyTrash = () => {
- Alert.alert("清空回收站?", "回收站中的笔记会被永久删除,此操作不可撤销。", [
+ Alert.alert("清空回收站", "回收站中的全部笔记和仍关联的附件都会删除,这个操作不可恢复。", [
{ text: "取消", style: "cancel" },
{
- text: "清空",
+ text: "清空回收站",
style: "destructive",
onPress: () => emptyTrashMutation.mutate(),
},
@@ -907,28 +912,35 @@ export const WorkspaceScreen = () => {
const handleDeleteSelection = () => {
const permanent = memoView === "trash";
-
- Alert.alert(permanent ? "永久删除选中笔记?" : "删除选中笔记?", permanent ? "此操作不可撤销。" : "选中的笔记会移动到回收站。", [
+ if (!permanent) {
+ deleteMemosMutation.mutate({ memoIds: selectedMemoIdList, permanent: false });
+ return;
+ }
+ Alert.alert(`永久删除 ${selectedMemoIdList.length} 条笔记`, "这个操作不可恢复。", [
{ text: "取消", style: "cancel" },
{
- text: permanent ? "永久删除" : "删除",
+ text: "永久删除",
style: "destructive",
- onPress: () => deleteMemosMutation.mutate({ memoIds: selectedMemoIdList, permanent }),
+ onPress: () => deleteMemosMutation.mutate({ memoIds: selectedMemoIdList, permanent: true }),
},
]);
};
const requestDeleteMemoSummary = (memo: MemoSummary) => {
const permanent = memoView === "trash";
-
- Alert.alert(permanent ? "永久删除笔记?" : "删除笔记?", permanent ? "此操作不可撤销。" : "笔记会移动到回收站。", [
+ if (!permanent) {
+ setMemoActionsMemo(null);
+ deleteMemosMutation.mutate({ memoIds: [memo.id], permanent: false });
+ return;
+ }
+ Alert.alert("永久删除笔记", "这个操作不可恢复。", [
{ text: "取消", style: "cancel" },
{
- text: permanent ? "永久删除" : "删除",
+ text: "永久删除",
style: "destructive",
onPress: () => {
setMemoActionsMemo(null);
- deleteMemosMutation.mutate({ memoIds: [memo.id], permanent });
+ deleteMemosMutation.mutate({ memoIds: [memo.id], permanent: true });
},
},
]);
@@ -946,13 +958,7 @@ export const WorkspaceScreen = () => {
const targetNotebookId = activeNotebookId === ALL_NOTES_ID ? selectedMemos[0]?.notebookId : activeNotebookId;
- Alert.alert("合并选中笔记?", "服务端会把选中的笔记合并成一条新笔记。", [
- { text: "取消", style: "cancel" },
- {
- text: "合并",
- onPress: () => mergeMemosMutation.mutate({ memoIds: selectedMemoIdList, notebookId: targetNotebookId }),
- },
- ]);
+ mergeMemosMutation.mutate({ memoIds: selectedMemoIdList, notebookId: targetNotebookId });
};
const handleSyncQueuedChanges = async () => {
@@ -2876,7 +2882,7 @@ const NotebookManagerModal = ({
return;
}
- Alert.alert("删除笔记本?", `将删除“${notebook.name}”。如果服务端不允许删除非空笔记本,请先移动或删除其中笔记。`, [
+ Alert.alert(`删除笔记本「${notebook.name}」`, "请先清空其中的笔记和子笔记本。删除后无法从这里恢复。", [
{ text: "取消", style: "cancel" },
{
text: "删除",
@@ -3113,10 +3119,10 @@ const TagsManagerModal = ({ onClose, visible }: { onClose: () => void; visible:
});
const requestDeleteTag = (tag: TagSummary) => {
- Alert.alert("删除标签?", `将从 ${tag.memoCount} 条笔记中移除 #${tag.name}。`, [
+ Alert.alert(`删除标签 #${tag.name}`, `将从 ${tag.memoCount} 条笔记中移除这个标签,笔记内容不会被删除。`, [
{ text: "取消", style: "cancel" },
{
- text: "删除",
+ text: "删除标签",
style: "destructive",
onPress: () => deleteTagMutation.mutate(tag.name),
},
@@ -3334,10 +3340,10 @@ const ApiTokensContent = ({ active, baseUrl }: { active: boolean; baseUrl: strin
};
const requestRevokeToken = (token: ApiToken) => {
- Alert.alert("撤销 Token?", `将撤销“${token.name}”,使用它的 MCP 客户端会失去访问权限。`, [
+ Alert.alert(`确定要删除 Token「${token.name}」吗?`, "删除操作不可逆。一旦删除,使用此 Token 进行 API 或 MCP 调用的一切客户端将立即失效并被拒绝访问。", [
{ text: "取消", style: "cancel" },
{
- text: "撤销",
+ text: "确认删除",
style: "destructive",
onPress: () => revokeTokenMutation.mutate(token.id),
},
@@ -4376,11 +4382,16 @@ const MemoDetailModal = ({
onTogglePin: (memo: MemoDetail) => void;
visible: boolean;
}) => {
+ const { resolvedTheme, toggleTheme } = useMobileTheme();
const [actionsOpen, setActionsOpen] = useState(false);
const [searchOpen, setSearchOpen] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [activeMatchIndex, setActiveMatchIndex] = useState(0);
const localePreference = useMobileLocalePreference();
+ const themedDetailMarkdownStyles = useMemo(
+ () => resolveMobileThemeStyles(detailMarkdownStyles, resolvedTheme),
+ [resolvedTheme]
+ );
const detailText = memo?.contentMarkdown || memo?.contentText || "没有正文内容";
const searchMatches = useMemo(() => getTextSearchMatches(detailText, searchQuery), [detailText, searchQuery]);
const searchMatchLabel = searchQuery.trim() ? `${searchMatches.length > 0 ? activeMatchIndex + 1 : 0}/${searchMatches.length}` : "0/0";
@@ -4409,12 +4420,22 @@ const MemoDetailModal = ({
<Pressable accessibilityLabel="返回" accessibilityRole="button" onPress={onClose} style={styles.detailHeaderButton}>
<ChevronLeft color="#475569" size={21} />
</Pressable>
- <Text style={styles.detailSyncStatus}>{isSaving ? "保存中" : "已同步"}</Text>
- {memo ? (
- <Pressable accessibilityLabel="笔记操作" accessibilityRole="button" onPress={() => setActionsOpen(true)} style={styles.detailHeaderButton}>
- <MoreHorizontal color="#475569" size={21} />
+ <View style={styles.detailHeaderActions}>
+ <Text numberOfLines={1} style={styles.detailSyncStatus}>{isSaving ? "保存中" : "已同步"}</Text>
+ <Pressable
+ accessibilityLabel={resolvedTheme === "dark" ? "切换到浅色模式" : "切换到深色模式"}
+ accessibilityRole="button"
+ onPress={toggleTheme}
+ style={styles.detailHeaderIconButton}
+ >
+ {resolvedTheme === "dark" ? <Sun color="#475569" size={19} /> : <Moon color="#475569" size={19} />}
</Pressable>
- ) : null}
+ {memo ? (
+ <Pressable accessibilityLabel="笔记操作" accessibilityRole="button" onPress={() => setActionsOpen(true)} style={styles.detailHeaderIconButton}>
+ <MoreHorizontal color="#475569" size={21} />
+ </Pressable>
+ ) : null}
+ </View>
</View>
{isLoading ? (
@@ -4458,7 +4479,7 @@ const MemoDetailModal = ({
{searchOpen && searchQuery.trim() ? (
<HighlightedDetailText activeIndex={activeMatchIndex} matches={searchMatches} text={detailText} />
) : (
- <Markdown style={detailMarkdownStyles}>{detailText}</Markdown>
+ <Markdown style={themedDetailMarkdownStyles}>{detailText}</Markdown>
)}
</ScrollView>
) : (
@@ -8564,12 +8585,25 @@ const baseWorkspaceStyles = StyleSheet.create({
justifyContent: "center",
width: 40,
},
+ detailHeaderActions: {
+ alignItems: "center",
+ flexDirection: "row",
+ gap: 2,
+ },
+ detailHeaderIconButton: {
+ alignItems: "center",
+ borderRadius: 18,
+ height: 36,
+ justifyContent: "center",
+ width: 36,
+ },
detailSyncStatus: {
backgroundColor: "#f1f5f9",
borderRadius: 999,
color: "#64748b",
fontSize: 12,
fontWeight: "700",
+ maxWidth: 88,
overflow: "hidden",
paddingHorizontal: 10,
paddingVertical: 5,