add keyboard tip for apis

This commit is contained in:
end-4
2024-01-23 12:03:58 +07:00
parent 1c5fae8096
commit 2e1f0509df
+10 -6
View File
@@ -1,7 +1,7 @@
import App from 'resource:///com/github/Aylur/ags/app.js'; import App from 'resource:///com/github/Aylur/ags/app.js';
import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'; import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { Box, Button, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget; const { Box, Button, CenterBox, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget;
const { execAsync, exec } = Utils; const { execAsync, exec } = Utils;
import { setupCursorHover, setupCursorHoverInfo } from "../../lib/cursorhover.js"; import { setupCursorHover, setupCursorHoverInfo } from "../../lib/cursorhover.js";
// APIs // APIs
@@ -86,10 +86,8 @@ function switchToTab(id) {
chatEntry.placeholderText = APIS[id].placeholderText, chatEntry.placeholderText = APIS[id].placeholderText,
currentApiId = id; currentApiId = id;
} }
const apiSwitcher = Box({ const apiSwitcher = CenterBox({
homogeneous: true, centerWidget: Box({
children: [
Box({
className: 'sidebar-chat-apiswitcher spacing-h-5', className: 'sidebar-chat-apiswitcher spacing-h-5',
hpack: 'center', hpack: 'center',
children: APIS.map((api, id) => Button({ children: APIS.map((api, id) => Button({
@@ -101,7 +99,13 @@ const apiSwitcher = Box({
} }
})), })),
}), }),
] endWidget: Button({
hpack: 'end',
className: 'txt-subtext txt-norm icon-material',
label: 'lightbulb',
tooltipText: 'Use PageUp/PageDown to switch between API pages',
setup: setupCursorHoverInfo,
}),
}) })
export default Widget.Box({ export default Widget.Box({