From 40f0f5387a92f90ac1791701f559aeda54a0a617 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 3 Dec 2024 09:43:16 -0800 Subject: [PATCH] Fix lint problems --- package-lock.json | 10 ++++++---- src-tauri/yaak_templates/bindings/parser.ts | 9 +++++++++ src-tauri/yaak_templates/index.ts | 1 + src-tauri/yaak_templates/package.json | 6 ++++++ src-web/components/LicenseBadge.tsx | 4 ++-- src-web/components/TemplateFunctionDialog.tsx | 2 +- src-web/components/TemplateVariableDialog.tsx | 2 +- src-web/components/WorkspaceHeader.tsx | 2 -- src-web/hooks/useOpenSettings.tsx | 4 ++-- src-web/hooks/useParseTemplate.ts | 2 +- src-web/hooks/useTemplateTokensToString.ts | 2 +- src-web/package.json | 1 - 12 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 src-tauri/yaak_templates/bindings/parser.ts create mode 100644 src-tauri/yaak_templates/index.ts create mode 100644 src-tauri/yaak_templates/package.json diff --git a/package-lock.json b/package-lock.json index d23936ee..a93a7751 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3389,6 +3389,10 @@ "resolved": "src-tauri/yaak_sse", "link": true }, + "node_modules/@yaakapp-internal/templates": { + "resolved": "src-tauri/yaak_templates", + "link": true + }, "node_modules/@yaakapp/api": { "resolved": "plugin-runtime-types", "link": true @@ -13752,9 +13756,8 @@ "version": "1.0.0" }, "src-tauri/yaak_templates": { - "name": "@yaakapp-internal/template", - "version": "1.0.0", - "extraneous": true + "name": "@yaakapp-internal/templates", + "version": "1.0.0" }, "src-web": { "name": "@yaakapp/app", @@ -13779,7 +13782,6 @@ "@tauri-apps/plugin-log": "^2.0.0", "@tauri-apps/plugin-os": "^2.0.0", "@tauri-apps/plugin-shell": "^2.0.0", - "@yaakapp-internal/license": "^1.0.0", "buffer": "^6.0.3", "classnames": "^2.5.1", "cm6-graphql": "^0.0.9", diff --git a/src-tauri/yaak_templates/bindings/parser.ts b/src-tauri/yaak_templates/bindings/parser.ts new file mode 100644 index 00000000..956b93a7 --- /dev/null +++ b/src-tauri/yaak_templates/bindings/parser.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type FnArg = { name: string, value: Val, }; + +export type Token = { "type": "raw", text: string, } | { "type": "tag", val: Val, } | { "type": "eof" }; + +export type Tokens = { tokens: Array, }; + +export type Val = { "type": "str", text: string, } | { "type": "var", name: string, } | { "type": "bool", value: boolean, } | { "type": "fn", name: string, args: Array, } | { "type": "null" }; diff --git a/src-tauri/yaak_templates/index.ts b/src-tauri/yaak_templates/index.ts new file mode 100644 index 00000000..1aaf1968 --- /dev/null +++ b/src-tauri/yaak_templates/index.ts @@ -0,0 +1 @@ +export * from './bindings/parser'; diff --git a/src-tauri/yaak_templates/package.json b/src-tauri/yaak_templates/package.json new file mode 100644 index 00000000..7d63f67b --- /dev/null +++ b/src-tauri/yaak_templates/package.json @@ -0,0 +1,6 @@ +{ + "name": "@yaakapp-internal/templates", + "private": true, + "version": "1.0.0", + "main": "index.ts" +} diff --git a/src-web/components/LicenseBadge.tsx b/src-web/components/LicenseBadge.tsx index fdc624c6..f8636b29 100644 --- a/src-web/components/LicenseBadge.tsx +++ b/src-web/components/LicenseBadge.tsx @@ -12,7 +12,7 @@ const labels: Record = { }; export function LicenseBadge() { - const openSettings = useOpenSettings(); + const openSettings = useOpenSettings(SettingsTab.License); const { check } = useLicense(); if (check.data == null) { @@ -29,7 +29,7 @@ export function LicenseBadge() { size="2xs" variant="border" className="!rounded-full mx-1" - onClick={() => openSettings.mutate(SettingsTab.License)} + onClick={() => openSettings.mutate()} color={ check.data.type == 'trial_ended' || check.data.type === 'personal_use' ? 'primary' diff --git a/src-web/components/TemplateFunctionDialog.tsx b/src-web/components/TemplateFunctionDialog.tsx index ca787520..cd7b34aa 100644 --- a/src-web/components/TemplateFunctionDialog.tsx +++ b/src-web/components/TemplateFunctionDialog.tsx @@ -8,7 +8,7 @@ import type { TemplateFunctionSelectArg, TemplateFunctionTextArg, } from '@yaakapp-internal/plugin'; -import type { FnArg, Tokens } from '@yaakapp-internal/template'; +import type { FnArg, Tokens } from '@yaakapp-internal/templates'; import classNames from 'classnames'; import { useCallback, useMemo, useState } from 'react'; import { useActiveRequest } from '../hooks/useActiveRequest'; diff --git a/src-web/components/TemplateVariableDialog.tsx b/src-web/components/TemplateVariableDialog.tsx index aa370172..d47b77f2 100644 --- a/src-web/components/TemplateVariableDialog.tsx +++ b/src-web/components/TemplateVariableDialog.tsx @@ -1,4 +1,4 @@ -import type { Tokens } from '@yaakapp-internal/template'; +import type { Tokens } from '@yaakapp-internal/templates'; import { useCallback, useMemo, useState } from 'react'; import { useActiveEnvironmentVariables } from '../hooks/useActiveEnvironmentVariables'; import { useRenderTemplate } from '../hooks/useRenderTemplate'; diff --git a/src-web/components/WorkspaceHeader.tsx b/src-web/components/WorkspaceHeader.tsx index 652f2bf8..2bdaa065 100644 --- a/src-web/components/WorkspaceHeader.tsx +++ b/src-web/components/WorkspaceHeader.tsx @@ -1,9 +1,7 @@ import classNames from 'classnames'; import React, { memo } from 'react'; -import { appInfo } from '../hooks/useAppInfo'; import { useToggleCommandPalette } from '../hooks/useToggleCommandPalette'; import { CookieDropdown } from './CookieDropdown'; -import { Button } from './core/Button'; import { Icon } from './core/Icon'; import { IconButton } from './core/IconButton'; import { HStack } from './core/Stacks'; diff --git a/src-web/hooks/useOpenSettings.tsx b/src-web/hooks/useOpenSettings.tsx index e95f19ca..9cf7f61c 100644 --- a/src-web/hooks/useOpenSettings.tsx +++ b/src-web/hooks/useOpenSettings.tsx @@ -4,12 +4,12 @@ import { invokeCmd } from '../lib/tauri'; import { useActiveWorkspace } from './useActiveWorkspace'; import { useAppRoutes } from './useAppRoutes'; -export function useOpenSettings() { +export function useOpenSettings(tab?: SettingsTab) { const routes = useAppRoutes(); const workspace = useActiveWorkspace(); return useMutation({ mutationKey: ['open_settings'], - mutationFn: async (tab?: SettingsTab) => { + mutationFn: async () => { if (workspace == null) return; await invokeCmd('cmd_new_child_window', { diff --git a/src-web/hooks/useParseTemplate.ts b/src-web/hooks/useParseTemplate.ts index fce83036..3f60aac6 100644 --- a/src-web/hooks/useParseTemplate.ts +++ b/src-web/hooks/useParseTemplate.ts @@ -1,5 +1,5 @@ import { useQuery } from '@tanstack/react-query'; -import type { Tokens } from '@yaakapp-internal/template'; +import type { Tokens } from '@yaakapp-internal/templates'; import { invokeCmd } from '../lib/tauri'; export function useParseTemplate(template: string) { diff --git a/src-web/hooks/useTemplateTokensToString.ts b/src-web/hooks/useTemplateTokensToString.ts index 7f073329..b8c9b603 100644 --- a/src-web/hooks/useTemplateTokensToString.ts +++ b/src-web/hooks/useTemplateTokensToString.ts @@ -1,5 +1,5 @@ import { useQuery } from '@tanstack/react-query'; -import type { Tokens } from '@yaakapp-internal/template'; +import type { Tokens } from '@yaakapp-internal/templates'; import { invokeCmd } from '../lib/tauri'; export function useTemplateTokensToString(tokens: Tokens) { diff --git a/src-web/package.json b/src-web/package.json index 77a5c603..16b60eb7 100644 --- a/src-web/package.json +++ b/src-web/package.json @@ -28,7 +28,6 @@ "@tauri-apps/plugin-log": "^2.0.0", "@tauri-apps/plugin-os": "^2.0.0", "@tauri-apps/plugin-shell": "^2.0.0", - "@yaakapp-internal/license": "^1.0.0", "buffer": "^6.0.3", "classnames": "^2.5.1", "cm6-graphql": "^0.0.9",