Skip to content

Commit

Permalink
Hide everything for non-admins
Browse files Browse the repository at this point in the history
  • Loading branch information
persas committed Oct 12, 2023
1 parent f7f0f97 commit 27b3bb3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions webapp/views/App/views/Home/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ const Dashboard = () => {
RecordHistory: 'Record History',
}

if (!canEditSurvey) {
return null
}

return (
<SurveyDefsLoader draft={canEditSurvey} validate={canEditSurvey}>
{showFirstTimeHelp && canEditSurvey ? (
{showFirstTimeHelp ? (
<Helper firstTimeHelp={showFirstTimeHelp} />
) : (
<div className="home-dashboard">
Expand All @@ -51,12 +55,12 @@ const Dashboard = () => {
{!isSurveyInfoEmpty && !Survey.isTemplate(surveyInfo) && <RecordsSummary />}
{activeTab === 'Dashboard' && !isSurveyInfoEmpty && (
<div style={{ display: 'flex', justifyContent: 'space-between', gap: '3em', width: '90%' }}>
{canEditSurvey && <StorageSummary />}
{canEditSurvey && <RecordsByUser />}
{canEditSurvey && hasSamplingPointData && <SamplingDataChart surveyInfo={surveyInfo} />}
<StorageSummary />
<RecordsByUser />
{hasSamplingPointData && <SamplingDataChart surveyInfo={surveyInfo} />}
</div>
)}
{activeTab === 'Dashboard' && canEditSurvey && !isSurveyInfoEmpty && <DailyRecordsByUser />}
{activeTab === 'Dashboard' && !isSurveyInfoEmpty && <DailyRecordsByUser />}
{activeTab === 'Record History' && !isSurveyInfoEmpty && <StorageSummary />}
</RecordsSummaryContext.Provider>
</div>
Expand Down

0 comments on commit 27b3bb3

Please sign in to comment.