@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,53 @@
|
|
|
1
|
+
.scratchpad__toolbar
|
|
2
|
+
background: $toolbar-bg
|
|
3
|
+
padding: rem(8px)
|
|
4
|
+
font-size: rem($font-size-small)
|
|
5
|
+
font-weight: normal
|
|
6
|
+
|
|
7
|
+
.scratchpad__toolbar__item
|
|
8
|
+
margin-right: rem(5px)
|
|
9
|
+
|
|
10
|
+
.select
|
|
11
|
+
margin: 0
|
|
12
|
+
height: auto
|
|
13
|
+
line-height: 1
|
|
14
|
+
|
|
15
|
+
.scratchpad__toolbar__button
|
|
16
|
+
padding: rem(5px)
|
|
17
|
+
font-size: rem($font-size-small)
|
|
18
|
+
font-weight: normal
|
|
19
|
+
background: none
|
|
20
|
+
border: 1px solid transparent
|
|
21
|
+
color: $toolbar-fore
|
|
22
|
+
outline: 0
|
|
23
|
+
transition: .2s linear opacity
|
|
24
|
+
|
|
25
|
+
// Hack for Firefox bug #984869
|
|
26
|
+
&>div
|
|
27
|
+
display: flex
|
|
28
|
+
flex-direction: row
|
|
29
|
+
align-items: center
|
|
30
|
+
|
|
31
|
+
&.enabled
|
|
32
|
+
cursor: pointer
|
|
33
|
+
|
|
34
|
+
.icon
|
|
35
|
+
font-size: rem($font-size-icon)
|
|
36
|
+
margin-right: 2px
|
|
37
|
+
|
|
38
|
+
&.enabled:hover
|
|
39
|
+
color: $toolbar-fore-hover
|
|
40
|
+
background: $toolbar-bg-hover
|
|
41
|
+
|
|
42
|
+
&.activated
|
|
43
|
+
color: $toolbar-fore-selected !important
|
|
44
|
+
background: $toolbar-bg-selected !important
|
|
45
|
+
|
|
46
|
+
&.disabled
|
|
47
|
+
pointer-events: none
|
|
48
|
+
opacity: $toolbar-disabled-opacity
|
|
49
|
+
|
|
50
|
+
.scratchpad__toolbar__split
|
|
51
|
+
width: 1px
|
|
52
|
+
height: 1rem
|
|
53
|
+
background: #DDD
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
export default function ToolbarComponent(props) {
|
|
5
|
+
const {
|
|
6
|
+
className,
|
|
7
|
+
children,
|
|
8
|
+
...rest
|
|
9
|
+
} = props;
|
|
10
|
+
const cn = classNames(className, 'scratchpad__toolbar flex-row flex-cross-center');
|
|
11
|
+
return (
|
|
12
|
+
<div {...rest} className={cn}>{children}</div>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ToolbarComponent.propTypes = {
|
|
17
|
+
className: PropTypes.string,
|
|
18
|
+
children: PropTypes.node,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function ToolbarButtonComponent(props) {
|
|
22
|
+
const {
|
|
23
|
+
activated = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
onClick,
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
30
|
+
const cn = classNames(className, 'scratchpad__toolbar__item scratchpad__toolbar__button', {
|
|
31
|
+
activated,
|
|
32
|
+
disabled,
|
|
33
|
+
enabled: !disabled,
|
|
34
|
+
});
|
|
35
|
+
return (
|
|
36
|
+
<button
|
|
37
|
+
{...rest}
|
|
38
|
+
tabIndex="-1"
|
|
39
|
+
className={cn}
|
|
40
|
+
onClick={() => !disabled && onClick && onClick()}
|
|
41
|
+
>
|
|
42
|
+
<div>{children}</div>
|
|
43
|
+
</button>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ToolbarButtonComponent.propTypes = {
|
|
48
|
+
activated: PropTypes.bool,
|
|
49
|
+
disabled: PropTypes.bool,
|
|
50
|
+
onClick: PropTypes.func,
|
|
51
|
+
className: PropTypes.string,
|
|
52
|
+
children: PropTypes.node,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function ToolbarSplitComponent(props) {
|
|
56
|
+
const {
|
|
57
|
+
className,
|
|
58
|
+
...rest
|
|
59
|
+
} = props;
|
|
60
|
+
const cn = classNames(className, 'scratchpad__toolbar__item scratchpad__toolbar__split');
|
|
61
|
+
return (
|
|
62
|
+
<div {...rest} className={cn} />
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
ToolbarSplitComponent.propTypes = {
|
|
67
|
+
className: PropTypes.string,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function ToolbarItemComponent(props) {
|
|
71
|
+
const {
|
|
72
|
+
className,
|
|
73
|
+
children,
|
|
74
|
+
...rest
|
|
75
|
+
} = props;
|
|
76
|
+
const cn = classNames(className, 'scratchpad__toolbar__item');
|
|
77
|
+
return (
|
|
78
|
+
<div {...rest} className={cn}>{children}</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ToolbarItemComponent.propTypes = {
|
|
83
|
+
className: PropTypes.string,
|
|
84
|
+
children: PropTypes.node,
|
|
85
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import ProblemIcon from '@vscode/codicons/src/icons/file.svg?react';
|
|
2
|
+
import SettingsIcon from '@vscode/codicons/src/icons/settings-gear.svg?react';
|
|
3
|
+
import { Allotment } from 'allotment';
|
|
4
|
+
import $ from 'jquery';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import type * as monaco from 'monaco-editor';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useDispatch, useSelector, useStore } from 'react-redux';
|
|
9
|
+
import Dom from 'vj/components/react/DomComponent';
|
|
10
|
+
import { ctx, Service } from 'vj/context';
|
|
11
|
+
import ScratchpadEditor from './ScratchpadEditorContainer';
|
|
12
|
+
import ScratchpadPretest from './ScratchpadPretestContainer';
|
|
13
|
+
import ScratchpadRecords from './ScratchpadRecordsContainer';
|
|
14
|
+
import ScratchpadSettings from './ScratchpadSettings';
|
|
15
|
+
import ScratchpadToolbar from './ScratchpadToolbarContainer';
|
|
16
|
+
|
|
17
|
+
const pages = {
|
|
18
|
+
problem: {
|
|
19
|
+
icon: () => <ProblemIcon />,
|
|
20
|
+
component: () => <Dom childDom={$('.problem-content').get(0)} />,
|
|
21
|
+
},
|
|
22
|
+
settings: {
|
|
23
|
+
icon: () => <SettingsIcon />,
|
|
24
|
+
component: () => <ScratchpadSettings />,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
let rerenderCallback = null;
|
|
29
|
+
class ScratchpadService extends Service {
|
|
30
|
+
constructor(public store) {
|
|
31
|
+
super(ctx, 'scratchpad');
|
|
32
|
+
this.load = new Promise((resolve) => {
|
|
33
|
+
this.loadCallback = resolve;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pages = pages;
|
|
38
|
+
load: Promise<void>;
|
|
39
|
+
loadCallback: () => void;
|
|
40
|
+
editor: monaco.editor.IStandaloneCodeEditor;
|
|
41
|
+
monaco: typeof import('monaco-editor');
|
|
42
|
+
|
|
43
|
+
init(editor: monaco.editor.IStandaloneCodeEditor, monaco: typeof import('monaco-editor')) {
|
|
44
|
+
this.editor = editor;
|
|
45
|
+
this.monaco = monaco;
|
|
46
|
+
this.loadCallback();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
addPage(key, icon, component) {
|
|
50
|
+
pages[key] = {
|
|
51
|
+
icon,
|
|
52
|
+
component,
|
|
53
|
+
};
|
|
54
|
+
rerenderCallback?.();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
declare module 'cordis' {
|
|
58
|
+
interface Context {
|
|
59
|
+
scratchpad: ScratchpadService;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let scratchpad: ScratchpadService;
|
|
64
|
+
|
|
65
|
+
export default function ScratchpadContainer() {
|
|
66
|
+
const store = useStore();
|
|
67
|
+
scratchpad ||= new ScratchpadService(store);
|
|
68
|
+
const [, updateState] = React.useState<any>();
|
|
69
|
+
const forceUpdate = React.useCallback(() => updateState({}), []);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
rerenderCallback = forceUpdate;
|
|
72
|
+
}, []);
|
|
73
|
+
const dispatch = useDispatch();
|
|
74
|
+
const ui = useSelector<any, any>((state) => state.ui, _.isEqual);
|
|
75
|
+
|
|
76
|
+
const handleChangeSize = _.debounce(() => {
|
|
77
|
+
ctx.scratchpad.editor?.layout?.();
|
|
78
|
+
$('#scratchpad').trigger('vjScratchpadRelayout');
|
|
79
|
+
forceUpdate();
|
|
80
|
+
}, 500);
|
|
81
|
+
const switchToPage = (target) => {
|
|
82
|
+
dispatch({
|
|
83
|
+
type: 'SCRATCHPAD_SWITCH_TO_PAGE',
|
|
84
|
+
payload: target,
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Allotment onChange={handleChangeSize}>
|
|
90
|
+
<Allotment.Pane visible={Object.keys(pages).length > 1} minSize={50} maxSize={50}>
|
|
91
|
+
<div className="scratchpad__tablist">
|
|
92
|
+
{Object.keys(pages).map((key) => {
|
|
93
|
+
const Component = pages[key].icon;
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
key={key}
|
|
97
|
+
className={`scratchpad__tabicon-${key}${key === ui.activePage ? ' scratchpad__tab-active' : ''}`}
|
|
98
|
+
onClick={() => switchToPage(key)}
|
|
99
|
+
>
|
|
100
|
+
<Component />
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
})}
|
|
104
|
+
</div>
|
|
105
|
+
</Allotment.Pane>
|
|
106
|
+
<Allotment.Pane visible={!!ui.activePage}>
|
|
107
|
+
<div className="scratchpad__problem">
|
|
108
|
+
{Object.keys(pages).map((key) => {
|
|
109
|
+
const Component = pages[key].component;
|
|
110
|
+
return (
|
|
111
|
+
<div key={key} style={{ display: key === ui.activePage ? 'block' : 'none' }}>
|
|
112
|
+
<Component />
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
})}
|
|
116
|
+
</div>
|
|
117
|
+
</Allotment.Pane>
|
|
118
|
+
<Allotment vertical onChange={handleChangeSize}>
|
|
119
|
+
<div key="editor" className="flex-col splitpane-fill">
|
|
120
|
+
<ScratchpadToolbar />
|
|
121
|
+
<ScratchpadEditor />
|
|
122
|
+
</div>
|
|
123
|
+
<Allotment.Pane visible={ui.pretest.visible}>
|
|
124
|
+
<ScratchpadPretest key="pretest" />
|
|
125
|
+
</Allotment.Pane>
|
|
126
|
+
<Allotment.Pane visible={ui.records.visible}>
|
|
127
|
+
<ScratchpadRecords key="records" />
|
|
128
|
+
</Allotment.Pane>
|
|
129
|
+
</Allotment>
|
|
130
|
+
</Allotment>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
let cacheKey = `${UserContext._id}/${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`;
|
|
2
|
+
if (UiContext.tdoc?._id) cacheKey += `@${UiContext.tdoc._id}`;
|
|
3
|
+
|
|
4
|
+
// TODO switch to indexeddb
|
|
5
|
+
export default function reducer(state = {
|
|
6
|
+
lang: localStorage.getItem(`${cacheKey}#lang`) || UiContext.codeLang,
|
|
7
|
+
code: localStorage.getItem(cacheKey) || UiContext.codeTemplate,
|
|
8
|
+
}, action: any = {}) {
|
|
9
|
+
if (action.type === 'SCRATCHPAD_EDITOR_UPDATE_CODE') {
|
|
10
|
+
localStorage.setItem(cacheKey, action.payload);
|
|
11
|
+
return {
|
|
12
|
+
...state,
|
|
13
|
+
code: action.payload,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (action.type === 'SCRATCHPAD_EDITOR_SET_LANG') {
|
|
17
|
+
localStorage.setItem(`${cacheKey}#lang`, action.payload);
|
|
18
|
+
return {
|
|
19
|
+
...state,
|
|
20
|
+
lang: action.payload,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { combineReducers } from 'redux';
|
|
2
|
+
import editor from './editor';
|
|
3
|
+
import pretest from './pretest';
|
|
4
|
+
import records from './records';
|
|
5
|
+
import state from './state';
|
|
6
|
+
import ui from './ui';
|
|
7
|
+
|
|
8
|
+
const reducer = combineReducers({
|
|
9
|
+
ui,
|
|
10
|
+
editor,
|
|
11
|
+
pretest,
|
|
12
|
+
records,
|
|
13
|
+
state,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default reducer;
|
|
17
|
+
export type RootState = ReturnType<typeof reducer>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { STATUS_TEXTS } from '@hydrooj/common';
|
|
2
|
+
|
|
3
|
+
export default function reducer(state = {
|
|
4
|
+
input: '',
|
|
5
|
+
output: '',
|
|
6
|
+
rid: null,
|
|
7
|
+
}, action: any = {}) {
|
|
8
|
+
if (action.type === 'SCRATCHPAD_PRETEST_DATA_CHANGE') {
|
|
9
|
+
const { type, value } = action.payload;
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
[type]: value,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (action.type === 'SCRATCHPAD_RECORDS_PUSH') {
|
|
16
|
+
const { rdoc } = action.payload;
|
|
17
|
+
if (rdoc._id === state.rid) {
|
|
18
|
+
const output = [`${STATUS_TEXTS[rdoc.status]} ${rdoc.time}ms ${rdoc.memory}KiB`];
|
|
19
|
+
if (rdoc.compilerTexts.length) output.push(rdoc.compilerTexts.join('\n'));
|
|
20
|
+
if (rdoc.testCases.length) output.push(rdoc.testCases[0].message || '');
|
|
21
|
+
return {
|
|
22
|
+
...state,
|
|
23
|
+
output: output.join('\n'),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (action.type === 'SCRATCHPAD_POST_PRETEST_FULFILLED') {
|
|
28
|
+
return {
|
|
29
|
+
...state,
|
|
30
|
+
rid: action.payload.rid,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return state;
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
export default function reducer(state = {
|
|
4
|
+
rows: [],
|
|
5
|
+
items: {},
|
|
6
|
+
}, action: any = {}) {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_FULFILLED': {
|
|
9
|
+
const { rdocs } = action.payload;
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
rows: _.map(rdocs, '_id'),
|
|
13
|
+
items: _.keyBy(rdocs, '_id'),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
case 'SCRATCHPAD_RECORDS_PUSH': {
|
|
17
|
+
const { rdoc } = action.payload;
|
|
18
|
+
const rows = [...state.rows];
|
|
19
|
+
if (!rows.includes(rdoc._id)) {
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
rows: [rdoc._id, ...state.rows],
|
|
23
|
+
items: {
|
|
24
|
+
...state.items,
|
|
25
|
+
[rdoc._id]: rdoc,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
...state,
|
|
31
|
+
items: {
|
|
32
|
+
...state.items,
|
|
33
|
+
[rdoc._id]: rdoc,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
return state;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import Notification from 'vj/components/notification';
|
|
2
|
+
import { i18n } from 'vj/utils';
|
|
3
|
+
|
|
4
|
+
export default function reducer(state = {
|
|
5
|
+
pretest: {
|
|
6
|
+
visible: UiContext.pdoc.config?.type === 'default'
|
|
7
|
+
? localStorage.getItem('scratchpad/pretest') === 'true'
|
|
8
|
+
: false,
|
|
9
|
+
},
|
|
10
|
+
records: {
|
|
11
|
+
visible: UiContext.canViewRecord && localStorage.getItem('scratchpad/records') === 'true',
|
|
12
|
+
isLoading: false,
|
|
13
|
+
},
|
|
14
|
+
settings: {
|
|
15
|
+
visible: false,
|
|
16
|
+
config: JSON.parse(localStorage.getItem('editor.config') || '{}'),
|
|
17
|
+
},
|
|
18
|
+
isPosting: false,
|
|
19
|
+
pretestWaitSec: 0,
|
|
20
|
+
submitWaitSec: 0,
|
|
21
|
+
lastTick: 0,
|
|
22
|
+
activePage: 'problem',
|
|
23
|
+
pendingCommand: '',
|
|
24
|
+
}, action: any = {}) {
|
|
25
|
+
switch (action.type) {
|
|
26
|
+
case 'SCRATCHPAD_UI_SET_VISIBILITY': {
|
|
27
|
+
const { uiElement, visibility } = action.payload;
|
|
28
|
+
localStorage.setItem(`scratchpad/${uiElement}`, visibility.toString());
|
|
29
|
+
return {
|
|
30
|
+
...state,
|
|
31
|
+
[uiElement]: {
|
|
32
|
+
...state[uiElement],
|
|
33
|
+
visible: visibility,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
case 'SCRATCHPAD_UI_TOGGLE_VISIBILITY': {
|
|
38
|
+
const { uiElement } = action.payload;
|
|
39
|
+
localStorage.setItem(`scratchpad/${uiElement}`, (!state[uiElement].visible).toString());
|
|
40
|
+
return {
|
|
41
|
+
...state,
|
|
42
|
+
[uiElement]: {
|
|
43
|
+
...state[uiElement],
|
|
44
|
+
visible: !state[uiElement].visible,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
case 'SCRATCHPAD_SETTING_UPDATE': {
|
|
49
|
+
const { setting, value } = action.payload;
|
|
50
|
+
const config = {
|
|
51
|
+
...state.settings.config,
|
|
52
|
+
[setting]: value,
|
|
53
|
+
};
|
|
54
|
+
localStorage.setItem('editor.config', JSON.stringify(config));
|
|
55
|
+
return {
|
|
56
|
+
...state,
|
|
57
|
+
settings: {
|
|
58
|
+
...state.settings,
|
|
59
|
+
config,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
case 'SCRATCHPAD_TRIGGER_EDITOR_COMMAND': {
|
|
64
|
+
return {
|
|
65
|
+
...state,
|
|
66
|
+
pendingCommand: action.payload.command,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
case 'SCRATCHPAD_POST_PRETEST_PENDING':
|
|
70
|
+
case 'SCRATCHPAD_POST_SUBMIT_PENDING': {
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
isPosting: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
case 'SCRATCHPAD_POST_PRETEST_FULFILLED':
|
|
77
|
+
case 'SCRATCHPAD_POST_SUBMIT_FULFILLED': {
|
|
78
|
+
Notification.success(i18n('Submitted.'));
|
|
79
|
+
return (action.type === 'SCRATCHPAD_POST_SUBMIT_FULFILLED' && UiContext.canViewRecord)
|
|
80
|
+
? {
|
|
81
|
+
...state,
|
|
82
|
+
records: {
|
|
83
|
+
...state.records,
|
|
84
|
+
visible: true,
|
|
85
|
+
},
|
|
86
|
+
isPosting: false,
|
|
87
|
+
submitWaitSec: 8,
|
|
88
|
+
} : {
|
|
89
|
+
...state,
|
|
90
|
+
isPosting: false,
|
|
91
|
+
pretestWaitSec: 5,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
case 'SCRATCHPAD_POST_PRETEST_REJECTED':
|
|
95
|
+
case 'SCRATCHPAD_POST_SUBMIT_REJECTED': {
|
|
96
|
+
Notification.error(action.payload.message);
|
|
97
|
+
return {
|
|
98
|
+
...state,
|
|
99
|
+
isPosting: false,
|
|
100
|
+
pretestWaitSec: 3,
|
|
101
|
+
submitWaitSec: 3,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
case 'SCRATCHPAD_WAITING_TICK': {
|
|
105
|
+
if (Date.now() - state.lastTick < 950) return state;
|
|
106
|
+
return {
|
|
107
|
+
...state,
|
|
108
|
+
lastTick: Date.now(),
|
|
109
|
+
pretestWaitSec: Math.max(state.pretestWaitSec - 1, 0),
|
|
110
|
+
submitWaitSec: Math.max(state.submitWaitSec - 1, 0),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_PENDING': {
|
|
114
|
+
return {
|
|
115
|
+
...state,
|
|
116
|
+
records: {
|
|
117
|
+
...state.records,
|
|
118
|
+
isLoading: true,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_REJECTED': {
|
|
123
|
+
Notification.error(action.payload.message);
|
|
124
|
+
return {
|
|
125
|
+
...state,
|
|
126
|
+
records: {
|
|
127
|
+
...state.records,
|
|
128
|
+
isLoading: false,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_FULFILLED': {
|
|
133
|
+
return {
|
|
134
|
+
...state,
|
|
135
|
+
records: {
|
|
136
|
+
...state.records,
|
|
137
|
+
isLoading: false,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
case 'SCRATCHPAD_SWITCH_TO_PAGE': {
|
|
142
|
+
let newPage = action.payload;
|
|
143
|
+
if (newPage === state.activePage) newPage = null;
|
|
144
|
+
return {
|
|
145
|
+
...state,
|
|
146
|
+
activePage: newPage,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
default:
|
|
150
|
+
return state;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.scratchpad-container
|
|
2
|
+
position: absolute
|
|
3
|
+
background: #FFF
|
|
4
|
+
|
|
5
|
+
#scratchpad
|
|
6
|
+
position: absolute
|
|
7
|
+
left: 0
|
|
8
|
+
top: $nav-item-height
|
|
9
|
+
width: 100%
|
|
10
|
+
bottom: 0
|
|
11
|
+
|
|
12
|
+
.scratchpad__problem
|
|
13
|
+
position: absolute
|
|
14
|
+
left: 0
|
|
15
|
+
top: 0
|
|
16
|
+
width: 100%
|
|
17
|
+
height: 100%
|
|
18
|
+
overflow: auto
|
|
19
|
+
|
|
20
|
+
.scratchpad__toolbar__pretest.enabled:hover .icon
|
|
21
|
+
color: red
|
|
22
|
+
|
|
23
|
+
.scratchpad__toolbar__submit.enabled:hover .icon
|
|
24
|
+
color: green
|
|
25
|
+
|
|
26
|
+
.scratchpad__records__table
|
|
27
|
+
&.loading
|
|
28
|
+
// make a flash by setting opacity, otherwise users
|
|
29
|
+
// won't think that refreshing is completed!
|
|
30
|
+
opacity: 0.6
|
|
31
|
+
|
|
32
|
+
.col--at
|
|
33
|
+
width: rem(120px)
|
|
34
|
+
|
|
35
|
+
.col--time,
|
|
36
|
+
.col--memory
|
|
37
|
+
width: rem(70px)
|
|
38
|
+
|
|
39
|
+
.col--detail
|
|
40
|
+
border-right: 1px solid $table-border-color
|
|
41
|
+
|
|
42
|
+
.icol
|
|
43
|
+
display: inline-block
|
|
44
|
+
|
|
45
|
+
.icol--pretest
|
|
46
|
+
width: rem(60px)
|
|
47
|
+
|
|
48
|
+
.flag
|
|
49
|
+
font-size: rem(12px)
|
|
50
|
+
color: #FFF
|
|
51
|
+
padding: rem(2px 3px)
|
|
52
|
+
|
|
53
|
+
.icol--stat
|
|
54
|
+
color: #AAA
|
|
55
|
+
width: rem(60px)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { prompt } from 'vj/components/dialog';
|
|
2
|
+
import { i18n } from 'vj/utils';
|
|
3
|
+
|
|
4
|
+
export default async function selectUser() {
|
|
5
|
+
const res = await prompt(i18n('Select User'), {
|
|
6
|
+
user: {
|
|
7
|
+
type: 'user',
|
|
8
|
+
label: i18n('Username / UID'),
|
|
9
|
+
required: true,
|
|
10
|
+
autofocus: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
return res?.user;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
window.Hydro.components.selectUser = selectUser;
|