From d39019fedfdd2289b5fa927689abe7848ee03df1 Mon Sep 17 00:00:00 2001 From: Remi Blom-Ohlsen Date: Wed, 1 Nov 2023 16:45:31 +0100 Subject: [PATCH] Hand error loading page when no report existed ++ --- .../ProjectStatus/Commands/useToolbarItems.tsx | 4 ++-- .../components/ProjectStatus/Sections/Sections.tsx | 14 +++++++------- .../ProjectWebParts/src/loc/mystrings.d.ts | 1 + .../ProjectWebParts/src/loc/nb-no.js | 1 + .../components/UserMessage/UserMessage.module.scss | 5 ++--- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Commands/useToolbarItems.tsx b/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Commands/useToolbarItems.tsx index d56081cde..74e419a59 100644 --- a/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Commands/useToolbarItems.tsx +++ b/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Commands/useToolbarItems.tsx @@ -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' }) @@ -116,7 +116,7 @@ export function useToolbarItems() { }) }) ), - { report: [formatDate(state.selectedReport.created, true)] } + { report: [formatDate(state.selectedReport?.created, true)] } ), state.selectedReport && new ListMenuItem( diff --git a/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Sections/Sections.tsx b/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Sections/Sections.tsx index 2e683e93d..c3db998f5 100644 --- a/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Sections/Sections.tsx +++ b/SharePointFramework/ProjectWebParts/src/components/ProjectStatus/Sections/Sections.tsx @@ -13,15 +13,15 @@ export const Sections: FC = () => { const createContextValue = useCreateContextValue({ iconSize: 50 }) const sections = useSections() - if (!context.state.selectedReport) return - return (
- {sections.map((sec, idx) => ( - - {SectionMap[sec.type] ?? null} - - ))} + {!context.state.selectedReport + ? + : sections.map((sec, idx) => ( + + {SectionMap[sec.type] ?? null} + + ))}
) } diff --git a/SharePointFramework/ProjectWebParts/src/loc/mystrings.d.ts b/SharePointFramework/ProjectWebParts/src/loc/mystrings.d.ts index f5ada0aad..1f7744400 100644 --- a/SharePointFramework/ProjectWebParts/src/loc/mystrings.d.ts +++ b/SharePointFramework/ProjectWebParts/src/loc/mystrings.d.ts @@ -127,6 +127,7 @@ declare interface IProjectWebPartsStrings { No: string NoLocalPropertiesListWarningText: string NoPropertiesMessage: string + NoReportsFoundMessage: string NoStatusReportsMessage: string NotPublishedStatusReport: string OpportunityMatrixGroupName: string diff --git a/SharePointFramework/ProjectWebParts/src/loc/nb-no.js b/SharePointFramework/ProjectWebParts/src/loc/nb-no.js index 7caf91dc8..c58503470 100644 --- a/SharePointFramework/ProjectWebParts/src/loc/nb-no.js +++ b/SharePointFramework/ProjectWebParts/src/loc/nb-no.js @@ -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.

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', diff --git a/SharePointFramework/shared-library/src/components/UserMessage/UserMessage.module.scss b/SharePointFramework/shared-library/src/components/UserMessage/UserMessage.module.scss index 89edf382b..9f3c5a13d 100644 --- a/SharePointFramework/shared-library/src/components/UserMessage/UserMessage.module.scss +++ b/SharePointFramework/shared-library/src/components/UserMessage/UserMessage.module.scss @@ -1,11 +1,10 @@ .root { .message { - padding:15px; + padding: 15px; p { margin: 0; padding: 0; } } - -} \ No newline at end of file +}