@panneau/app 4.0.5 → 4.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/es/index.js +94 -102
  2. package/package.json +41 -41
package/es/index.js CHANGED
@@ -23,7 +23,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
23
23
  import classNames from 'classnames';
24
24
  import isString from 'lodash-es/isString';
25
25
  import queryString from 'query-string';
26
- import { FormattedMessage, defineMessages } from 'react-intl';
26
+ import { FormattedMessage } from 'react-intl';
27
27
  import { useResourceUrlGenerator, useResourceTypeName } from '@panneau/core/hooks';
28
28
  import Alert from '@panneau/element-alert';
29
29
  import Button from '@panneau/element-button';
@@ -33,7 +33,7 @@ import isArray from 'lodash-es/isArray';
33
33
  import Link from '@panneau/element-link';
34
34
  import Menu from '@panneau/element-menu';
35
35
  import Navbar from '@panneau/element-navbar';
36
- import Label from '@panneau/element-label';
36
+ import LabelComponent from '@panneau/element-label';
37
37
  import ResourceList from '@panneau/list-resource-items';
38
38
  import Loading from '@panneau/element-loading';
39
39
  import ResourceForm from '@panneau/form-resource';
@@ -299,7 +299,7 @@ function PageHeader(_ref) {
299
299
  className: "d-flex align-items-center flex-wrap",
300
300
  children: [title !== null ? /*#__PURE__*/jsx("h1", {
301
301
  className: classNames(['mb-0', 'h2']),
302
- children: /*#__PURE__*/jsx(Label, {
302
+ children: /*#__PURE__*/jsx(LabelComponent, {
303
303
  children: title
304
304
  })
305
305
  }) : null, actions !== null ? /*#__PURE__*/jsx("div", {
@@ -996,102 +996,98 @@ function LoginPage() {
996
996
  });
997
997
  }
998
998
 
999
- var messages = defineMessages({
1000
- metaTitle401: {
1001
- "id": "HOobY2",
1002
- "defaultMessage": [{
1003
- "type": 0,
1004
- "value": "Error 401"
1005
- }]
1006
- },
1007
- title401: {
1008
- "id": "6nwWPR",
1009
- "defaultMessage": [{
1010
- "type": 0,
1011
- "value": "Error 401"
1012
- }]
1013
- },
1014
- description401: {
1015
- "id": "82P2dS",
1016
- "defaultMessage": [{
1017
- "type": 0,
1018
- "value": "You are not authorized to access this page."
1019
- }]
1020
- },
1021
- metaTitle403: {
1022
- "id": "+6cCPF",
1023
- "defaultMessage": [{
1024
- "type": 0,
1025
- "value": "Error 403"
1026
- }]
1027
- },
1028
- title403: {
1029
- "id": "Pih2UO",
1030
- "defaultMessage": [{
1031
- "type": 0,
1032
- "value": "Error 403"
1033
- }]
1034
- },
1035
- description403: {
1036
- "id": "8HFiMs",
1037
- "defaultMessage": [{
1038
- "type": 0,
1039
- "value": "Access to this page is forbidden"
1040
- }]
1041
- },
1042
- metaTitle404: {
1043
- "id": "US/AMe",
1044
- "defaultMessage": [{
1045
- "type": 0,
1046
- "value": "Error 404"
1047
- }]
1048
- },
1049
- title404: {
1050
- "id": "6Ie+vL",
1051
- "defaultMessage": [{
1052
- "type": 0,
1053
- "value": "Error 404"
1054
- }]
1055
- },
1056
- description404: {
1057
- "id": "naie2b",
1058
- "defaultMessage": [{
1059
- "type": 0,
1060
- "value": "This page doesn't exist"
1061
- }]
1062
- },
1063
- metaTitle500: {
1064
- "id": "ejwBSw",
1065
- "defaultMessage": [{
1066
- "type": 0,
1067
- "value": "Error 500"
1068
- }]
1069
- },
1070
- title500: {
1071
- "id": "owrRHV",
1072
- "defaultMessage": [{
1073
- "type": 0,
1074
- "value": "Error 500"
1075
- }]
1076
- },
1077
- description500: {
1078
- "id": "yALN2p",
1079
- "defaultMessage": [{
1080
- "type": 0,
1081
- "value": "There was an error"
1082
- }]
1083
- },
1084
- gotoHome: {
1085
- "id": "hezcGl",
1086
- "defaultMessage": [{
1087
- "type": 0,
1088
- "value": "Go to home page"
1089
- }]
1090
- }
1091
- });
1092
999
  function ErrorPage(_ref) {
1093
1000
  var _ref$statusCode = _ref.statusCode,
1094
1001
  statusCode = _ref$statusCode === void 0 ? null : _ref$statusCode;
1002
+ var code = statusCode || 404;
1003
+ var title = useMemo(function () {
1004
+ switch (code) {
1005
+ case 401:
1006
+ return /*#__PURE__*/jsx(FormattedMessage, {
1007
+ id: "6nwWPR",
1008
+ defaultMessage: [{
1009
+ "type": 0,
1010
+ "value": "Error 401"
1011
+ }]
1012
+ });
1013
+ case 403:
1014
+ return /*#__PURE__*/jsx(FormattedMessage, {
1015
+ id: "Pih2UO",
1016
+ defaultMessage: [{
1017
+ "type": 0,
1018
+ "value": "Error 403"
1019
+ }]
1020
+ });
1021
+ case 404:
1022
+ return /*#__PURE__*/jsx(FormattedMessage, {
1023
+ id: "6Ie+vL",
1024
+ defaultMessage: [{
1025
+ "type": 0,
1026
+ "value": "Error 404"
1027
+ }]
1028
+ });
1029
+ case 500:
1030
+ return /*#__PURE__*/jsx(FormattedMessage, {
1031
+ id: "owrRHV",
1032
+ defaultMessage: [{
1033
+ "type": 0,
1034
+ "value": "Error 500"
1035
+ }]
1036
+ });
1037
+ default:
1038
+ return /*#__PURE__*/jsx(FormattedMessage, {
1039
+ id: "6Ie+vL",
1040
+ defaultMessage: [{
1041
+ "type": 0,
1042
+ "value": "Error 404"
1043
+ }]
1044
+ });
1045
+ }
1046
+ }, [statusCode]);
1047
+ var description = useMemo(function () {
1048
+ switch (code) {
1049
+ case 401:
1050
+ return /*#__PURE__*/jsx(FormattedMessage, {
1051
+ id: "82P2dS",
1052
+ defaultMessage: [{
1053
+ "type": 0,
1054
+ "value": "You are not authorized to access this page."
1055
+ }]
1056
+ });
1057
+ case 403:
1058
+ return /*#__PURE__*/jsx(FormattedMessage, {
1059
+ id: "8HFiMs",
1060
+ defaultMessage: [{
1061
+ "type": 0,
1062
+ "value": "Access to this page is forbidden"
1063
+ }]
1064
+ });
1065
+ case 404:
1066
+ return /*#__PURE__*/jsx(FormattedMessage, {
1067
+ id: "naie2b",
1068
+ defaultMessage: [{
1069
+ "type": 0,
1070
+ "value": "This page doesn't exist"
1071
+ }]
1072
+ });
1073
+ case 500:
1074
+ return /*#__PURE__*/jsx(FormattedMessage, {
1075
+ id: "yALN2p",
1076
+ defaultMessage: [{
1077
+ "type": 0,
1078
+ "value": "There was an error"
1079
+ }]
1080
+ });
1081
+ default:
1082
+ return /*#__PURE__*/jsx(FormattedMessage, {
1083
+ id: "naie2b",
1084
+ defaultMessage: [{
1085
+ "type": 0,
1086
+ "value": "This page doesn't exist"
1087
+ }]
1088
+ });
1089
+ }
1090
+ }, [statusCode]);
1095
1091
  return /*#__PURE__*/jsx(GuestLayout, {
1096
1092
  fullscreen: true,
1097
1093
  children: /*#__PURE__*/jsx("div", {
@@ -1101,13 +1097,9 @@ function ErrorPage(_ref) {
1101
1097
  children: /*#__PURE__*/jsxs("div", {
1102
1098
  className: "col-12 col-sm-8 col-md-6",
1103
1099
  children: [/*#__PURE__*/jsx("h1", {
1104
- children: /*#__PURE__*/jsx(Label, {
1105
- children: messages["title".concat(statusCode || 404)]
1106
- })
1100
+ children: title
1107
1101
  }), /*#__PURE__*/jsx("p", {
1108
- children: /*#__PURE__*/jsx(Label, {
1109
- children: messages["description".concat(statusCode || 404)]
1110
- })
1102
+ children: description
1111
1103
  })]
1112
1104
  })
1113
1105
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/app",
3
- "version": "4.0.5",
3
+ "version": "4.0.7",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -72,45 +72,45 @@
72
72
  "@fortawesome/fontawesome-svg-core": "^6.5.1",
73
73
  "@fortawesome/free-solid-svg-icons": "^6.5.1",
74
74
  "@fortawesome/react-fontawesome": "^0.2.0",
75
- "@panneau/actions": "^4.0.5",
76
- "@panneau/auth": "^4.0.5",
77
- "@panneau/core": "^4.0.5",
78
- "@panneau/data": "^4.0.5",
79
- "@panneau/displays": "^4.0.5",
80
- "@panneau/element-accordion": "^4.0.5",
81
- "@panneau/element-alert": "^4.0.5",
82
- "@panneau/element-avatar": "^4.0.5",
83
- "@panneau/element-breadcrumbs": "^4.0.5",
84
- "@panneau/element-button": "^4.0.5",
85
- "@panneau/element-buttons": "^4.0.5",
86
- "@panneau/element-dropdown": "^4.0.5",
87
- "@panneau/element-form": "^4.0.5",
88
- "@panneau/element-form-group": "^4.0.5",
89
- "@panneau/element-grid": "^4.0.5",
90
- "@panneau/element-icon": "^4.0.5",
91
- "@panneau/element-label": "^4.0.5",
92
- "@panneau/element-link": "^4.0.5",
93
- "@panneau/element-loading": "^4.0.5",
94
- "@panneau/element-media-card": "^4.0.5",
95
- "@panneau/element-media-player": "^4.0.5",
96
- "@panneau/element-menu": "^4.0.5",
97
- "@panneau/element-modal": "^4.0.5",
98
- "@panneau/element-navbar": "^4.0.5",
99
- "@panneau/element-pagination": "^4.0.5",
100
- "@panneau/element-radios": "^4.0.5",
101
- "@panneau/element-range": "^4.0.5",
102
- "@panneau/element-resource-card": "^4.0.5",
103
- "@panneau/fields": "^4.0.5",
104
- "@panneau/filter-filters": "^4.0.5",
105
- "@panneau/filters": "^4.0.5",
106
- "@panneau/form-resource": "^4.0.5",
107
- "@panneau/forms": "^4.0.5",
108
- "@panneau/intl": "^4.0.5",
109
- "@panneau/list-resource-items": "^4.0.5",
110
- "@panneau/lists": "^4.0.5",
111
- "@panneau/modals": "^4.0.5",
112
- "@panneau/themes": "^4.0.5",
113
- "@panneau/uppy": "^4.0.5",
75
+ "@panneau/actions": "^4.0.7",
76
+ "@panneau/auth": "^4.0.7",
77
+ "@panneau/core": "^4.0.7",
78
+ "@panneau/data": "^4.0.7",
79
+ "@panneau/displays": "^4.0.7",
80
+ "@panneau/element-accordion": "^4.0.7",
81
+ "@panneau/element-alert": "^4.0.7",
82
+ "@panneau/element-avatar": "^4.0.7",
83
+ "@panneau/element-breadcrumbs": "^4.0.7",
84
+ "@panneau/element-button": "^4.0.7",
85
+ "@panneau/element-buttons": "^4.0.7",
86
+ "@panneau/element-dropdown": "^4.0.7",
87
+ "@panneau/element-form": "^4.0.7",
88
+ "@panneau/element-form-group": "^4.0.7",
89
+ "@panneau/element-grid": "^4.0.7",
90
+ "@panneau/element-icon": "^4.0.7",
91
+ "@panneau/element-label": "^4.0.7",
92
+ "@panneau/element-link": "^4.0.7",
93
+ "@panneau/element-loading": "^4.0.7",
94
+ "@panneau/element-media-card": "^4.0.7",
95
+ "@panneau/element-media-player": "^4.0.7",
96
+ "@panneau/element-menu": "^4.0.7",
97
+ "@panneau/element-modal": "^4.0.7",
98
+ "@panneau/element-navbar": "^4.0.7",
99
+ "@panneau/element-pagination": "^4.0.7",
100
+ "@panneau/element-radios": "^4.0.7",
101
+ "@panneau/element-range": "^4.0.7",
102
+ "@panneau/element-resource-card": "^4.0.7",
103
+ "@panneau/fields": "^4.0.7",
104
+ "@panneau/filter-filters": "^4.0.7",
105
+ "@panneau/filters": "^4.0.7",
106
+ "@panneau/form-resource": "^4.0.7",
107
+ "@panneau/forms": "^4.0.7",
108
+ "@panneau/intl": "^4.0.7",
109
+ "@panneau/list-resource-items": "^4.0.7",
110
+ "@panneau/lists": "^4.0.7",
111
+ "@panneau/modals": "^4.0.7",
112
+ "@panneau/themes": "^4.0.7",
113
+ "@panneau/uppy": "^4.0.7",
114
114
  "classnames": "^2.5.1",
115
115
  "lodash-es": "^4.17.21",
116
116
  "prop-types": "^15.7.2",
@@ -121,5 +121,5 @@
121
121
  "publishConfig": {
122
122
  "access": "public"
123
123
  },
124
- "gitHead": "ac8b065e8c7ada1d176d15eff1c0fa53599ad31f"
124
+ "gitHead": "8d44fb7aa253ad3ef23c1aca2e7f1a4884c357a6"
125
125
  }