Skip to content

Commit

Permalink
Implement favourite asset loader screen
Browse files Browse the repository at this point in the history
Display a loader whilst the chosen favourite asset's details are retrieved from the bitshares blockchain, rather than the main menu.
  • Loading branch information
grctest committed Jan 16, 2023
1 parent adf21d8 commit cc6574c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
19 changes: 1 addition & 18 deletions public/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,4 @@ window.electron = {
});
return translations;
}
}

/*
contextBridge.exposeInMainWorld(
"electron",
{
testConnection: async (url) => {
return _testConnection(url);
},
openURL: async (target) => {
return _openURL(target);
},
openDEX: async (args) => {
return _openDEX(args);
}
}
);
*/
}
19 changes: 19 additions & 0 deletions src/components/blockchain/Favourites.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default function Favourites(properties) {
let environment = appStore((state) => state.environment);
const relevantChain = environment === 'production' ? 'BTS' : 'BTS_TEST';

const [inProgress, setInProgress] = useState(false);

function goBack() {
setMode();
}
Expand All @@ -28,8 +30,10 @@ export default function Favourites(properties) {
* @param {String} assetID
*/
async function chosenAsset(assetID) {
setInProgress(true);
if (!assetID.includes('1.3.')) {
console.log('invalid ID');
setInProgress(false);
return;
}
console.log('chosen favourite' + assetID);
Expand All @@ -39,15 +43,18 @@ export default function Favourites(properties) {
searchResult = await fetchObject(nodes[0], assetID);
} catch (error) {
console.log(error);
setInProgress(false);
return;
}

if (!searchResult || !searchResult.length) {
console.log({msg: "Couldn't find account", account});
setInProgress(false);
return;
}

setAsset(searchResult[0]);
setInProgress(false);
setMode();
}

Expand Down Expand Up @@ -123,6 +130,18 @@ export default function Favourites(properties) {
})
: null;

if (inProgress) {
return (
<Col span={12}>
<Paper padding="sm" shadow="xs">
<Box mx="auto" sx={{padding: '10px'}}>
<Loader size="lg" />
</Box>
</Paper>
</Col>
);
}

return (
<Col span={12}>
<Paper padding="sm" shadow="xs">
Expand Down
1 change: 0 additions & 1 deletion src/lib/states.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18next from 'i18next';
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import { connect, checkBeet, link } from 'beet-js';
Expand Down
1 change: 0 additions & 1 deletion src/localization/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import i18next from 'i18next';
import { initReactI18next } from "react-i18next";
import { localePreferenceStore } from '../lib/states';

const languages = ['en','da', 'de', 'et', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'th'];
const pages = [
'beet',
'blockchain',
Expand Down

0 comments on commit cc6574c

Please sign in to comment.