-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tools): moved everything into the tools dir
- Loading branch information
Showing
21 changed files
with
678 additions
and
424 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './cli'; | ||
export * from './tauri'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-disable @tanstack/query/exhaustive-deps */ | ||
import { type UseMutationOptions, queryOptions } from '@tanstack/react-query'; | ||
import { type OpenDialogOptions, open } from '@tauri-apps/api/dialog'; | ||
import { normalize } from '@tauri-apps/api/path'; | ||
|
||
import { queryClient } from '~/lib/query-client'; | ||
|
||
import { cli } from './cli'; | ||
|
||
export const tauri = { | ||
dialog: { | ||
open(defaultOptions?: OpenDialogOptions) { | ||
return { | ||
mutationKey: ['open', defaultOptions].filter((v) => !!v), | ||
mutationFn: async ({ options: _options }: { options?: OpenDialogOptions }) => { | ||
const options = { ...defaultOptions, ..._options }; | ||
let dir: string | null = null; | ||
const selected = await open(options); | ||
if (Array.isArray(selected)) dir = selected[0]; | ||
else dir = selected; | ||
if (!dir) throw new Error('No directory selected'); | ||
return dir; | ||
}, | ||
} satisfies UseMutationOptions<string, Error, { options?: OpenDialogOptions }>; | ||
}, | ||
}, | ||
path: { | ||
normalize(path: string) { | ||
return queryOptions({ | ||
queryKey: ['path', 'normalize', path].filter((v) => !!v), | ||
queryFn: async () => { | ||
let p = await normalize(path); | ||
const homeDirectory = await queryClient.fetchQuery(cli.homeDir()); | ||
if (p.includes(homeDirectory)) p = p.replace(homeDirectory, '~/'); | ||
return p; | ||
}, | ||
}); | ||
}, | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Box, type BoxProps } from 'styled-system/jsx'; | ||
|
||
import { IconButton, type IconButtonProps } from '~/ui/icon-button'; | ||
|
||
export interface FloatingActionButtonProps extends IconButtonProps { | ||
containerProps?: BoxProps; | ||
} | ||
|
||
export const FloatingActionButton: React.FC<FloatingActionButtonProps> = ({ containerProps, ...props }) => { | ||
return ( | ||
<Box pos="absolute" top="2" left="2" {...containerProps}> | ||
{/* @ts-expect-error - TODO: fix */} | ||
<IconButton {...props} /> | ||
</Box> | ||
); | ||
}; |
Oops, something went wrong.