Initial import of weiyuan frontend

This commit is contained in:
qiubaishen
2026-10-15 16:33:46 +08:00
commit d8f3aee261
774 changed files with 374914 additions and 0 deletions
@@ -0,0 +1,84 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import Loading from './ui/Loading';
import {
isChunkLoadError,
reloadForChunkError,
} from '../../helpers/chunkReload';
class ChunkErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { error: null, reloading: false };
}
static getDerivedStateFromError(error) {
return { error, reloading: false };
}
componentDidCatch(error) {
if (reloadForChunkError(error)) {
this.setState({ reloading: true });
}
}
render() {
const { error } = this.state;
if (!error) {
return this.props.children;
}
const chunkLoadError = isChunkLoadError(error);
if (chunkLoadError && this.state.reloading) {
return <Loading />;
}
return (
<div
style={{
minHeight: '100vh',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: 24,
textAlign: 'center',
}}
>
<div>
<h2 style={{ marginBottom: 12 }}>
{chunkLoadError ? 'Page update required' : 'Something went wrong'}
</h2>
<p style={{ marginBottom: 16 }}>
{chunkLoadError
? 'The app was updated while this page was open. Refresh to load the latest files.'
: 'Please refresh the page and try again.'}
</p>
<button type='button' onClick={() => window.location.reload()}>
Refresh
</button>
</div>
</div>
);
}
}
export default ChunkErrorBoundary;