Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/error notices #172

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@tauri-apps/plugin-shell": "^2.0.0",
"bigger-picture": "^1.1.17",
"p-retry": "^6.2.0",
"svelte-french-toast": "^1.2.0",
"sveltekit-i18n": "^2.4.2"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion ui/src/lib/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"welcome_text_2": "Private, encrypted and secured by keys only you control.",
"what_is_your_name": "What is your name?",
"need_camera_permission": "Camera permission is required to scan codes.",
"open_app_settings": "Open App Settings"
"open_app_settings": "Open App Settings",
"holochain_connect_error": "Error connecting to Holochain"
}
19 changes: 13 additions & 6 deletions ui/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { RelayClient } from '$store/RelayClient';
import { RelayStore } from '$store/RelayStore';
import { type RoleNameCallZomeRequest } from '@holochain/client';
import toast, { Toaster } from 'svelte-french-toast';

import '../app.postcss';

Expand All @@ -32,10 +33,8 @@
document.documentElement.style.setProperty('--app-height', `${appHeight}px`);
}

onMount(() => {
async function initHolochain() {
// console.log("FISH", window.__TAURI__)

async function initHolochain() {
try {
let tokenResp
if (adminPort) {
const adminWebsocket = await AdminWebsocket.connect({ url: new URL(`ws://localhost:${adminPort}`) })
Expand Down Expand Up @@ -73,10 +72,16 @@
await relayStore.initialize()
connected = true
console.log("Connected")
} catch(e) {
console.error("Failed to init holochain", e);
toast.error(`${$t('common.holochain_connect_error')}: ${e.message}`);
}

}

onMount(() => {
// Launch and connect to holochain
initHolochain()

// To change from light mode to dark mode based on system settings
// XXX: not using the built in skeleton autoModeWatcher() because it doesn't set modeCurrent in JS which we use
const mql = window.matchMedia('(prefers-color-scheme: light)');
Expand Down Expand Up @@ -161,6 +166,8 @@
{/if}
</div>

<Toaster position="bottom-end" />

<style>
/* Add this to ensure the page doesn't scroll */
:global(body) {
Expand Down