diff --git a/src/components/common/TicketEditor/TicketEditor.tsx b/src/components/common/TicketEditor/TicketEditor.tsx index 40563fda..65f9bac2 100644 --- a/src/components/common/TicketEditor/TicketEditor.tsx +++ b/src/components/common/TicketEditor/TicketEditor.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/typedef */ import React, { useEffect, useMemo, useState } from 'react'; import { observer } from 'mobx-react-lite'; import { useStores } from 'store'; @@ -9,6 +10,7 @@ import { EuiIcon, EuiBadge } from '@elastic/eui'; +import { renderMarkdown } from 'people/utils/RenderMarkdown.tsx'; import { phaseTicketStore } from '../../../store/phase'; import { ActionButton, @@ -18,7 +20,6 @@ import { import { TicketContainer, TicketHeader, - TicketTextArea, TicketInput, TicketHeaderInputWrap } from '../../../pages/tickets/style'; @@ -26,6 +27,7 @@ import { TicketStatus, Ticket, Author } from '../../../store/interface'; import { Toast } from '../../../people/widgetViews/workspace/interface'; import { uiStore } from '../../../store/ui'; import { Select, Option } from '../../../people/widgetViews/workspace/style.ts'; +import { TicketTextAreaComp } from './TicketTextArea.tsx'; interface TicketEditorProps { ticketData: Ticket; @@ -54,7 +56,9 @@ const TicketEditor = observer( const [selectedVersion, setSelectedVersion] = useState(latestTicket?.version as number); const [versionTicketData, setVersionTicketData] = useState(latestTicket as Ticket); const [isCopying, setIsCopying] = useState(false); + const [isPreview, setIsPreview] = useState(false); const { main } = useStores(); + const ui = uiStore; const groupTickets = useMemo( () => phaseTicketStore.getTicketsByGroup(ticketData.ticket_group as string), @@ -240,6 +244,9 @@ const TicketEditor = observer( } }; + const handlePreview = () => { + setIsPreview(!isPreview); + }; return ( @@ -279,15 +286,30 @@ const TicketEditor = observer( > Copy + + {isPreview ? 'Preview' : 'Edit'} + - ) => - setVersionTicketData({ ...versionTicketData, description: e.target.value }) - } - placeholder="Enter ticket details..." - /> + {!isPreview ? ( + + setVersionTicketData({ ...versionTicketData, description: value }) + } + placeholder="Enter ticket details..." + ui={ui} + /> + ) : ( +
+ {renderMarkdown(versionTicketData.description)} +
+ )} + ) => onChange(e.target.value)} + onPaste={handlePaste} + placeholder={placeholder} + /> + + ); +}; diff --git a/src/pages/tickets/workspace/WorkspaceTickets.tsx b/src/pages/tickets/workspace/WorkspaceTickets.tsx index cf41c1bf..a8b6f2be 100644 --- a/src/pages/tickets/workspace/WorkspaceTickets.tsx +++ b/src/pages/tickets/workspace/WorkspaceTickets.tsx @@ -68,7 +68,7 @@ function WorkspaceBodyComponent() { useEffect(() => { getTotalBounties(uuid, checkboxIdToSelectedMap, page); - }, [getTotalBounties]); + }, [checkboxIdToSelectedMap, getTotalBounties, page, uuid]); const onChangeStatus = (optionId: any) => { const newCheckboxIdToSelectedMap = { diff --git a/src/people/widgetViews/workspace/style.ts b/src/people/widgetViews/workspace/style.ts index 7b992e97..3636f033 100644 --- a/src/people/widgetViews/workspace/style.ts +++ b/src/people/widgetViews/workspace/style.ts @@ -1638,6 +1638,7 @@ export const Option = styled.option` export const CopyButtonGroup = styled.div` display: flex; + gap: 10px; align-items: center; justify-content: flex-end; margin-left: auto;