@carbonorm/carbonreact 1.0.7 → 1.0.9
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.
- package/package.json +3 -2
- package/src/CarbonReact.tsx +136 -0
- package/src/components/Alert/Alert.tsx +210 -0
- package/src/components/Errors/AccessDenied.tsx +32 -0
- package/src/components/Errors/BackendThrowable.tsx +44 -0
- package/src/components/Errors/ErrorHttpCode.tsx +31 -0
- package/src/components/Errors/Localhost.tsx +38 -0
- package/src/components/Errors/PageNotFound.tsx +16 -0
- package/src/components/Errors/style.module.css +108 -0
- package/src/components/Errors/style.module.css.d.ts +34 -0
- package/src/components/Errors/style.module.css.map +1 -0
- package/src/components/Errors/style.module.scss +111 -0
- package/src/components/Errors/style.module.scss.d.ts +34 -0
- package/src/components/Errors/style.module.scss.json +1 -0
- package/src/components/Loading/Loading.tsx +37 -0
- package/src/components/Nest/Nest.tsx +241 -0
- package/src/components/Popup/Popup.tsx +55 -0
- package/src/custom.d.ts +47 -0
- package/src/hoc/GlobalHistory.tsx +11 -0
- package/src/hoc/addValidSQL.tsx +6 -0
- package/src/hoc/axiosInstance.tsx +494 -0
- package/src/hoc/changed.tsx +58 -0
- package/src/hoc/deleteRestfulObjectArrays.tsx +25 -0
- package/src/hoc/getStyles.tsx +44 -0
- package/src/hoc/hexToRgb.tsx +15 -0
- package/src/hoc/isEdgeBrowser.tsx +7 -0
- package/src/hoc/parseMultipleJson.tsx +49 -0
- package/src/hoc/scrollIntoView.tsx +6 -0
- package/src/hoc/setUrl.tsx +49 -0
- package/src/hoc/updateRestfulObjectArrays.tsx +92 -0
- package/src/hoc/uploadImage.tsx +99 -0
- package/src/hoc/windowDimensions.tsx +24 -0
- package/src/index.ts +53 -0
- package/src/style.module.css +261 -0
- package/src/style.module.css.d.ts +44 -0
- package/src/style.module.css.json +1 -0
- package/src/style.module.css.map +1 -0
- package/src/style.module.scss +269 -0
- package/src/style.module.scss.d.ts +44 -0
- package/src/variables/C6.tsx +3317 -0
- package/{dist/CarbonReact.umd.css → src/variables/bootstrap.module.css} +3065 -3561
- package/src/variables/bootstrap.module.css.d.ts +7736 -0
- package/src/variables/bootstrap.module.css.json +1 -0
- package/src/variables/bootstrap.module.css.map +1 -0
- package/src/variables/bootstrap.module.scss +37 -0
- package/src/variables/bootstrap.module.scss.d.ts +7736 -0
- package/src/variables/isProduction.tsx +5 -0
- package/dist/CarbonReact.umd.css.map +0 -1
- package/dist/CarbonReact.umd.js +0 -4653
- package/dist/CarbonReact.umd.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonorm/carbonreact",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"main": "dist/CarbonReact.cjs.js",
|
|
5
5
|
"browser": "dist/CarbonReact.umd.js",
|
|
6
6
|
"module": "dist/CarbonReact.esm.js",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"build:css": "sass ./src:./src && typed-scss-modules 'src/**/*.?(s)css' --nameFormat all --exportType default src"
|
|
66
66
|
},
|
|
67
67
|
"files": [
|
|
68
|
-
"dist"
|
|
68
|
+
"dist",
|
|
69
|
+
"src"
|
|
69
70
|
],
|
|
70
71
|
"dependencies": {
|
|
71
72
|
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {clearCache} from "@carbonorm/carbonnode";
|
|
2
|
+
import changed from "hoc/changed";
|
|
3
|
+
import {GlobalHistory} from "hoc/GlobalHistory";
|
|
4
|
+
import hexToRgb from "hoc/hexToRgb";
|
|
5
|
+
import React, {ReactNode} from 'react';
|
|
6
|
+
import {BrowserRouter} from 'react-router-dom';
|
|
7
|
+
import {ToastContainer} from 'react-toastify';
|
|
8
|
+
import 'react-toastify/dist/ReactToastify.min.css';
|
|
9
|
+
import BackendThrowable from 'components/Errors/BackendThrowable';
|
|
10
|
+
import Nest from 'components/Nest/Nest';
|
|
11
|
+
import {iCarbons} from "variables/C6";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export type tStatefulApiData<T> = T[] | undefined | null;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// this refers to the value types of the keys above, aka values in the state
|
|
18
|
+
export interface iRestfulObjectArrayTypes {
|
|
19
|
+
carbons: tStatefulApiData<iCarbons>,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type tRestfulObjectArrayKeys = keyof iRestfulObjectArrayTypes
|
|
23
|
+
|
|
24
|
+
export type tRestfulObjectArrayValues = iRestfulObjectArrayTypes[tRestfulObjectArrayKeys];
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
export type tRestfulObjectValues = tRestfulObjectArrayValues[number];
|
|
28
|
+
|
|
29
|
+
// our central container, single page application is best with the DigApi
|
|
30
|
+
export interface iCarbonORMState extends iRestfulObjectArrayTypes {
|
|
31
|
+
websocketEvents: MessageEvent[],
|
|
32
|
+
websocketData: any[],
|
|
33
|
+
websocket?: WebSocket,
|
|
34
|
+
websocketMounted: boolean,
|
|
35
|
+
alert?: boolean,
|
|
36
|
+
alertsWaiting: any[],
|
|
37
|
+
backendThrowable: any[],
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default class CarbonReact<P = {}, S = {}> extends React.Component<{
|
|
41
|
+
children?: ReactNode | ReactNode[],
|
|
42
|
+
} & P, iCarbonORMState & S> {
|
|
43
|
+
|
|
44
|
+
static instance: CarbonReact;
|
|
45
|
+
|
|
46
|
+
static lastLocation = window.location.pathname;
|
|
47
|
+
|
|
48
|
+
state = {
|
|
49
|
+
carbons: undefined,
|
|
50
|
+
alertsWaiting: [],
|
|
51
|
+
backendThrowable: [],
|
|
52
|
+
websocketData: [],
|
|
53
|
+
websocketEvents: [],
|
|
54
|
+
websocketMounted: false,
|
|
55
|
+
} as iCarbonORMState & S;
|
|
56
|
+
|
|
57
|
+
// @link https://github.com/welldone-software/why-did-you-render
|
|
58
|
+
// noinspection JSUnusedGlobalSymbols
|
|
59
|
+
static whyDidYouRender = true;
|
|
60
|
+
|
|
61
|
+
constructor(props) {
|
|
62
|
+
|
|
63
|
+
super(props);
|
|
64
|
+
|
|
65
|
+
CarbonReact.instance = this;
|
|
66
|
+
|
|
67
|
+
// This should only ever be done here, when the full state is being trashed.
|
|
68
|
+
clearCache({
|
|
69
|
+
ignoreWarning: true
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/** We can think of our app as having one state; this state.
|
|
74
|
+
* Long-term, I'd like us to store this state to local storage and only load updates on reload...
|
|
75
|
+
* Class based components are far easier to manage state in local storage and pass state down to children.
|
|
76
|
+
* Children, if not faced with a local storage or other complexity should be a functional component. Functional
|
|
77
|
+
* components' tend to be shorter syntactically and bonus points if it's stateless.
|
|
78
|
+
**/
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
websocketTimeout = 5000;
|
|
83
|
+
|
|
84
|
+
shouldComponentUpdate(
|
|
85
|
+
nextProps: Readonly<any>,
|
|
86
|
+
nextState: Readonly<iCarbonORMState>,
|
|
87
|
+
_nextContext: any): boolean {
|
|
88
|
+
|
|
89
|
+
changed(this.constructor.name + ' (DigApi)', 'props', this.props, nextProps);
|
|
90
|
+
changed(this.constructor.name + ' (DigApi)', 'state', this.state, nextState);
|
|
91
|
+
|
|
92
|
+
return true
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
componentDidUpdate(_prevProps: Readonly<any>, _prevState: Readonly<iCarbonORMState>, _snapshot?: any) {
|
|
97
|
+
if (CarbonReact.lastLocation !== location.pathname) {
|
|
98
|
+
CarbonReact.lastLocation = location.pathname;
|
|
99
|
+
const websocket = this.state.websocket;
|
|
100
|
+
if (websocket?.readyState === WebSocket.OPEN) {
|
|
101
|
+
websocket.send(location.pathname);
|
|
102
|
+
console.log(location.pathname);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
render() {
|
|
108
|
+
|
|
109
|
+
console.log('CarbonORM TSX RENDER');
|
|
110
|
+
|
|
111
|
+
const colorHex = '#' + Math.random().toString(16).slice(-6);
|
|
112
|
+
|
|
113
|
+
console.log('%c color (' + colorHex + ')', 'color: ' + colorHex);
|
|
114
|
+
|
|
115
|
+
const nest = <Nest position={'fixed'} backgroundColor={''} color={hexToRgb(colorHex)} count={100}/>;
|
|
116
|
+
|
|
117
|
+
if (this.state.backendThrowable.length > 0) {
|
|
118
|
+
|
|
119
|
+
return <>
|
|
120
|
+
{nest}
|
|
121
|
+
<BackendThrowable/>
|
|
122
|
+
</>;
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return <BrowserRouter>
|
|
127
|
+
<GlobalHistory/>
|
|
128
|
+
{this.props.children}
|
|
129
|
+
<ToastContainer/>
|
|
130
|
+
</BrowserRouter>;
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import CarbonReact from "CarbonReact";
|
|
3
|
+
import {ReactNode} from "react";
|
|
4
|
+
import Popup from "components/Popup/Popup";
|
|
5
|
+
import getStyles from "hoc/getStyles";
|
|
6
|
+
import {faClose} from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
|
8
|
+
import isProduction from "variables/isProduction";
|
|
9
|
+
|
|
10
|
+
// 'digBtnBlue': string;
|
|
11
|
+
// 'digBtnGreen': string;
|
|
12
|
+
// 'digBtnLightRed': string;
|
|
13
|
+
// 'digBtnRed': string;
|
|
14
|
+
export interface iAlertButtonOptions {
|
|
15
|
+
text: string,
|
|
16
|
+
value?: string,
|
|
17
|
+
className?: string,
|
|
18
|
+
color: "default" | "primary" | "secondary" | "inherit" | "danger" | "info" | "success" | "warning" | undefined,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function addAlert(props: iAlert) {
|
|
22
|
+
|
|
23
|
+
CarbonReact.instance.setState(previousState => ({
|
|
24
|
+
alertsWaiting: previousState.alertsWaiting.length === 0
|
|
25
|
+
? [props]
|
|
26
|
+
: [...previousState.alertsWaiting, props]
|
|
27
|
+
}))
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface iAlert {
|
|
32
|
+
title: string,
|
|
33
|
+
text: string,
|
|
34
|
+
component?: ReactNode,
|
|
35
|
+
icon?: "warning" | "error" | "success" | "info" | "question" | null,
|
|
36
|
+
buttons?: (iAlertButtonOptions)[] | undefined, //['No thanks!', 'Yes, Delete it'],
|
|
37
|
+
dangerMode?: true,
|
|
38
|
+
then?: (value: string | undefined) => void,
|
|
39
|
+
timeout?: number,
|
|
40
|
+
footerText?: string,
|
|
41
|
+
|
|
42
|
+
intercept?: boolean,
|
|
43
|
+
backendThrowable?: { [key: string]: any },
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function Alert() {
|
|
47
|
+
|
|
48
|
+
const {alertsWaiting, backendThrowable} = CarbonReact.instance.state
|
|
49
|
+
|
|
50
|
+
let alert: iAlert | undefined = undefined;
|
|
51
|
+
|
|
52
|
+
const alertWaiting = alertsWaiting.length + backendThrowable.length
|
|
53
|
+
|
|
54
|
+
if (backendThrowable.length !== 0) {
|
|
55
|
+
|
|
56
|
+
const buttons: iAlertButtonOptions[] = [{
|
|
57
|
+
text: 'Close',
|
|
58
|
+
color: 'danger',
|
|
59
|
+
}];
|
|
60
|
+
|
|
61
|
+
const hideExpandInformation = isProduction
|
|
62
|
+
|
|
63
|
+
if (false === hideExpandInformation) {
|
|
64
|
+
buttons.push({
|
|
65
|
+
text: 'Expand',
|
|
66
|
+
color: 'primary',
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const backendThrowable = CarbonReact.instance.state.backendThrowable[0]
|
|
71
|
+
|
|
72
|
+
alert = {
|
|
73
|
+
title: "Oh no! An issue occurred!",
|
|
74
|
+
text: backendThrowable?.['DropInGaming\\PHP\\Errors\\DropException'] ?? 'An unknown issue occurred. Please try again.',
|
|
75
|
+
timeout: 0,
|
|
76
|
+
footerText: hideExpandInformation ? '' : 'These alert footer options are only shown to admins and in development environments. Click "Expand" to see more details.',
|
|
77
|
+
buttons: buttons,
|
|
78
|
+
// backendThrowable has its own custom component that can be expanded (called in the Bootstrap component)
|
|
79
|
+
// our then function will be called when the user clicks on the button providing the option to expand or close
|
|
80
|
+
backendThrowable: backendThrowable,
|
|
81
|
+
then: (value: string | undefined) => {
|
|
82
|
+
|
|
83
|
+
if (value === 'Expand') {
|
|
84
|
+
|
|
85
|
+
CarbonReact.instance.setState(previousState => {
|
|
86
|
+
|
|
87
|
+
let backendThrowable = previousState.backendThrowable.pop()
|
|
88
|
+
|
|
89
|
+
if (backendThrowable === undefined) {
|
|
90
|
+
return {
|
|
91
|
+
backendThrowable: []
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
backendThrowable.expanded = true
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
backendThrowable: [backendThrowable, ...(previousState.backendThrowable ?? [])]
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
} else {
|
|
103
|
+
CarbonReact.instance.setState(previousState => ({
|
|
104
|
+
backendThrowable: previousState.backendThrowable.slice(1)
|
|
105
|
+
}))
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
} else if (alertsWaiting.length !== 0) {
|
|
111
|
+
|
|
112
|
+
alert = alertsWaiting[0]
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (alert === undefined) {
|
|
117
|
+
|
|
118
|
+
return null
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const timeout = alert?.timeout || 15000
|
|
123
|
+
|
|
124
|
+
const bootstrap = CarbonReact.instance
|
|
125
|
+
|
|
126
|
+
const dig = getStyles()
|
|
127
|
+
|
|
128
|
+
let cancelTimeout: any = null
|
|
129
|
+
|
|
130
|
+
const handleClose = () => {
|
|
131
|
+
if (null !== cancelTimeout) {
|
|
132
|
+
clearTimeout(cancelTimeout)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (alert?.backendThrowable === undefined) {
|
|
136
|
+
bootstrap.setState(previousState => ({
|
|
137
|
+
alertsWaiting: previousState.alertsWaiting.slice(1)
|
|
138
|
+
}))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (alert?.intercept === false) {
|
|
144
|
+
handleClose()
|
|
145
|
+
return null
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (0 !== timeout) {
|
|
149
|
+
|
|
150
|
+
cancelTimeout = setTimeout(() => {
|
|
151
|
+
handleClose()
|
|
152
|
+
}, timeout)
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return <Popup handleClose={handleClose}>
|
|
157
|
+
<div className={classNames("model-content", dig.rounded0, dig.border0)} style={{
|
|
158
|
+
maxWidth: '75vw',
|
|
159
|
+
maxHeight: '75vh',
|
|
160
|
+
}}>
|
|
161
|
+
<div className={classNames(dig.modalHeader, dig.rounded0, dig.border0, {
|
|
162
|
+
// icon?: "warning" | "error" | "success" | "info" | "question"
|
|
163
|
+
[dig.bg_primary]: "info" === alert.icon || alert.icon === undefined || alert.icon === null,
|
|
164
|
+
[dig.bg_success]: "success" === alert.icon,
|
|
165
|
+
[dig.bg_warning]: "warning" === alert.icon,
|
|
166
|
+
[dig.bg_danger]: "error" === alert.icon, // TODO - change to red
|
|
167
|
+
[dig.bgPrimary]: "question" === alert.icon,
|
|
168
|
+
})}>
|
|
169
|
+
<h3 className={classNames(dig.modalTitle, dig.textDark)} id="staticBackdropLabel">
|
|
170
|
+
#{alertWaiting} {alert.title}
|
|
171
|
+
</h3>
|
|
172
|
+
<div onClick={handleClose}>
|
|
173
|
+
<FontAwesomeIcon
|
|
174
|
+
icon={faClose}
|
|
175
|
+
size={'xl'}/>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
<div className={classNames(dig.modalBody, dig.border0, dig.textWhite)}>
|
|
179
|
+
<div className={dig.textCenter}>
|
|
180
|
+
{alert.text}
|
|
181
|
+
{alert.component}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
{undefined !== alert.buttons &&
|
|
185
|
+
<div className={classNames(dig.modalFooter, dig.border0, dig.rounded0)}>
|
|
186
|
+
{alert.footerText && <div className={classNames(dig.textCenter, dig.textWhite)}>{alert.footerText}</div>}
|
|
187
|
+
|
|
188
|
+
{alert.buttons?.map((button: iAlertButtonOptions, index: number) => {
|
|
189
|
+
|
|
190
|
+
return <button key={index}
|
|
191
|
+
className={classNames(dig.btn, dig.btnLg, {
|
|
192
|
+
// todo - color: "default" | "primary" | "secondary" | "inherit" | "danger" | "info" | "success" | "warning" | undefined,
|
|
193
|
+
[dig.bg_success]: "success" === button.color,
|
|
194
|
+
[dig.bg_danger]: "danger" === button.color,
|
|
195
|
+
[dig.bg_primary]: "primary" === button.color,
|
|
196
|
+
[dig.bg_warning]: "warning" === button.color,
|
|
197
|
+
}, "btn-Yes", dig.rounded0)}
|
|
198
|
+
onClick={() => {
|
|
199
|
+
handleClose()
|
|
200
|
+
alert?.then?.(button.value ?? button.text)
|
|
201
|
+
}}>{button.text}</button>
|
|
202
|
+
|
|
203
|
+
})}
|
|
204
|
+
|
|
205
|
+
</div>}
|
|
206
|
+
</div>
|
|
207
|
+
</Popup>
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styles from "../../style.module.css"
|
|
4
|
+
|
|
5
|
+
export default function AccessDenied ({children} : {children?: React.ReactNode}) {
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<div className={styles.notfound}>
|
|
10
|
+
<div className={styles.notfound_404}>
|
|
11
|
+
<h3>Oops! Access not granted</h3>
|
|
12
|
+
{children}
|
|
13
|
+
<h1 style={{
|
|
14
|
+
position: "absolute",
|
|
15
|
+
left: "50%",
|
|
16
|
+
top: "50%",
|
|
17
|
+
transform: "translate(-50%, -50%)",
|
|
18
|
+
fontSize: "252px",
|
|
19
|
+
fontWeight: 900,
|
|
20
|
+
textTransform: "uppercase",
|
|
21
|
+
letterSpacing: "-40px",
|
|
22
|
+
marginLeft: "-20px",
|
|
23
|
+
marginTop: "20px"
|
|
24
|
+
|
|
25
|
+
}}><span>4</span><span>0</span><span>3</span></h1>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import styles from './style.module.scss';
|
|
2
|
+
import OutsideClickHandler from 'react-outside-click-handler';
|
|
3
|
+
|
|
4
|
+
export default function BackendThrowable() {
|
|
5
|
+
|
|
6
|
+
const CarbonORM = require('CarbonReact').default;
|
|
7
|
+
|
|
8
|
+
const bootstrap = CarbonORM.instance;
|
|
9
|
+
|
|
10
|
+
const currentThrowable = bootstrap.state.backendThrowable[0];
|
|
11
|
+
|
|
12
|
+
console.log([bootstrap.state.backendThrowable, currentThrowable]);
|
|
13
|
+
|
|
14
|
+
return <div className={styles.maintenanceHero}>
|
|
15
|
+
<h1 className={styles.httpStatusCode}>{currentThrowable?.status || 500}</h1>
|
|
16
|
+
<OutsideClickHandler
|
|
17
|
+
onOutsideClick={() => bootstrap.setState(currentState => ({ backendThrowable: currentState.backendThrowable.slice(1) }))}>
|
|
18
|
+
<div className={styles.centeredContainer}>
|
|
19
|
+
{Object.keys(currentThrowable).map((key, index) => {
|
|
20
|
+
|
|
21
|
+
const valueIsString = typeof currentThrowable[key] === 'string';
|
|
22
|
+
|
|
23
|
+
const valueIsCode = 'THROWN NEAR' === key;
|
|
24
|
+
|
|
25
|
+
return <div key={index}>
|
|
26
|
+
<div className={styles.errorTextGeneral}> > <span className={styles.errorKeys}>{key}</span>:
|
|
27
|
+
{valueIsString
|
|
28
|
+
? (valueIsCode ? <div
|
|
29
|
+
style={{ backgroundColor: 'black', fontSize: 'xx-small' }}
|
|
30
|
+
dangerouslySetInnerHTML={{ __html: currentThrowable[key] }} /> :
|
|
31
|
+
<i className={styles.errorValues}>"{currentThrowable[key]}"</i>)
|
|
32
|
+
: ''}
|
|
33
|
+
</div>
|
|
34
|
+
{valueIsString
|
|
35
|
+
? ''
|
|
36
|
+
:
|
|
37
|
+
<pre className={styles.errorPre}>{JSON.stringify(currentThrowable[key], undefined, 4)}</pre>}
|
|
38
|
+
</div>;
|
|
39
|
+
})}
|
|
40
|
+
</div>
|
|
41
|
+
</OutsideClickHandler>
|
|
42
|
+
</div>;
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import classes from "style.module.css"
|
|
2
|
+
|
|
3
|
+
export default function ErrorHttpCode(
|
|
4
|
+
{
|
|
5
|
+
code,
|
|
6
|
+
title = 'Hey Gamer, we\'ve encountered an unexpected issue!',
|
|
7
|
+
message = 'Our team has been alerted and is actively investigating the issue. Please continue playing or ask support for any questions.'
|
|
8
|
+
}: {
|
|
9
|
+
code: string,
|
|
10
|
+
title: string,
|
|
11
|
+
message: string
|
|
12
|
+
}) {
|
|
13
|
+
|
|
14
|
+
return <main role="main">
|
|
15
|
+
<div className={classes.maintenance}>
|
|
16
|
+
<div className={classes.problemBox}>
|
|
17
|
+
<div className={classes.notfound}>
|
|
18
|
+
<div className={classes.notfound_404}>
|
|
19
|
+
<h3>{title}</h3>
|
|
20
|
+
<h1>{code}</h1>
|
|
21
|
+
</div>
|
|
22
|
+
<h2>{message}</h2>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</main>
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default function Localhost() {
|
|
5
|
+
|
|
6
|
+
const center = {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
justifyContent: 'center',
|
|
10
|
+
height: '100%',
|
|
11
|
+
'&:hover': {color: 'blue !important'},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const onMouseEnter = (e) => {
|
|
15
|
+
const target = e.target as HTMLElement;
|
|
16
|
+
target.style.backgroundColor = '#e13570';
|
|
17
|
+
target.style.border = '2px solid rgb(31, 0, 69)';
|
|
18
|
+
target.style.boxShadow = '-2px 0px 7px 2px #e13570';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onMouseLeave = (e) => {
|
|
22
|
+
const target = e.target as HTMLElement;
|
|
23
|
+
target.style.backgroundColor = 'rgb(31, 0, 69)';
|
|
24
|
+
target.style.border = '2px solid #593676';
|
|
25
|
+
target.style.boxShadow = '-2px 0px 7px 2px #e13570';
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return <React.Fragment>
|
|
29
|
+
<h1 style={center}>Whoa, where we dropping?</h1>
|
|
30
|
+
<a onMouseEnter={onMouseEnter}
|
|
31
|
+
onMouseLeave={onMouseLeave}
|
|
32
|
+
style={center} href={'//local.dropingaming.gg:3000/'}>GG</a>
|
|
33
|
+
<a onMouseEnter={onMouseEnter}
|
|
34
|
+
onMouseLeave={onMouseLeave}
|
|
35
|
+
style={center} href={'//local.dropingaming.com:3000/'}>COM</a>
|
|
36
|
+
</React.Fragment>;
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import classes from "style.module.css"
|
|
3
|
+
|
|
4
|
+
export default function PageNotFound() {
|
|
5
|
+
|
|
6
|
+
return <div>
|
|
7
|
+
<div className={classes.notfound}>
|
|
8
|
+
<div className={classes.notfound_404}>
|
|
9
|
+
<h3>Oops! Page not found</h3>
|
|
10
|
+
<h1><span>4</span><span>0</span><span>4</span></h1>
|
|
11
|
+
</div>
|
|
12
|
+
<h2>we are sorry, but the page you requested was not found</h2>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
}
|
|
16
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css?family=Share+Tech+Mono|Montserrat:700");
|
|
2
|
+
* {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
border: 0;
|
|
6
|
+
font-size: 100%;
|
|
7
|
+
vertical-align: baseline;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
color: inherit;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.maintenance-hero {
|
|
13
|
+
background: url("#") no-repeat center center fixed;
|
|
14
|
+
-webkit-background-size: cover;
|
|
15
|
+
-moz-background-size: cover;
|
|
16
|
+
-o-background-size: cover;
|
|
17
|
+
background-size: cover;
|
|
18
|
+
opacity: 0.8;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.httpStatusCode {
|
|
22
|
+
font-size: 45vw;
|
|
23
|
+
text-align: center;
|
|
24
|
+
position: fixed;
|
|
25
|
+
width: 100vw;
|
|
26
|
+
z-index: 1;
|
|
27
|
+
color: rgba(255, 255, 255, 0.1490196078);
|
|
28
|
+
text-shadow: 0 0 50px rgba(0, 0, 0, 0.07);
|
|
29
|
+
top: 50%;
|
|
30
|
+
transform: translateY(-50%);
|
|
31
|
+
font-family: "Montserrat", monospace;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.centeredContainer {
|
|
35
|
+
background-color: rgba(1, 1, 1, 0.9);
|
|
36
|
+
width: 70vw;
|
|
37
|
+
overflow: scroll;
|
|
38
|
+
max-height: 80%;
|
|
39
|
+
position: relative;
|
|
40
|
+
top: 20vh;
|
|
41
|
+
margin: 0 auto;
|
|
42
|
+
padding: 30px 30px 10px;
|
|
43
|
+
box-shadow: 0 0 150px -20px rgba(0, 0, 0, 0.5);
|
|
44
|
+
z-index: 3;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.errorTextGeneral {
|
|
48
|
+
font-family: "Share Tech Mono", monospace;
|
|
49
|
+
color: #f5f5f5;
|
|
50
|
+
margin: 0 0 20px;
|
|
51
|
+
font-size: 22px;
|
|
52
|
+
line-height: 1.2;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.errorKeys {
|
|
56
|
+
color: #f0c674;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.error-values {
|
|
60
|
+
color: #8abeb7;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes slide {
|
|
64
|
+
from {
|
|
65
|
+
right: -100px;
|
|
66
|
+
transform: rotate(360deg);
|
|
67
|
+
opacity: 0;
|
|
68
|
+
}
|
|
69
|
+
to {
|
|
70
|
+
right: 15px;
|
|
71
|
+
transform: rotate(0deg);
|
|
72
|
+
opacity: 1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.error-pre {
|
|
76
|
+
background-color: rgba(18, 18, 18, 0.9);
|
|
77
|
+
max-height: 30%;
|
|
78
|
+
overflow: scroll;
|
|
79
|
+
margin: 0 0 1em;
|
|
80
|
+
padding: 0.5em 1em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.error-pre code,
|
|
84
|
+
.error-pre .line-number {
|
|
85
|
+
/* Ukuran line-height antara teks di dalam tag <code> dan <span class="line-number"> harus sama! */
|
|
86
|
+
font: normal normal 12px/14px "Courier New", Courier, Monospace;
|
|
87
|
+
color: black;
|
|
88
|
+
display: block;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.error-pre .line-number {
|
|
92
|
+
float: left;
|
|
93
|
+
margin: 0 1em 0 -1em;
|
|
94
|
+
border-right: 1px solid;
|
|
95
|
+
text-align: right;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.error-pre .line-number span {
|
|
99
|
+
display: block;
|
|
100
|
+
padding: 0 0.5em 0 1em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.error-pre .cl {
|
|
104
|
+
display: block;
|
|
105
|
+
clear: both;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/*# sourceMappingURL=style.module.css.map */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'centered_container': string;
|
|
3
|
+
'centered-container': string;
|
|
4
|
+
'centeredContainer': string;
|
|
5
|
+
'cl': string;
|
|
6
|
+
'error_keys': string;
|
|
7
|
+
'error_pre': string;
|
|
8
|
+
'error_text_general': string;
|
|
9
|
+
'error_values': string;
|
|
10
|
+
'error-keys': string;
|
|
11
|
+
'error-pre': string;
|
|
12
|
+
'error-text-general': string;
|
|
13
|
+
'error-values': string;
|
|
14
|
+
'errorKeys': string;
|
|
15
|
+
'errorPre': string;
|
|
16
|
+
'errorTextGeneral': string;
|
|
17
|
+
'errorValues': string;
|
|
18
|
+
'http_status_code': string;
|
|
19
|
+
'http-status-code': string;
|
|
20
|
+
'httpStatusCode': string;
|
|
21
|
+
'line_number': string;
|
|
22
|
+
'line-number': string;
|
|
23
|
+
'lineNumber': string;
|
|
24
|
+
'maintenance_hero': string;
|
|
25
|
+
'maintenance-hero': string;
|
|
26
|
+
'maintenanceHero': string;
|
|
27
|
+
'slide': string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ClassNames = keyof Styles;
|
|
31
|
+
|
|
32
|
+
declare const styles: Styles;
|
|
33
|
+
|
|
34
|
+
export default styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["style.module.scss"],"names":[],"mappings":"AAAQ;AAER;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EAEE;EACA;EACA;EACA;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAIF;EACE;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;AAEE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA","file":"style.module.css"}
|