Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Jan 15, 2021
2 parents 9b2d28e + b2e8757 commit 957878d
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/common-ui/lib/intl/common-ui-en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const COMMON_UI_MESSAGES_ENGLISH = {
deleteButtonText: "Delete",
editableTable: "Editable Table",
editButtonText: "Edit",
errorPageTitle: "Error",
existing: "Existing",
field_author: "Author",
field_changedProperties: "Changed Properties",
Expand Down Expand Up @@ -56,6 +57,7 @@ export const COMMON_UI_MESSAGES_ENGLISH = {
select: "Select",
selected: "selected",
showChanges: "Show Changes",
somethingWentWrong: "Something went wrong",
submitBtnText: "Save",
tableTotalCount: "Total matched records: {totalCount}",
uiAppVersion: "UI Application Version: {version}",
Expand Down
1 change: 1 addition & 0 deletions packages/common-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react": "^16.13.1",
"react-datepicker": "^3.0.0",
"react-dom": "^16.13.1",
"react-error-boundary": "^3.1.0",
"react-hooks-async": "^3.10.1",
"react-intl": "^5.0.2",
"react-modal": "^3.11.2",
Expand Down
33 changes: 33 additions & 0 deletions packages/dina-ui/components/error/ErrorBoundaryPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ErrorBoundary, FallbackProps } from "react-error-boundary";
import { PropsWithChildren } from "react";
import { Head, Nav } from "..";
import { useDinaIntl } from "../../intl/dina-ui-intl";
import { CommonMessage } from "common-ui/lib/intl/common-ui-intl";
import { Footer } from "../button-bar/nav/nav";

/** Catches errors in render methods and displays a fallback error message. */
export function ErrorBoundaryPage({ children }: PropsWithChildren<{}>) {
return (
<ErrorBoundary FallbackComponent={ErrorFallback}>{children}</ErrorBoundary>
);
}

function ErrorFallback({ error }: FallbackProps) {
const { formatMessage } = useDinaIntl();

return (
<div>
<Head title={formatMessage("errorPageTitle")} />
<Nav />
<main className="container-fluid">
<div className="alert alert-danger" role="alert">
<p>
<CommonMessage id="somethingWentWrong" />:
</p>
<pre>{error.message}</pre>
</div>
</main>
<Footer />
</div>
);
}
1 change: 1 addition & 0 deletions packages/dina-ui/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./add-person/PersonForm";
export * from "./error/ErrorBoundaryPage";
export * from "./head";
export * from "./button-bar/nav/nav";
2 changes: 1 addition & 1 deletion packages/dina-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dina-ui",
"version": "0.18.0",
"version": "0.18.1",
"scripts": {
"build": "run-s next:build next:export",
"dev": "next",
Expand Down
9 changes: 6 additions & 3 deletions packages/dina-ui/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "react-datepicker/dist/react-datepicker.css";
import "react-dropzone-uploader/dist/styles.css";
import "react-table/react-table.css";
import "react-tabs/style/react-tabs.css";
import { ErrorBoundaryPage } from "../components";
import "../components/button-bar/nav/app-top.css";
import "../components/button-bar/nav/nav.css";
import "../components/button-bar/nav/wet-beow-bootstrap-4.css";
Expand Down Expand Up @@ -53,9 +54,11 @@ export default class DinaUiApp extends App {
<AuthenticatedApiClientProvider apiContext={this.contextValue}>
<FileUploadProviderImpl>
<DinaIntlProvider>
<ModalProvider appElement={appElement}>
<Component {...pageProps} />
</ModalProvider>
<ErrorBoundaryPage>
<ModalProvider appElement={appElement}>
<Component {...pageProps} />
</ModalProvider>
</ErrorBoundaryPage>
</DinaIntlProvider>
</FileUploadProviderImpl>
</AuthenticatedApiClientProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ function SingleMetadataForm({ router, metadata }: SingleMetadataFormProps) {
className="col-md-3 col-sm-4"
name="acDigitizationDate"
disabled={true}
showTime={true}
/>
</div>
<div className="row">
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.10.1", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2":
"@babel/runtime@^7.10.1", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==
Expand Down Expand Up @@ -8294,6 +8294,13 @@ react-dropzone-uploader@^2.11.0:
dependencies:
"@babel/runtime" "^7.1.2"

react-error-boundary@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/react-error-boundary/-/react-error-boundary-3.1.0.tgz#9487443df2f9ba1db90d8ab52351814907ea4af3"
integrity sha512-lmPrdi5SLRJR+AeJkqdkGlW/CRkAUvZnETahK58J4xb5wpbfDngasEGu+w0T1iXEhVrYBJZeW+c4V1hILCnMWQ==
dependencies:
"@babel/runtime" "^7.12.5"

react-fast-compare@^2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9"
Expand Down

0 comments on commit 957878d

Please sign in to comment.