Skip to content

Commit

Permalink
Merge pull request #151 from Web3-Builders-Alliance/main
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMarchetto authored Jul 27, 2023
2 parents 807aa41 + 4264d06 commit 5549f99
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crate/Cargo.lock

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

2 changes: 1 addition & 1 deletion crate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "soda_sol"
version = "0.0.6"
version = "0.0.7"
edition = "2021"
license = "Apache-2.0"
description = "Generates Solana Projects from an IDL"
Expand Down
6 changes: 4 additions & 2 deletions ui/context/IDL/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ const IDLProvider = ({ children }: { children: ReactNode }) => {
.then(() => {
if (IDL.name === "Chewing Glass") {
invoke("new_window", { target: "bubbles" }).catch(async (e) => {
await message(e, { title: "Error", type: "error" });
console.log(e)
await message(e?.error ?? "Error open more windows", { title: "Error", type: "error" });
});
}
setIDL(IDL);
})
.catch(async (e) => {
await message(e, { title: "Error", type: "error" });
console.log(e)
await message(e?.error ?? "Error setting IDL", { title: "Error", type: "error" });
});
};

Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
4 changes: 3 additions & 1 deletion ui/src-tauri/Cargo.lock

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

4 changes: 2 additions & 2 deletions ui/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "soda"
version = "0.1.1"
version = "0.1.2"
description = "Generates source code from an IDL"
authors = ["Juan Patricio Marchetto"]
license = "Apache-2.0"
Expand All @@ -19,7 +19,7 @@ tauri = { version = "1.2.5", features = ["dialog-all", "fs-create-dir", "fs-read
serde_json = "1.0.93"
serde = "1.0.164"
thiserror = "1.0.40"
soda_sol = { path="../../crate"}
soda_sol = "0.0.7"

[features]
# by default Tauri runs in production mode
Expand Down
10 changes: 9 additions & 1 deletion ui/src-tauri/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::sync::{MutexGuard, PoisonError};

use std::time::SystemTimeError;
use crate::StateStruct;

#[derive(thiserror::Error, Debug)]
Expand Down Expand Up @@ -59,3 +59,11 @@ impl From<tauri::Error> for Error {
}
}
}

impl From<SystemTimeError> for Error {
fn from(err: SystemTimeError) -> Error {
Error::CustomError {
message: err.to_string(),
}
}
}
3 changes: 2 additions & 1 deletion ui/src-tauri/src/new_window.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::time::{SystemTime, UNIX_EPOCH};
use crate::*;

#[tauri::command]
pub async fn new_window(handle: tauri::AppHandle, target: &str) -> Result<(), Error> {
tauri::WindowBuilder::new(&handle, target, tauri::WindowUrl::App(target.into()))
tauri::WindowBuilder::new(&handle, format!("{}{}", target, SystemTime::now().duration_since(UNIX_EPOCH)?.subsec_nanos()), tauri::WindowUrl::App(target.into()))
.title(target)
.inner_size(800.0, 700.0)
.build()?;
Expand Down
2 changes: 1 addition & 1 deletion ui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "soda",
"version": "0.1.1"
"version": "0.1.2"
},
"tauri": {
"allowlist": {
Expand Down

0 comments on commit 5549f99

Please sign in to comment.