diff --git a/src/pages/index.tsx b/src/pages/index.tsx index e4422ade..9de0c873 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -5,7 +5,7 @@ import { AppMode } from 'config'; import { Route, Switch } from 'react-router-dom'; import { observer } from 'mobx-react-lite'; import WorkspaceMission from 'people/widgetViews/WorkspaceMission'; -import WorkspaceFeature from 'people/widgetViews/WorkspaceFeature'; +import BriefFeatureComponent from '../people/widgetViews/BriefFeature.tsx'; import PeopleHeader from '../people/main/Header'; import TokenRefresh from '../people/utils/TokenRefresh'; import BotsBody from './bots/Body'; @@ -49,12 +49,12 @@ const modeDispatchPages: Record React.ReactElement> = { - - - + + + diff --git a/src/pages/tickets/style.ts b/src/pages/tickets/style.ts index 4ad6dda2..15fa93a9 100644 --- a/src/pages/tickets/style.ts +++ b/src/pages/tickets/style.ts @@ -19,6 +19,185 @@ export const WorkspaceBody = styled.div` overflow-x: hidden; `; +export const FeatureBody = styled.div` + display: flex; + flex-direction: column; + background: var(--Search-bar-background, #f2f3f5); + height: 100vh; + overflow-y: auto; + overflow-x: hidden; +`; + +export const Header = styled.div` + height: 130px; + width: 65%; + display: flex; + align-items: center; + justify-content: space-between; + background: #fff; +`; + +export const Leftheader = styled.div` + display: flex; + gap: 20px; + align-items: center; + justify-content: center; +`; + +export const HeaderWrap = styled.div` + display: flex; + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background: #fff; +`; + +export const DataWrap = styled.div` + padding: 40px 50px; + display: flex; + width: 50%; + margin: 0 auto; + display: flex; + flex-direction: column; + align-items: left; + justify-content: center; + + @media only screen and (max-width: 900px) { + width: 90%; + padding: 30px 40px; + } + + @media only screen and (max-width: 500px) { + width: 90%; + padding: 20px 10px; + } +`; + +export const FieldWrap = styled.div` + margin-bottom: 30px; +`; + +export const Label = styled.h5` + font-size: 1.12rem; + font-weight: bolder; +`; + +export const Data = styled.div` + border: 1px solid #ccc; + min-height: 50px; + border-radius: 5px; + padding: 20px 30px; + position: relative; + display: flex; + flex-direction: column; + white-space: pre-wrap; + + .MaterialIcon { + font-style: normal; + font-weight: 900; + font-size: 1.4rem; + color: #000000; + } +`; + +export const OptionsWrap = styled.div` + position: absolute; + right: 6px; + top: 4px; + cursor: pointer; + display: flex; + flex-direction: column; + align-items: center; + + button { + border: 0.5px solid #000000; + font-size: 0.8rem; + font-weight: 700; + border-radius: 5px; + padding: 2px 10px; + } +`; + +export const TextArea = styled.textarea` + padding: 0.5rem 1rem; + border-radius: 0.375rem; + border: 2px solid #dde1e5; + outline: none; + caret-color: #618aff; + color: #3c3f41; + font-family: 'Barlow'; + font-size: 1rem; + font-style: normal; + font-weight: 500; + line-height: 20px; + width: 100%; + resize: none; + min-height: 5.9375rem; + + ::placeholder { + color: #b0b7bc; + font-family: 'Barlow'; + font-size: 13px; + font-style: normal; + font-weight: 400; + line-height: 20px; + } + :focus { + border: 2px solid #82b4ff; + } +`; + +export const ButtonWrap = styled.div` + margin-left: auto; + margin-top: 10px; + display: flex; + gap: 15px; +`; + +interface ButtonProps { + color?: string; +} +export const ActionButton = styled.button` + padding: 5px 20px; + border-radius: 5px; + background: ${(p: any) => { + if (p.color === 'primary') { + return 'rgb(97, 138, 255)'; + } + }}; + color: ${(p: any) => { + if (p.color === 'primary') { + return '#FFF'; + } + }}; + border: ${(p: any) => { + if (p.color === 'primary') { + return '1px solid rgb(97, 138, 255)'; + } else { + return '1px solid #636363'; + } + }}; +`; + +export const FeatureLabel = styled.p` + color: var(--Text-2, #3c3f41); + font-family: Barlow; + font-size: 28px; + font-style: normal; + font-weight: 700; + margin: 2px; + display: flex; + align-items: center; +`; + +export const FeatureName = styled.div` + display: flex; + flex-direction: column; + justify-content: center; +`; + export const Backdrop = styled.div` position: fixed; z-index: 1; diff --git a/src/pages/tickets/workspace/workspaceHeader/WorkspaceHeaderStyles.tsx b/src/pages/tickets/workspace/workspaceHeader/WorkspaceHeaderStyles.tsx index bab407f0..ca28d2bd 100644 --- a/src/pages/tickets/workspace/workspaceHeader/WorkspaceHeaderStyles.tsx +++ b/src/pages/tickets/workspace/workspaceHeader/WorkspaceHeaderStyles.tsx @@ -5,15 +5,6 @@ interface styledProps { color?: any; } -export const Header = styled.div` - height: 130px; - width: 65%; - display: flex; - align-items: center; - justify-content: space-between; - background: #fff; -`; - export const UrlButtonContainer = styled.div` width: 180px; display: flex; @@ -133,12 +124,6 @@ export const FilterLabel = styled.label` line-height: 17px; letter-spacing: 0.15px; `; -export const Leftheader = styled.div` - display: flex; - gap: 20px; - align-items: center; - justify-content: center; -`; export const CompanyNameAndLink = styled.div` display: flex; flex-direction: column; diff --git a/src/pages/tickets/workspace/workspaceHeader/index.tsx b/src/pages/tickets/workspace/workspaceHeader/index.tsx index fb0f46f5..e7c83e35 100644 --- a/src/pages/tickets/workspace/workspaceHeader/index.tsx +++ b/src/pages/tickets/workspace/workspaceHeader/index.tsx @@ -8,6 +8,7 @@ import { WorkspaceBountyHeaderProps } from '../../../../people/interfaces.ts'; import { SearchBar } from '../../../../components/common/index.tsx'; import { useStores } from '../../../../store/index.tsx'; import { userCanManageBounty, filterCount } from '../../../../helpers/index.ts'; +import { Leftheader, Header } from '../../style.ts'; import addBounty from './Icons/addBounty.svg'; import file from './Icons/file.svg'; import githubIcon from './Icons/githubIcon.svg'; @@ -25,11 +26,9 @@ import { FillContainer, Filters, FiltersRight, - Header, ImageContainer, Img, InternalContainer, - Leftheader, NewStatusContainer, NumberOfBounties, PrimaryText, diff --git a/src/people/widgetViews/BriefFeature.tsx b/src/people/widgetViews/BriefFeature.tsx new file mode 100644 index 00000000..c1ce7e23 --- /dev/null +++ b/src/people/widgetViews/BriefFeature.tsx @@ -0,0 +1,164 @@ +import { EuiGlobalToastList, EuiLoadingSpinner } from '@elastic/eui'; +import { + Body, + FeatureBody, + FeatureLabel, + FeatureName, + Leftheader, + Header, + HeaderWrap, + DataWrap, + FieldWrap, + Label, + Data, + OptionsWrap, + TextArea, + ButtonWrap, + ActionButton +} from 'pages/tickets/style'; +import React, { useCallback, useEffect, useState } from 'react'; +import { useParams } from 'react-router-dom'; +import { useStores } from 'store'; +import { Feature } from 'store/main'; +import MaterialIcon from '@material/react-material-icon'; + +const BriefFeatureComponent = () => { + const { main, ui } = useStores(); + const { uuid } = useParams<{ uuid: string }>(); + const [featureData, setFeatureData] = useState(); + const [loading, setLoading] = useState(true); + const [displayBrief, setDidplayBrief] = useState(false); + const [editBrief, setEditBrief] = useState(false); + const [brief, setBrief] = useState(featureData?.brief); + + const getFeatureData = useCallback(async () => { + if (!uuid) return; + console.log('uuid: ', uuid); + const featureData = await main.getUserFeatureByUuid(uuid); + if (!featureData) return; + setFeatureData(featureData); + + setLoading(false); + }, [uuid, main]); + + useEffect(() => { + getFeatureData(); + }, [getFeatureData]); + + const toastsEl = ( + ui.setToasts([])} + toastLifeTimeMs={3000} + /> + ); + + if (loading) { + return ( + + + + ); + } + + const editBriefActions = () => { + setEditBrief(!editBrief); + setDidplayBrief(false); + }; + + const briefChange = (e: React.ChangeEvent) => { + const newValue = e.target.value; + if (newValue.length) { + setBrief(newValue); + } + }; + + const submitBrief = async () => { + const body = { + brief: brief ?? '', + uuid: featureData?.uuid ?? '', + workspace_uuid: featureData?.workspace_uuid ?? '' + }; + await main.addOrUpdateFeature(body); + await getFeatureData(); + setEditBrief(false); + }; + + return ( + !loading && ( + + +
+ + + {featureData?.name} + + +
+
+ + + + + + setDidplayBrief(!displayBrief)} + data-testid="brief-option-btn" + /> + + + {!editBrief && ( +
') + : 'No brief yet' + }} + /> + )} + + {editBrief && ( + <> +