mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:15 +01:00
Changes for commercial use (#138)
This commit is contained in:
@@ -8,7 +8,7 @@ export interface AppInfo {
|
||||
appLogDir: string;
|
||||
}
|
||||
|
||||
const appInfo = (await invokeCmd('cmd_metadata')) as AppInfo;
|
||||
export const appInfo = (await invokeCmd('cmd_metadata')) as AppInfo;
|
||||
|
||||
export function useAppInfo() {
|
||||
return appInfo;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { SettingsTab } from '../components/Settings/Settings';
|
||||
import { QUERY_COOKIE_JAR_ID } from './useActiveCookieJar';
|
||||
import { QUERY_ENVIRONMENT_ID } from './useActiveEnvironment';
|
||||
|
||||
@@ -13,12 +14,18 @@ export type RouteParamsRequest = RouteParamsWorkspace & {
|
||||
requestId: string;
|
||||
};
|
||||
|
||||
export type RouteParamsSettings = {
|
||||
workspaceId: string;
|
||||
tab?: SettingsTab;
|
||||
};
|
||||
|
||||
export const paths = {
|
||||
workspaces() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
workspaces(_ = {}) {
|
||||
return '/workspaces';
|
||||
},
|
||||
workspaceSettings({ workspaceId } = { workspaceId: ':workspaceId' } as RouteParamsWorkspace) {
|
||||
return `/workspaces/${workspaceId}/settings`;
|
||||
workspaceSettings({ workspaceId, tab } = { workspaceId: ':workspaceId' } as RouteParamsSettings) {
|
||||
return `/workspaces/${workspaceId}/settings?tab=${tab ?? SettingsTab.General}`;
|
||||
},
|
||||
workspace(
|
||||
{ workspaceId, environmentId, cookieJarId } = {
|
||||
|
||||
@@ -19,7 +19,7 @@ export function useKeyValue<T extends object | boolean | number | string | null>
|
||||
key,
|
||||
fallback,
|
||||
}: {
|
||||
namespace?: 'global' | 'no_sync';
|
||||
namespace?: 'global' | 'no_sync' | 'license';
|
||||
key: string | string[];
|
||||
fallback: T;
|
||||
}) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import type { SettingsTab } from '../components/Settings/Settings';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useActiveWorkspace } from './useActiveWorkspace';
|
||||
import { useAppRoutes } from './useAppRoutes';
|
||||
@@ -8,15 +9,11 @@ export function useOpenSettings() {
|
||||
const workspace = useActiveWorkspace();
|
||||
return useMutation({
|
||||
mutationKey: ['open_settings'],
|
||||
mutationFn: async () => {
|
||||
mutationFn: async (tab?: SettingsTab) => {
|
||||
if (workspace == null) return;
|
||||
|
||||
await invokeCmd('cmd_new_child_window', {
|
||||
url: routes.paths.workspaceSettings({
|
||||
workspaceId: workspace.id,
|
||||
cookieJarId: null,
|
||||
environmentId: null,
|
||||
}),
|
||||
url: routes.paths.workspaceSettings({ workspaceId: workspace.id, tab }),
|
||||
label: 'settings',
|
||||
title: 'Yaak Settings',
|
||||
innerSize: [600, 550],
|
||||
|
||||
Reference in New Issue
Block a user