diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 8944559..7ed2757 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -82,6 +82,7 @@ "tiny-secp256k1": "^2.2.3", "url-regex": "^5.0.0", "viem": "^2.21.7", + "vis-data": "^7.1.9", "vis-network": "^9.1.9", "vite-plugin-svelte": "^3.0.1" } diff --git a/packages/svelte/src/lib/components/Footer.svelte b/packages/svelte/src/lib/components/Footer.svelte index c235ea1..5788037 100644 --- a/packages/svelte/src/lib/components/Footer.svelte +++ b/packages/svelte/src/lib/components/Footer.svelte @@ -52,15 +52,6 @@ > Scobru - at - - Plancia - ยท
<script>
- import { useGun, useUser } from '@your-org/se-2gun';
import { createAccount } from "@byteatatime/wagmi-svelte";
const gun = useGun(); // Initialize GunDB
const { user } = useUser()
-
+
- Authentication
- SE-2Gun provides Ethereum-based authentication:
+ Authentication
+ SE-2Gun provides Ethereum-based authentication:
import { signIn, login, logout } from "$lib/gun/auth";
@@ -97,10 +95,10 @@
-
+
- User Profile Management
- Manage user profiles with these functions:
+ User Profile Management
+ Manage user profiles with these functions:
import { loadUserProfile, saveUserProfile, addProfileField }
-
+
- SHINE (Secure Hash Integrity Network Ethereum)
- Use SHINE for data verification on the blockchain:
+ SHINE (Secure Hash Integrity Network Ethereum)
+ Use SHINE for data verification on the blockchain:
async function saveMessage() {
const gunInstance =
-
+
- Components
+ Components
- AccountProfile.svelte
-
+
AccountProfile.svelte
+
Displays account information including the public key, color, pulse, blink status, and last login.
@@ -191,8 +189,8 @@
>={userPublicKey} />
- AccountAvatar.svelte
- Shows the user's avatar with options to upload a new one if it's the current user's profile.
+ AccountAvatar.svelte
+ Shows the user's avatar with options to upload a new one if it's the current user's profile.
import AccountAvatar from={2} />
- ProfileDisplay.svelte
-
+
ProfileDisplay.svelte
+
Allows viewing and editing user profile information with dynamic addition and removal of fields.
@@ -216,8 +214,8 @@
<ProfileDisplay />
- Usage Example
- Here's how you might use these components together on a user profile page:
+ Usage Example
+ Here's how you might use these components together on a user profile page:
<script>
import { useUser } div class="w-full md:w-1/3">
- <AccountAvatar pubAccountAvatar pub={$user.pub} size={128} />
- <AccountProfile pubAccountProfile pub={$user.pub} />
</div>
<div class="w-full md:w-2/3">
- <ProfileDisplay />
+ <ProfileDisplay />
</div>
</div>
@@ -260,12 +258,12 @@
-
+
- Additional Functions
+ Additional Functions
- User Functions
-
+ User Functions
+
- selectedUser: A writable store that holds the currently selected user's public key.
- userPub: A derived store that always contains the current user's public key.
-
@@ -287,8 +285,8 @@
store.
- Account Functions
-
+ Account Functions
+
-
useAccount(pubKey: string): Sets up and manages an account for the given public key, including
profile data and online status.
diff --git a/packages/svelte/src/routes/inspect/+page.svelte b/packages/svelte/src/routes/inspect/+page.svelte
index d24df8a..a5cf7b8 100644
--- a/packages/svelte/src/routes/inspect/+page.svelte
+++ b/packages/svelte/src/routes/inspect/+page.svelte
@@ -3,11 +3,11 @@
import "gun/sea";
import { onMount } from "svelte";
import { get, writable } from "svelte/store";
- import { currentUser, gun } from "$lib/stores";
+ import { gun } from "$lib/stores";
import { Network } from "vis-network/standalone";
- import type { IGunInstance } from "gun";
+ import { browser } from "$app/environment";
- let gunInstance: IGunInstance
| null = null;
+ let gunInstance: any;
let nodeData = writable({});
let nodePath = writable("");
let errorMessage = "";
@@ -21,11 +21,11 @@
function initGun() {
if (get(gun) === null) {
- gunInstance = gun.set(Gun(get(customRelay)));
+ gunInstance = gun.set(new Gun(get(customRelay)));
} else {
gunInstance = get(gun);
}
- gunInstance.on("hi", peer => {
+ gunInstance.on("hi", (peer: any) => {
console.log("Connected to peer:", peer);
});
initNetwork();
@@ -54,14 +54,18 @@
stabilization: { iterations: 150 },
},
};
- network = new Network(container, data, options);
- network.on("click", function (params) {
- if (params.nodes.length > 0) {
- const nodeId = params.nodes[0];
- nodePath.set(nodeId); // Aggiorna l'input box
- loadNodeData(nodeId); // Carica i dati del nodo
- }
- });
+ if (browser) {
+ network = new Network(container, data, options);
+ }
+ if (network) {
+ network.on("click", function (params) {
+ if (params.nodes.length > 0) {
+ const nodeId = params.nodes[0];
+ nodePath.set(nodeId); // Aggiorna l'input box
+ loadNodeData(nodeId); // Carica i dati del nodo
+ }
+ });
+ }
}
async function loadNodeData(path = $nodePath) {
@@ -183,7 +187,6 @@
Current Relay: {$customRelay}