Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
binarybaron committed Oct 9, 2024
1 parent f4c61c6 commit 2b5d67c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
6 changes: 4 additions & 2 deletions src-gui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
height: 100%;
margin: 0;
overflow: auto;
overscroll-behavior: none; /* Prevents the bounce effect */
overscroll-behavior-y: contain; /* Prevents the bounce effect on the y-axis */
}

* {
overscroll-behavior: none; /* Prevents the bounce effect on all elements */
}
</style>
</body>
Expand Down
3 changes: 2 additions & 1 deletion src-gui/src/renderer/components/modal/swap/SwapDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ export default function SwapDialog({
onClose: () => void;
}) {
const classes = useStyles();

const swap = useAppSelector((state) => state.swap);
const isSwapRunning = useIsSwapRunning();

const [debug, setDebug] = useState(false);
const [openSuspendAlert, setOpenSuspendAlert] = useState(false);

const dispatch = useAppDispatch();

function onCancel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default function InitPage() {
endIcon={<PlayArrowIcon />}
onInvoke={init}
displayErrorSnackbar
onPendingChange={}
>
Request quote and start swap
</PromiseInvokeButton>
Expand Down
8 changes: 4 additions & 4 deletions src-gui/src/renderer/store/storeRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ const rootPersistConfig = {
};

// Use Tauri's store plugin for persistent settings
const tauriStore = await createStore(`${getNetworkName()}_settings.bin`, {
const tauriStore = createStore(`${getNetworkName()}_settings.bin`, {
autoSave: 1000 as unknown as boolean,
});

// Configure how settings are stored and retrieved using Tauri's storage
const settingsPersistConfig = {
key: "settings",
storage: {
getItem: async (key: string) => (tauriStore).get(key),
setItem: async (key: string, value: unknown) => (tauriStore).set(key, value),
removeItem: async (key: string) => (tauriStore).delete(key),
getItem: async (key: string) => (await tauriStore).get(key),
setItem: async (key: string, value: unknown) => (await tauriStore).set(key, value),
removeItem: async (key: string) => (await tauriStore).delete(key),
},
};

Expand Down
9 changes: 2 additions & 7 deletions src-gui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ export default defineConfig(async () => ({
plugins: [
react(),
tsconfigPaths(),
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: "__tla",
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: i => `__tla_${i}`
}),
// automatically regenerate the typescript bindings when there's a change
topLevelAwait(),
// Automatically regenerate the typescript bindings when there's a change to the rust code
watch({
pattern: ["../swap/src/**/*"],
command: "yarn run gen-bindings",
Expand Down
4 changes: 0 additions & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"build": {
"devUrl": "http://localhost:1420",
"frontendDist": "../src-gui/dist",
"beforeDevCommand": {
"cwd": "../src-gui",
"script": "yarn run dev"
},
"beforeBuildCommand": {
"cwd": "../src-gui",
"script": "yarn run build"
Expand Down
5 changes: 2 additions & 3 deletions swap/src/cli/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ impl Watcher {
// Note: since this is de-facto a daemon, we have to gracefully handle errors
// (which in our case means logging the error message and trying again later)
loop {
tokio::time::sleep(Duration::from_secs(Watcher::CHECK_INTERVAL)).await;

// Fetch current transactions and timelocks
let current_swaps = match self.get_current_swaps().await {
Ok(val) => val,
Expand Down Expand Up @@ -82,9 +84,6 @@ impl Watcher {
// Insert new status
self.cached_timelocks.insert(swap_id, new_timelock_status);
}

// Sleep and check again later
tokio::time::sleep(Duration::from_secs(Watcher::CHECK_INTERVAL)).await;
}
}

Expand Down

0 comments on commit 2b5d67c

Please sign in to comment.