Skip to content

Commit

Permalink
disable peek overview for temporary issues until it is confirmed (#3749)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulramesha authored Feb 22, 2024
1 parent d73cd2e commit 62607ad
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/ui/src/control-link/control-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ export type TControlLink = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
onClick: () => void;
children: React.ReactNode;
target?: string;
disabled?: boolean;
};

export const ControlLink: React.FC<TControlLink> = (props) => {
const { href, onClick, children, target = "_self", ...rest } = props;
const { href, onClick, children, target = "_self", disabled = false, ...rest } = props;
const LEFT_CLICK_EVENT_CODE = 0;

const _onClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
Expand All @@ -19,6 +20,8 @@ export const ControlLink: React.FC<TControlLink> = (props) => {
}
};

if (disabled) return <>{children}</>;

return (
<a href={href} target={target} onClick={_onClick} {...rest}>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
target="_blank"
onClick={() => handleIssuePeekOverview(issue)}
className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100"
disabled={!!issue?.tempId}
>
<>
{issue?.tempId !== undefined && (
Expand Down
4 changes: 3 additions & 1 deletion web/components/issues/issue-layouts/gantt/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const IssueGanttBlock: React.FC<Props> = observer((props) => {
const handleIssuePeekOverview = () =>
workspaceSlug &&
issueDetails &&
!issueDetails.tempId &&
setPeekIssue({ workspaceSlug, projectId: issueDetails.project_id, issueId: issueDetails.id });

return (
Expand Down Expand Up @@ -89,8 +90,9 @@ export const IssueGanttSidebarBlock: React.FC<Props> = observer((props) => {
target="_blank"
onClick={handleIssuePeekOverview}
className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100"
disabled={!!issueDetails?.tempId}
>
<div className="relative flex h-full w-full cursor-pointer items-center gap-2" onClick={handleIssuePeekOverview}>
<div className="relative flex h-full w-full cursor-pointer items-center gap-2">
{stateDetails && <StateGroupIcon stateGroup={stateDetails?.group} color={stateDetails?.color} />}
<div className="flex-shrink-0 text-xs text-custom-text-300">
{projectDetails?.identifier} {issueDetails?.sequence_id}
Expand Down
1 change: 1 addition & 0 deletions web/components/issues/issue-layouts/kanban/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const KanbanIssueDetailsBlock: React.FC<IssueDetailsBlockProps> = observer((prop
target="_blank"
onClick={() => handleIssuePeekOverview(issue)}
className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100"
disabled={!!issue?.tempId}
>
<Tooltip tooltipHeading="Title" tooltipContent={issue.name}>
<span>{issue.name}</span>
Expand Down
1 change: 1 addition & 0 deletions web/components/issues/issue-layouts/list/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const IssueBlock: React.FC<IssueBlockProps> = observer((props: IssueBlock
target="_blank"
onClick={() => handleIssuePeekOverview(issue)}
className="w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100"
disabled={!!issue?.tempId}
>
<Tooltip tooltipHeading="Title" tooltipContent={issue.name}>
<span>{issue.name}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
target="_blank"
onClick={() => handleIssuePeekOverview(issueDetail)}
className="clickable w-full line-clamp-1 cursor-pointer text-sm text-custom-text-100"
disabled={!!issueDetail?.tempId}
>
<div className="w-full overflow-hidden">
<Tooltip tooltipHeading="Title" tooltipContent={issueDetail.name}>
Expand Down

0 comments on commit 62607ad

Please sign in to comment.