Skip to content

Commit

Permalink
fix: error handling display bug
Browse files Browse the repository at this point in the history
  • Loading branch information
golota60 committed Mar 7, 2023
1 parent 491e9d4 commit 5eca19c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "trayasen",
"private": true,
"version": "0.0.3",
"version": "0.0.4",
"type": "module",
"license": "MIT",
"scripts": {
Expand All @@ -20,7 +20,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tauri-plugin-autostart-api": "https://github.com/tauri-apps/tauri-plugin-autostart",
"use-simple-async": "^1.4.0"
"use-simple-async": "^1.4.2"
},
"devDependencies": {
"@callstack/eslint-config": "^13.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/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 src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "Trayasen"
version = "0.0.3"
version = "0.0.4"
description = "An app to control IKEA Idasen desk"
authors = ["you"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Trayasen",
"version": "0.0.3"
"version": "0.0.4"
},
"tauri": {
"allowlist": {
Expand Down
24 changes: 21 additions & 3 deletions src/IntroPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { relaunch } from "@tauri-apps/api/process";
import { Link } from "found";
import { useEffect, useState } from "react";
import useSimpleAsync from "use-simple-async";
import DeskElement from "./DeskElement";
import Button from "./generic/Button";
import Spinner from "./generic/Spinner";
import { connectToDesk, getConnectionDesk } from "./rustUtils";
import { connectToDesk, getConnectionDesk, removeConfig } from "./rustUtils";

const IntroPage = () => {
const [data, { error, loading }] = useSimpleAsync(getConnectionDesk, {
Expand Down Expand Up @@ -39,13 +40,30 @@ const IntroPage = () => {
}

if (error) {
return <div>Something went wrong.</div>;
return (
<div>
Something went wrong.{" "}
<div>
<Button
onClick={() => {
removeConfig();
relaunch();
}}
>
Reset config & restart the app
</Button>
</div>
<div>
Error contents: <p>{error as any}</p>
</div>
</div>
);
}

return (
<div className="w-full h-full flex flex-col justify-center items-center bg-slate-800">
<img src="/carrot.png" alt="A carrot logo" />
<h1 className="text-4xl mt-2 mb-3">Welcome to Idasen Tray!</h1>
<h1 className="text-4xl mt-2 mb-3">Welcome to Trayasen!</h1>
<p>
This app will help you to interact with your IKEA Idasen Desk from the
system tray.
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2903,10 +2903,10 @@ uri-js@^4.2.2:
dependencies:
punycode "^2.1.0"

use-simple-async@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/use-simple-async/-/use-simple-async-1.4.0.tgz#97f067c98aaf5d9fd629be5d6efdbf652300ba8e"
integrity sha512-qEull4VcW56/L4a7qJ1DBPdMSYZQCc+jVEmW+Xs/KpOmy/itki8nOu++oQQOu3x2Iwqxc6ROKx6FAa+YJDwApQ==
use-simple-async@^1.4.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/use-simple-async/-/use-simple-async-1.4.2.tgz#929059a6574485e7f6be6891273ac25384de6957"
integrity sha512-svexItUOxngdvA3IpbHB1AS6SkmNvDE0kZSP8+5srX9uQAkU18a2Y25OVUzHVjdJ+U2wINk3nhZ1+smNS9fw7g==

use-sync-external-store@^1.0.0:
version "1.2.0"
Expand Down

0 comments on commit 5eca19c

Please sign in to comment.