forked from Shinonome/dots-hyprland
ags: user options: sidebar page order
This commit is contained in:
@@ -79,6 +79,13 @@ let configOptions = {
|
|||||||
'batchCount': 20,
|
'batchCount': 20,
|
||||||
'allowNsfw': false,
|
'allowNsfw': false,
|
||||||
},
|
},
|
||||||
|
'pages': {
|
||||||
|
'order': ["apis", "tools"],
|
||||||
|
'apis': {
|
||||||
|
'order': ["gemini", "gpt", "waifu", "booru"],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
'search': {
|
'search': {
|
||||||
'engineBaseUrl': "https://www.google.com/search?q=",
|
'engineBaseUrl': "https://www.google.com/search?q=",
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import { widgetContent } from './sideleft.js';
|
|||||||
import { IconTabContainer } from '../.commonwidgets/tabcontainer.js';
|
import { IconTabContainer } from '../.commonwidgets/tabcontainer.js';
|
||||||
|
|
||||||
const EXPAND_INPUT_THRESHOLD = 30;
|
const EXPAND_INPUT_THRESHOLD = 30;
|
||||||
const APIS = [
|
const APILIST = {
|
||||||
{
|
'gemini': {
|
||||||
name: 'Assistant (Gemini Pro)',
|
name: 'Assistant (Gemini Pro)',
|
||||||
sendCommand: geminiSendMessage,
|
sendCommand: geminiSendMessage,
|
||||||
contentWidget: geminiView,
|
contentWidget: geminiView,
|
||||||
@@ -28,7 +28,7 @@ const APIS = [
|
|||||||
tabIcon: geminiTabIcon,
|
tabIcon: geminiTabIcon,
|
||||||
placeholderText: 'Message Gemini...',
|
placeholderText: 'Message Gemini...',
|
||||||
},
|
},
|
||||||
{
|
'gpt': {
|
||||||
name: 'Assistant (GPTs)',
|
name: 'Assistant (GPTs)',
|
||||||
sendCommand: chatGPTSendMessage,
|
sendCommand: chatGPTSendMessage,
|
||||||
contentWidget: chatGPTView,
|
contentWidget: chatGPTView,
|
||||||
@@ -36,7 +36,7 @@ const APIS = [
|
|||||||
tabIcon: chatGPTTabIcon,
|
tabIcon: chatGPTTabIcon,
|
||||||
placeholderText: 'Message the model...',
|
placeholderText: 'Message the model...',
|
||||||
},
|
},
|
||||||
{
|
'waifu': {
|
||||||
name: 'Waifus',
|
name: 'Waifus',
|
||||||
sendCommand: waifuSendMessage,
|
sendCommand: waifuSendMessage,
|
||||||
contentWidget: waifuView,
|
contentWidget: waifuView,
|
||||||
@@ -44,7 +44,7 @@ const APIS = [
|
|||||||
tabIcon: waifuTabIcon,
|
tabIcon: waifuTabIcon,
|
||||||
placeholderText: 'Enter tags',
|
placeholderText: 'Enter tags',
|
||||||
},
|
},
|
||||||
{
|
'booru': {
|
||||||
name: 'Booru',
|
name: 'Booru',
|
||||||
sendCommand: booruSendMessage,
|
sendCommand: booruSendMessage,
|
||||||
contentWidget: booruView,
|
contentWidget: booruView,
|
||||||
@@ -52,7 +52,8 @@ const APIS = [
|
|||||||
tabIcon: booruTabIcon,
|
tabIcon: booruTabIcon,
|
||||||
placeholderText: 'Enter tags',
|
placeholderText: 'Enter tags',
|
||||||
},
|
},
|
||||||
];
|
}
|
||||||
|
const APIS = userOptions.sidebar.pages.apis.order.map((apiName) => APILIST[apiName]);
|
||||||
let currentApiId = 0;
|
let currentApiId = 0;
|
||||||
|
|
||||||
function apiSendMessage(textView) {
|
function apiSendMessage(textView) {
|
||||||
|
|||||||
@@ -12,20 +12,21 @@ import { chatEntry } from './apiwidgets.js';
|
|||||||
import { TabContainer } from '../.commonwidgets/tabcontainer.js';
|
import { TabContainer } from '../.commonwidgets/tabcontainer.js';
|
||||||
import { checkKeybind } from '../.widgetutils/keybind.js';
|
import { checkKeybind } from '../.widgetutils/keybind.js';
|
||||||
|
|
||||||
const contents = [
|
const SIDEBARTABS = {
|
||||||
{
|
'apis': {
|
||||||
name: 'apis',
|
name: 'apis',
|
||||||
content: apiWidgets,
|
content: apiWidgets,
|
||||||
materialIcon: 'api',
|
materialIcon: 'api',
|
||||||
friendlyName: 'APIs',
|
friendlyName: 'APIs',
|
||||||
},
|
},
|
||||||
{
|
'tools': {
|
||||||
name: 'tools',
|
name: 'tools',
|
||||||
content: toolBox,
|
content: toolBox,
|
||||||
materialIcon: 'home_repair_service',
|
materialIcon: 'home_repair_service',
|
||||||
friendlyName: 'Tools',
|
friendlyName: 'Tools',
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
const CONTENTS = userOptions.sidebar.pages.order.map((tabName) => SIDEBARTABS[tabName])
|
||||||
|
|
||||||
const pinButton = Button({
|
const pinButton = Button({
|
||||||
attribute: {
|
attribute: {
|
||||||
@@ -61,9 +62,9 @@ const pinButton = Button({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const widgetContent = TabContainer({
|
export const widgetContent = TabContainer({
|
||||||
icons: contents.map((item) => item.materialIcon),
|
icons: CONTENTS.map((item) => item.materialIcon),
|
||||||
names: contents.map((item) => item.friendlyName),
|
names: CONTENTS.map((item) => item.friendlyName),
|
||||||
children: contents.map((item) => item.content),
|
children: CONTENTS.map((item) => item.content),
|
||||||
className: 'sidebar-left spacing-v-10',
|
className: 'sidebar-left spacing-v-10',
|
||||||
setup: (self) => self.hook(App, (self, currentName, visible) => {
|
setup: (self) => self.hook(App, (self, currentName, visible) => {
|
||||||
if (currentName === 'sideleft')
|
if (currentName === 'sideleft')
|
||||||
|
|||||||
Reference in New Issue
Block a user