mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 16:21:25 +02:00
Add more info to settings
This commit is contained in:
@@ -8,6 +8,6 @@ export default defineConfig({
|
|||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['es'],
|
formats: ['es'],
|
||||||
},
|
},
|
||||||
outDir: resolve(__dirname, '../../src-tauri/plugins/build/filter-jsonpath'),
|
outDir: resolve(__dirname, '../../src-tauri/plugins/filter-jsonpath'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ export default defineConfig({
|
|||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['es'],
|
formats: ['es'],
|
||||||
},
|
},
|
||||||
outDir: resolve(__dirname, '../../src-tauri/plugins/build/filter-xpath'),
|
outDir: resolve(__dirname, '../../src-tauri/plugins/filter-xpath'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ export default defineConfig({
|
|||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['es'],
|
formats: ['es'],
|
||||||
},
|
},
|
||||||
outDir: resolve(__dirname, '../../src-tauri/plugins/build/importer-insomnia'),
|
outDir: resolve(__dirname, '../../src-tauri/plugins/importer-insomnia'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ export default defineConfig({
|
|||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['es'],
|
formats: ['es'],
|
||||||
},
|
},
|
||||||
outDir: resolve(__dirname, '../../src-tauri/plugins/build/importer-postman'),
|
outDir: resolve(__dirname, '../../src-tauri/plugins/importer-postman'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ export default defineConfig({
|
|||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['es'],
|
formats: ['es'],
|
||||||
},
|
},
|
||||||
outDir: resolve(__dirname, '../../src-tauri/plugins/build/importer-yaak'),
|
outDir: resolve(__dirname, '../../src-tauri/plugins/importer-yaak'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ serde_json = { version = "1.0.111", features = ["raw_value"] }
|
|||||||
sqlx = { version = "0.7.3", features = ["sqlite", "runtime-tokio-rustls", "json", "chrono", "time"] }
|
sqlx = { version = "0.7.3", features = ["sqlite", "runtime-tokio-rustls", "json", "chrono", "time"] }
|
||||||
tauri = { version = "1.5.2", features = [
|
tauri = { version = "1.5.2", features = [
|
||||||
"config-toml",
|
"config-toml",
|
||||||
|
"path-all",
|
||||||
"devtools",
|
"devtools",
|
||||||
"dialog-open",
|
"dialog-open",
|
||||||
"dialog-save",
|
"dialog-save",
|
||||||
|
|||||||
@@ -47,6 +47,9 @@
|
|||||||
"all": false,
|
"all": false,
|
||||||
"open": true,
|
"open": true,
|
||||||
"save": true
|
"save": true
|
||||||
|
},
|
||||||
|
"path": {
|
||||||
|
"all": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useActiveWorkspace } from '../hooks/useActiveWorkspace';
|
import { useActiveWorkspace } from '../hooks/useActiveWorkspace';
|
||||||
|
import { useAppInfo } from '../hooks/useAppInfo';
|
||||||
import { useSettings } from '../hooks/useSettings';
|
import { useSettings } from '../hooks/useSettings';
|
||||||
import { useUpdateSettings } from '../hooks/useUpdateSettings';
|
import { useUpdateSettings } from '../hooks/useUpdateSettings';
|
||||||
import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace';
|
import { useUpdateWorkspace } from '../hooks/useUpdateWorkspace';
|
||||||
@@ -14,6 +15,7 @@ export const SettingsDialog = () => {
|
|||||||
const updateWorkspace = useUpdateWorkspace(workspace?.id ?? null);
|
const updateWorkspace = useUpdateWorkspace(workspace?.id ?? null);
|
||||||
const settings = useSettings();
|
const settings = useSettings();
|
||||||
const updateSettings = useUpdateSettings();
|
const updateSettings = useUpdateSettings();
|
||||||
|
const appInfo = useAppInfo();
|
||||||
|
|
||||||
if (settings == null || workspace == null) {
|
if (settings == null || workspace == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -25,7 +27,6 @@ export const SettingsDialog = () => {
|
|||||||
name="appearance"
|
name="appearance"
|
||||||
label="Appearance"
|
label="Appearance"
|
||||||
labelPosition="left"
|
labelPosition="left"
|
||||||
labelClassName="w-1/3"
|
|
||||||
size="sm"
|
size="sm"
|
||||||
value={settings.appearance}
|
value={settings.appearance}
|
||||||
onChange={(appearance) => updateSettings.mutateAsync({ ...settings, appearance })}
|
onChange={(appearance) => updateSettings.mutateAsync({ ...settings, appearance })}
|
||||||
@@ -49,7 +50,6 @@ export const SettingsDialog = () => {
|
|||||||
name="updateChannel"
|
name="updateChannel"
|
||||||
label="Update Channel"
|
label="Update Channel"
|
||||||
labelPosition="left"
|
labelPosition="left"
|
||||||
labelClassName="w-1/3"
|
|
||||||
size="sm"
|
size="sm"
|
||||||
value={settings.updateChannel}
|
value={settings.updateChannel}
|
||||||
onChange={(updateChannel) => updateSettings.mutateAsync({ ...settings, updateChannel })}
|
onChange={(updateChannel) => updateSettings.mutateAsync({ ...settings, updateChannel })}
|
||||||
@@ -80,8 +80,6 @@ export const SettingsDialog = () => {
|
|||||||
label="Request Timeout (ms)"
|
label="Request Timeout (ms)"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
labelPosition="left"
|
labelPosition="left"
|
||||||
labelClassName="w-1/3"
|
|
||||||
containerClassName="col-span-2"
|
|
||||||
defaultValue={`${workspace.settingRequestTimeout}`}
|
defaultValue={`${workspace.settingRequestTimeout}`}
|
||||||
validate={(value) => parseInt(value) >= 0}
|
validate={(value) => parseInt(value) >= 0}
|
||||||
onChange={(v) => updateWorkspace.mutateAsync({ settingRequestTimeout: parseInt(v) || 0 })}
|
onChange={(v) => updateWorkspace.mutateAsync({ settingRequestTimeout: parseInt(v) || 0 })}
|
||||||
@@ -103,6 +101,28 @@ export const SettingsDialog = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|
||||||
|
<Separator className="my-4" />
|
||||||
|
|
||||||
|
<Heading size={2}>App Info</Heading>
|
||||||
|
<table className="text-sm w-full">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td className="h-xs pr-3">Version</td>
|
||||||
|
<td className="h-xs text-xs font-mono select-all cursor-text">
|
||||||
|
{appInfo.data?.version}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{appInfo.data && (
|
||||||
|
<tr>
|
||||||
|
<td className="h-xs pr-3 whitespace-nowrap">Data Directory</td>
|
||||||
|
<td className="h-xs text-xs font-mono select-all cursor-text break-all min-w-0">
|
||||||
|
{appInfo.data.appDataDir}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</VStack>
|
</VStack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { invoke, shell } from '@tauri-apps/api';
|
import { invoke, shell } from '@tauri-apps/api';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { useAlert } from '../hooks/useAlert';
|
import { useAlert } from '../hooks/useAlert';
|
||||||
import { useAppVersion } from '../hooks/useAppVersion';
|
import { useAppInfo } from '../hooks/useAppInfo';
|
||||||
import { useExportData } from '../hooks/useExportData';
|
import { useExportData } from '../hooks/useExportData';
|
||||||
import { useImportData } from '../hooks/useImportData';
|
import { useImportData } from '../hooks/useImportData';
|
||||||
import { useListenToTauriEvent } from '../hooks/useListenToTauriEvent';
|
import { useListenToTauriEvent } from '../hooks/useListenToTauriEvent';
|
||||||
@@ -18,7 +18,7 @@ import { SettingsDialog } from './SettingsDialog';
|
|||||||
export function SettingsDropdown() {
|
export function SettingsDropdown() {
|
||||||
const importData = useImportData();
|
const importData = useImportData();
|
||||||
const exportData = useExportData();
|
const exportData = useExportData();
|
||||||
const appVersion = useAppVersion();
|
const appInfo = useAppInfo();
|
||||||
const dropdownRef = useRef<DropdownRef>(null);
|
const dropdownRef = useRef<DropdownRef>(null);
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
const alert = useAlert();
|
const alert = useAlert();
|
||||||
@@ -96,7 +96,7 @@ export function SettingsDropdown() {
|
|||||||
leftSlot: <Icon icon="folderOutput" />,
|
leftSlot: <Icon icon="folderOutput" />,
|
||||||
onSelect: () => exportData.mutate(),
|
onSelect: () => exportData.mutate(),
|
||||||
},
|
},
|
||||||
{ type: 'separator', label: `Yaak v${appVersion.data}` },
|
{ type: 'separator', label: `Yaak v${appInfo.data?.version}` },
|
||||||
{
|
{
|
||||||
key: 'update-check',
|
key: 'update-check',
|
||||||
label: 'Check for Updates',
|
label: 'Check for Updates',
|
||||||
@@ -126,7 +126,7 @@ export function SettingsDropdown() {
|
|||||||
variant: showChangelog ? 'notify' : 'default',
|
variant: showChangelog ? 'notify' : 'default',
|
||||||
leftSlot: <Icon icon="cake" />,
|
leftSlot: <Icon icon="cake" />,
|
||||||
rightSlot: <Icon icon="externalLink" />,
|
rightSlot: <Icon icon="externalLink" />,
|
||||||
onSelect: () => shell.open(`https://yaak.app/changelog/${appVersion.data}`),
|
onSelect: () => shell.open(`https://yaak.app/changelog/${appInfo.data?.version}`),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import classNames from 'classnames';
|
|||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useKeyPressEvent } from 'react-use';
|
import { useHotKey } from '../../hooks/useHotKey';
|
||||||
import { Overlay } from '../Overlay';
|
import { Overlay } from '../Overlay';
|
||||||
import { Heading } from './Heading';
|
import { Heading } from './Heading';
|
||||||
import { IconButton } from './IconButton';
|
import { IconButton } from './IconButton';
|
||||||
@@ -34,10 +34,7 @@ export function Dialog({
|
|||||||
[description],
|
[description],
|
||||||
);
|
);
|
||||||
|
|
||||||
useKeyPressEvent('Escape', (e) => {
|
useHotKey('popup.close', onClose);
|
||||||
e.preventDefault();
|
|
||||||
onClose();
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Overlay open={open} onClose={onClose} portalName="dialog">
|
<Overlay open={open} onClose={onClose} portalName="dialog">
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ const Menu = forwardRef<Omit<DropdownRef, 'open' | 'isOpen' | 'toggle'>, MenuPro
|
|||||||
[handleClose],
|
[handleClose],
|
||||||
);
|
);
|
||||||
|
|
||||||
useHotKey('dropdown.close', handleClose);
|
useHotKey('popup.close', handleClose);
|
||||||
|
|
||||||
const handlePrev = useCallback(() => {
|
const handlePrev = useCallback(() => {
|
||||||
setSelectedIndex((currIndex) => {
|
setSelectedIndex((currIndex) => {
|
||||||
|
|||||||
10
src-web/hooks/useAppInfo.ts
Normal file
10
src-web/hooks/useAppInfo.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import * as app from '@tauri-apps/api/app';
|
||||||
|
import * as path from '@tauri-apps/api/path';
|
||||||
|
|
||||||
|
export function useAppInfo() {
|
||||||
|
return useQuery(['appInfo'], async () => {
|
||||||
|
const [version, appDataDir] = await Promise.all([app.getVersion(), path.appDataDir()]);
|
||||||
|
return { version, appDataDir };
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
|
||||||
import { getVersion } from '@tauri-apps/api/app';
|
|
||||||
|
|
||||||
export function useAppVersion() {
|
|
||||||
return useQuery<string>(['appVersion'], getVersion);
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ import { debounce } from '../lib/debounce';
|
|||||||
import { useOsInfo } from './useOsInfo';
|
import { useOsInfo } from './useOsInfo';
|
||||||
|
|
||||||
export type HotkeyAction =
|
export type HotkeyAction =
|
||||||
| 'dropdown.close'
|
| 'popup.close'
|
||||||
| 'environmentEditor.toggle'
|
| 'environmentEditor.toggle'
|
||||||
| 'hotkeys.showHelp'
|
| 'hotkeys.showHelp'
|
||||||
| 'grpc_request.send'
|
| 'grpc_request.send'
|
||||||
@@ -20,7 +20,7 @@ export type HotkeyAction =
|
|||||||
| 'urlBar.focus';
|
| 'urlBar.focus';
|
||||||
|
|
||||||
const hotkeys: Record<HotkeyAction, string[]> = {
|
const hotkeys: Record<HotkeyAction, string[]> = {
|
||||||
'dropdown.close': ['Escape'],
|
'popup.close': ['Escape'],
|
||||||
'environmentEditor.toggle': ['CmdCtrl+Shift+e'],
|
'environmentEditor.toggle': ['CmdCtrl+Shift+e'],
|
||||||
'grpc_request.send': ['CmdCtrl+Enter', 'CmdCtrl+r'],
|
'grpc_request.send': ['CmdCtrl+Enter', 'CmdCtrl+r'],
|
||||||
'hotkeys.showHelp': ['CmdCtrl+Shift+/'],
|
'hotkeys.showHelp': ['CmdCtrl+Shift+/'],
|
||||||
@@ -36,7 +36,7 @@ const hotkeys: Record<HotkeyAction, string[]> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const hotkeyLabels: Record<HotkeyAction, string> = {
|
const hotkeyLabels: Record<HotkeyAction, string> = {
|
||||||
'dropdown.close': 'Close Dropdown',
|
'popup.close': 'Close Dropdown',
|
||||||
'environmentEditor.toggle': 'Edit Environments',
|
'environmentEditor.toggle': 'Edit Environments',
|
||||||
'grpc_request.send': 'Send Message',
|
'grpc_request.send': 'Send Message',
|
||||||
'hotkeys.showHelp': 'Show Keyboard Shortcuts',
|
'hotkeys.showHelp': 'Show Keyboard Shortcuts',
|
||||||
|
|||||||
Reference in New Issue
Block a user