Update App version to 0.1.2

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
luckfox-eng29
2026-03-16 21:49:37 +08:00
parent 9a4e604c61
commit 6f426e8999
32 changed files with 4045 additions and 217 deletions

View File

@@ -65,6 +65,7 @@ interface StorageFilePageProps {
showSDManagement?: boolean;
onResetSDStorage?: () => void;
onUnmountSDStorage?: () => void;
onFormatSDStorage?: () => void;
onMountSDStorage?: () => void;
}
@@ -77,6 +78,7 @@ export const FileManager: React.FC<StorageFilePageProps> = ({
showSDManagement = false,
onResetSDStorage,
onUnmountSDStorage,
onFormatSDStorage,
}) => {
const { $at } = useReactAt();
@@ -212,6 +214,16 @@ export const FileManager: React.FC<StorageFilePageProps> = ({
}
}, [onResetSDStorage, syncStorage]);
const handleFormatWrapper = useCallback(async () => {
if (onFormatSDStorage) {
setLoading(true);
await onFormatSDStorage();
setSDMountStatus(null);
syncStorage();
setLoading(false);
}
}, [onFormatSDStorage, syncStorage]);
if (mediaType === "sd" && sdMountStatus && sdMountStatus !== "ok") {
return (
<div className="mx-auto max-w-4xl py-8">
@@ -237,6 +249,19 @@ export const FileManager: React.FC<StorageFilePageProps> = ({
? $at("Please insert an SD card and try again.")
: $at("Please format the SD card and try again.")}
</p>
{sdMountStatus !== "none" && (
<div className="pt-2">
<AntdButton
disabled={loading}
danger={true}
type="primary"
onClick={handleFormatWrapper}
className="w-full text-red-500 dark:text-red-400 border-red-200 dark:border-red-800"
>
{$at("Format MicroSD Card")}
</AntdButton>
</div>
)}
</div>
</div>
@@ -291,6 +316,7 @@ export const FileManager: React.FC<StorageFilePageProps> = ({
showSDManagement={showSDManagement}
onNewImageClick={handleNewImageClick}
onUnmountSDStorage={handleUnmountWrapper}
onFormatSDStorage={handleFormatWrapper}
syncStorage={syncStorage}
/>
@@ -476,6 +502,7 @@ interface ActionButtonsSectionProps {
showSDManagement?: boolean;
onNewImageClick: (incompleteFileName?: string) => void;
onUnmountSDStorage?: () => void;
onFormatSDStorage?: () => void;
syncStorage: () => void;
}
@@ -484,15 +511,22 @@ const ActionButtonsSection: React.FC<ActionButtonsSectionProps> = ({
loading,
showSDManagement,
onUnmountSDStorage,
onFormatSDStorage,
}) => {
const { $at } = useReactAt();
if (mediaType === "sd" && showSDManagement) {
return (
<div className="flex animate-fadeIn justify-between opacity-0"
<div className="flex animate-fadeIn justify-between gap-2 opacity-0"
style={{ animationDuration: "0.7s", animationDelay: "0.25s" }}
>
<AntdButton
disabled={loading}
type="primary"
danger={true}
onClick={onFormatSDStorage}
className="w-full text-red-500 dark:text-red-400 border-red-200 dark:border-red-800"
>{$at("Format MicroSD Card")}</AntdButton>
<AntdButton
disabled={loading}
type="primary"
@@ -503,4 +537,4 @@ const ActionButtonsSection: React.FC<ActionButtonsSectionProps> = ({
</div>
);
}
};
};

View File

@@ -1,10 +1,12 @@
import { useState } from "react";
import { useReactAt } from "i18n-auto-extractor/react";
import { FileManager } from "@/layout/components_side/SharedFolders/FileManager";
import notifications from "@/notifications";
import { useJsonRpc } from "@/hooks/useJsonRpc";
export default function SDFilePage() {
const { $at } = useReactAt();
const [send] = useJsonRpc();
const [loading, setLoading] = useState(false);
@@ -34,6 +36,23 @@ export default function SDFilePage() {
setLoading(false);
};
const handleFormatSDStorage = async () => {
if (!window.confirm($at("Formatting the SD card will erase all data. Continue?"))) {
return;
}
setLoading(true);
send("formatSDStorage", { confirm: true }, res => {
if ("error" in res) {
notifications.error(res.error.data || res.error.message);
setLoading(false);
return;
}
notifications.success($at("SD card formatted successfully"));
});
await new Promise(resolve => setTimeout(resolve, 2000));
setLoading(false);
};
return (
<FileManager
mediaType="sd"
@@ -45,6 +64,7 @@ export default function SDFilePage() {
showSDManagement={true}
onResetSDStorage={handleResetSDStorage}
onUnmountSDStorage={handleUnmountSDStorage}
onFormatSDStorage={handleFormatSDStorage}
/>
);
}
}

View File

@@ -3,9 +3,16 @@ import React from "react";
import SideTabs from "@components/Sidebar/SideTabs";
import DeviceFilePage from "@/layout/components_side/SharedFolders/DeviceFilePage";
import SDFilePage from "@/layout/components_side/SharedFolders/SDFilePage";
import { useBootStorageType } from "@/hooks/useBootStorage";
const SharedFolders: React.FC = () => {
const { bootStorageType } = useBootStorageType();
const isBootFromSD = bootStorageType === "sd";
if (isBootFromSD) {
return <DeviceFilePage />;
}
return (
<SideTabs