Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/KitchenandInventory/KIHeader/KIHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
DropdownMenu,
DropdownItem,
} from 'reactstrap';
import DarkModeButton from '~/components/Header/DarkModeButton';
import DarkModeButton from '../../Header/DarkModeButton';
import { fetchTaskEditSuggestions } from '~/components/TaskEditSuggestions/thunks';
import BellNotification from '~/components/Header/BellNotification';
import { getHeaderData } from '../../../actions/authActions';
Expand Down
131 changes: 77 additions & 54 deletions src/components/Reports/PeopleTableDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@
import NewModal from '../common/NewModal';
import TableFilter from './TableFilter/TableFilter';

function TaskModalTrigger({ value, windowWidth, renderMobileFilteredTask, renderFilteredTask }) {

Check warning on line 8 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'windowWidth' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WC&open=AZ2gVq1JVVB4PQRwO4WC&pullRequest=5170

Check warning on line 8 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'renderMobileFilteredTask' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WD&open=AZ2gVq1JVVB4PQRwO4WD&pullRequest=5170

Check warning on line 8 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'value' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WB&open=AZ2gVq1JVVB4PQRwO4WB&pullRequest=5170

Check warning on line 8 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'renderFilteredTask' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WE&open=AZ2gVq1JVVB4PQRwO4WE&pullRequest=5170
return (
<>
{windowWidth <= 1020 ? renderMobileFilteredTask(value) : renderFilteredTask(value)}
</>
);
}

function TaskModalContent({ whyInfo, intentInfo, endstateInfo }) {

Check warning on line 16 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'intentInfo' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WG&open=AZ2gVq1JVVB4PQRwO4WG&pullRequest=5170

Check warning on line 16 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'whyInfo' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WF&open=AZ2gVq1JVVB4PQRwO4WF&pullRequest=5170

Check warning on line 16 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'endstateInfo' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WH&open=AZ2gVq1JVVB4PQRwO4WH&pullRequest=5170
return (
<>
<div>Why This Task is important</div>
<textarea className="rectangle" type="text" value={whyInfo} readOnly />
<div>Design Intent</div>
<textarea className="rectangle" type="text" value={intentInfo} readOnly />
<div>End State</div>
<textarea className="rectangle" type="text" value={endstateInfo} readOnly />
</>
);
}

function PeopleTableDetails(props) {
const [name, setName] = useState('');
Expand Down Expand Up @@ -165,12 +185,12 @@
</div>
<div className='task-info'>
<div className='sub-head'>Resources</div>
<div>{value.resources?.map(res =>
res.map((resource, index) => {
if (index < 2) {
<div>{value.resources?.map((res, outerIndex) =>
res.map((resource, innerIndex) => {
if (innerIndex < 2) {
return (
<img
key={`${value._id}-${resource.name}`}
key={`${outerIndex}-${innerIndex}`}
alt={resource.name}
src={resource.profilePic || '/pfp-default.png'}
className="img-circle"
Expand Down Expand Up @@ -215,12 +235,12 @@
<div>{value.priority}</div>
<div>{value.status}</div>
<div>
{value.resources?.map(res =>
res.map((resource, index) => {
if (index < 2) {
{value.resources?.map((res, outerIndex) =>
res.map((resource, innerIndex) => {
if (innerIndex < 2) {
return (
<img
key={`${value._id}-${resource.name}`}
key={`${outerIndex}-${innerIndex}`}
alt={resource.name}
src={resource.profilePic || '/pfp-default.png'}
className="img-circle"
Expand All @@ -231,10 +251,10 @@
return null;
}),
)}
{value.resources?.map((res) =>
{value.resources?.map((res, outerIndex) =>
res.length > 2 ? (
<button
key={res[0]?.name || res[0]?.id}
key={`button-${outerIndex}`}

Check warning on line 257 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use Array index in keys

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WI&open=AZ2gVq1JVVB4PQRwO4WI&pullRequest=5170
type="button"
className="name resourceMoreToggle"
onClick={() => toggleMoreResources(value._id)}
Expand All @@ -245,21 +265,19 @@
)}
<div id={value._id} className="extra">
<div className="extra1">
{value.resources?.map(res =>
{value.resources?.map((res, outerIndex) =>
// eslint-disable-next-line array-callback-return,consistent-return
res.map((resource, index) => {
if (index >= 2) {
return (
<img
key={resource.index}
alt={resource.name}
src={resource.profilePic || '/pfp-default.png'}
className="img-circle"
title={resource.name}
/>
);
}
}),
res
.filter((_, index) => index >= 2)
.map((resource, innerIndex) => (
<img
key={`${outerIndex}-${innerIndex}`}
alt={resource.name}
src={resource.profilePic || '/pfp-default.png'}
className="img-circle"
title={resource.name}
/>
)),
)}
</div>
</div>
Expand All @@ -282,7 +300,7 @@

// )

const renderModalContent = (value) => (

Check warning on line 303 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this useless assignment to variable "renderModalContent".

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WK&open=AZ2gVq1JVVB4PQRwO4WK&pullRequest=5170

Check warning on line 303 in src/components/Reports/PeopleTableDetails.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the declaration of the unused 'renderModalContent' variable.

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ2gVq1JVVB4PQRwO4WJ&open=AZ2gVq1JVVB4PQRwO4WJ&pullRequest=5170
<div>
<div>Why This Task is important</div>
<textarea className="rectangle" type="text" value={value.whyInfo} />
Expand Down Expand Up @@ -323,36 +341,41 @@
Clear Filters
</button>
</div>
{windowWidth > 1020 ? (
<>
<div className={`people-table-row reports-table-head ${darkMode ? 'bg-space-cadet' : ''}`}>
<div data-testid="task">Task</div>
<div data-testid="priority">Priority</div>
<div data-testid="status">Status</div>
<div data-testid="resources" className="people-table-center-cell">Resources</div>
<div data-testid="active" className="people-table-center-cell">Active</div>
<div data-testid="assign" className="people-table-center-cell">Assign</div>
<div data-testid="eh" className="people-table-end-cell">Estimated Hours</div>
<div data-testid="sd" className="people-table-end-cell">Start Date</div>
<div data-testid="ed" className="people-table-end-cell">End Date</div>
</div>
<div className="people-table people-table-scrollable">
{filteredTasks.map(value => (
<NewModal key={value._id} header="Task info" trigger={() => renderFilteredTask(value)} darkMode={darkMode}>
{renderModalContent(value)}
</NewModal>
))}
</div>
</>
) : (
<div className="people-table">
{filteredTasks.map(value => (
<NewModal key={value._id} header="Task info" trigger={() => renderMobileFilteredTask(value)} darkMode={darkMode}>
{renderModalContent(value)}
</NewModal>
))}
</div>
)}
<div className={`people-table-row reports-table-head ${darkMode ? 'bg-space-cadet' : ''}`}>
<div data-testid="task">Task</div>
<div data-testid="priority">Priority</div>
<div data-testid="status">Status</div>
<div data-testid="resources" className="people-table-center-cell">Resources</div>
<div data-testid="active" className="people-table-center-cell">Active</div>
<div data-testid="assign" className="people-table-center-cell">Assign</div>
<div data-testid="eh" className="people-table-end-cell">Estimated Hours</div>
<div data-testid="sd" className="people-table-end-cell">Start Date</div>
<div data-testid="ed" className="people-table-end-cell">End Date</div>
</div>
<div className="people-table">
{filteredTasks.map(value => (

// eslint-disable-next-line react/no-unstable-nested-components
<NewModal
key={value._id}
header="Task info"
trigger={
<TaskModalTrigger
value={value}
windowWidth={windowWidth}
renderMobileFilteredTask={renderMobileFilteredTask}
renderFilteredTask={renderFilteredTask}
/>
}
>
<TaskModalContent
whyInfo={value.whyInfo}
intentInfo={value.intentInfo}
endstateInfo={value.endstateInfo}
/>
</NewModal>
))}
</div>
</Container>
);
}
Expand Down
Loading