mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-24 01:43:28 -05:00
fix(gui): Button to open data directory (#256)
This commit is contained in:
parent
9e27c6548b
commit
c9d3536f36
11 changed files with 187 additions and 24 deletions
|
|
@ -23,6 +23,7 @@
|
|||
"@tauri-apps/api": "^2.0.0",
|
||||
"@tauri-apps/plugin-cli": "^2.0.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
|
||||
"@tauri-apps/plugin-opener": "^2.2.5",
|
||||
"@tauri-apps/plugin-process": "^2.0.0",
|
||||
"@tauri-apps/plugin-shell": "^2.0.0",
|
||||
"@tauri-apps/plugin-store": "^2.0.0",
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import PromiseInvokeButton from "renderer/components/PromiseInvokeButton";
|
|||
import { useAppSelector } from "store/hooks";
|
||||
import InfoBox from "../../modal/swap/InfoBox";
|
||||
import CliLogsBox from "../../other/RenderedCliLog";
|
||||
import { initializeContext } from "renderer/rpc";
|
||||
import { getDataDir, initializeContext } from "renderer/rpc";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
import RotateLeftIcon from "@material-ui/icons/RotateLeft";
|
||||
import { revealItemInDir } from "@tauri-apps/plugin-opener";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
actionsOuter: {
|
||||
|
|
@ -66,11 +67,12 @@ export default function DaemonControlBox() {
|
|||
<PromiseInvokeButton
|
||||
endIcon={<FolderOpenIcon />}
|
||||
isIconButton
|
||||
requiresContext={false}
|
||||
size="small"
|
||||
tooltipTitle="Open the data directory of the Swap Daemon in your file explorer"
|
||||
onInvoke={() => {
|
||||
// TODO: Implement this
|
||||
throw new Error("Not implemented");
|
||||
tooltipTitle="Open the data directory in your file explorer"
|
||||
onInvoke={async () => {
|
||||
const dataDir = await getDataDir();
|
||||
await revealItemInDir(dataDir);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import {
|
|||
CheckElectrumNodeResponse,
|
||||
GetMoneroAddressesResponse,
|
||||
TauriBackgroundRefundEvent,
|
||||
GetDataDirArgs,
|
||||
} from "models/tauriModel";
|
||||
import {
|
||||
contextStatusEventReceived,
|
||||
|
|
@ -277,3 +278,10 @@ export async function updateAllNodeStatuses() {
|
|||
export async function getMoneroAddresses(): Promise<GetMoneroAddressesResponse> {
|
||||
return await invokeNoArgs<GetMoneroAddressesResponse>("get_monero_addresses");
|
||||
}
|
||||
|
||||
export async function getDataDir(): Promise<string> {
|
||||
const testnet = isTestnet();
|
||||
return await invoke<GetDataDirArgs, string>("get_data_dir", {
|
||||
is_testnet: testnet,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -792,6 +792,13 @@
|
|||
dependencies:
|
||||
"@tauri-apps/api" "^2.0.0"
|
||||
|
||||
"@tauri-apps/plugin-opener@^2.2.5":
|
||||
version "2.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-opener/-/plugin-opener-2.2.5.tgz#928b917d28d3e8b5bafb90f5f91fb0ed20c27fd4"
|
||||
integrity sha512-hHsJ9RPWpZvZEPVFaL+d25gABMUMOf/A6ESXnvf/ii9guTukj58WXsAE/SOysXRIhej7kseRCxnOnIMpSCdUsQ==
|
||||
dependencies:
|
||||
"@tauri-apps/api" "^2.0.0"
|
||||
|
||||
"@tauri-apps/plugin-process@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/plugin-process/-/plugin-process-2.0.0.tgz#002fd73f0d7b1ae2a5aacf442aa657e83dc2960b"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue