This commit is contained in:
bakhirev 2024-07-01 15:59:12 +03:00
parent b3d02def19
commit 53d8fb5d27
3 changed files with 68 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,32 @@
import React from 'react';
import ExternalLink from '../index';
import userSettings from 'ts/store/UserSettings';
interface IPRLinkProps {
prId?: string,
text?: string,
className?: string,
}
function PRLink({ prId, text, className }: IPRLinkProps) {
if (!prId) return null;
const prefix = userSettings?.settings?.linksPrefix?.task || '/';
return (
<ExternalLink
text={text || 'PR'}
link={`${prefix}${prId}`}
className={className}
/>
);
}
PRLink.defaultProps = {
prId: '',
text: '',
className: '',
};
export default PRLink;

View file

@ -0,0 +1,33 @@
import React from 'react';
import ExternalLink from '../index';
import userSettings from 'ts/store/UserSettings';
interface ITaskLinkProps {
task?: string,
className?: string,
}
function TaskLink({ task, className }: ITaskLinkProps) {
if (!task) return null;
const prefix = userSettings?.settings?.linksPrefix?.task || '/';
const formattedTask = task?.[0] === '#'
? task.replace('#', '')
: task;
return (
<ExternalLink
text={task}
link={`${prefix}${formattedTask}`}
className={className}
/>
);
}
TaskLink.defaultProps = {
task: '',
className: '',
};
export default TaskLink;