@shzlx/ui-default 4.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/api.ts +61 -0
- package/backendlib/builder.ts +182 -0
- package/backendlib/markdown-it-imsize.ts +235 -0
- package/backendlib/markdown-it-katex.ts +139 -0
- package/backendlib/markdown-it-media.ts +163 -0
- package/backendlib/markdown-it-xss.ts +200 -0
- package/backendlib/markdown.js +64 -0
- package/backendlib/misc.ts +54 -0
- package/backendlib/template.ts +279 -0
- package/breakpoints.json +5 -0
- package/components/DOMAttachedObject.ts +128 -0
- package/components/autocomplete/AssignSelectAutoComplete.tsx +22 -0
- package/components/autocomplete/CustomSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/DomainSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/FileSelectAutoComplete.tsx +26 -0
- package/components/autocomplete/LanguageSelectAutoComplete.tsx +24 -0
- package/components/autocomplete/ProblemSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/UserSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/components/AssignSelectAutoComplete.tsx +118 -0
- package/components/autocomplete/components/DomainSelectAutoComplete.tsx +53 -0
- package/components/autocomplete/components/FileSelectAutoComplete.tsx +50 -0
- package/components/autocomplete/components/LanguageSelectAutoComplete.tsx +48 -0
- package/components/autocomplete/components/ProblemSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/components/UserSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/domainselectautocomplete.page.styl +6 -0
- package/components/autocomplete/index.tsx +110 -0
- package/components/autocomplete/problemselectautocomplete.page.styl +6 -0
- package/components/autocomplete/userselectautocomplete.page.styl +6 -0
- package/components/browser-update.page.ts +27 -0
- package/components/calendar/calendar.page.styl +129 -0
- package/components/calendar/index.js +367 -0
- package/components/clipboard.page.ts +23 -0
- package/components/contest/contest.page.styl +119 -0
- package/components/contest/contest.page.ts +23 -0
- package/components/contest/contest_sidebar.page.styl +21 -0
- package/components/contest/problem-contest-bg.png +0 -0
- package/components/contest/problem-contest-bg@2x.png +0 -0
- package/components/customFont.page.tsx +90 -0
- package/components/datepicker/datepicker.page.tsx +94 -0
- package/components/dialog/DomDialog.ts +145 -0
- package/components/dialog/dialog.page.styl +40 -0
- package/components/dialog/index.tsx +285 -0
- package/components/discussion/CommentBox.js +103 -0
- package/components/discussion/collapsible.page.styl +40 -0
- package/components/discussion/collapsible.page.tsx +62 -0
- package/components/discussion/comments.page.styl +142 -0
- package/components/discussion/comments.page.tsx +192 -0
- package/components/discussion/discussion.page.styl +17 -0
- package/components/discussion/history.page.tsx +81 -0
- package/components/discussion/reaction.page.styl +30 -0
- package/components/discussion/reaction.page.tsx +103 -0
- package/components/drop/drop.page.styl +40 -0
- package/components/dropdown/Dropdown.js +50 -0
- package/components/dropdown/dropdown.page.styl +33 -0
- package/components/dropdown/dropdown.page.ts +8 -0
- package/components/editor/cmeditor.page.ts +23 -0
- package/components/editor/cmeditor.styl +10 -0
- package/components/editor/index.tsx +293 -0
- package/components/editor/mdeditor.ts +60 -0
- package/components/editor/textareaHandler.ts +29 -0
- package/components/footer/footer.page.styl +94 -0
- package/components/footer/footer.page.ts +26 -0
- package/components/form/button.page.default.styl +59 -0
- package/components/form/button.page.styl +36 -0
- package/components/form/checkbox.page.styl +89 -0
- package/components/form/form.page.styl +200 -0
- package/components/form/form.page.ts +20 -0
- package/components/form/multiSelectCheckbox.page.js +46 -0
- package/components/form/radiobox.page.styl +62 -0
- package/components/form/select.page.styl +29 -0
- package/components/form/textbox.page.styl +79 -0
- package/components/form/textbox.page.ts +21 -0
- package/components/form/var.inc.styl +14 -0
- package/components/header/header.page.styl +79 -0
- package/components/highlighter/code-example.js +111 -0
- package/components/highlighter/highlighter.page.styl +99 -0
- package/components/highlighter/highlighter.page.ts +72 -0
- package/components/highlighter/meta.js +15 -0
- package/components/highlighter/prismjs.js +122 -0
- package/components/hint.page.styl +9 -0
- package/components/hint.ts +19 -0
- package/components/hitokoto/index.page.js +21 -0
- package/components/hotkey/hotkey.page.js +83 -0
- package/components/katex/katex.page.js +26 -0
- package/components/katex/katex.page.styl +2 -0
- package/components/languageselect.tsx +94 -0
- package/components/loader/loader.page.styl +40 -0
- package/components/mantine.page.tsx +39 -0
- package/components/marker/Marker.js +192 -0
- package/components/marker/MarkerReactive.js +55 -0
- package/components/marker/marker.page.js +8 -0
- package/components/marker/marker.page.styl +57 -0
- package/components/media/media.page.js +46 -0
- package/components/menu/menu-heading.page.js +28 -0
- package/components/menu/menu.page.js +18 -0
- package/components/menu/menu.page.styl +68 -0
- package/components/message/index.page.ts +166 -0
- package/components/message/worker.ts +110 -0
- package/components/messagepad/DialogueListItem.page.styl +28 -0
- package/components/messagepad/DialogueListItemComponent.jsx +39 -0
- package/components/messagepad/Message.page.styl +64 -0
- package/components/messagepad/MessageComponent.jsx +33 -0
- package/components/messagepad/MessagePad.page.styl +99 -0
- package/components/messagepad/MessagePadDialogueContentContainer.jsx +104 -0
- package/components/messagepad/MessagePadDialogueListContainer.jsx +49 -0
- package/components/messagepad/MessagePadInputContainer.jsx +100 -0
- package/components/messagepad/index.jsx +49 -0
- package/components/messagepad/reducers/activeId.ts +36 -0
- package/components/messagepad/reducers/dialogues.js +53 -0
- package/components/messagepad/reducers/index.ts +14 -0
- package/components/messagepad/reducers/inputs.js +43 -0
- package/components/messagepad/reducers/isPosting.ts +49 -0
- package/components/monaco/index.ts +178 -0
- package/components/monaco/languages/markdown.ts +97 -0
- package/components/monaco/languages/typescript.ts +45 -0
- package/components/monaco/languages/yaml.ts +22 -0
- package/components/monaco/loader.ts +96 -0
- package/components/monaco/monaco.styl +30 -0
- package/components/monaco/nls.js +31 -0
- package/components/monaco/schema/problemconfig.ts +123 -0
- package/components/navigation/hamburgers.page.styl +87 -0
- package/components/navigation/nav-logo-small_dark.png +0 -0
- package/components/navigation/navigation.page.js +203 -0
- package/components/navigation/navigation.page.styl +211 -0
- package/components/notification/index.ts +105 -0
- package/components/notification/notification.page.js +14 -0
- package/components/notification/notification.page.styl +84 -0
- package/components/nprogress.page.styl +50 -0
- package/components/omnisearch/index.page.tsx +124 -0
- package/components/omnisearch/omnibar.page.styl +138 -0
- package/components/pager/pager.page.styl +57 -0
- package/components/preview/preview.page.ts +187 -0
- package/components/problem/create.page.js +12 -0
- package/components/problem/list.page.js +9 -0
- package/components/problem/rp.page.styl +4 -0
- package/components/problem/tag.page.styl +84 -0
- package/components/problemconfig/BasicForm.tsx +92 -0
- package/components/problemconfig/ProblemConfigEditor.tsx +170 -0
- package/components/problemconfig/ProblemConfigForm.tsx +140 -0
- package/components/problemconfig/ProblemConfigTree.tsx +163 -0
- package/components/problemconfig/ProblemType.tsx +165 -0
- package/components/problemconfig/index.tsx +91 -0
- package/components/problemconfig/reducer/config.ts +173 -0
- package/components/problemconfig/reducer/index.ts +11 -0
- package/components/problemconfig/reducer/testdata.ts +16 -0
- package/components/problemconfig/tree/AddTestcase.tsx +137 -0
- package/components/problemconfig/tree/SelectionManager.tsx +140 -0
- package/components/problemconfig/tree/SubtaskSettings.tsx +180 -0
- package/components/problemconfig/tree/Testcase.tsx +98 -0
- package/components/profile/backgrounds/1.jpg +0 -0
- package/components/profile/backgrounds/10.jpg +0 -0
- package/components/profile/backgrounds/11.jpg +0 -0
- package/components/profile/backgrounds/12.jpg +0 -0
- package/components/profile/backgrounds/13.jpg +0 -0
- package/components/profile/backgrounds/14.jpg +0 -0
- package/components/profile/backgrounds/15.jpg +0 -0
- package/components/profile/backgrounds/16.jpg +0 -0
- package/components/profile/backgrounds/17.jpg +0 -0
- package/components/profile/backgrounds/18.jpg +0 -0
- package/components/profile/backgrounds/19.jpg +0 -0
- package/components/profile/backgrounds/2.jpg +0 -0
- package/components/profile/backgrounds/20.jpg +0 -0
- package/components/profile/backgrounds/21.jpg +0 -0
- package/components/profile/backgrounds/3.jpg +0 -0
- package/components/profile/backgrounds/4.jpg +0 -0
- package/components/profile/backgrounds/5.jpg +0 -0
- package/components/profile/backgrounds/6.jpg +0 -0
- package/components/profile/backgrounds/7.jpg +0 -0
- package/components/profile/backgrounds/8.jpg +0 -0
- package/components/profile/backgrounds/9.jpg +0 -0
- package/components/profile/backgrounds/gen_thumbnails.sh +7 -0
- package/components/profile/backgrounds/thumbnail/1.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/10.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/11.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/12.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/13.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/14.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/15.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/16.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/17.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/18.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/19.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/2.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/20.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/21.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/3.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/4.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/5.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/6.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/7.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/8.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/9.jpg +0 -0
- package/components/profile/profile.page.styl +23 -0
- package/components/react/DomComponent.tsx +14 -0
- package/components/react/IconComponent.tsx +20 -0
- package/components/record/record.page.styl +26 -0
- package/components/rotator/index.js +75 -0
- package/components/rotator/rotator.page.styl +20 -0
- package/components/scratchpad/DataInput.page.styl +17 -0
- package/components/scratchpad/DataInputComponent.jsx +45 -0
- package/components/scratchpad/Editor.page.styl +13 -0
- package/components/scratchpad/Panel.page.styl +18 -0
- package/components/scratchpad/PanelButton.page.styl +15 -0
- package/components/scratchpad/PanelButtonComponent.jsx +19 -0
- package/components/scratchpad/PanelComponent.jsx +25 -0
- package/components/scratchpad/ScratchpadEditorContainer.tsx +137 -0
- package/components/scratchpad/ScratchpadPretestContainer.jsx +57 -0
- package/components/scratchpad/ScratchpadRecordsContainer.jsx +45 -0
- package/components/scratchpad/ScratchpadRecordsRowContainer.jsx +83 -0
- package/components/scratchpad/ScratchpadSettings.tsx +48 -0
- package/components/scratchpad/ScratchpadToolbarContainer.jsx +190 -0
- package/components/scratchpad/Tab.page.styl +24 -0
- package/components/scratchpad/Toolbar.page.styl +53 -0
- package/components/scratchpad/ToolbarComponent.jsx +85 -0
- package/components/scratchpad/index.tsx +132 -0
- package/components/scratchpad/reducers/editor.ts +24 -0
- package/components/scratchpad/reducers/index.ts +17 -0
- package/components/scratchpad/reducers/pretest.ts +34 -0
- package/components/scratchpad/reducers/records.ts +40 -0
- package/components/scratchpad/reducers/state.ts +10 -0
- package/components/scratchpad/reducers/ui.ts +152 -0
- package/components/scratchpad/scratchpad.page.styl +55 -0
- package/components/scratchpad/var.inc.styl +2 -0
- package/components/selectUser.tsx +16 -0
- package/components/signin/signInDialog.page.js +84 -0
- package/components/signin/signin_dialog.page.styl +57 -0
- package/components/smoothscroll/smoothscroll.page.js +44 -0
- package/components/socket/index.ts +68 -0
- package/components/star/star.page.styl +20 -0
- package/components/star/star.page.ts +58 -0
- package/components/sticky/sticky.page.js +66 -0
- package/components/tab/Tab.js +168 -0
- package/components/tab/tab.page.js +9 -0
- package/components/tab/tab.page.styl +105 -0
- package/components/tab/var.inc.styl +3 -0
- package/components/table/StyledTable.js +51 -0
- package/components/table/styledTable.page.js +8 -0
- package/components/table/table.page.styl +73 -0
- package/components/time/time.page.js +47 -0
- package/components/tooltip/Tooltip.js +49 -0
- package/components/tooltip/tooltip.page.js +29 -0
- package/components/tooltip/tooltip.page.styl +69 -0
- package/components/training/training.page.styl +25 -0
- package/components/upload.tsx +103 -0
- package/components/vote/vote.page.js +43 -0
- package/components/zipDownloader/index.ts +157 -0
- package/constant/domain.js +21 -0
- package/constant/message.js +5 -0
- package/constant/record.js +52 -0
- package/context.ts +11 -0
- package/entry.js +72 -0
- package/hydro.ts +112 -0
- package/index.ts +226 -0
- package/lazyload.ts +69 -0
- package/locales/en.yaml +71 -0
- package/locales/ko.yaml +823 -0
- package/locales/zh.yaml +1137 -0
- package/locales/zh_TW.yaml +1133 -0
- package/misc/Page.ts +49 -0
- package/misc/PageLoader.js +31 -0
- package/misc/float.styl +14 -0
- package/misc/grid.styl +1048 -0
- package/misc/immersive-background.jpg +0 -0
- package/misc/immersive-background@2x.jpg +0 -0
- package/misc/immersive.styl +23 -0
- package/misc/nothing.styl +13 -0
- package/misc/puzzled_twd2.svg +1 -0
- package/misc/section.styl +105 -0
- package/misc/slideout.styl +46 -0
- package/misc/structure.styl +158 -0
- package/misc/textalign.styl +11 -0
- package/misc/typography.styl +485 -0
- package/package.json +148 -0
- package/polyfill.ts +90 -0
- package/postcss.config.js +15 -0
- package/sentry.ts +26 -0
- package/service-worker.ts +265 -0
- package/setting.yaml +98 -0
- package/templates/about.html +14 -0
- package/templates/bsod.html +35 -0
- package/templates/components/comments_discussion.html +165 -0
- package/templates/components/comments_solution.html +171 -0
- package/templates/components/contest.html +12 -0
- package/templates/components/form.html +214 -0
- package/templates/components/home.html +20 -0
- package/templates/components/homework.html +8 -0
- package/templates/components/md_hint.html +39 -0
- package/templates/components/noscript_note.html +15 -0
- package/templates/components/nothing.html +6 -0
- package/templates/components/paginator.html +25 -0
- package/templates/components/problem.html +33 -0
- package/templates/components/record.html +21 -0
- package/templates/components/sidemenu.html +11 -0
- package/templates/components/user.html +49 -0
- package/templates/contest_balloon.html +48 -0
- package/templates/contest_clarification.html +103 -0
- package/templates/contest_detail.html +56 -0
- package/templates/contest_edit.html +259 -0
- package/templates/contest_main.html +146 -0
- package/templates/contest_manage.html +80 -0
- package/templates/contest_print.html +27 -0
- package/templates/contest_problemlist.html +231 -0
- package/templates/contest_scoreboard.html +46 -0
- package/templates/contest_scoreboard_download_html.html +71 -0
- package/templates/contest_user.html +47 -0
- package/templates/discussion_create.html +28 -0
- package/templates/discussion_detail.html +149 -0
- package/templates/discussion_edit.html +30 -0
- package/templates/discussion_main_or_node.html +47 -0
- package/templates/domain_base.html +26 -0
- package/templates/domain_create.html +55 -0
- package/templates/domain_dashboard.html +45 -0
- package/templates/domain_edit.html +6 -0
- package/templates/domain_group.html +51 -0
- package/templates/domain_join.html +47 -0
- package/templates/domain_join_applications.html +67 -0
- package/templates/domain_permission.html +66 -0
- package/templates/domain_role.html +71 -0
- package/templates/domain_user.html +86 -0
- package/templates/domain_user_raw.html +5 -0
- package/templates/error.html +25 -0
- package/templates/home_domain.html +64 -0
- package/templates/home_files.html +16 -0
- package/templates/home_messages.html +9 -0
- package/templates/home_security.html +224 -0
- package/templates/home_settings.html +21 -0
- package/templates/homework_detail.html +82 -0
- package/templates/homework_edit.html +138 -0
- package/templates/homework_files.html +24 -0
- package/templates/homework_main.html +76 -0
- package/templates/layout/basic.html +27 -0
- package/templates/layout/home_base.html +13 -0
- package/templates/layout/html5.html +74 -0
- package/templates/layout/immersive.html +22 -0
- package/templates/layout/mail.html +31 -0
- package/templates/layout/simple.html +4 -0
- package/templates/layout/wiki_base.html +16 -0
- package/templates/main.html +22 -0
- package/templates/manage_base.html +24 -0
- package/templates/manage_config.html +6 -0
- package/templates/manage_dashboard.html +27 -0
- package/templates/manage_script.html +56 -0
- package/templates/manage_setting.html +6 -0
- package/templates/manage_user_import.html +23 -0
- package/templates/manage_user_priv.html +76 -0
- package/templates/partials/category.html +19 -0
- package/templates/partials/contest.html +3 -0
- package/templates/partials/contest_balloon.html +37 -0
- package/templates/partials/contest_sidebar.html +150 -0
- package/templates/partials/contest_sidebar_management.html +56 -0
- package/templates/partials/contest_user.html +19 -0
- package/templates/partials/discussion_edit_form.html +45 -0
- package/templates/partials/discussion_list.html +50 -0
- package/templates/partials/discussion_nodes_widget.html +17 -0
- package/templates/partials/files.html +49 -0
- package/templates/partials/footer.html +108 -0
- package/templates/partials/hamburger.html +7 -0
- package/templates/partials/header_mobile.html +12 -0
- package/templates/partials/homepage/bulletin.html +7 -0
- package/templates/partials/homepage/contest.html +48 -0
- package/templates/partials/homepage/discussion.html +13 -0
- package/templates/partials/homepage/discussion_nodes.html +4 -0
- package/templates/partials/homepage/error.html +5 -0
- package/templates/partials/homepage/hitokoto.html +6 -0
- package/templates/partials/homepage/homework.html +45 -0
- package/templates/partials/homepage/problem_search.html +13 -0
- package/templates/partials/homepage/ranking.html +39 -0
- package/templates/partials/homepage/recent_problems.html +17 -0
- package/templates/partials/homepage/starred_problems.html +15 -0
- package/templates/partials/homepage/suggestion.html +34 -0
- package/templates/partials/homepage/training.html +50 -0
- package/templates/partials/homework.html +3 -0
- package/templates/partials/homework_default_penalty_rules.yaml +6 -0
- package/templates/partials/homework_sidebar.html +93 -0
- package/templates/partials/login_dialog.html +56 -0
- package/templates/partials/manage_user_priv.html +78 -0
- package/templates/partials/nav.html +138 -0
- package/templates/partials/problem-sidebar-information.html +25 -0
- package/templates/partials/problem.html +2 -0
- package/templates/partials/problem_category_dialog.html +43 -0
- package/templates/partials/problem_default.md +26 -0
- package/templates/partials/problem_description.html +33 -0
- package/templates/partials/problem_files.html +63 -0
- package/templates/partials/problem_list.html +68 -0
- package/templates/partials/problem_lucky.html +10 -0
- package/templates/partials/problem_sidebar.html +14 -0
- package/templates/partials/problem_sidebar_contest.html +43 -0
- package/templates/partials/problem_sidebar_homework.html +42 -0
- package/templates/partials/problem_sidebar_normal.html +152 -0
- package/templates/partials/problem_stat.html +3 -0
- package/templates/partials/scoreboard.html +79 -0
- package/templates/partials/setting.html +92 -0
- package/templates/partials/training_default.json +14 -0
- package/templates/partials/training_detail.html +153 -0
- package/templates/partials/user.html +2 -0
- package/templates/partials/user_detail/activity.html +18 -0
- package/templates/partials/user_detail/solution.html +29 -0
- package/templates/problem_config.html +39 -0
- package/templates/problem_detail.html +150 -0
- package/templates/problem_edit.html +111 -0
- package/templates/problem_files.html +91 -0
- package/templates/problem_hack.html +41 -0
- package/templates/problem_import.html +58 -0
- package/templates/problem_main.html +100 -0
- package/templates/problem_solution.html +55 -0
- package/templates/problem_statistics.html +96 -0
- package/templates/problem_submit.html +40 -0
- package/templates/ranking.html +81 -0
- package/templates/record_detail.html +134 -0
- package/templates/record_detail_status.html +93 -0
- package/templates/record_detail_summary.html +19 -0
- package/templates/record_main.html +142 -0
- package/templates/record_main_tr.html +35 -0
- package/templates/status.html +75 -0
- package/templates/training_detail.html +120 -0
- package/templates/training_edit.html +68 -0
- package/templates/training_files.html +64 -0
- package/templates/training_main.html +107 -0
- package/templates/user_changemail_mail.html +6 -0
- package/templates/user_changemail_mail_sent.html +9 -0
- package/templates/user_delete_pending.html +10 -0
- package/templates/user_detail.html +181 -0
- package/templates/user_login.html +46 -0
- package/templates/user_logout.html +13 -0
- package/templates/user_lostpass.html +27 -0
- package/templates/user_lostpass_mail.html +6 -0
- package/templates/user_lostpass_mail_sent.html +9 -0
- package/templates/user_lostpass_with_code.html +29 -0
- package/templates/user_register.html +22 -0
- package/templates/user_register_mail.html +6 -0
- package/templates/user_register_mail_sent.html +9 -0
- package/templates/user_register_with_code.html +35 -0
- package/templates/user_sudo.html +54 -0
- package/templates/user_sudo_redirect.html +18 -0
- package/templates/wiki_help.html +189 -0
- package/theme/bp6-compat.css +48 -0
- package/theme/dark.styl +397 -0
- package/theme/default.js +33 -0
- package/typed.d.ts +20 -0
- package/utils/base.ts +209 -0
- package/utils/base64.js +104 -0
- package/utils/db.ts +32 -0
- package/utils/index.ts +73 -0
- package/utils/loadReactRedux.ts +32 -0
- package/utils/mediaQuery.ts +13 -0
- package/utils/pjax.js +148 -0
- package/utils/slide.ts +57 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
.omnibar {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0px;
|
|
4
|
+
left: 0px;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
8
|
+
backdrop-filter: blur(3px);
|
|
9
|
+
z-index: 999;
|
|
10
|
+
transition: 0.2s;
|
|
11
|
+
}
|
|
12
|
+
.omnibar-main {
|
|
13
|
+
height: min(600px, 100% - 20px);
|
|
14
|
+
width: min(750px, 60%);
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 50%;
|
|
17
|
+
left: 50%;
|
|
18
|
+
transform: translate(-50%, -50%);
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
>div:first-child {
|
|
22
|
+
transition: 0.2s;
|
|
23
|
+
margin-bottom: 10px;
|
|
24
|
+
input {
|
|
25
|
+
background-color: #fff;
|
|
26
|
+
border-radius: 5px;
|
|
27
|
+
border: 2px solid #aaa;
|
|
28
|
+
padding-left: 42px;
|
|
29
|
+
height: 48px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
font-size: 18px;
|
|
32
|
+
outline: 0;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
span {
|
|
36
|
+
height: 48px;
|
|
37
|
+
width: 48px;
|
|
38
|
+
position: absolute;
|
|
39
|
+
display: grid;
|
|
40
|
+
scale: 1.5;
|
|
41
|
+
place-items: center;
|
|
42
|
+
top: 0px;
|
|
43
|
+
left: 0px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
>div:last-child {
|
|
47
|
+
flex: 1;
|
|
48
|
+
scrollbar-width: none;
|
|
49
|
+
-ms-overflow-style: none;
|
|
50
|
+
overflow-x: hidden;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
&::-webkit-scrollbar { width: 0 !important; }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
.omnibar-toggle {
|
|
56
|
+
z-index: 99;
|
|
57
|
+
background: white;
|
|
58
|
+
display: grid;
|
|
59
|
+
place-items: center;
|
|
60
|
+
width: 40px;
|
|
61
|
+
height: 40px;
|
|
62
|
+
position: fixed;
|
|
63
|
+
right: 20px;
|
|
64
|
+
bottom: 30px;
|
|
65
|
+
transition: 0.2s;
|
|
66
|
+
border-radius: 5px;
|
|
67
|
+
&:hover {
|
|
68
|
+
background: #ccc;
|
|
69
|
+
}
|
|
70
|
+
span {
|
|
71
|
+
scale: 1.5;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
#omnibar-content {
|
|
75
|
+
overscroll-behavior: none;
|
|
76
|
+
}
|
|
77
|
+
.omnibar-content-title {
|
|
78
|
+
text-align: left;
|
|
79
|
+
margin-bottom: 10px;
|
|
80
|
+
width: 100%;
|
|
81
|
+
font-size: 18px;
|
|
82
|
+
font-weight: bold;
|
|
83
|
+
}
|
|
84
|
+
.omnibar-content-section {
|
|
85
|
+
background: white;
|
|
86
|
+
border-radius: 10px;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
padding: 10px;
|
|
91
|
+
line-height: 1;
|
|
92
|
+
margin-bottom: 10px;
|
|
93
|
+
border: 2px solid #888;
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
width: 100%;
|
|
96
|
+
text-decoration: none !important;
|
|
97
|
+
&:hover {
|
|
98
|
+
background: #eee;
|
|
99
|
+
}
|
|
100
|
+
>div {
|
|
101
|
+
width: 100%;
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.omnibar-user img {
|
|
108
|
+
height: 36px;
|
|
109
|
+
width: 36px;
|
|
110
|
+
border-radius: 50%;
|
|
111
|
+
margin-right: 10px;
|
|
112
|
+
}
|
|
113
|
+
.omnibar-user-info {
|
|
114
|
+
>span {
|
|
115
|
+
font-size: 14px;
|
|
116
|
+
margin-bottom: 3px;
|
|
117
|
+
display: inline-block;
|
|
118
|
+
}
|
|
119
|
+
>div {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: row;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.omnibar-problem a {
|
|
126
|
+
margin: 2px 0px 3px 0px;
|
|
127
|
+
}
|
|
128
|
+
.omnibar-problem .icon {
|
|
129
|
+
margin-right: 3px;
|
|
130
|
+
&:not(:first-child) {
|
|
131
|
+
margin-left: 10px;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
@media print {
|
|
135
|
+
.omnibar, .omnibar-toggle {
|
|
136
|
+
display: none;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.pager
|
|
2
|
+
text-align: center
|
|
3
|
+
font-size: rem($font-size-small)
|
|
4
|
+
|
|
5
|
+
&:empty
|
|
6
|
+
display: none
|
|
7
|
+
|
|
8
|
+
&.pager-bottom
|
|
9
|
+
margin-bottom: rem(10px)
|
|
10
|
+
border-top: 2px solid $pager-border-color
|
|
11
|
+
|
|
12
|
+
.pager__item
|
|
13
|
+
border-top: 2px solid $pager-border-color
|
|
14
|
+
|
|
15
|
+
&.pager-top
|
|
16
|
+
margin-top: rem(10px)
|
|
17
|
+
border-bottom: 2px solid $pager-border-color
|
|
18
|
+
|
|
19
|
+
.pager__item
|
|
20
|
+
border-bottom: 2px solid $pager-border-color
|
|
21
|
+
|
|
22
|
+
li
|
|
23
|
+
margin: 0
|
|
24
|
+
display: inline-block
|
|
25
|
+
margin-top: -2px
|
|
26
|
+
|
|
27
|
+
.pager__item
|
|
28
|
+
display: inline-block
|
|
29
|
+
padding: rem(10px)
|
|
30
|
+
text-decoration: none
|
|
31
|
+
border: 0
|
|
32
|
+
transition: border-top .2s linear, color .2s linear
|
|
33
|
+
color: #a7a7a7
|
|
34
|
+
|
|
35
|
+
&.link
|
|
36
|
+
&, .typo &
|
|
37
|
+
color: #a7a7a7
|
|
38
|
+
|
|
39
|
+
&:hover
|
|
40
|
+
border-color: $primary-color
|
|
41
|
+
text-decoration: none
|
|
42
|
+
&, .typo &
|
|
43
|
+
color: #666
|
|
44
|
+
|
|
45
|
+
&.current
|
|
46
|
+
color: $secondary-color !important
|
|
47
|
+
border-color: $secondary-color !important
|
|
48
|
+
|
|
49
|
+
+mobile()
|
|
50
|
+
.pager__item
|
|
51
|
+
&.ellipsis,
|
|
52
|
+
&.first,
|
|
53
|
+
&.previous,
|
|
54
|
+
&.next,
|
|
55
|
+
&.last
|
|
56
|
+
display: none
|
|
57
|
+
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import Clipboard from 'clipboard';
|
|
2
|
+
import $ from 'jquery';
|
|
3
|
+
import { nanoid } from 'nanoid';
|
|
4
|
+
import { ActionDialog, InfoDialog } from 'vj/components/dialog/index';
|
|
5
|
+
import Notification from 'vj/components/notification';
|
|
6
|
+
import { AutoloadPage } from 'vj/misc/Page';
|
|
7
|
+
import { i18n, request, tpl } from 'vj/utils';
|
|
8
|
+
import uploadFiles from '../upload';
|
|
9
|
+
|
|
10
|
+
async function startEdit(filename, value, fileCategory = 'file') {
|
|
11
|
+
const { default: Editor } = await import('vj/components/editor/index');
|
|
12
|
+
const promise = new ActionDialog({
|
|
13
|
+
$body: tpl`
|
|
14
|
+
<div class="typo" style="width: 100%; height: 100%">
|
|
15
|
+
<textarea name="fileContent" style="width: 100%; height: 100%"></textarea>
|
|
16
|
+
</div>`,
|
|
17
|
+
width: `${window.innerWidth - 200}px`,
|
|
18
|
+
height: `${window.innerHeight - 100}px`,
|
|
19
|
+
cancelByEsc: false,
|
|
20
|
+
}).open();
|
|
21
|
+
const languages = [
|
|
22
|
+
['yaml', ['yaml', 'yml']],
|
|
23
|
+
['cpp', ['c', 'cc', 'cpp', 'h', 'hpp']],
|
|
24
|
+
['json', ['json']],
|
|
25
|
+
['plain', ['in', 'out', 'ans']],
|
|
26
|
+
];
|
|
27
|
+
const language = languages.filter((i) => i[1].includes(filename.split('.').pop()))[0]?.[0] || 'auto';
|
|
28
|
+
const editor = new Editor($('[name="fileContent"]'), {
|
|
29
|
+
value,
|
|
30
|
+
autoResize: false,
|
|
31
|
+
autoLayout: false,
|
|
32
|
+
language: (language as string),
|
|
33
|
+
model: `hydro://problem/${fileCategory}/${filename}`,
|
|
34
|
+
});
|
|
35
|
+
const action = await promise;
|
|
36
|
+
value = (editor.value() as string).replace(/\r\n/g, '\n');
|
|
37
|
+
editor.destroy();
|
|
38
|
+
if (action !== 'ok') return null;
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const dialogAction = (id) => [
|
|
43
|
+
tpl`<button class="rounded button" data-action="copy" id="copy-${id}">${i18n('Copy Link')}</button>`,
|
|
44
|
+
tpl`<button class="rounded button" data-action="download">${i18n('Download')}</button>`,
|
|
45
|
+
tpl`<button class="primary rounded button" data-action="ok">${i18n('Ok')}</button>`,
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
function bindCopyLink(id, src: string) {
|
|
49
|
+
// Usually brackets are allowed in URLs, but in markdown there's need to escape them
|
|
50
|
+
src = src.replace(/\(/g, '%28').replace(/\)/g, '%29');
|
|
51
|
+
const url = !['file', 'files'].some((i) => window.location.href.endsWith(i))
|
|
52
|
+
|| ['homework', 'training'].some((i) => window.location.href.match(`${i}/.*/file`))
|
|
53
|
+
? `file://${src.substring(src.lastIndexOf('/') + 1)}` : src;
|
|
54
|
+
const clip = new Clipboard(`#copy-${id}`, { text: () => url });
|
|
55
|
+
clip.on('success', () => Notification.success(i18n(`${url.startsWith('file://') ? 'Reference' : 'Download'} link copied to clipboard!`)));
|
|
56
|
+
clip.on('error', () => Notification.error(i18n('Copy failed :(')));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function previewVideo(link) {
|
|
60
|
+
const id = nanoid();
|
|
61
|
+
const dialog = new InfoDialog({
|
|
62
|
+
$body: tpl`
|
|
63
|
+
<div class="typo"><video width="100%" controls>
|
|
64
|
+
<source src="${link}" type="${link.endsWith('ogg') ? 'video/ogg' : 'video/mp4'}">
|
|
65
|
+
Your browser doesn't support video tag.
|
|
66
|
+
</video></div>`,
|
|
67
|
+
$action: dialogAction(id),
|
|
68
|
+
});
|
|
69
|
+
bindCopyLink(id, link);
|
|
70
|
+
const action = await dialog.open();
|
|
71
|
+
if (action === 'download') window.open(link);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function previewImage(link) {
|
|
75
|
+
const id = nanoid();
|
|
76
|
+
const dialog = new InfoDialog({
|
|
77
|
+
$body: tpl`<div class="typo"><img src="${link}" style="max-height: calc(80vh - 45px);"></img></div>`,
|
|
78
|
+
$action: dialogAction(id),
|
|
79
|
+
});
|
|
80
|
+
bindCopyLink(id, link);
|
|
81
|
+
const action = await dialog.open();
|
|
82
|
+
if (action === 'download') window.open(link);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function previewPDF(link) {
|
|
86
|
+
const uuidURL = URL.createObjectURL(new Blob());
|
|
87
|
+
const uuid = uuidURL.toString();
|
|
88
|
+
URL.revokeObjectURL(uuidURL);
|
|
89
|
+
const id = nanoid();
|
|
90
|
+
const dialog = new InfoDialog({
|
|
91
|
+
$body: tpl`
|
|
92
|
+
<div class="typo" style="height: 100%;">
|
|
93
|
+
<object classid="clsid:${(uuid.substring(uuid.lastIndexOf('/') + 1))}">
|
|
94
|
+
<param name="SRC" value="${link}" >
|
|
95
|
+
<embed width="100%" style="height: 100%;border: none;" src="${link}">
|
|
96
|
+
<noembed></noembed>
|
|
97
|
+
</embed>
|
|
98
|
+
</object>
|
|
99
|
+
</div>`,
|
|
100
|
+
width: `${window.innerWidth - 200}px`,
|
|
101
|
+
height: `${window.innerHeight - 100}px`,
|
|
102
|
+
$action: dialogAction(id),
|
|
103
|
+
});
|
|
104
|
+
bindCopyLink(id, link);
|
|
105
|
+
const action = await dialog.open();
|
|
106
|
+
if (action === 'download') window.open(link);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function previewOffice(link, src) {
|
|
110
|
+
const id = nanoid();
|
|
111
|
+
const dialog = new InfoDialog({
|
|
112
|
+
$body: tpl`
|
|
113
|
+
<div class="typo">
|
|
114
|
+
<iframe src="https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(new URL(src, window.location.href).toString())}"
|
|
115
|
+
scrolling="no" border="0" frameborder="no" framespacing="0" width="100%" style="height: 70vh;"></iframe>
|
|
116
|
+
</div>`,
|
|
117
|
+
width: `${window.innerWidth - 200}px`,
|
|
118
|
+
height: `${window.innerHeight - 100}px`,
|
|
119
|
+
$action: dialogAction(id),
|
|
120
|
+
});
|
|
121
|
+
bindCopyLink(id, link);
|
|
122
|
+
const action = await dialog.open();
|
|
123
|
+
if (action === 'download') window.open(link);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export async function previewFile(ev?, type = '') {
|
|
127
|
+
if (ev?.metaKey || ev?.ctrlKey || ev?.shiftKey) return null;
|
|
128
|
+
if (ev) ev.preventDefault();
|
|
129
|
+
const filename = ev
|
|
130
|
+
? ev.currentTarget.closest('[data-filename]').getAttribute('data-filename')
|
|
131
|
+
// eslint-disable-next-line no-alert
|
|
132
|
+
: prompt(i18n('Filename'));
|
|
133
|
+
if (!filename) return null;
|
|
134
|
+
const filesize = ev
|
|
135
|
+
? +ev.currentTarget.closest('[data-size]').getAttribute('data-size')
|
|
136
|
+
: 0;
|
|
137
|
+
let content = '';
|
|
138
|
+
if (ev) {
|
|
139
|
+
const link = $(ev.currentTarget).find('a').attr('href');
|
|
140
|
+
if (!link) return null;
|
|
141
|
+
type ||= ev.currentTarget.getAttribute('data-preview');
|
|
142
|
+
const ext = filename.split('.').pop().toLowerCase();
|
|
143
|
+
if (['zip', 'rar', '7z'].includes(ext) || filesize > 8 * 1024 * 1024) {
|
|
144
|
+
const id = nanoid();
|
|
145
|
+
const dialog = new ActionDialog({
|
|
146
|
+
$body: tpl.typoMsg(i18n('Cannot preview this file. Download now?')),
|
|
147
|
+
$action: dialogAction(id),
|
|
148
|
+
});
|
|
149
|
+
bindCopyLink(id, link);
|
|
150
|
+
const action = await dialog.open();
|
|
151
|
+
if (action === 'ok') window.open(link);
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
if (['mp4', 'webm', 'ogg'].includes(ext)) return previewVideo(link);
|
|
155
|
+
if (['png', 'jpeg', 'jpg', 'gif', 'webp', 'bmp'].includes(ext)) return previewImage(link);
|
|
156
|
+
if (ext === 'pdf') return previewPDF(`${link}${link.includes('?') ? '&' : '?'}noDisposition=1`);
|
|
157
|
+
Notification.info(i18n('Loading file...'));
|
|
158
|
+
try {
|
|
159
|
+
const { url } = await request.get(link, {}, { headers: { Pragma: 'no-cache' } });
|
|
160
|
+
if (/^(?:doc|xls|ppt)x?$/.test(ext)) return previewOffice(link, url);
|
|
161
|
+
content = await request.get(url, undefined, { dataType: 'text' });
|
|
162
|
+
} catch (e) {
|
|
163
|
+
Notification.error(i18n('Failed to load file: {0}', e.message));
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
} else Notification.info(i18n('Loading editor...'));
|
|
167
|
+
const val = await startEdit(filename, content, type || 'file');
|
|
168
|
+
if (typeof val !== 'string') return null;
|
|
169
|
+
const file = new File([val], filename, { type: 'text/plain' });
|
|
170
|
+
const endpoint = new URL(!window.location.href.endsWith('/files')
|
|
171
|
+
? `${window.location.href.substring(0, window.location.href.lastIndexOf('/'))}/files` : '', window.location.href);
|
|
172
|
+
const sidebarType = type || $(ev.currentTarget).closest('[data-fragment-id]').data('type');
|
|
173
|
+
const sidebar = ev && $(ev.currentTarget).closest('[data-fragment-id]').data('sidebar') !== undefined;
|
|
174
|
+
await uploadFiles(endpoint.toString(), [file], {
|
|
175
|
+
type: sidebarType || type,
|
|
176
|
+
sidebar,
|
|
177
|
+
pjax: true,
|
|
178
|
+
});
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const dataPreviewPage = new AutoloadPage('dataPreview', () => {
|
|
183
|
+
$(document).on('click', '[data-preview]', previewFile);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
window.Hydro.components.preview = { startEdit, previewFile };
|
|
187
|
+
export default dataPreviewPage;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import { alert } from 'vj/components/dialog';
|
|
3
|
+
import { NamedPage } from 'vj/misc/Page';
|
|
4
|
+
import { i18n } from 'vj/utils';
|
|
5
|
+
|
|
6
|
+
export default new NamedPage(['problem_create', 'problem_edit'], () => {
|
|
7
|
+
$('input[name="pid"]').on('blur', () => {
|
|
8
|
+
if (/^[0-9]+$/.test($('input[name="pid"]').val())) {
|
|
9
|
+
alert(i18n('Problem ID cannot be a pure number. Leave blank if you want to use numberic id.'));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import { AutoloadPage } from 'vj/misc/Page';
|
|
3
|
+
|
|
4
|
+
export default new AutoloadPage('problemListPage', () => {
|
|
5
|
+
$('.col--problem-name>a').attr('target', '_blank');
|
|
6
|
+
$(document).on('vjContentNew', () => {
|
|
7
|
+
$('.col--problem-name>a').attr('target', '_blank');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.problem__tags
|
|
2
|
+
margin: 0 !important
|
|
3
|
+
padding: 0 !important
|
|
4
|
+
list-style: none !important
|
|
5
|
+
font-size: 0
|
|
6
|
+
word-break: keep-all
|
|
7
|
+
display: flex
|
|
8
|
+
flex-wrap: wrap
|
|
9
|
+
|
|
10
|
+
.problem__tag
|
|
11
|
+
display: inline-block
|
|
12
|
+
vertical-align: top
|
|
13
|
+
height: rem($table-lh)
|
|
14
|
+
margin: rem(0 2px 2px 0) !important
|
|
15
|
+
padding: 0 !important
|
|
16
|
+
|
|
17
|
+
.problem__tag-item
|
|
18
|
+
padding: 0 10px !important
|
|
19
|
+
margin-left: rem(3px)
|
|
20
|
+
margin-bottom: rem(5px)
|
|
21
|
+
line-height: 30px !important
|
|
22
|
+
display: inline-flex
|
|
23
|
+
flex-direction: row
|
|
24
|
+
align-items: center
|
|
25
|
+
border: none
|
|
26
|
+
border-radius: 2px
|
|
27
|
+
box-shadow: none
|
|
28
|
+
font-size: 14px
|
|
29
|
+
line-height: 18px
|
|
30
|
+
max-width: 100%
|
|
31
|
+
min-height: 30px
|
|
32
|
+
min-width: 30px
|
|
33
|
+
padding: 6px 8px
|
|
34
|
+
position: relative
|
|
35
|
+
background-color: rgba(143, 153, 168, 0.15)
|
|
36
|
+
color: #1c2127
|
|
37
|
+
&:hover
|
|
38
|
+
text-decoration: none
|
|
39
|
+
> span
|
|
40
|
+
display: flex
|
|
41
|
+
align-items: center
|
|
42
|
+
> *
|
|
43
|
+
flex-grow: 0
|
|
44
|
+
flex-shrink: 0
|
|
45
|
+
margin-right: 8px
|
|
46
|
+
&:before,
|
|
47
|
+
> *
|
|
48
|
+
margin-right: 4px
|
|
49
|
+
> :last-child
|
|
50
|
+
margin-right: 0
|
|
51
|
+
&:focus
|
|
52
|
+
outline: rgba(33, 93, 176, 0.752) solid 2px
|
|
53
|
+
outline-offset: 0
|
|
54
|
+
-moz-outline-radius: 6px
|
|
55
|
+
&.interactive
|
|
56
|
+
cursor: pointer
|
|
57
|
+
&:hover
|
|
58
|
+
background: rgba(143, 153, 168, 0.3)
|
|
59
|
+
color: #111418
|
|
60
|
+
|
|
61
|
+
.problem__tag-link
|
|
62
|
+
display: inline-block
|
|
63
|
+
padding: rem(0 7px)
|
|
64
|
+
overflow: hidden
|
|
65
|
+
text-overflow: ellipsis
|
|
66
|
+
white-space: nowrap
|
|
67
|
+
max-width: rem(250px)
|
|
68
|
+
line-height: rem($table-lh)
|
|
69
|
+
height: rem($table-lh)
|
|
70
|
+
background: #F0F0F0
|
|
71
|
+
color: $text-1-color !important
|
|
72
|
+
font-size: rem($font-size-small)
|
|
73
|
+
|
|
74
|
+
&:hover
|
|
75
|
+
background: $primary-color
|
|
76
|
+
color: #FFF !important
|
|
77
|
+
text-decoration: none
|
|
78
|
+
|
|
79
|
+
.col--problem-name
|
|
80
|
+
.problem__tags
|
|
81
|
+
float: right
|
|
82
|
+
|
|
83
|
+
.problem__tag
|
|
84
|
+
margin: rem(0 2px 0 0) !important
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
import { i18n } from 'vj/utils';
|
|
4
|
+
import FileSelectAutoComplete from '../autocomplete/components/FileSelectAutoComplete';
|
|
5
|
+
import LanguageSelectAutoComplete from '../autocomplete/components/LanguageSelectAutoComplete';
|
|
6
|
+
import type { RootState } from './reducer/index';
|
|
7
|
+
|
|
8
|
+
export function FormItem({
|
|
9
|
+
columns, label, children, helpText = '', disableLabel = false, ...props
|
|
10
|
+
}) {
|
|
11
|
+
return (
|
|
12
|
+
<div {...props} className={`${columns && `medium-${columns}`} columns form__item`}>
|
|
13
|
+
<label htmlFor={`${label}-form`}>
|
|
14
|
+
{!disableLabel && i18n(label)}
|
|
15
|
+
{children}
|
|
16
|
+
{helpText && (<p className="help-text">{i18n(helpText)}</p>)}
|
|
17
|
+
</label>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type KeyType<K, T = string | number> = {
|
|
23
|
+
[Q in keyof K]: K[Q] extends T ? Q : never;
|
|
24
|
+
}[keyof K];
|
|
25
|
+
type FileSelectKey = 'checker' | 'interactor' | 'manager';
|
|
26
|
+
|
|
27
|
+
export function ManagedInput({ placeholder, formKey }: { placeholder?: string, formKey: KeyType<RootState['config']> }) {
|
|
28
|
+
const value = useSelector((state: RootState) => state.config[formKey]);
|
|
29
|
+
const dispatch = useDispatch();
|
|
30
|
+
return (
|
|
31
|
+
<input
|
|
32
|
+
placeholder={i18n(placeholder)}
|
|
33
|
+
value={value || ''}
|
|
34
|
+
type={typeof value === 'number' ? 'number' : 'text'}
|
|
35
|
+
onChange={(ev) => {
|
|
36
|
+
dispatch({ type: 'CONFIG_FORM_UPDATE', key: formKey, value: ev.currentTarget.value });
|
|
37
|
+
}}
|
|
38
|
+
className="textbox"
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function ManagedSelect({ options, formKey }: { options: string[], formKey: KeyType<RootState['config']> }) {
|
|
44
|
+
const value = useSelector((state: RootState) => state.config[formKey]);
|
|
45
|
+
const dispatch = useDispatch();
|
|
46
|
+
return (
|
|
47
|
+
<select
|
|
48
|
+
value={value || ''}
|
|
49
|
+
onChange={(ev) => {
|
|
50
|
+
dispatch({ type: 'CONFIG_FORM_UPDATE', key: formKey, value: ev.currentTarget.value });
|
|
51
|
+
}}
|
|
52
|
+
className="select"
|
|
53
|
+
>
|
|
54
|
+
{options.map((o) => (<option id={o} key={o}>{o}</option>))}
|
|
55
|
+
</select>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function SingleFileSelect({ formKey, withLang = false, label = 'Checker' }: { formKey: FileSelectKey, withLang?: boolean, label?: string }) {
|
|
60
|
+
const value = useSelector((state: RootState) => state.config[formKey]);
|
|
61
|
+
const Files = useSelector((state: RootState) => state.testdata);
|
|
62
|
+
const dispatch = useDispatch();
|
|
63
|
+
const selectedFile = typeof value === 'string' ? value : value?.file || '';
|
|
64
|
+
const selectedLang = typeof value === 'string' ? 'auto' : value?.lang || 'auto';
|
|
65
|
+
const update = (file: string, lang: string) => {
|
|
66
|
+
if (file === selectedFile && lang === selectedLang) return;
|
|
67
|
+
if (withLang) dispatch({ type: 'CONFIG_FORM_UPDATE', key: formKey, value: file ? { file, lang } : null });
|
|
68
|
+
else dispatch({ type: 'CONFIG_FORM_UPDATE', key: formKey, value: file });
|
|
69
|
+
};
|
|
70
|
+
return withLang ? (<>
|
|
71
|
+
<FormItem columns={5} label={label}>
|
|
72
|
+
<FileSelectAutoComplete
|
|
73
|
+
width="100%"
|
|
74
|
+
data={Files}
|
|
75
|
+
selectedKeys={[selectedFile]}
|
|
76
|
+
onChange={(val) => update(val, selectedLang)}
|
|
77
|
+
/>
|
|
78
|
+
</FormItem>
|
|
79
|
+
<FormItem columns={3} label="Language">
|
|
80
|
+
<LanguageSelectAutoComplete
|
|
81
|
+
selectedKeys={[selectedLang]}
|
|
82
|
+
onChange={(val) => update(selectedFile, val)}
|
|
83
|
+
withAuto
|
|
84
|
+
/>
|
|
85
|
+
</FormItem>
|
|
86
|
+
</>) : (<FileSelectAutoComplete
|
|
87
|
+
width="100%"
|
|
88
|
+
data={Files}
|
|
89
|
+
selectedKeys={[selectedFile]}
|
|
90
|
+
onChange={(val) => update(val, selectedLang)}
|
|
91
|
+
/>);
|
|
92
|
+
}
|