mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 22:22:02 +02:00
Run oxfmt across repo, add format script and docs
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import { revealItemInDir } from '@tauri-apps/plugin-opener';
|
||||
import { getModel, settingsAtom, workspacesAtom } from '@yaakapp-internal/models';
|
||||
import classNames from 'classnames';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
import { openWorkspaceFromSyncDir } from '../commands/openWorkspaceFromSyncDir';
|
||||
import { openWorkspaceSettings } from '../commands/openWorkspaceSettings';
|
||||
import { switchWorkspace } from '../commands/switchWorkspace';
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { revealItemInDir } from "@tauri-apps/plugin-opener";
|
||||
import { getModel, settingsAtom, workspacesAtom } from "@yaakapp-internal/models";
|
||||
import classNames from "classnames";
|
||||
import { useAtomValue } from "jotai";
|
||||
import { memo, useCallback, useMemo } from "react";
|
||||
import { openWorkspaceFromSyncDir } from "../commands/openWorkspaceFromSyncDir";
|
||||
import { openWorkspaceSettings } from "../commands/openWorkspaceSettings";
|
||||
import { switchWorkspace } from "../commands/switchWorkspace";
|
||||
import {
|
||||
activeWorkspaceAtom,
|
||||
activeWorkspaceIdAtom,
|
||||
activeWorkspaceMetaAtom,
|
||||
} from '../hooks/useActiveWorkspace';
|
||||
import { useCreateWorkspace } from '../hooks/useCreateWorkspace';
|
||||
import { useDeleteSendHistory } from '../hooks/useDeleteSendHistory';
|
||||
import { useWorkspaceActions } from '../hooks/useWorkspaceActions';
|
||||
import { showDialog } from '../lib/dialog';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
import { revealInFinderText } from '../lib/reveal';
|
||||
import { CloneGitRepositoryDialog } from './CloneGitRepositoryDialog';
|
||||
import type { ButtonProps } from './core/Button';
|
||||
import { Button } from './core/Button';
|
||||
import type { DropdownItem } from './core/Dropdown';
|
||||
import { Icon } from './core/Icon';
|
||||
import type { RadioDropdownItem } from './core/RadioDropdown';
|
||||
import { RadioDropdown } from './core/RadioDropdown';
|
||||
import { SwitchWorkspaceDialog } from './SwitchWorkspaceDialog';
|
||||
} from "../hooks/useActiveWorkspace";
|
||||
import { useCreateWorkspace } from "../hooks/useCreateWorkspace";
|
||||
import { useDeleteSendHistory } from "../hooks/useDeleteSendHistory";
|
||||
import { useWorkspaceActions } from "../hooks/useWorkspaceActions";
|
||||
import { showDialog } from "../lib/dialog";
|
||||
import { jotaiStore } from "../lib/jotai";
|
||||
import { revealInFinderText } from "../lib/reveal";
|
||||
import { CloneGitRepositoryDialog } from "./CloneGitRepositoryDialog";
|
||||
import type { ButtonProps } from "./core/Button";
|
||||
import { Button } from "./core/Button";
|
||||
import type { DropdownItem } from "./core/Dropdown";
|
||||
import { Icon } from "./core/Icon";
|
||||
import type { RadioDropdownItem } from "./core/RadioDropdown";
|
||||
import { RadioDropdown } from "./core/RadioDropdown";
|
||||
import { SwitchWorkspaceDialog } from "./SwitchWorkspaceDialog";
|
||||
|
||||
type Props = Pick<ButtonProps, 'className' | 'justify' | 'forDropdown' | 'leftSlot'>;
|
||||
type Props = Pick<ButtonProps, "className" | "justify" | "forDropdown" | "leftSlot">;
|
||||
|
||||
export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
className,
|
||||
@@ -42,9 +42,9 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
|
||||
const openCloneGitRepositoryDialog = useCallback(() => {
|
||||
showDialog({
|
||||
id: 'clone-git-repository',
|
||||
size: 'md',
|
||||
title: 'Clone Git Repository',
|
||||
id: "clone-git-repository",
|
||||
size: "md",
|
||||
title: "Clone Git Repository",
|
||||
render: ({ hide }) => <CloneGitRepositoryDialog hide={hide} />,
|
||||
});
|
||||
}, []);
|
||||
@@ -63,20 +63,20 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
|
||||
const itemsBefore: DropdownItem[] = [
|
||||
{
|
||||
label: 'New Workspace',
|
||||
label: "New Workspace",
|
||||
leftSlot: <Icon icon="plus" />,
|
||||
submenu: [
|
||||
{
|
||||
label: 'Create Empty',
|
||||
label: "Create Empty",
|
||||
leftSlot: <Icon icon="plus_circle" />,
|
||||
onSelect: createWorkspace,
|
||||
},
|
||||
{
|
||||
label: 'Open Folder',
|
||||
label: "Open Folder",
|
||||
leftSlot: <Icon icon="folder_open" />,
|
||||
onSelect: async () => {
|
||||
const dir = await open({
|
||||
title: 'Select Workspace Directory',
|
||||
title: "Select Workspace Directory",
|
||||
directory: true,
|
||||
multiple: false,
|
||||
});
|
||||
@@ -86,7 +86,7 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Clone Git Repository',
|
||||
label: "Clone Git Repository",
|
||||
leftSlot: <Icon icon="hard_drive_download" />,
|
||||
onSelect: openCloneGitRepositoryDialog,
|
||||
},
|
||||
@@ -96,16 +96,16 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
const itemsAfter: DropdownItem[] = [
|
||||
...workspaceActions.map((a) => ({
|
||||
label: a.label,
|
||||
leftSlot: <Icon icon={a.icon ?? 'empty'} />,
|
||||
leftSlot: <Icon icon={a.icon ?? "empty"} />,
|
||||
onSelect: async () => {
|
||||
if (workspace != null) await a.call(workspace);
|
||||
},
|
||||
})),
|
||||
...(workspaceActions.length > 0 ? [{ type: 'separator' as const }] : []),
|
||||
...(workspaceActions.length > 0 ? [{ type: "separator" as const }] : []),
|
||||
{
|
||||
label: 'Workspace Settings',
|
||||
label: "Workspace Settings",
|
||||
leftSlot: <Icon icon="settings" />,
|
||||
hotKeyAction: 'workspace_settings.show',
|
||||
hotKeyAction: "workspace_settings.show",
|
||||
onSelect: openWorkspaceSettings,
|
||||
},
|
||||
{
|
||||
@@ -118,8 +118,8 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Clear Send History',
|
||||
color: 'warning',
|
||||
label: "Clear Send History",
|
||||
color: "warning",
|
||||
leftSlot: <Icon icon="history" />,
|
||||
onSelect: deleteSendHistory,
|
||||
},
|
||||
@@ -148,18 +148,18 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
switchWorkspace.mutate({ workspaceId, inNewWindow: true });
|
||||
return;
|
||||
}
|
||||
if (typeof settings.openWorkspaceNewWindow === 'boolean') {
|
||||
if (typeof settings.openWorkspaceNewWindow === "boolean") {
|
||||
switchWorkspace.mutate({ workspaceId, inNewWindow: settings.openWorkspaceNewWindow });
|
||||
return;
|
||||
}
|
||||
|
||||
const workspace = getModel('workspace', workspaceId);
|
||||
const workspace = getModel("workspace", workspaceId);
|
||||
if (workspace == null) return;
|
||||
|
||||
showDialog({
|
||||
id: 'switch-workspace',
|
||||
size: 'sm',
|
||||
title: 'Switch Workspace',
|
||||
id: "switch-workspace",
|
||||
size: "sm",
|
||||
title: "Switch Workspace",
|
||||
render: ({ hide }) => <SwitchWorkspaceDialog workspace={workspace} hide={hide} />,
|
||||
});
|
||||
}, []);
|
||||
@@ -176,12 +176,12 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
|
||||
size="sm"
|
||||
className={classNames(
|
||||
className,
|
||||
'text !px-2 truncate',
|
||||
workspace === null && 'italic opacity-disabled',
|
||||
"text !px-2 truncate",
|
||||
workspace === null && "italic opacity-disabled",
|
||||
)}
|
||||
{...buttonProps}
|
||||
>
|
||||
{workspace?.name ?? 'Workspace'}
|
||||
{workspace?.name ?? "Workspace"}
|
||||
</Button>
|
||||
</RadioDropdown>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user