update
This commit is contained in:
parent
3c5e6aa41e
commit
fc37a99cf8
39
src/pages/app/edit/AIEditorLink.tsx
Normal file
39
src/pages/app/edit/AIEditorLink.tsx
Normal file
@ -0,0 +1,39 @@
|
||||
import { Tooltip } from '@mui/material';
|
||||
import { Folder } from 'lucide-react';
|
||||
import { Button } from '@mui/material';
|
||||
|
||||
import { useLayoutStore } from '@/modules/layout/store';
|
||||
import { useShallow } from 'zustand/shallow';
|
||||
import { toast } from 'react-toastify';
|
||||
type Props = {
|
||||
pathname?: string;
|
||||
};
|
||||
export const AIEditorLink = (props: Props) => {
|
||||
const layoutUser = useLayoutStore(
|
||||
useShallow((state) => ({
|
||||
user: state.me?.username || '',
|
||||
})),
|
||||
);
|
||||
return (
|
||||
<Tooltip title={'打开对应的文件夹'}>
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (!layoutUser.user) {
|
||||
toast.error('请先登录');
|
||||
}
|
||||
let folder = `${layoutUser.user}/resources/${props.pathname}`;
|
||||
if (folder.endsWith('/')) {
|
||||
folder = folder.slice(0, -1);
|
||||
}
|
||||
let baseUri = location.origin;
|
||||
if (DEV_SERVER) {
|
||||
baseUri = 'http://localhost:3005';
|
||||
}
|
||||
const openUrl = `${baseUri}/root/ai-pages/ai-editor/?folder=${folder}/`;
|
||||
window.open(openUrl, '_blank');
|
||||
}}>
|
||||
<Folder size={16} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
@ -23,6 +23,7 @@ import { TextField } from '@mui/material';
|
||||
import { pick } from 'lodash-es';
|
||||
import { useAppDeleteModalStore, AppDeleteModal } from '../modules/AppDeleteModal';
|
||||
import { toast } from 'react-toastify';
|
||||
import { AIEditorLink } from './AIEditorLink';
|
||||
|
||||
const FormModal = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -211,6 +212,7 @@ export const AppVersionList = () => {
|
||||
<LinkOutlined />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<AIEditorLink pathname={item.key + '/' + item.version} />
|
||||
<Tooltip title='文件管理'>
|
||||
<Button
|
||||
onClick={() => {
|
||||
|
@ -26,7 +26,8 @@ import { pick } from 'lodash-es';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { useLayoutStore } from '@/modules/layout/store';
|
||||
import { useAppDeleteModalStore, AppDeleteModal } from '../modules/AppDeleteModal';
|
||||
import { AppWindow, Edit, Link, RefreshCcw, Share2, Trash } from 'lucide-react';
|
||||
import { AppWindow, Edit, Folder, Link, RefreshCcw, Share2, Trash } from 'lucide-react';
|
||||
import { AIEditorLink } from './AIEditorLink';
|
||||
|
||||
const FormModal = () => {
|
||||
const defaultValues = {
|
||||
@ -433,6 +434,7 @@ export const List = () => {
|
||||
<Link size={16} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<AIEditorLink pathname={item.key} />
|
||||
<Tooltip title={'Delete'}>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user