+
+
+
出错了
-
- )
+ );
}
-export default errorFallbackRender
+export default errorFallbackRender;
diff --git a/napcat.webui/src/components/file_icon.tsx b/napcat.webui/src/components/file_icon.tsx
index 9327abe9..c955d921 100644
--- a/napcat.webui/src/components/file_icon.tsx
+++ b/napcat.webui/src/components/file_icon.tsx
@@ -11,8 +11,8 @@ import {
FaFileVideo,
FaFileWord,
FaFileZipper,
- FaFolderClosed
-} from 'react-icons/fa6'
+ FaFolderClosed,
+} from 'react-icons/fa6';
export interface FileIconProps {
name?: string
@@ -20,12 +20,12 @@ export interface FileIconProps {
}
const FileIcon = (props: FileIconProps) => {
- const { name, isDirectory = false } = props
+ const { name, isDirectory = false } = props;
if (isDirectory) {
- return
+ return
;
}
- const ext = name?.split('.').pop() || ''
+ const ext = name?.split('.').pop() || '';
if (ext) {
switch (ext.toLowerCase()) {
case 'jpg':
@@ -50,20 +50,20 @@ const FileIcon = (props: FileIconProps) => {
case 'fig':
case 'xd':
case 'svgz':
- return
+ return
;
case 'pdf':
- return
+ return
;
case 'doc':
case 'docx':
- return
+ return
;
case 'xls':
case 'xlsx':
- return
+ return
;
case 'csv':
- return
+ return
;
case 'ppt':
case 'pptx':
- return
+ return
;
case 'zip':
case 'rar':
case '7z':
@@ -79,18 +79,18 @@ const FileIcon = (props: FileIconProps) => {
case 'taz':
case 'tz':
case 'tzo':
- return
+ return
;
case 'txt':
- return
+ return
;
case 'mp3':
case 'wav':
case 'flac':
- return
+ return
;
case 'mp4':
case 'avi':
case 'mov':
case 'wmv':
- return
+ return
;
case 'html':
case 'css':
case 'js':
@@ -154,13 +154,13 @@ const FileIcon = (props: FileIconProps) => {
case 'userosscache':
case 'sln.docstates':
case 'dll':
- return
+ return
;
default:
- return
+ return
;
}
}
- return
-}
+ return
;
+};
-export default FileIcon
+export default FileIcon;
diff --git a/napcat.webui/src/components/file_manage/create_file_modal.tsx b/napcat.webui/src/components/file_manage/create_file_modal.tsx
index 51b3a14c..d959a044 100644
--- a/napcat.webui/src/components/file_manage/create_file_modal.tsx
+++ b/napcat.webui/src/components/file_manage/create_file_modal.tsx
@@ -1,12 +1,12 @@
-import { Button, ButtonGroup } from '@heroui/button'
-import { Input } from '@heroui/input'
+import { Button, ButtonGroup } from '@heroui/button';
+import { Input } from '@heroui/input';
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
- ModalHeader
-} from '@heroui/modal'
+ ModalHeader,
+} from '@heroui/modal';
interface CreateFileModalProps {
isOpen: boolean
@@ -18,22 +18,22 @@ interface CreateFileModalProps {
onCreate: () => void
}
-export default function CreateFileModal({
+export default function CreateFileModal ({
isOpen,
fileType,
newFileName,
onTypeChange,
onNameChange,
onClose,
- onCreate
+ onCreate,
}: CreateFileModalProps) {
return (
新建
-
-
+
+
-
+
-
- )
+ );
}
diff --git a/napcat.webui/src/components/file_manage/file_edit_modal.tsx b/napcat.webui/src/components/file_manage/file_edit_modal.tsx
index cc906e63..309d8f78 100644
--- a/napcat.webui/src/components/file_manage/file_edit_modal.tsx
+++ b/napcat.webui/src/components/file_manage/file_edit_modal.tsx
@@ -1,14 +1,14 @@
-import { Button } from '@heroui/button'
-import { Code } from '@heroui/code'
+import { Button } from '@heroui/button';
+import { Code } from '@heroui/code';
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
- ModalHeader
-} from '@heroui/modal'
+ ModalHeader,
+} from '@heroui/modal';
-import CodeEditor from '@/components/code_editor'
+import CodeEditor from '@/components/code_editor';
interface FileEditModalProps {
isOpen: boolean
@@ -18,61 +18,61 @@ interface FileEditModalProps {
onContentChange: (newContent?: string) => void
}
-export default function FileEditModal({
+export default function FileEditModal ({
isOpen,
file,
onClose,
onSave,
- onContentChange
+ onContentChange,
}: FileEditModalProps) {
// 根据文件后缀返回对应语言
const getLanguage = (filePath: string) => {
- if (filePath.endsWith('.js')) return 'javascript'
- if (filePath.endsWith('.ts')) return 'typescript'
- if (filePath.endsWith('.tsx')) return 'tsx'
- if (filePath.endsWith('.jsx')) return 'jsx'
- if (filePath.endsWith('.vue')) return 'vue'
- if (filePath.endsWith('.svelte')) return 'svelte'
- if (filePath.endsWith('.json')) return 'json'
- if (filePath.endsWith('.html')) return 'html'
- if (filePath.endsWith('.css')) return 'css'
- if (filePath.endsWith('.scss')) return 'scss'
- if (filePath.endsWith('.less')) return 'less'
- if (filePath.endsWith('.md')) return 'markdown'
- if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) return 'yaml'
- if (filePath.endsWith('.xml')) return 'xml'
- if (filePath.endsWith('.sql')) return 'sql'
- if (filePath.endsWith('.sh')) return 'shell'
- if (filePath.endsWith('.bat')) return 'bat'
- if (filePath.endsWith('.php')) return 'php'
- if (filePath.endsWith('.java')) return 'java'
- if (filePath.endsWith('.c')) return 'c'
- if (filePath.endsWith('.cpp')) return 'cpp'
- if (filePath.endsWith('.h')) return 'h'
- if (filePath.endsWith('.hpp')) return 'hpp'
- if (filePath.endsWith('.go')) return 'go'
- if (filePath.endsWith('.py')) return 'python'
- if (filePath.endsWith('.rb')) return 'ruby'
- if (filePath.endsWith('.cs')) return 'csharp'
- if (filePath.endsWith('.swift')) return 'swift'
- if (filePath.endsWith('.vb')) return 'vb'
- if (filePath.endsWith('.lua')) return 'lua'
- if (filePath.endsWith('.pl')) return 'perl'
- if (filePath.endsWith('.r')) return 'r'
- return 'plaintext'
- }
+ if (filePath.endsWith('.js')) return 'javascript';
+ if (filePath.endsWith('.ts')) return 'typescript';
+ if (filePath.endsWith('.tsx')) return 'tsx';
+ if (filePath.endsWith('.jsx')) return 'jsx';
+ if (filePath.endsWith('.vue')) return 'vue';
+ if (filePath.endsWith('.svelte')) return 'svelte';
+ if (filePath.endsWith('.json')) return 'json';
+ if (filePath.endsWith('.html')) return 'html';
+ if (filePath.endsWith('.css')) return 'css';
+ if (filePath.endsWith('.scss')) return 'scss';
+ if (filePath.endsWith('.less')) return 'less';
+ if (filePath.endsWith('.md')) return 'markdown';
+ if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) return 'yaml';
+ if (filePath.endsWith('.xml')) return 'xml';
+ if (filePath.endsWith('.sql')) return 'sql';
+ if (filePath.endsWith('.sh')) return 'shell';
+ if (filePath.endsWith('.bat')) return 'bat';
+ if (filePath.endsWith('.php')) return 'php';
+ if (filePath.endsWith('.java')) return 'java';
+ if (filePath.endsWith('.c')) return 'c';
+ if (filePath.endsWith('.cpp')) return 'cpp';
+ if (filePath.endsWith('.h')) return 'h';
+ if (filePath.endsWith('.hpp')) return 'hpp';
+ if (filePath.endsWith('.go')) return 'go';
+ if (filePath.endsWith('.py')) return 'python';
+ if (filePath.endsWith('.rb')) return 'ruby';
+ if (filePath.endsWith('.cs')) return 'csharp';
+ if (filePath.endsWith('.swift')) return 'swift';
+ if (filePath.endsWith('.vb')) return 'vb';
+ if (filePath.endsWith('.lua')) return 'lua';
+ if (filePath.endsWith('.pl')) return 'perl';
+ if (filePath.endsWith('.r')) return 'r';
+ return 'plaintext';
+ };
return (
-
+
-
+
编辑文件
- {file?.path}
+ {file?.path}
-
-
+
+
-
+
取消
-
+
保存
- )
+ );
}
diff --git a/napcat.webui/src/components/file_manage/file_preview_modal.tsx b/napcat.webui/src/components/file_manage/file_preview_modal.tsx
index e416eb48..c559875f 100644
--- a/napcat.webui/src/components/file_manage/file_preview_modal.tsx
+++ b/napcat.webui/src/components/file_manage/file_preview_modal.tsx
@@ -1,17 +1,17 @@
-import { Button } from '@heroui/button'
+import { Button } from '@heroui/button';
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
- ModalHeader
-} from '@heroui/modal'
-import { Spinner } from '@heroui/spinner'
-import { useRequest } from 'ahooks'
-import path from 'path-browserify'
-import { useEffect } from 'react'
+ ModalHeader,
+} from '@heroui/modal';
+import { Spinner } from '@heroui/spinner';
+import { useRequest } from 'ahooks';
+import path from 'path-browserify';
+import { useEffect } from 'react';
-import FileManager from '@/controllers/file_manager'
+import FileManager from '@/controllers/file_manager';
interface FilePreviewModalProps {
isOpen: boolean
@@ -19,74 +19,74 @@ interface FilePreviewModalProps {
onClose: () => void
}
-export const videoExts = ['.mp4', '.webm']
-export const audioExts = ['.mp3', '.wav']
+export const videoExts = ['.mp4', '.webm'];
+export const audioExts = ['.mp3', '.wav'];
-export const supportedPreviewExts = [...videoExts, ...audioExts]
+export const supportedPreviewExts = [...videoExts, ...audioExts];
-export default function FilePreviewModal({
+export default function FilePreviewModal ({
isOpen,
filePath,
- onClose
+ onClose,
}: FilePreviewModalProps) {
- const ext = path.extname(filePath).toLowerCase()
+ const ext = path.extname(filePath).toLowerCase();
const { data, loading, error, run } = useRequest(
async () => FileManager.downloadToURL(filePath),
{
refreshDeps: [filePath],
manual: true,
refreshDepsAction: () => {
- const ext = path.extname(filePath).toLowerCase()
+ const ext = path.extname(filePath).toLowerCase();
if (!filePath || !supportedPreviewExts.includes(ext)) {
- return
+ return;
}
- run()
- }
+ run();
+ },
}
- )
+ );
useEffect(() => {
if (filePath) {
- run()
+ run();
}
- }, [filePath])
+ }, [filePath]);
- let contentElement = null
+ let contentElement = null;
if (!supportedPreviewExts.includes(ext)) {
- contentElement = 暂不支持预览此文件类型
+ contentElement = 暂不支持预览此文件类型
;
} else if (error) {
- contentElement = 读取文件失败
+ contentElement = 读取文件失败
;
} else if (loading || !data) {
contentElement = (
-
+
- )
+ );
} else if (videoExts.includes(ext)) {
- contentElement =
+ contentElement =
;
} else if (audioExts.includes(ext)) {
- contentElement =
+ contentElement =
;
} else {
contentElement = (
-
+
- )
+ );
}
return (
-
+
文件预览
-
+
{contentElement}
-
+
关闭
- )
+ );
}
diff --git a/napcat.webui/src/components/file_manage/file_table.tsx b/napcat.webui/src/components/file_manage/file_table.tsx
index 2cbda7b3..b0e0b2d2 100644
--- a/napcat.webui/src/components/file_manage/file_table.tsx
+++ b/napcat.webui/src/components/file_manage/file_table.tsx
@@ -1,6 +1,6 @@
-import { Button, ButtonGroup } from '@heroui/button'
-import { Pagination } from '@heroui/pagination'
-import { Spinner } from '@heroui/spinner'
+import { Button, ButtonGroup } from '@heroui/button';
+import { Pagination } from '@heroui/pagination';
+import { Spinner } from '@heroui/spinner';
import {
type Selection,
type SortDescriptor,
@@ -9,20 +9,20 @@ import {
TableCell,
TableColumn,
TableHeader,
- TableRow
-} from '@heroui/table'
-import path from 'path-browserify'
-import { useCallback, useEffect, useState } from 'react'
-import { BiRename } from 'react-icons/bi'
-import { FiCopy, FiDownload, FiMove, FiTrash2 } from 'react-icons/fi'
-import { PhotoSlider } from 'react-photo-view'
+ TableRow,
+} from '@heroui/table';
+import path from 'path-browserify';
+import { useCallback, useEffect, useState } from 'react';
+import { BiRename } from 'react-icons/bi';
+import { FiCopy, FiDownload, FiMove, FiTrash2 } from 'react-icons/fi';
+import { PhotoSlider } from 'react-photo-view';
-import FileIcon from '@/components/file_icon'
+import FileIcon from '@/components/file_icon';
-import type { FileInfo } from '@/controllers/file_manager'
+import type { FileInfo } from '@/controllers/file_manager';
-import { supportedPreviewExts } from './file_preview_modal'
-import ImageNameButton, { PreviewImage, imageExts } from './image_name_button'
+import { supportedPreviewExts } from './file_preview_modal';
+import ImageNameButton, { PreviewImage, imageExts } from './image_name_button';
export interface FileTableProps {
files: FileInfo[]
@@ -42,9 +42,9 @@ export interface FileTableProps {
onDownload: (filePath: string) => void
}
-const PAGE_SIZE = 20
+const PAGE_SIZE = 20;
-export default function FileTable({
+export default function FileTable ({
files,
currentPath,
loading,
@@ -59,40 +59,40 @@ export default function FileTable({
onMoveRequest,
onCopyPath,
onDelete,
- onDownload
+ onDownload,
}: FileTableProps) {
- const [page, setPage] = useState(1)
- const pages = Math.ceil(files.length / PAGE_SIZE) || 1
- const start = (page - 1) * PAGE_SIZE
- const end = start + PAGE_SIZE
- const displayFiles = files.slice(start, end)
- const [showImage, setShowImage] = useState(false)
- const [previewIndex, setPreviewIndex] = useState(0)
- const [previewImages, setPreviewImages] = useState([])
+ const [page, setPage] = useState(1);
+ const pages = Math.ceil(files.length / PAGE_SIZE) || 1;
+ const start = (page - 1) * PAGE_SIZE;
+ const end = start + PAGE_SIZE;
+ const displayFiles = files.slice(start, end);
+ const [showImage, setShowImage] = useState(false);
+ const [previewIndex, setPreviewIndex] = useState(0);
+ const [previewImages, setPreviewImages] = useState([]);
const addPreviewImage = useCallback((image: PreviewImage) => {
setPreviewImages((prev) => {
- const exists = prev.some((p) => p.key === image.key)
- if (exists) return prev
- return [...prev, image]
- })
- }, [])
+ const exists = prev.some((p) => p.key === image.key);
+ if (exists) return prev;
+ return [...prev, image];
+ });
+ }, []);
useEffect(() => {
- setPreviewImages([])
- setPreviewIndex(0)
- setShowImage(false)
- setPage(1)
- }, [currentPath])
+ setPreviewImages([]);
+ setPreviewIndex(0);
+ setShowImage(false);
+ setPage(1);
+ }, [currentPath]);
const onPreviewImage = (name: string, images: PreviewImage[]) => {
- const index = images.findIndex((image) => image.key === name)
+ const index = images.findIndex((image) => image.key === name);
if (index === -1) {
- return
+ return;
}
- setPreviewIndex(index)
- setShowImage(true)
- }
+ setPreviewIndex(index);
+ setShowImage(true);
+ };
return (
<>
@@ -104,20 +104,20 @@ export default function FileTable({
onIndexChange={setPreviewIndex}
/>
+
setPage(page)}
@@ -126,64 +126,65 @@ export default function FileTable({
}
>
-
+
名称
-
+
类型
-
+
大小
-
+
修改时间
- 操作
+ 操作
+
}
>
{displayFiles.map((file: FileInfo) => {
- const filePath = path.join(currentPath, file.name)
- const ext = path.extname(file.name).toLowerCase()
- const previewable = supportedPreviewExts.includes(ext)
- const images = previewImages
+ const filePath = path.join(currentPath, file.name);
+ const ext = path.extname(file.name).toLowerCase();
+ const previewable = supportedPreviewExts.includes(ext);
+ const images = previewImages;
return (
- {imageExts.includes(ext) ? (
- onPreviewImage(file.name, images)}
- onAddPreview={addPreviewImage}
- />
- ) : (
-
- file.isDirectory
- ? onDirectoryClick(file.name)
- : previewable
- ? onPreview(filePath)
- : onEdit(filePath)
+ {imageExts.includes(ext)
+ ? (
+ onPreviewImage(file.name, images)}
+ onAddPreview={addPreviewImage}
+ />
+ )
+ : (
+
+ file.isDirectory
+ ? onDirectoryClick(file.name)
+ : previewable
+ ? onPreview(filePath)
+ : onEdit(filePath)}
+ className='text-left justify-start'
+ startContent={
+
}
- className="text-left justify-start"
- startContent={
-
- }
- >
- {file.name}
-
- )}
+ >
+ {file.name}
+
+ )}
{file.isDirectory ? '目录' : '文件'}
@@ -193,43 +194,43 @@ export default function FileTable({
{new Date(file.mtime).toLocaleString()}
-
+
onRenameRequest(file.name)}
>
onMoveRequest(file.name)}
>
onCopyPath(file.name)}
>
onDownload(filePath)}
>
onDelete(filePath)}
>
@@ -237,10 +238,10 @@ export default function FileTable({
- )
+ );
})}
>
- )
+ );
}
diff --git a/napcat.webui/src/components/file_manage/image_name_button.tsx b/napcat.webui/src/components/file_manage/image_name_button.tsx
index c1332f41..fc7da0a1 100644
--- a/napcat.webui/src/components/file_manage/image_name_button.tsx
+++ b/napcat.webui/src/components/file_manage/image_name_button.tsx
@@ -1,20 +1,20 @@
-import { Button } from '@heroui/button'
-import { Image } from '@heroui/image'
-import { Spinner } from '@heroui/spinner'
-import { useRequest } from 'ahooks'
-import path from 'path-browserify'
-import { useEffect } from 'react'
+import { Button } from '@heroui/button';
+import { Image } from '@heroui/image';
+import { Spinner } from '@heroui/spinner';
+import { useRequest } from 'ahooks';
+import path from 'path-browserify';
+import { useEffect } from 'react';
-import FileManager from '@/controllers/file_manager'
+import FileManager from '@/controllers/file_manager';
-import FileIcon from '../file_icon'
+import FileIcon from '../file_icon';
export interface PreviewImage {
key: string
src: string
alt: string
}
-export const imageExts = ['.png', '.jpg', '.jpeg', '.gif', '.bmp']
+export const imageExts = ['.png', '.jpg', '.jpeg', '.gif', '.bmp'];
export interface ImageNameButtonProps {
name: string
@@ -23,11 +23,11 @@ export interface ImageNameButtonProps {
onAddPreview: (image: PreviewImage) => void
}
-export default function ImageNameButton({
+export default function ImageNameButton ({
name,
filePath,
onPreview,
- onAddPreview
+ onAddPreview,
}: ImageNameButtonProps) {
const { data, loading, error, run } = useRequest(
async () => FileManager.downloadToURL(filePath),
@@ -35,54 +35,58 @@ export default function ImageNameButton({
refreshDeps: [filePath],
manual: true,
refreshDepsAction: () => {
- const ext = path.extname(filePath).toLowerCase()
+ const ext = path.extname(filePath).toLowerCase();
if (!filePath || !imageExts.includes(ext)) {
- return
+ return;
}
- run()
- }
+ run();
+ },
}
- )
+ );
useEffect(() => {
if (data) {
onAddPreview({
key: name,
src: data,
- alt: name
- })
+ alt: name,
+ });
}
- }, [data, name, onAddPreview])
+ }, [data, name, onAddPreview]);
useEffect(() => {
if (filePath) {
- run()
+ run();
}
- }, [])
+ }, []);
return (
- ) : loading || !data ? (
-
- ) : (
-
- )
+ error
+ ? (
+
+ )
+ : loading || !data
+ ? (
+
+ )
+ : (
+
+ )
}
>
{name}
- )
+ );
}
diff --git a/napcat.webui/src/components/file_manage/move_modal.tsx b/napcat.webui/src/components/file_manage/move_modal.tsx
index ab7a631a..1a424c66 100644
--- a/napcat.webui/src/components/file_manage/move_modal.tsx
+++ b/napcat.webui/src/components/file_manage/move_modal.tsx
@@ -1,18 +1,18 @@
-import { Button } from '@heroui/button'
+import { Button } from '@heroui/button';
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
- ModalHeader
-} from '@heroui/modal'
-import { Spinner } from '@heroui/spinner'
-import clsx from 'clsx'
-import path from 'path-browserify'
-import { useState } from 'react'
-import { IoAdd, IoRemove } from 'react-icons/io5'
+ ModalHeader,
+} from '@heroui/modal';
+import { Spinner } from '@heroui/spinner';
+import clsx from 'clsx';
+import path from 'path-browserify';
+import { useState } from 'react';
+import { IoAdd, IoRemove } from 'react-icons/io5';
-import FileManager from '@/controllers/file_manager'
+import FileManager from '@/controllers/file_manager';
interface MoveModalProps {
isOpen: boolean
@@ -25,68 +25,68 @@ interface MoveModalProps {
// 将 DirectoryTree 改为递归组件
// 新增 selectedPath 属性,用于标识当前选中的目录
-function DirectoryTree({
+function DirectoryTree ({
basePath,
onSelect,
- selectedPath
+ selectedPath,
}: {
basePath: string
onSelect: (dir: string) => void
selectedPath?: string
}) {
- const [dirs, setDirs] = useState([])
- const [expanded, setExpanded] = useState(false)
+ const [dirs, setDirs] = useState([]);
+ const [expanded, setExpanded] = useState(false);
// 新增loading状态
- const [loading, setLoading] = useState(false)
+ const [loading, setLoading] = useState(false);
const fetchDirectories = async () => {
try {
// 直接使用 basePath 调用接口,移除 process.platform 判断
- const list = await FileManager.listDirectories(basePath)
- setDirs(list.map((item) => item.name))
+ const list = await FileManager.listDirectories(basePath);
+ setDirs(list.map((item) => item.name));
} catch (error) {
// ...error handling...
}
- }
+ };
const handleToggle = async () => {
if (!expanded) {
- setExpanded(true)
- setLoading(true)
- await fetchDirectories()
- setLoading(false)
+ setExpanded(true);
+ setLoading(true);
+ await fetchDirectories();
+ setLoading(false);
} else {
- setExpanded(false)
+ setExpanded(false);
}
- }
+ };
const handleClick = () => {
- onSelect(basePath)
- handleToggle()
- }
+ onSelect(basePath);
+ handleToggle();
+ };
// 计算显示的名称
const getDisplayName = () => {
- if (basePath === '/') return '/'
- if (/^[A-Z]:$/i.test(basePath)) return basePath
- return path.basename(basePath)
- }
+ if (basePath === '/') return '/';
+ if (/^[A-Z]:$/i.test(basePath)) return basePath;
+ return path.basename(basePath);
+ };
// 更新 Button 的 variant 逻辑
- const isSeleted = selectedPath === basePath
+ const isSeleted = selectedPath === basePath;
const variant = isSeleted
? 'solid'
: selectedPath && path.dirname(selectedPath) === basePath
? 'flat'
- : 'light'
+ : 'light';
return (
-
+
{expanded && (
- {loading ? (
-
-
-
- ) : (
- dirs.map((dirName) => {
- const childPath =
+ {loading
+ ? (
+
+
+
+ )
+ : (
+ dirs.map((dirName) => {
+ const childPath =
basePath === '/' && /^[A-Z]:$/i.test(dirName)
? dirName
- : path.join(basePath, dirName)
- return (
-
- )
- })
- )}
+ : path.join(basePath, dirName);
+ return (
+
+ );
+ })
+ )}
)}
- )
+ );
}
-export default function MoveModal({
+export default function MoveModal ({
isOpen,
moveTargetPath,
selectionInfo,
onClose,
onMove,
- onSelect
+ onSelect,
}: MoveModalProps) {
return (
选择目标目录
-
+
-
+
当前选择:{moveTargetPath || '未选择'}
-
移动项:{selectionInfo}
+
移动项:{selectionInfo}
-
+
取消
-
+
确定
- )
+ );
}
diff --git a/napcat.webui/src/components/file_manage/rename_modal.tsx b/napcat.webui/src/components/file_manage/rename_modal.tsx
index 0ddf1dde..5d74aabc 100644
--- a/napcat.webui/src/components/file_manage/rename_modal.tsx
+++ b/napcat.webui/src/components/file_manage/rename_modal.tsx
@@ -1,12 +1,12 @@
-import { Button } from '@heroui/button'
-import { Input } from '@heroui/input'
+import { Button } from '@heroui/button';
+import { Input } from '@heroui/input';
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
- ModalHeader
-} from '@heroui/modal'
+ ModalHeader,
+} from '@heroui/modal';
interface RenameModalProps {
isOpen: boolean
@@ -16,29 +16,29 @@ interface RenameModalProps {
onRename: () => void
}
-export default function RenameModal({
+export default function RenameModal ({
isOpen,
newFileName,
onNameChange,
onClose,
- onRename
+ onRename,
}: RenameModalProps) {
return (
重命名
-
+
-
+
取消
-
+
确定
- )
+ );
}
diff --git a/napcat.webui/src/components/github_info/icon_wrapper.tsx b/napcat.webui/src/components/github_info/icon_wrapper.tsx
index 2b5652bc..4ed35df9 100644
--- a/napcat.webui/src/components/github_info/icon_wrapper.tsx
+++ b/napcat.webui/src/components/github_info/icon_wrapper.tsx
@@ -1,4 +1,4 @@
-import clsx from 'clsx'
+import clsx from 'clsx';
export interface IconWrapperProps {
children?: React.ReactNode
@@ -14,6 +14,6 @@ const IconWrapper = ({ children, className }: IconWrapperProps) => (
>
{children}
-)
+);
-export default IconWrapper
+export default IconWrapper;
diff --git a/napcat.webui/src/components/github_info/item_counter.tsx b/napcat.webui/src/components/github_info/item_counter.tsx
index bde66e44..33b9676f 100644
--- a/napcat.webui/src/components/github_info/item_counter.tsx
+++ b/napcat.webui/src/components/github_info/item_counter.tsx
@@ -1,10 +1,10 @@
-import { ChevronRightIcon } from '../icons'
+import { ChevronRightIcon } from '../icons';
const ItemCounter = ({ number }: { number: number }) => (
-
-
{number}
-
+
+ {number}
+
-)
+);
-export default ItemCounter
+export default ItemCounter;
diff --git a/napcat.webui/src/components/github_info/release.tsx b/napcat.webui/src/components/github_info/release.tsx
index 5c1a41a5..4c63a255 100644
--- a/napcat.webui/src/components/github_info/release.tsx
+++ b/napcat.webui/src/components/github_info/release.tsx
@@ -1,40 +1,40 @@
-import { useEffect, useState } from 'react'
+import { useEffect, useState } from 'react';
-import { getReleaseTime } from '@/utils/time'
+import { getReleaseTime } from '@/utils/time';
-import type { GithubRelease as GithubReleaseType } from '@/types/github'
+import type { GithubRelease as GithubReleaseType } from '@/types/github';
export interface GithubReleaseProps {
releaseData: GithubReleaseType
}
const GithubRelease: React.FC
= (props) => {
- const { releaseData } = props
- const [releaseTime, setReleaseTime] = useState(null)
+ const { releaseData } = props;
+ const [releaseTime, setReleaseTime] = useState(null);
useEffect(() => {
if (releaseData) {
const timer = setInterval(() => {
- const time = getReleaseTime(releaseData.published_at)
+ const time = getReleaseTime(releaseData.published_at);
- setReleaseTime(time)
- }, 1000)
+ setReleaseTime(time);
+ }, 1000);
- return () => clearInterval(timer)
+ return () => clearInterval(timer);
}
- }, [releaseData])
+ }, [releaseData]);
return (
-
+
Releases
-
-
{releaseData.name}
-
-
{releaseTime}
-
Latest
+
+
{releaseData.name}
+
+ {releaseTime}
+ Latest
- )
-}
+ );
+};
-export default GithubRelease
+export default GithubRelease;
diff --git a/napcat.webui/src/components/hitokoto.tsx b/napcat.webui/src/components/hitokoto.tsx
index e31c77d7..ef7f0b4f 100644
--- a/napcat.webui/src/components/hitokoto.tsx
+++ b/napcat.webui/src/components/hitokoto.tsx
@@ -1,76 +1,78 @@
-import { Button } from '@heroui/button'
-import { Tooltip } from '@heroui/tooltip'
-import { useRequest } from 'ahooks'
-import toast from 'react-hot-toast'
-import { IoCopy, IoRefresh } from 'react-icons/io5'
+import { Button } from '@heroui/button';
+import { Tooltip } from '@heroui/tooltip';
+import { useRequest } from 'ahooks';
+import toast from 'react-hot-toast';
+import { IoCopy, IoRefresh } from 'react-icons/io5';
-import { request } from '@/utils/request'
+import { request } from '@/utils/request';
-import PageLoading from './page_loading'
+import PageLoading from './page_loading';
-export default function Hitokoto() {
+export default function Hitokoto () {
const {
data: dataOri,
error,
loading,
- run
+ run,
} = useRequest(() => request.get
('https://hitokoto.152710.xyz/'), {
pollingInterval: 10000,
- throttleWait: 1000
- })
- const data = dataOri?.data
+ throttleWait: 1000,
+ });
+ const data = dataOri?.data;
const onCopy = () => {
try {
- const text = `${data?.hitokoto} —— ${data?.from} ${data?.from_who}`
- navigator.clipboard.writeText(text)
- toast.success('复制成功')
+ const text = `${data?.hitokoto} —— ${data?.from} ${data?.from_who}`;
+ navigator.clipboard.writeText(text);
+ toast.success('复制成功');
} catch (error) {
- toast.error('复制失败, 请手动复制')
+ toast.error('复制失败, 请手动复制');
}
- }
+ };
return (