Skip to content

Commit

Permalink
Hand error loading page when no report existed ++
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Nov 1, 2023
1 parent fa49919 commit d39019f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function useToolbarItems() {
.setOnClick(() => {
window.open(state.selectedReport?.snapshotUrl, '_self')
}),
new ListMenuItem(state.selectedReport ? formatDate(state.selectedReport.created) : '')
new ListMenuItem(state.selectedReport ? formatDate(state.selectedReport.created) : strings.NoReportsFoundMessage)
.setIcon('History')
.setWidth('fit-content')
.setStyle({ minWidth: '145px' })
Expand All @@ -116,7 +116,7 @@ export function useToolbarItems() {
})
})
),
{ report: [formatDate(state.selectedReport.created, true)] }
{ report: [formatDate(state.selectedReport?.created, true)] }
),
state.selectedReport &&
new ListMenuItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export const Sections: FC = () => {
const createContextValue = useCreateContextValue({ iconSize: 50 })
const sections = useSections()

if (!context.state.selectedReport) return <UserMessage text={strings.NoStatusReportsMessage} />

return (
<div className={styles.root} id='pp-statussection'>
{sections.map((sec, idx) => (
<SectionContext.Provider key={idx} value={createContextValue(sec)}>
{SectionMap[sec.type] ?? null}
</SectionContext.Provider>
))}
{!context.state.selectedReport
? <UserMessage text={strings.NoStatusReportsMessage} />
: sections.map((sec, idx) => (
<SectionContext.Provider key={idx} value={createContextValue(sec)}>
{SectionMap[sec.type] ?? null}
</SectionContext.Provider>
))}
</div>
)
}
1 change: 1 addition & 0 deletions SharePointFramework/ProjectWebParts/src/loc/mystrings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ declare interface IProjectWebPartsStrings {
No: string
NoLocalPropertiesListWarningText: string
NoPropertiesMessage: string
NoReportsFoundMessage: string
NoStatusReportsMessage: string
NotPublishedStatusReport: string
OpportunityMatrixGroupName: string
Expand Down
1 change: 1 addition & 0 deletions SharePointFramework/ProjectWebParts/src/loc/nb-no.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ define([], function () {
No: 'Nei',
NoLocalPropertiesListWarningText: 'Du må synkronisere prosjektegenskapene før du kan konfigurere felter/kolonner som skal vises for eksterne brukere/gjester.<br /><br />Dette gjøres ved å klikke på knappen \'Synkroniser prosjektegenskaper\'.',
NoPropertiesMessage: 'Finner ingen informasjon om prosjektet.',
NoReportsFoundMessage: 'Ingen rapporter funnet',
NoStatusReportsMessage: 'Det er ennå ikke rapportert status for prosjektet. Hvis du er eier av området, kan du rapportere status ved å klikke på _Ny statusrapport_ i menyen over.',
NotPublishedStatusReport: 'Ikke publisert',
OpportunityMatrixGroupName: 'Mulighetsmatrise',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.root {
.message {
padding:15px;
padding: 15px;

p {
margin: 0;
padding: 0;
}
}

}
}

0 comments on commit d39019f

Please sign in to comment.