diff --git a/packages/ui-default/components/autocomplete/components/AutoComplete.tsx b/packages/ui-default/components/autocomplete/components/AutoComplete.tsx index b6739046d..f23a4bf50 100644 --- a/packages/ui-default/components/autocomplete/components/AutoComplete.tsx +++ b/packages/ui-default/components/autocomplete/components/AutoComplete.tsx @@ -17,6 +17,7 @@ export interface AutoCompleteProps { */ height?: string; disabled?: boolean; + placeholder?: string; disabledHint?: string; listStyle?: React.CSSProperties; cacheKey?: string; @@ -295,6 +296,7 @@ const AutoComplete = forwardRef(function Impl(props: AutoCompleteProps, re if (allowEmptyQuery) handleInputChange(); setFocused(true); }} + placeholder={props.placeholder} onBlur={() => setFocused(false)} onKeyDown={handleInputKeyDown} defaultValue={multi ? '' : selectedKeys.join(',')} @@ -344,6 +346,7 @@ AutoComplete.propTypes = { allowEmptyQuery: PropTypes.bool, freeSolo: PropTypes.bool, freeSoloConverter: PropTypes.func, + placeholder: PropTypes.string, }; AutoComplete.defaultProps = { diff --git a/packages/ui-default/components/problemconfig/ProblemConfigForm.tsx b/packages/ui-default/components/problemconfig/ProblemConfigForm.tsx index afab7fac0..78bb8106a 100644 --- a/packages/ui-default/components/problemconfig/ProblemConfigForm.tsx +++ b/packages/ui-default/components/problemconfig/ProblemConfigForm.tsx @@ -1,8 +1,8 @@ -import React, { useState } from 'react'; +import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import i18n from 'vj/utils/i18n'; import { - Card, Switch, Tab, Tabs, InputGroup, Tag, + Card, Tab, Tabs, InputGroup, Tag, } from '@blueprintjs/core'; import type { RootState } from './reducer/index'; import CustomSelectAutoComplete from '../autocomplete/components/CustomSelectAutoComplete'; @@ -35,48 +35,43 @@ function FileIOConfig() { } function ExtraFilesConfig() { - const [showTab, setshowTab] = useState(false); const Files = useSelector((state: RootState) => state.testdata); const userExtraFiles = useSelector((state: RootState) => state.config.user_extra_files); const judgeExtraFiles = useSelector((state: RootState) => state.config.judge_extra_files); const dispatch = useDispatch(); return ( - setshowTab(!showTab)} /> -
- - dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'user_extra_files', value: val.split(',') })} - multi - /> - )} - /> - dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'judge_extra_files', value: val.split(',') })} - multi - /> - )} - /> - -
+ + dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'user_extra_files', value: val.split(',') })} + multi + /> + )} + /> + dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'judge_extra_files', value: val.split(',') })} + multi + /> + )} + /> +
); } function LangConfig() { - const [showTab, setshowTab] = useState(false); const langs = useSelector((state: RootState) => state.config.langs) || []; const prefixes = new Set(Object.keys(LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0])); const data = Object.keys(LANGS).filter((i) => !prefixes.has(i)) @@ -88,21 +83,19 @@ function LangConfig() { ref.current.setSelectedKeys(selectedKeys); }, [JSON.stringify(selectedKeys)]); return ( - - setshowTab(!showTab)} /> - - { - const value = val.split(','); - value.push(...Array.from(new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0])))); - dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'langs', value }); - }} - multi - /> - + + { + const value = val.split(','); + value.push(...Array.from(new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0])))); + dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'langs', value }); + }} + multi + /> ); } diff --git a/packages/ui-default/locales/zh.yaml b/packages/ui-default/locales/zh.yaml index 7aaa46934..58c29c0ec 100644 --- a/packages/ui-default/locales/zh.yaml +++ b/packages/ui-default/locales/zh.yaml @@ -141,6 +141,7 @@ Compile Error: 编译错误 Compilers' Version and Parameters: 编译器版本及参数 Complete: 完成 Completed: 已完成 +Config: 配置 Confirm deleting the selected roles?: 您确定删除所选角色吗? Confirm deleting this comment? Its replies will be deleted as well.: 确认删除这个评论吗?回复会被同时删除。 Confirm deleting this reply?: 确认删除这个回复吗? @@ -825,6 +826,7 @@ Uncompleted: 未完成 Unique: 唯一 Unknown field {0}.: 未知字段 {0}。 Unknown: 未知 +Unlimited: 无限制 Unordered List: 无序列表 Unstar Topic: 取消收藏 Unstar: 取消收藏 diff --git a/packages/ui-default/pages/problem_config.page.styl b/packages/ui-default/pages/problem_config.page.styl index 8073be520..ef43e08a1 100644 --- a/packages/ui-default/pages/problem_config.page.styl +++ b/packages/ui-default/pages/problem_config.page.styl @@ -3,13 +3,6 @@ .problem-sidebar-testdata__detail max-height: 270px overflow-y: auto - - &.collapsed .collapsed--hidden, - &.expanded .expanded--hidden - display: none - - &.collapsed .problem-sidebar-testdata__detail - display: none .col--size width: 80px diff --git a/packages/ui-default/pages/problem_config.page.tsx b/packages/ui-default/pages/problem_config.page.tsx index 6fc7a1320..3e3c26691 100644 --- a/packages/ui-default/pages/problem_config.page.tsx +++ b/packages/ui-default/pages/problem_config.page.tsx @@ -1,5 +1,4 @@ import { NamedPage } from 'vj/misc/Page'; -import { slideDown, slideUp } from 'vj/utils/slide'; import request from 'vj/utils/request'; import loadReactRedux from 'vj/utils/loadReactRedux'; import i18n from 'vj/utils/i18n'; @@ -12,21 +11,6 @@ import tpl from 'vj/utils/tpl'; import { SubtaskType } from 'hydrooj/src/interface'; import { configYamlFormat } from 'vj/components/problemconfig/ProblemConfigEditor'; -async function handleSection(ev: JQuery.ClickEvent, type: string) { - const $section = $(ev.currentTarget).closest('.section--problem-sidebar-testdata'); - if ($section.is(`.${type}d, .animating`)) return; - $section.addClass('animating'); - const $detail = $section.find('.problem-sidebar-testdata__detail'); - if (type === 'expand') { - await slideDown($detail, 300, { opacity: 0 }, { opacity: 1 }); - } else { - await slideUp($detail, 300, { opacity: 1 }, { opacity: 0 }); - } - $section.addClass(type === 'expand' ? 'expanded' : 'collapsed'); - $section.removeClass(type === 'expand' ? 'collapsed' : 'expanded'); - $section.removeClass('animating'); -} - function onBeforeUnload(e) { e.returnValue = ''; } @@ -216,8 +200,6 @@ const page = new NamedPage('problem_config', () => { $(document).on('click', '[name="testdata__upload"]', () => handleClickUpload()); $(document).on('click', '[name="testdata__delete"]', (ev) => handleClickRemove(ev)); $(document).on('click', '[name="testdata__download__all"]', () => handleClickDownloadAll()); - $(document).on('click', '[name="testdata__section__expand"]', (ev) => handleSection(ev, 'expand')); - $(document).on('click', '[name="testdata__section__collapse"]', (ev) => handleSection(ev, 'collapse')); }); export default page; diff --git a/packages/ui-default/pages/problem_edit.page.styl b/packages/ui-default/pages/problem_edit.page.styl index 9492e71ea..7662dc97f 100644 --- a/packages/ui-default/pages/problem_edit.page.styl +++ b/packages/ui-default/pages/problem_edit.page.styl @@ -12,25 +12,10 @@ &.tab--active border-color: #ed5f82; - .section--problem-sidebar-tags - &.collapsed .collapsed--hidden, - &.expanded .expanded--hidden - display: none - - &.collapsed .problem-sidebar-tags__detail - display: none - .section--problem-sidebar-additional_file .problem-sidebar-additional_file__detail height: 270px overflow-y: auto - - &.collapsed .collapsed--hidden, - &.expanded .expanded--hidden - display: none - - &.collapsed .problem-sidebar-additional_file__detail - display: none .col--size width: 80px diff --git a/packages/ui-default/templates/partials/problem_sidebar_additional_file.html b/packages/ui-default/templates/partials/problem_sidebar_additional_file.html index 44ff10b3e..4d4ef2413 100644 --- a/packages/ui-default/templates/partials/problem_sidebar_additional_file.html +++ b/packages/ui-default/templates/partials/problem_sidebar_additional_file.html @@ -1,8 +1,8 @@ {% import "components/nothing.html" as nothing with context %} {% import "components/problem.html" as problem with context %} -
+
-

{{ additional_file.length if additional_file.length else 0 }} {{_('Additional File')}}

+

{{ additional_file.length|default(0) }} {{_('Additional File')}}

{% if additional_file.length %} diff --git a/packages/ui-default/templates/partials/problem_sidebar_testdata.html b/packages/ui-default/templates/partials/problem_sidebar_testdata.html index fcebdadcf..5d87c94db 100644 --- a/packages/ui-default/templates/partials/problem_sidebar_testdata.html +++ b/packages/ui-default/templates/partials/problem_sidebar_testdata.html @@ -1,6 +1,6 @@ {% import "components/nothing.html" as nothing with context %} {% import "components/problem.html" as problem with context %} -
-
+

{{ _('Categories') }} ({{ _('click to add') }})

-
{% include "partials/category.html" %} diff --git a/packages/ui-default/templates/problem_files.html b/packages/ui-default/templates/problem_files.html index 927144131..6e531d559 100644 --- a/packages/ui-default/templates/problem_files.html +++ b/packages/ui-default/templates/problem_files.html @@ -7,8 +7,9 @@

{{ _('Testdata') }}

{% if not reference and (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) %} - - + {{ _('Config') }} + + {% endif %}