mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 03:11:12 +01:00
Git support (#143)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Workspace } from '@yaakapp-internal/models';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { router } from '../lib/router';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { getActiveWorkspace } from './useActiveWorkspace';
|
||||
@@ -12,10 +12,9 @@ export function useDeleteActiveWorkspace() {
|
||||
mutationKey: ['delete_workspace'],
|
||||
mutationFn: async () => {
|
||||
const workspace = getActiveWorkspace();
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-workspace',
|
||||
title: 'Delete Workspace',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{workspace?.name}</InlineCode>?
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { GrpcRequest } from '@yaakapp-internal/models';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
@@ -10,10 +10,9 @@ export function useDeleteAnyGrpcRequest() {
|
||||
return useFastMutation<GrpcRequest | null, string, GrpcRequest>({
|
||||
mutationKey: ['delete_any_grpc_request'],
|
||||
mutationFn: async (request) => {
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-grpc-request',
|
||||
title: 'Delete Request',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{fallbackRequestName(request)}</InlineCode>?
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HttpRequest } from '@yaakapp-internal/models';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
@@ -10,10 +10,9 @@ export function useDeleteAnyHttpRequest() {
|
||||
return useFastMutation<HttpRequest | null, string, HttpRequest>({
|
||||
mutationKey: ['delete_any_http_request'],
|
||||
mutationFn: async (request) => {
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-request',
|
||||
title: 'Delete Request',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{fallbackRequestName(request)}</InlineCode>?
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { CookieJar } from '@yaakapp-internal/models';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { cookieJarsAtom } from './useCookieJars';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
@@ -14,10 +14,9 @@ export function useDeleteCookieJar(cookieJar: CookieJar | null) {
|
||||
return useFastMutation<CookieJar | null, string>({
|
||||
mutationKey: ['delete_cookie_jar', cookieJar?.id],
|
||||
mutationFn: async () => {
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-cookie-jar',
|
||||
title: 'Delete CookieJar',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{cookieJar?.name}</InlineCode>?
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Environment } from '@yaakapp-internal/models';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { environmentsAtom } from './useEnvironments';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
@@ -14,10 +14,9 @@ export function useDeleteEnvironment(environment: Environment | null) {
|
||||
return useFastMutation<Environment | null, string>({
|
||||
mutationKey: ['delete_environment', environment?.id],
|
||||
mutationFn: async () => {
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-environment',
|
||||
title: 'Delete Environment',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{environment?.name}</InlineCode>?
|
||||
|
||||
@@ -2,10 +2,10 @@ import type { Folder } from '@yaakapp-internal/models';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
import {foldersAtom, getFolder} from './useFolders';
|
||||
import { foldersAtom, getFolder } from './useFolders';
|
||||
import { removeModelById } from './useSyncModelStores';
|
||||
|
||||
export function useDeleteFolder(id: string | null) {
|
||||
@@ -15,10 +15,9 @@ export function useDeleteFolder(id: string | null) {
|
||||
mutationKey: ['delete_folder', id],
|
||||
mutationFn: async () => {
|
||||
const folder = getFolder(id);
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-folder',
|
||||
title: 'Delete Folder',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{folder?.name}</InlineCode> and everything in it?
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useSetAtom } from 'jotai/index';
|
||||
import { showAlert } from '../lib/alert';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { showConfirmDelete } from '../lib/confirm';
|
||||
import { pluralizeCount } from '../lib/pluralize';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { getActiveWorkspaceId } from './useActiveWorkspace';
|
||||
@@ -34,10 +34,9 @@ export function useDeleteSendHistory() {
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmed = await showConfirm({
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-send-history',
|
||||
title: 'Clear Send History',
|
||||
variant: 'delete',
|
||||
description: <>Delete {labels.join(' and ')}?</>,
|
||||
});
|
||||
if (!confirmed) return false;
|
||||
|
||||
@@ -25,7 +25,9 @@ export function useNotificationToast() {
|
||||
id: payload.id,
|
||||
timeout: null,
|
||||
message: payload.message,
|
||||
onClose: () => markRead(payload.id),
|
||||
onClose: () => {
|
||||
markRead(payload.id)
|
||||
},
|
||||
action: ({ hide }) =>
|
||||
actionLabel && actionUrl ? (
|
||||
<Button
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { useRouter } from '@tanstack/react-router';
|
||||
import { SettingsTab } from '../components/Settings/SettingsTab';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { getActiveWorkspaceId } from './useActiveWorkspace';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
|
||||
export function useOpenSettings(tab = SettingsTab.General) {
|
||||
const router = useRouter();
|
||||
return useFastMutation({
|
||||
mutationKey: ['open_settings'],
|
||||
mutationFn: async () => {
|
||||
const workspaceId = getActiveWorkspaceId();
|
||||
if (workspaceId == null) return;
|
||||
|
||||
trackEvent('dialog', 'show', { id: 'settings', tab: `${tab}` });
|
||||
const location = router.buildLocation({
|
||||
to: '/workspaces/$workspaceId/settings',
|
||||
params: { workspaceId },
|
||||
search: { tab },
|
||||
});
|
||||
await invokeCmd('cmd_new_child_window', {
|
||||
url: location.href,
|
||||
label: 'settings',
|
||||
title: 'Yaak Settings',
|
||||
innerSize: [750, 600],
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user