Skip to content

Commit

Permalink
fix: model theme fail
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwusanyu-c committed Apr 11, 2023
1 parent de137c9 commit 314cafc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
28 changes: 13 additions & 15 deletions packages/extension/chrome-option/components/Pr-List.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { useThrottleFn } from 'ahooks'
import { Button, Input, Modal, Space, Table, Tag, Tooltip, message } from 'antd'
import { App, Button, Input, Space, Table, Tag, Tooltip } from 'antd'
import { ExclamationCircleFilled } from '@ant-design/icons'
import { useEffect, useRef, useState } from 'react'
import { createRunList } from '@pr-checker/utils/common'
import { compareBranch, getPRDetail, rebasePr } from '@pr-checker/fetchGit'
import type React from 'react'
import type { IRepoWithPRs } from './Repo-List'
import type { ColumnsType } from 'antd/es/table'

interface PrListProps {
opType: string
repoInfo: IRepoWithPRs
Expand All @@ -28,19 +27,17 @@ interface DataType {
// TODO merge
// TODO merge all select handle

// TODO rebase all select handle

// TODO refactor
// TODO: rerender fail ?
export const PrList = (props: PrListProps) => {
const [tableData, settableData] = useState<DataType[] >([])
const tableDataCache = useRef<DataType[]>([])
const [loading, setLoading] = useState(false)
useEffect(() => {
if (props.repoInfo.pullRequests.length > 0) {
setLoading(true)
if(props.opType === 'rebase'){
if (props.opType === 'rebase')
handleTableData(props.repoInfo.pullRequests)
}
}
}, [props.repoInfo, props.opType])

Expand Down Expand Up @@ -101,8 +98,8 @@ export const PrList = (props: PrListProps) => {
{ wait: 300 },
)

const { confirm } = Modal
const [messageApi, contextHolder] = message.useMessage()
const { modal, message } = App.useApp()
const { confirm } = modal
const handleOp = async(item: DataType) => {
confirm({
title: 'Tips',
Expand All @@ -117,9 +114,11 @@ export const PrList = (props: PrListProps) => {
return new Promise((resolve) => {
const run = async() => {
if (props.opType === 'rebase') {
const res = await rebasePrList(props.token, item.repoName, [item.number])
resolve(res)
window.alert('a')
//await rebasePrList(props.token, item.repoName, [item.number])
setLoading(true)
handleTableData(props.repoInfo.pullRequests)
resolve(true)
}
}
run()
Expand All @@ -133,7 +132,7 @@ export const PrList = (props: PrListProps) => {
await Promise.all(createRunList(numberArr.length, async(i: number) => {
await rebasePr(token, repoName, numberArr[i])
}))
messageApi.open({
message.open({
type: 'success',
content: 'rebase success',
})
Expand All @@ -153,7 +152,7 @@ export const PrList = (props: PrListProps) => {

const handleOpAll = async() => {
if (selectedNumberData.length === 0) {
messageApi.open({
message.open({
type: 'warning',
content: 'Select the row you want to work on',
})
Expand All @@ -171,10 +170,10 @@ export const PrList = (props: PrListProps) => {
return new Promise((resolve) => {
const run = async() => {
if (props.opType === 'rebase') {
const res = await rebasePrList(props.token, props.repoInfo.uname, selectedNumberData)
resolve(res)
//await rebasePrList(props.token, props.repoInfo.uname, selectedNumberData)
setLoading(true)
handleTableData(props.repoInfo.pullRequests)
resolve(true)
}
}
run()
Expand Down Expand Up @@ -285,7 +284,6 @@ export const PrList = (props: PrListProps) => {
scroll={{ y: 'calc(100vh - 200px)' }}
pagination={false}
/>
{contextHolder}
</div>
)
}
10 changes: 6 additions & 4 deletions packages/extension/chrome-option/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import store from '../store'
import { OptionPage } from './view/OptionPage'
import 'antd/dist/reset.css'
import 'uno.css'

import { App } from 'antd';
ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(
<ConfigProvider
theme={{
Expand All @@ -14,8 +14,10 @@ ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(
},
}}
>
<Provider store={store}>
<OptionPage />
</Provider>
<App>
<Provider store={store}>
<OptionPage />
</Provider>
</App>
</ConfigProvider>,
)

0 comments on commit 314cafc

Please sign in to comment.