Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions src/pages/ProblemSetDetail/Settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import ProCard from '@ant-design/pro-card'
import { useRequest } from 'ahooks'
import { Col, message, Row } from 'antd'
import { Col, message, Row, Button } from 'antd'
import ShadowCard from 'components/ShadowCard'
import type React from 'react'
import { useState } from 'react'
import { useParams } from 'react-router-dom'
import { useNavigate, useParams } from 'react-router-dom'
import type { ProTablePagination } from 'types'
import { transPagination } from 'utils'
import { DEFAULT_GUTTER } from 'utils/constants'
import { NoDomainUrlError, NoProblemIdError } from 'utils/exception'
import Horse from 'utils/service'
import AddExistProblem from './AddExistProblem'
import DraggableProblemTable from './DraggableProblemTable'
import { PlusOutlined } from '@ant-design/icons'
import { useTranslation } from 'react-i18next'

const Index: React.FC = () => {
const { t } = useTranslation()
const [tab, setTab] = useState('tab1')
const { domainUrl, problemSetId } =
useParams<{ domainUrl: string; problemSetId: string }>()

const navigate = useNavigate()
if (!domainUrl) {
throw new NoDomainUrlError()
}
Expand Down Expand Up @@ -61,7 +64,23 @@ const Index: React.FC = () => {
manual: true
}
)

const styleMarginRight = {
marginRight: '10px'
}
const createNewProblem = (
<div style={styleMarginRight}>
{' '}
<Button
icon={<PlusOutlined />}
onClick={() => {
navigate(`/domain/${domainUrl}/create-problem`)
}}
type='primary'
>
{t('ProblemList.create')}
</Button>{' '}
</div>
)
return (
<Row gutter={DEFAULT_GUTTER}>
<Col span={24}>
Expand All @@ -88,7 +107,8 @@ const Index: React.FC = () => {
tabs={{
activeKey: tab,
onChange: setTab,
animated: { inkBar: true, tabPane: true }
animated: { inkBar: true, tabPane: true },
tabBarExtraContent: createNewProblem
}}
>
<ProCard.TabPane key='tab1' tab='Add Existed'>
Expand Down