mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: update tpl function
This commit is contained in:
2 files changed
+6
-10
No files matched your search
@@ -2,7 +2,6 @@ import $ from 'jquery';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { HexColorInput, HexColorPicker } from 'react-colorful';
|
import { HexColorInput, HexColorPicker } from 'react-colorful';
|
||||||
import { createRoot } from 'react-dom/client';
|
|
||||||
import { ActionDialog } from 'vj/components/dialog';
|
import { ActionDialog } from 'vj/components/dialog';
|
||||||
import Notification from 'vj/components/notification';
|
import Notification from 'vj/components/notification';
|
||||||
import { NamedPage } from 'vj/misc/Page';
|
import { NamedPage } from 'vj/misc/Page';
|
||||||
@@ -72,17 +71,14 @@ async function handleSetColor(tdoc) {
|
|||||||
for (const pid of tdoc.pids) val[+pid] = { color: '#ffffff', name: '' };
|
for (const pid of tdoc.pids) val[+pid] = { color: '#ffffff', name: '' };
|
||||||
}
|
}
|
||||||
Notification.info(i18n('Loading...'));
|
Notification.info(i18n('Loading...'));
|
||||||
const promise = new ActionDialog({
|
const action = await new ActionDialog({
|
||||||
$body: tpl`
|
$body: tpl(<>
|
||||||
<div className="row"><div className="columns">
|
<div className="row"><div className="columns">
|
||||||
<h1>${i18n('Set Color')}</h1>
|
<h1>{i18n('Set Color')}</h1>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="balloon"></div>`,
|
<Balloon tdoc={tdoc} val={val} />
|
||||||
|
</>, true),
|
||||||
}).open();
|
}).open();
|
||||||
createRoot($('#balloon').get(0)).render(
|
|
||||||
<Balloon tdoc={tdoc} val={val} />,
|
|
||||||
);
|
|
||||||
const action = await promise;
|
|
||||||
if (action !== 'ok') return;
|
if (action !== 'ok') return;
|
||||||
Notification.info(i18n('Updating...'));
|
Notification.info(i18n('Updating...'));
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export namespace Time {
|
|||||||
else if (isMoment(timestamp)) _timestamp = timestamp.toDate().getTime();
|
else if (isMoment(timestamp)) _timestamp = timestamp.toDate().getTime();
|
||||||
else _timestamp = timestamp.getTime();
|
else _timestamp = timestamp.getTime();
|
||||||
const hexSeconds = Math.floor(_timestamp / 1000).toString(16);
|
const hexSeconds = Math.floor(_timestamp / 1000).toString(16);
|
||||||
return new ObjectId(`${hexSeconds}${allZero ? '0000000000000000' : new ObjectId().toHexString().substr(8)}`);
|
return new ObjectId(`${hexSeconds}${allZero ? '0000000000000000' : new ObjectId().toHexString().substring(8)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user