-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed disabling
the requests, improved notification links
#8197
base: develop
Are you sure you want to change the base?
Changes from all commits
f762f42
8fc2f3c
9a054c1
44f085e
ea5f502
87c7368
4f250d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
### Fixed | ||
|
||
- Request card was not disabed properly after downloading | ||
(<https://github.com/cvat-ai/cvat/pull/8197>) | ||
|
||
### Changed | ||
- Following the link in notification no longer reloads the page | ||
(<https://github.com/cvat-ai/cvat/pull/8197>) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Button from 'antd/lib/button'; | ||
import React from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
|
||
export type UseHistoryType = RouteComponentProps['history']; | ||
|
||
const RouterLinkHOC = (history?: UseHistoryType) => ( | ||
function (props: { children: React.ReactNode, href?: string }): JSX.Element { | ||
const { href, children } = props; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that would be better. But we cant use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, I see |
||
|
||
if (href?.match(/^\//) && history) { | ||
return ( | ||
<Button | ||
type='link' | ||
className='cvat-notification-link' | ||
onClick={() => { | ||
history.push(href); | ||
}} | ||
> | ||
{children} | ||
</Button> | ||
); | ||
} | ||
|
||
return (<a href={href}>{children}</a>); | ||
}); | ||
|
||
export default function CVATMarkdown(props: { history?: UseHistoryType, children: string }): JSX.Element { | ||
const { children, history } = props; | ||
|
||
return ( | ||
<ReactMarkdown | ||
components={{ | ||
a: RouterLinkHOC(history), | ||
}} | ||
> | ||
{children} | ||
</ReactMarkdown> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License header?