mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 20:13:59 +01:00
move clear conversation to settings + focus prompt searchbar + hid electron menubar (#285)
* hid electron menubar * command prompt search bar automatically focused on button press * moved clear conversation into settings, revamped to match style
This commit is contained in:
parent
f752a4420e
commit
58cafd20a5
|
@ -18,6 +18,7 @@ function createWindow() {
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
|
autoHideMenuBar: true,
|
||||||
show: false,
|
show: false,
|
||||||
icon: iconPath,
|
icon: iconPath,
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"warning": "Warning",
|
"warning": "Warning",
|
||||||
"clearMessageWarning": "Please be advised that by submitting this message, all subsequent messages will be deleted!",
|
"clearMessageWarning": "Please be advised that by submitting this message, all subsequent messages will be deleted!",
|
||||||
"clearConversationWarning": "Please be advised that by confirming this action, all messages will be deleted!",
|
"clearConversationWarning": "Please be advised that by confirming this action, all messages will be deleted!",
|
||||||
"clearConversation": "Clear Conversation",
|
"clearConversation": "Clear Conversation History",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"export": "Export",
|
"export": "Export",
|
||||||
"author": "Made by Jing Hua",
|
"author": "Made by Jing Hua",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"warning": "Warning",
|
"warning": "Warning",
|
||||||
"clearMessageWarning": "Please be advised that by submitting this message, all subsequent messages will be deleted!",
|
"clearMessageWarning": "Please be advised that by submitting this message, all subsequent messages will be deleted!",
|
||||||
"clearConversationWarning": "Please be advised that by confirming this action, all messages will be deleted!",
|
"clearConversationWarning": "Please be advised that by confirming this action, all messages will be deleted!",
|
||||||
"clearConversation": "Clear Conversation",
|
"clearConversation": "Clear Conversation History",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"export": "Export",
|
"export": "Export",
|
||||||
"author": "Made by Jing Hua",
|
"author": "Made by Jing Hua",
|
||||||
|
|
|
@ -16,9 +16,18 @@ const CommandPrompt = ({
|
||||||
const prompts = useStore((state) => state.prompts);
|
const prompts = useStore((state) => state.prompts);
|
||||||
const [_prompts, _setPrompts] = useState<Prompt[]>(prompts);
|
const [_prompts, _setPrompts] = useState<Prompt[]>(prompts);
|
||||||
const [input, setInput] = useState<string>('');
|
const [input, setInput] = useState<string>('');
|
||||||
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const [dropDown, setDropDown, dropDownRef] = useHideOnOutsideClick();
|
const [dropDown, setDropDown, dropDownRef] = useHideOnOutsideClick();
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (dropDown && inputRef.current) {
|
||||||
|
// When dropdown is visible, focus the input
|
||||||
|
inputRef.current.focus();
|
||||||
|
}
|
||||||
|
}, [dropDown]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filteredPrompts = matchSorter(useStore.getState().prompts, input, {
|
const filteredPrompts = matchSorter(useStore.getState().prompts, input, {
|
||||||
keys: ['name'],
|
keys: ['name'],
|
||||||
|
@ -46,6 +55,7 @@ const CommandPrompt = ({
|
||||||
>
|
>
|
||||||
<div className='text-sm px-4 py-2 w-max'>{t('promptLibrary')}</div>
|
<div className='text-sm px-4 py-2 w-max'>{t('promptLibrary')}</div>
|
||||||
<input
|
<input
|
||||||
|
ref={inputRef}
|
||||||
type='text'
|
type='text'
|
||||||
className='text-gray-800 dark:text-white p-3 text-sm border-none bg-gray-200 dark:bg-gray-600 m-0 w-full mr-0 h-8 focus:outline-none'
|
className='text-gray-800 dark:text-white p-3 text-sm border-none bg-gray-200 dark:bg-gray-600 m-0 w-full mr-0 h-8 focus:outline-none'
|
||||||
value={input}
|
value={input}
|
||||||
|
|
|
@ -21,15 +21,14 @@ const ClearConversation = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<a
|
<button className='btn btn-neutral'
|
||||||
className='flex py-2 px-2 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm'
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsModalOpen(true);
|
setIsModalOpen(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
{t('clearConversation')}
|
{t('clearConversation')}
|
||||||
</a>
|
</button>
|
||||||
{isModalOpen && (
|
{isModalOpen && (
|
||||||
<PopupModal
|
<PopupModal
|
||||||
setIsModalOpen={setIsModalOpen}
|
setIsModalOpen={setIsModalOpen}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import useStore from '@store/store';
|
import useStore from '@store/store';
|
||||||
|
|
||||||
import ClearConversation from './ClearConversation';
|
|
||||||
import Api from './Api';
|
import Api from './Api';
|
||||||
import Me from './Me';
|
import Me from './Me';
|
||||||
import AboutMenu from '@components/AboutMenu';
|
import AboutMenu from '@components/AboutMenu';
|
||||||
|
@ -27,7 +26,6 @@ const MenuOptions = () => {
|
||||||
{countTotalTokens && <TotalTokenCostDisplay />}
|
{countTotalTokens && <TotalTokenCostDisplay />}
|
||||||
{googleClientId && <GoogleSync clientId={googleClientId} />}
|
{googleClientId && <GoogleSync clientId={googleClientId} />}
|
||||||
<AboutMenu />
|
<AboutMenu />
|
||||||
<ClearConversation />
|
|
||||||
<ImportExportChat />
|
<ImportExportChat />
|
||||||
<Api />
|
<Api />
|
||||||
<SettingsMenu />
|
<SettingsMenu />
|
||||||
|
|
|
@ -15,6 +15,7 @@ import PromptLibraryMenu from '@components/PromptLibraryMenu';
|
||||||
import ChatConfigMenu from '@components/ChatConfigMenu';
|
import ChatConfigMenu from '@components/ChatConfigMenu';
|
||||||
import EnterToSubmitToggle from './EnterToSubmitToggle';
|
import EnterToSubmitToggle from './EnterToSubmitToggle';
|
||||||
import TotalTokenCost, { TotalTokenCostToggle } from './TotalTokenCost';
|
import TotalTokenCost, { TotalTokenCostToggle } from './TotalTokenCost';
|
||||||
|
import ClearConversation from '@components/Menu/MenuOptions/ClearConversation';
|
||||||
|
|
||||||
const SettingsMenu = () => {
|
const SettingsMenu = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -51,6 +52,7 @@ const SettingsMenu = () => {
|
||||||
<AdvancedModeToggle />
|
<AdvancedModeToggle />
|
||||||
<TotalTokenCostToggle />
|
<TotalTokenCostToggle />
|
||||||
</div>
|
</div>
|
||||||
|
<ClearConversation />
|
||||||
<PromptLibraryMenu />
|
<PromptLibraryMenu />
|
||||||
<ChatConfigMenu />
|
<ChatConfigMenu />
|
||||||
<TotalTokenCost />
|
<TotalTokenCost />
|
||||||
|
|
Loading…
Reference in a new issue