import {
BarChartOutlined,
EditOutlined,
PlusOutlined,
} from '@ant-design/icons';
import { Button, Form, Input, Modal, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import React, { useMemo, useState } from 'react';
import {
addWorkspaceWebsite,
refreshWorkspaceWebsites,
useWorspaceWebsites,
WebsiteInfo,
} from '../api/model/website';
import { Loading } from '../components/Loading';
import { NoWorkspaceTip } from '../components/NoWorkspaceTip';
import { useRequest } from '../hooks/useRequest';
import { useUserStore } from '../store/user';
export const Website: React.FC = React.memo(() => {
const [isModalOpen, setIsModalOpen] = useState(false);
const currentWorkspace = useUserStore(
(state) => state.info?.currentWorkspace
);
const [form] = Form.useForm();
const [{ loading }, handleAddWebsite] = useRequest(async () => {
await form.validateFields();
const values = form.getFieldsValue();
await addWorkspaceWebsite(currentWorkspace!.id, values.name, values.domain);
refreshWorkspaceWebsites(currentWorkspace!.id);
setIsModalOpen(false);
form.resetFields();
});
if (!currentWorkspace) {
return