bug fixes

This commit is contained in:
undefined committed 2025-10-23 17:57:29 +08:00
1 parent d0944bdde9
commit 2f2e006eff
10 files changed
+56 -65

No files matched your search

@@ -164,6 +164,9 @@ $highlight-button-color = #F6DF45
.row
max-width: 100vw !important;
.data-table td
line-height: 1.5
.col--rank
width: rem(60px)
text-align: center
+14 -34
View File
@@ -1,42 +1,22 @@
import $ from 'jquery';
import React from 'react';
import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete';
import { ActionDialog } from 'vj/components/dialog';
import { prompt } from 'vj/components/dialog';
import { NamedPage } from 'vj/misc/Page';
import { i18n, tpl } from 'vj/utils';
import { i18n } from 'vj/utils';
export default new NamedPage('home_domain', () => {
$(tpl(
<div style={{ display: 'none' }} className="dialog__body--join-domain" id="join-domain-dialog">
<div className="row"><div className="columns">
<h1>{i18n('Join Domain')}</h1>
</div></div>
<div className="row">
<div className="columns">
<label>
{i18n('Domain ID')}
<div className="textbox-container">
<input name="domainId" type="text" className="textbox" data-autofocus />
</div>
</label>
</div>
</div>
</div>,
)).appendTo(document.body);
const selector: any = DomainSelectAutoComplete.getOrConstruct($('#join-domain-dialog [name="domainId"]'));
$(document).on('click', '[id="join-domain-button"]', async () => {
const action = await new ActionDialog({
$body: $('.dialog__body--join-domain > div'),
onDispatch(a) {
if (a === 'ok' && selector.value() === null) {
selector.focus();
return false;
}
return true;
const res = await prompt(i18n('Join Domain'), {
domain: {
type: 'domain',
label: i18n('Domain ID'),
required: true,
autofocus: true,
},
}).open();
if (action !== 'ok') return;
window.location.href = `/domain/join?target=${encodeURIComponent(selector.value()._id.toString())}`;
}, {
cancelByClickingBack: true,
cancelByEsc: true,
});
if (!res?.domain) return;
window.location.href = `/domain/join?target=${encodeURIComponent(res.domain.toString())}`;
});
});
@@ -15,11 +15,12 @@ import {
addSpeculationRules, delay, i18n, pjax, request,
} from 'vj/utils';
const keywords = ['category', 'difficulty', 'namespace'];
const list = [];
const filterTags = {};
const pinned: Record<string, string[]> = { category: [], difficulty: [], namespace: [] };
const selections = { category: {}, difficulty: {}, namespace: {} };
const selectedTags: Record<string, string[]> = { category: [], difficulty: [], namespace: [] };
const pinned: Record<string, string[]> = Object.fromEntries(keywords.map((keyword) => [keyword, []]));
const selections = Object.fromEntries(keywords.map((keyword) => [keyword, {}]));
const selectedTags: Record<string, string[]> = Object.fromEntries(keywords.map((keyword) => [keyword, []]));
let selectedPids: string[] = [];
let clearSelectionHandler: (() => void) | null = null;
@@ -35,7 +36,7 @@ function setDomSelected($dom, selected, icon?) {
}
const parserOptions = {
keywords: ['category', 'difficulty', 'namespace'],
keywords,
offsets: true,
alwaysArray: true,
tokenize: true,
@@ -46,8 +47,7 @@ function writeSelectionToInput() {
const parsedCurrentValue = parser.parse(currentValue, parserOptions) as SearchParserResult;
const q = parser.stringify({
...parsedCurrentValue,
category: selectedTags.category,
difficulty: selectedTags.difficulty,
...keywords.reduce((acc, keyword) => ({ ...acc, [keyword]: selectedTags[keyword] }), {}),
text: parsedCurrentValue.text,
}, parserOptions);
$('[name="q"]').val(q);