Skip to content

Commit

Permalink
[NOREF] - Restricted edit button to users who have access (#652)
Browse files Browse the repository at this point in the history
Restricted edit button to users who have access
  • Loading branch information
patrickseguraoddball authored Jul 27, 2023
1 parent 08c9e8c commit ae4e0e0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 45 deletions.
35 changes: 1 addition & 34 deletions src/components/ShareExport/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -81,40 +81,7 @@ exports[`ShareExportModal matches the snapshot 1`] = `
</div>
<div
class="mint-no-print"
>
<div
class="display-flex flex-align-center"
>
<div
class="height-2 border-left-2px border-base-light margin-right-2 "
/>
<div>
<a
class="usa-link display-flex flex-align-center"
href="/models/f11eb129-2c80-4080-9440-439cbe1a286f/task-list"
>
<svg
class="usa-icon margin-right-1"
focusable="false"
height="1em"
role="img"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 0h24v24H0z"
fill="none"
/>
<path
d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"
/>
</svg>
Edit Model Plan
</a>
</div>
</div>
</div>
/>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/views/ModelPlan/ReadOnly/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ const ReadOnly = ({ isHelpArticle }: { isHelpArticle?: boolean }) => {
statusLabel
modifiedOrCreateLabel={!!modifiedDts}
modifiedDts={modifiedDts ?? createdDts}
hasEditAccess={hasEditAccess}
/>

{!isViewingFilteredGroup && (
Expand Down
27 changes: 16 additions & 11 deletions src/views/ModelPlan/TaskList/_components/TaskListStatus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type TaskListStatusProps = {
icon?: boolean;
modelID: string;
status: ModelStatus;
hasEditAccess?: boolean;
statusLabel?: boolean;
updateLabel?: boolean;
modifiedDts?: string;
Expand All @@ -23,6 +24,7 @@ const TaskListStatus = ({
icon,
modelID,
status,
hasEditAccess = false,
statusLabel = false,
updateLabel = false,
modifiedDts,
Expand Down Expand Up @@ -66,18 +68,21 @@ const TaskListStatus = ({
</Grid>
{readOnly && (
<div className="mint-no-print">
<div className="display-flex flex-align-center">
<div className="height-2 border-left-2px border-base-light margin-right-2 " />
<div>
<UswdsReactLink
to={`/models/${modelID}/task-list`}
className="display-flex flex-align-center"
>
<IconEdit className="margin-right-1" />
{t('edit')}
</UswdsReactLink>
{hasEditAccess && (
<div className="display-flex flex-align-center">
<div className="height-2 border-left-2px border-base-light margin-right-2 " />

<div>
<UswdsReactLink
to={`/models/${modelID}/task-list`}
className="display-flex flex-align-center"
>
<IconEdit className="margin-right-1" />
{t('edit')}
</UswdsReactLink>
</div>
</div>
</div>
)}
</div>
)}
</Grid>
Expand Down

0 comments on commit ae4e0e0

Please sign in to comment.