Merge branch 'master' into contest-problemlist

This commit is contained in:
undefined committed 2022-10-18 16:56:18 +08:00
commit 58c0cade0e
28 files changed
+304 -187

No files matched your search

@@ -26,7 +26,7 @@ export default connect((state: any) => ({
});
},
}))(class MonacoEditor extends React.PureComponent<ScratchpadOptions> {
disposable = [];
disposable: monaco.IDisposable[] = [];
__prevent_trigger_change_event = false;
model: monaco.editor.ITextModel;
editor: monaco.editor.IStandaloneCodeEditor;
@@ -78,7 +78,7 @@ export default connect((state: any) => ({
[
{
range: model.getFullModelRange(),
text: value,
text: value!,
},
],
() => null,
+27 -28
View File
@@ -4,37 +4,36 @@ import i18n from 'vj/utils/i18n';
import tpl from 'vj/utils/tpl';
import createHint from './hint';
let inserted = false;
let hintInserted = false;
$(tpl`<div style="display: none" class="dialog__body--user-select">
<div class="row"><div class="columns">
<h1 name="select_user_hint">${i18n('Select User')}</h1>
</div></div>
<div class="row">
<div class="columns">
<label>${i18n('Username / UID')}
<input name="user" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
</div>
</div>`).appendTo(document.body);
const userSelector = UserSelectAutoComplete.getOrConstruct($('.dialog__body--user-select [name="user"]')) as any;
const userSelectDialog = new ActionDialog({
$body: $('.dialog__body--user-select > div'),
onDispatch(action) {
if (action === 'ok' && userSelector.value() === null) {
userSelector.focus();
return false;
}
return true;
},
});
export default async function selectUser(hint?: string) {
if (!inserted) {
const el = $(tpl`<div style="display: none" class="dialog__body--user-select">
<div class="row"><div class="columns">
<h1 name="select_user_hint">${i18n('Select User')}</h1>
</div></div>
<div class="row">
<div class="columns">
<label>${i18n('Username / UID')}
<input name="user" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
</div>
</div>`);
el.appendTo(document.body);
if (hint) createHint(hint, $('[name="select_user_hint"]'));
inserted = true;
if (hint && !hintInserted) {
createHint(hint, $('[name="select_user_hint"]'));
hintInserted = true;
}
const userSelector = UserSelectAutoComplete.getOrConstruct($('.dialog__body--user-select [name="user"]')) as any;
const userSelectDialog = new ActionDialog({
$body: $('.dialog__body--user-select > div'),
onDispatch(action) {
if (action === 'ok' && userSelector.value() === null) {
userSelector.focus();
return false;
}
return true;
},
});
userSelector.clear();
const action = await userSelectDialog.open();
if (action !== 'ok') return null;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.41.14",
"version": "4.41.17",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "index.ts",
@@ -20,10 +20,11 @@ const page = new NamedPage('manage_user_priv', () => {
async function changeUserPriv(uid, priv) {
try {
const res = await request.post('', uid !== 'default' ? {
uid,
const res = await request.post('', {
uid: uid !== 'default' ? uid : 0,
priv,
} : { priv });
system: uid === 'default',
});
if (res.url && res.url !== window.location.href) window.location.href = res.url;
else {
Notification.success(i18n('Priv has been updated to {0}.', priv));
@@ -54,8 +55,8 @@ const page = new NamedPage('manage_user_priv', () => {
handleOpenUserPrivDialog(user.udoc);
}
$('[name="select_user"]').on('click', () => handleClickSelectUser());
$('[name="set_priv"]').on('click', (ev) => handleOpenUserPrivDialog(ev));
$(document).on('click', '[name="select_user"]', () => handleClickSelectUser());
$(document).on('click', '[name="set_priv"]', (ev) => handleOpenUserPrivDialog(ev));
});
export default page;
@@ -163,18 +163,26 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
$('.loader-container').hide();
}
let progress = false;
async function enterScratchpadMode() {
if (progress) return;
progress = true;
await extender.extend();
await loadReact();
renderReact();
await scratchpadFadeIn();
progress = false;
}
async function leaveScratchpadMode() {
if (progress) return;
progress = true;
await scratchpadFadeOut();
$('.problem-content-container').append($('.problem-content'));
await extender.collapse();
unmountReact();
progress = false;
}
async function loadObjective() {
@@ -124,7 +124,6 @@
</div>
<div class="section__body">
<dl class="large horizontal">
<dt>{{ _('Delay')}}</dt><dd>{{ statistics.delay[0]|int }}</dd>
<dt>{{ _('5 Min')}}</dt><dd>{{ statistics['d5min'] }}</dd>
<dt>{{ _('1 Hour')}}</dt><dd>{{ statistics['d1h'] }}</dd>
<dt>{{ _('Day') }}</dt><dd>{{ statistics['day'] }}</dd>