mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
1 parent
00dcf3864f
commit
ab12ca8526
10 files changed
+115
-97
No files matched your search
@@ -23,6 +23,7 @@ function runWebpack({
|
||||
proxy: {
|
||||
context: () => true,
|
||||
target: 'http://localhost:2333',
|
||||
ws: true,
|
||||
},
|
||||
});
|
||||
return server.listen(8000);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AutoloadPage } from 'vj/misc/Page';
|
||||
import delay from 'vj/utils/delay'
|
||||
|
||||
const formPage = new AutoloadPage('formPage', () => {
|
||||
$(document).on('vjFormDisableUpdate', 'input, select, textarea', (ev) => {
|
||||
@@ -10,6 +11,15 @@ const formPage = new AutoloadPage('formPage', () => {
|
||||
$formItem.removeClass('is--disabled');
|
||||
}
|
||||
});
|
||||
|
||||
const submitting = {};
|
||||
|
||||
$('[type="submit"]').on('click', async (ev) => {
|
||||
if (!submitting[ev.currentTarget]) $(ev.currentTarget).closest('form').submit();
|
||||
submitting[ev.currentTarget] = true;
|
||||
await delay(5000);
|
||||
submitting[ev.currentTarget] = false;
|
||||
})
|
||||
});
|
||||
|
||||
export default formPage;
|
||||
@@ -3,6 +3,7 @@ import classNames from 'classnames';
|
||||
|
||||
export default function DataInputComponent(props) {
|
||||
const {
|
||||
html,
|
||||
title,
|
||||
value,
|
||||
onChange,
|
||||
@@ -12,16 +13,20 @@ export default function DataInputComponent(props) {
|
||||
const cn = classNames(className, 'flex-col flex-fill');
|
||||
return (
|
||||
<div {...rest} className={cn}>
|
||||
<textarea
|
||||
className="scratchpad__data-input"
|
||||
wrap="off"
|
||||
value={value}
|
||||
onChange={(ev) => {
|
||||
ev.stopPropagation();
|
||||
onChange(ev.target.value);
|
||||
}}
|
||||
placeholder={title}
|
||||
/>
|
||||
{html // eslint-disable-next-line react/no-danger
|
||||
? <div className="scratchpad__data-input" wrap="off" dangerouslySetInnerHTML={{ __html: value }} />
|
||||
: (
|
||||
<textarea
|
||||
className="scratchpad__data-input"
|
||||
wrap="off"
|
||||
value={value}
|
||||
onChange={(ev) => {
|
||||
ev.stopPropagation();
|
||||
onChange(ev.target.value);
|
||||
}}
|
||||
placeholder={title}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadPret
|
||||
<DataInput
|
||||
title={i18n('Output')}
|
||||
value={this.props.output}
|
||||
html
|
||||
/>
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { STATUS_TEXTS } from '@hydrooj/utils/lib/status';
|
||||
|
||||
export default function reducer(state = {
|
||||
input: '',
|
||||
output: '',
|
||||
@@ -12,10 +14,13 @@ export default function reducer(state = {
|
||||
}
|
||||
if (action.type === 'SCRATCHPAD_RECORDS_PUSH') {
|
||||
const { rdoc } = action.payload;
|
||||
if (rdoc._id === state.rid && rdoc.testCases[0]) {
|
||||
if (rdoc._id === state.rid) {
|
||||
const output = [`${STATUS_TEXTS[rdoc.status]} ${rdoc.time}ms ${rdoc.memory}MiB`];
|
||||
if (rdoc.compilerTexts.length) output.push(rdoc.compilerTexts.join('\n'));
|
||||
if (rdoc.testCases.length) output.push(rdoc.testCases[0].message || '');
|
||||
return {
|
||||
...state,
|
||||
output: rdoc.testCases[0].message,
|
||||
output: output.join('\n'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.6.10",
|
||||
"version": "4.6.11",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
@@ -22,11 +22,7 @@
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@babel/register": "^7.13.14",
|
||||
"@babel/runtime-corejs2": "^7.13.10",
|
||||
"@snowpack/plugin-react-refresh": "^2.4.2",
|
||||
"acorn": "^8.0.5",
|
||||
"acorn-stage3": "^4.0.0",
|
||||
"acorn-walk": "^8.0.2",
|
||||
"astring": "^1.7.4",
|
||||
"@hydrooj/utils": "^1.0.7",
|
||||
"autoprefixer": "^9.8.6",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
@@ -82,7 +78,6 @@
|
||||
"redux-thunk": "^2.2.0",
|
||||
"rupture": "^0.7.1",
|
||||
"slideout": "^1.0.1",
|
||||
"snowpack": "^3.3.2",
|
||||
"sockjs-client": "^1.5.1",
|
||||
"speed-measure-webpack-plugin": "^1.5.0",
|
||||
"sticky-kit": "^1.1.3",
|
||||
@@ -116,7 +111,6 @@
|
||||
"nunjucks": "^3.2.3",
|
||||
"prismjs": "^1.23.0",
|
||||
"streamsaver": "^2.0.5",
|
||||
"vite": "^2.1.5",
|
||||
"web-streams-polyfill": "^3.0.2",
|
||||
"xss": "^1.0.8",
|
||||
"yargs": "^16.2.0"
|
||||
|
||||
Reference in new issue
Block a user