commit 0aa63e4da1df9f6a40d7eb933bb20e84631fad85
parent f741d68439773f511749eaf87433fa1ac7796574
Author: triesap <137732411+triesap@users.noreply.github.com>
Date: Fri, 27 Sep 2024 15:09:56 +0000
apps-lib: edit tabs component, edit components using label_swap, edit ndk utils, add locales, routes
Diffstat:
6 files changed, 45 insertions(+), 42 deletions(-)
diff --git a/apps-lib/src/lib/components/nav_option.svelte b/apps-lib/src/lib/components/nav_option.svelte
@@ -8,33 +8,8 @@
type INavBasisOption,
} from "$lib";
- let el_swap: HTMLLabelElement | null = null;
-
export let basis: INavBasisOption;
$: basis = basis;
-
- $: classes_swap = ``;
-
- let layer = 1;
-
- /*
-<label bind:this={el_swap} class={`swap${classes_swap}`}>
- <div class="swap-off">
- <p
- class={`${fmt_cl(basis.label.classes)} font-sans text-navPrevious text-layer-${layer}-glyph-hl -translate-y-[1px] transition-all`}
- >
- {basis.label.swap.value_on}
- </p>
- </div>
- <div class="swap-on">
- <p
- class={`${fmt_cl(basis.label.classes)} font-sans text-navPrevious text-layer-${layer}-glyph-hl group-active:opacity-60 -translate-y-[1px] transition-all`}
- >
- {basis.label.swap.value_off}
- </p>
- </div>
- </label>
- */
</script>
{#if basis.loading}
@@ -45,9 +20,9 @@
<button
class={`group col-span-4 flex flex-row h-full pr-6 gap-2 justify-end items-center`}
on:click={async () => {
- await basis.callback([classes_swap ? false : true, el_swap]);
- if (classes_swap) classes_swap = ``;
- else classes_swap = ` swap-active`;
+ //await basis.callback([classes_swap ? false : true, el_swap]);
+ //if (classes_swap) classes_swap = ``;
+ //else classes_swap = ` swap-active`;
}}
>
{#if `glyph` in basis && basis.glyph}
diff --git a/apps-lib/src/lib/components/tabs.svelte b/apps-lib/src/lib/components/tabs.svelte
@@ -7,7 +7,9 @@
fmt_cl,
sleep,
tabs_blur,
+ tabs_visible,
} from "$lib";
+ import { onDestroy, onMount } from "svelte";
export let basis: ITabsBasis;
$: basis = basis;
@@ -18,6 +20,22 @@
let el: HTMLElement | null;
let el_inner: HTMLElement | null;
+
+ onMount(async () => {
+ try {
+ tabs_visible.set(true);
+ } catch (e) {
+ } finally {
+ }
+ });
+
+ onDestroy(async () => {
+ try {
+ tabs_visible.set(false);
+ } catch (e) {
+ } finally {
+ }
+ });
</script>
<div
diff --git a/apps-lib/src/lib/locales/en/model_fields.json b/apps-lib/src/lib/locales/en/model_fields.json
@@ -26,5 +26,13 @@
"banner": "Banner",
"nip05": "NIP 05",
"lud06": "LUD 06",
- "lud16": "LUD 16"
+ "lud16": "LUD 16",
+ "url": "",
+ "description": "",
+ "pubkey": "",
+ "contact": "",
+ "supported_nips": "",
+ "software": "",
+ "version": "",
+ "data": ""
}
\ No newline at end of file
diff --git a/apps-lib/src/lib/ui/label_swap.svelte b/apps-lib/src/lib/ui/label_swap.svelte
@@ -8,10 +8,6 @@
$: layer = basis?.layer ? basis.layer : 1;
$: classes_swap = basis.swap?.toggle ? ` swap-active` : ``;
-
- $: {
- console.log(`classes_swap `, classes_swap);
- }
</script>
<div class={`flex flex-row justify-start items-center`}>
diff --git a/apps-lib/src/lib/utils/ndk.ts b/apps-lib/src/lib/utils/ndk.ts
@@ -1,13 +1,13 @@
import NDK, { NDKEvent, NDKPrivateKeySigner, NDKUser } from '@nostr-dev-kit/ndk';
import { time_now_ms } from "./client";
-export async function ndk_setup_privkey(opts: {
+export const ndk_init = async (opts: {
$ndk: NDK;
- private_key: string;
-}): Promise<NDKUser | undefined> {
+ secret_key: string;
+}): Promise<NDKUser | undefined> => {
try {
- const { $ndk: ndk, private_key } = opts;
- const signer = new NDKPrivateKeySigner(private_key);
+ const { $ndk: ndk, secret_key } = opts;
+ const signer = new NDKPrivateKeySigner(secret_key);
ndk.signer = signer;
const user = await signer.user();
@@ -15,10 +15,12 @@ export async function ndk_setup_privkey(opts: {
user.ndk = ndk;
return user;
}
- } catch (e) { }
+ } catch (e) {
+ console.log(`(error) ndk_setup_privkey `, e);
+ }
};
-export async function ndk_event(opts: {
+export const ndk_event = async (opts: {
$ndk: NDK;
$ndk_user: NDKUser;
basis: {
@@ -26,7 +28,7 @@ export async function ndk_event(opts: {
content: string;
tags?: string[][];
}
-}): Promise<NDKEvent | undefined> {
+}): Promise<NDKEvent | undefined> => {
try {
const { $ndk: ndk, $ndk_user: ndk_user, basis } = opts;
const time_now = time_now_ms();
@@ -47,5 +49,7 @@ export async function ndk_event(opts: {
tags
});
return event;
- } catch (e) { };
+ } catch (e) {
+ console.log(`(error) ndk_event `, e);
+ }
};
diff --git a/apps-lib/src/lib/utils/routes.ts b/apps-lib/src/lib/utils/routes.ts
@@ -5,6 +5,7 @@ export type NavigationRoute =
| "/models/nostr-profile"
| "/models/nostr-profile/edit/field"
| "/models/nostr-profile/view"
+ | "/models/nostr-relay"
| "/models/trade-product"
| "/models/trade-product/add"
| "/models/trade-product/add/preview"
@@ -26,6 +27,7 @@ export function parse_route(route: string): NavigationRoute {
case "/models/nostr-profile":
case "/models/nostr-profile/edit/field":
case "/models/nostr-profile/view":
+ case "/models/nostr-relay":
case "/models/trade-product":
case "/models/trade-product/add":
case "/models/trade-product/add/preview":