ui: add alert/prompt/confirm helper function (#1018)

This commit is contained in:
undefined authored and GitHub committed 2025-07-19 11:27:37 +01:00
1 parent 2d7979105e
commit d4271b3fbd
12 files changed
+176 -196

No files matched your search

@@ -2,7 +2,7 @@ import $ from 'jquery';
import yaml from 'js-yaml';
import React from 'react';
import { createRoot } from 'react-dom/client';
import { ConfirmDialog } from 'vj/components/dialog';
import { confirm } from 'vj/components/dialog';
import Notification from 'vj/components/notification';
import { downloadProblemSet } from 'vj/components/zipDownloader';
import { NamedPage } from 'vj/misc/Page';
@@ -316,10 +316,7 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
</a>
</li>));
$(document).on('click', '#clearAnswers', async () => {
const result = await new ConfirmDialog({
$body: tpl.typoMsg(i18n('All changes will be lost. Are you sure to clear all answers?')),
}).open();
if (result === 'yes') await clearAns();
if (await confirm(i18n('All changes will be lost. Are you sure to clear all answers?'))) await clearAns();
});
}
const ele = document.createElement('div');