Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Wznmickey/add hint button #126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
26 changes: 21 additions & 5 deletions src/pages/ProblemSetDetail/Settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { PlusOutlined } from '@ant-design/icons'
import ProCard from '@ant-design/pro-card'
import { useRequest } from 'ahooks'
import { Col, message, Row } from 'antd'
import { Button, Col, message, Row } from 'antd'
import ShadowCard from 'components/ShadowCard'
import type React from 'react'
import { useState } from 'react'
import { useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { useNavigate, useParams } from 'react-router-dom'
import type { ProTablePagination } from 'types'
import { transPagination } from 'utils'
import { DEFAULT_GUTTER } from 'utils/constants'
Expand All @@ -14,10 +16,11 @@ import AddExistProblem from './AddExistProblem'
import DraggableProblemTable from './DraggableProblemTable'

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,19 @@ const Index: React.FC = () => {
manual: true
}
)

const createNewProblem = (
<div className='mx-8 space-x-4'>
<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 +103,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