Skip to content

Commit

Permalink
Merge pull request #19 from AvailX/updater-frontend
Browse files Browse the repository at this point in the history
Updater frontend
  • Loading branch information
girogio authored Feb 20, 2024
2 parents deebf74 + 96aad13 commit bf12118
Showing 19 changed files with 179 additions and 72 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -85,14 +85,20 @@ jobs:
with:
node-version: 20
cache: 'npm'
- run: npm install
- run: npm ci

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libsoup-3.0-dev libwebkit2gtk-4.1-dev patchelf javascriptcoregtk-4.1 build-essential curl wget file libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- name: Install Tauri CLI using Cargo
uses: baptiste0928/cargo-install@v3
with:
crate: tauri-cli
version: "2.0.0-beta.1"

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -110,6 +116,7 @@ jobs:
MAINNET_API_OBSCURA: ""
DEVNET_API_OBSCURA: ""
with:
tauriScript: cargo tauri
args: ${{ matrix.platform == 'macos_arm-latest' && ' --target aarch64-apple-darwin' || '' }} # This is required for Apple ARM chips
distPath: dist
# The tagName is alpha for develop, beta for staging and latest for release
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ jobs:
- uses: tauri-apps/tauri-action@v0
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY}}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD}}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD}}
API: ${{ secrets.AVAIL_API_URL}}
DEV_NODE_IP: ${{ secrets.DEV_NODE_IP}}
TESTNET_API_OBSCURA: ${{ secrets.TESTNET_API_OBSCURA}}
73 changes: 70 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.3",
"@mui/x-date-pickers": "^6.18.1",
"@tauri-apps/plugin-deep-link": "^2.0.0-beta.0",
"@tauri-apps/plugin-process": "^2.0.0-beta.0",
"@tauri-apps/plugin-updater": "^2.0.0-beta.0",
"@walletconnect/web3wallet": "^1.10.1",
"axios": "^1.5.1",
"conf": "^12.0.0",
1 change: 1 addition & 0 deletions public/wallet-connect-screens/wallet-connect.js
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ function updateUIswitchCase(data) {
}

case 'create-request-event': {
document.querySelector('#scrollable-container').style.paddingTop = '35px';
if (data.program_id) {
document.querySelector('#program').style.display = 'block';
document.querySelector('#program-input').style.display = 'block';
13 changes: 12 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ tauri = { version = "2.0.0-beta.1", features = [] }
tauri-plugin-deep-link = "2.0.0-beta"
tauri-plugin-http = { version = "2.0.0-beta", features = ["cookies"] }
tauri-plugin-updater = { version = "2.0.0-beta.0", features = [] }
tauri-plugin-process = "2.0.0-beta"
tiny-bip39 = "1.0.0"
tokio = { version = "1.29.1", features = ["full"] }
ureq = { version = "2.7.1", features = ["json"] }
Binary file modified src-tauri/icons/icon.icns
Binary file not shown.
1 change: 1 addition & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ use crate::services::wallet_connect_api::{
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_process::init())
.setup(|app| {
#[cfg(desktop)]
app.handle()
12 changes: 0 additions & 12 deletions src/browser/nova_browser.tsx
Original file line number Diff line number Diff line change
@@ -163,21 +163,9 @@ const Browser: React.FC<BrowserProperties> = ({ initialUrl, theme = 'light', han
setConnected(false);
});

const unlisten_wc_transaction_start = listen('wc_transaction_start', event => {
startScan();
});

const unlisten_wc_transaction_end = listen('wc_transaction_end', (event) => {
if (!scanInProgress){
endScan();
}
})

return () => {
unlisten_connected.then(remove => remove());
unlisten_disconnected.then(remove => remove());
unlisten_wc_transaction_start.then(remove => remove());
unlisten_wc_transaction_end.then(remove => remove());
};
}, []);

4 changes: 0 additions & 4 deletions src/components/dialogs/transfer.tsx
Original file line number Diff line number Diff line change
@@ -43,9 +43,7 @@ const TransferDialog: React.FC<DeleteDialogProperties> = ({ isOpen, onRequestClo
onRequestClose();

sessionStorage.setItem('transferState', 'true');
startScan();
transfer(request, setErrorAlert, setMessage).then(() => {
endScan();
sessionStorage.setItem('transferState', 'false');
}).catch(async (e) => {
console.log(e);
@@ -55,8 +53,6 @@ const TransferDialog: React.FC<DeleteDialogProperties> = ({ isOpen, onRequestClo
error = JSON.parse(e) as AvailError;
}

endScan();

// Handle transfer off
sessionStorage.setItem('transferState', 'false');
emit('transfer_off');
2 changes: 1 addition & 1 deletion src/components/events/event.tsx
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ const AvailEventComponent: React.FC<{event: SuccinctAvailEvent; slideFunction: (
}
</mui.Typography>
<mui.Box sx={{
display: 'flex', flexDirection: 'row', alignItems: 'center', width: '120%',
display: 'flex', flexDirection: 'row', alignItems: 'center', width: '140%',
}}>
<mui.Typography variant='body2' color='grey'>
{formatDate(new Date(created))}
37 changes: 18 additions & 19 deletions src/components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -48,11 +48,6 @@ const renderIcon = (index: number) => {
break;
}

/*
Case 3:
return <InsertPhotoIcon />;
break;
*/
case 3: {
return <DropIcon />;
break;
@@ -63,17 +58,21 @@ const renderIcon = (index: number) => {
break;
}

case 5: {
case 5:
return <InsertPhotoIcon />;
break;

case 6: {
return <SupportAgentRoundedIcon />;
break;
}

case 6: {
case 7: {
return <SettingsRoundedIcon />;
break;
}

case 7: {
case 8: {
return <LogoutIcon />;
break;
}
@@ -185,28 +184,28 @@ export default function SideMenu() {
break;
}

/*
Case 3:
navigate("/nfts")
break;
*/
case 3:
navigate("/browser", { state: "https://faucet.puzzle.online" })
break;

case 4:
navigate("/browser")
break;
case 5:

case 5:
navigate("/nfts")
break;
case 6:
open_url("https://discord.gg/avail-1140618884764942386").then((res) => {
console.log(res);
}).catch((e) => {
console.log(e);
})
break;
case 6:
case 7:
navigate("/settings")
break;
case 7:
case 8:
setLogoutDialog(true);
break;
default:
@@ -221,7 +220,7 @@ export default function SideMenu() {
setLogoutDialog(false);
}} />
<List >
{['Home', 'Swap', 'Activity', 'Faucet', 'Browser', 'Support'].map((text, index) => (
{['Home', 'Swap', 'Activity', 'Faucet', 'Browser','Nfts', 'Support'].map((text, index) => (
<ListItem key={text} disablePadding sx={{
display: 'block', color: '#fff', marginTop: (text == 'Home') ? '' : '20%', transition: 'transform 0.3s ease-in-out, boxShadow 0.3s ease-in-out', // Smooth transition for transform and boxShadow
'&:hover': {
@@ -279,7 +278,7 @@ export default function SideMenu() {
},
}}
onClick={() => {
handleOnClick(index + 6);
handleOnClick(index + 7);
}}
>
<ListItemIcon
@@ -292,7 +291,7 @@ export default function SideMenu() {
}}

>
{renderIcon(index + 6)}
{renderIcon(index + 7)}
</ListItemIcon>
<ListItemText primary={text} sx={{opacity: open ? 1 : 0}} />
</ListItemButton>
16 changes: 15 additions & 1 deletion src/services/nfts/fetch.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,21 @@ export async function get_nfts() {
// Get metadata for each nft, just fetch from nft_uris, they are https links
const nfts = await Promise.all(nft_uris.map(async uri => {
const metadata = await fetch(uri).then(async res => res.json());
return metadata as INft;
//the metadata is either an image or an INft object
if (metadata.image === undefined) {
return {
name: '',
image: metadata,
attributes: [],
mintNumber: 0,
collectionLink: '',
collectionName: '',
collectionDescription: '',
sourceLink: ''
};
} else {
return metadata as INft;
}
}));

return nfts;
5 changes: 5 additions & 0 deletions src/services/util/deep_link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { onOpenUrl } from "@tauri-apps/plugin-deep-link";

await onOpenUrl((urls) => {
console.log('deep link:', urls);
});
Loading

0 comments on commit bf12118

Please sign in to comment.