Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally render edit history in project view and sidemenu #1339

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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
6 changes: 4 additions & 2 deletions frontend/src/Components/Controls/ProjectControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ProjectControls = ({ projectLastUpdated, handleEdit }: props) => {
const { currentContext } = useModuleCurrentContext()
const { editMode, setEditMode } = useAppContext()
const { activeTabProject, setActiveTabProject, isRevision } = useProjectContext()
const { isSaving } = useAppContext()
const { isSaving, showEditHistory } = useAppContext()
const { isEditDisabled, getEditDisabledText } = useEditDisabled()

const [isMenuOpen, setIsMenuOpen] = useState(false)
Expand Down Expand Up @@ -150,7 +150,9 @@ const ProjectControls = ({ projectLastUpdated, handleEdit }: props) => {
onChange={(_, index) => handleTabChange(index)}
variant="scrollable"
>
{projectTabNames.map((tabName) => <Tab key={tabName} label={tabName} />)}
{projectTabNames
.filter(tabName => showEditHistory || tabName !== "Case edit history")
.map(tabName => <Tab key={tabName} label={tabName} />)}
</Tabs>

</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CenterIcon = styled.div`
`

const ProjectDetails: React.FC = () => {
const { sidebarOpen } = useAppContext()
const { sidebarOpen, showEditHistory } = useAppContext()
const { currentContext } = useModuleCurrentContext()
const { caseId } = useParams()

Expand Down Expand Up @@ -87,17 +87,19 @@ const ProjectDetails: React.FC = () => {
: <Tooltip title="Case edit history" placement="right"><Icon data={settings} /></Tooltip>}
</TimelineElement>
</Grid>
<Grid item>
<TimelineElement
variant="ghost"
className="GhostButton"
onClick={() => navigate(projectPath(currentContext?.id!), { state: { activeTabProject: 4 } })}
>
{sidebarOpen
? "Settings"
: <Tooltip title="Settings" placement="right"><Icon data={settings} /></Tooltip>}
</TimelineElement>
</Grid>
{showEditHistory && (
<Grid item>
<TimelineElement
variant="ghost"
className="GhostButton"
onClick={() => navigate(projectPath(currentContext?.id!), { state: { activeTabProject: 4 } })}
>
{sidebarOpen
? "Settings"
: <Tooltip title="Settings" placement="right"><Icon data={settings} /></Tooltip>}
</TimelineElement>
</Grid>
)}
</Timeline>
</Grid>
) : null
Expand Down