diff --git a/package.json b/package.json index f2bd4946..e0d7e0be 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "@floating-ui/react": "^0.23.1", "@headlessui/react": "^1.7.15", "@nostr-dev-kit/ndk": "^0.5.13", - "@tanstack/react-query": "^4.29.15", + "@tanstack/react-query": "^4.29.17", + "@tanstack/react-query-devtools": "^4.29.17", "@tanstack/react-virtual": "3.0.0-beta.54", "@tauri-apps/api": "^1.4.0", "cheerio": "1.0.0-rc.12", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8652de15..10c0f045 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,11 @@ dependencies: specifier: ^0.5.13 version: 0.5.13(typescript@4.9.5) '@tanstack/react-query': - specifier: ^4.29.15 - version: 4.29.15(react-dom@18.2.0)(react@18.2.0) + specifier: ^4.29.17 + version: 4.29.17(react-dom@18.2.0)(react@18.2.0) + '@tanstack/react-query-devtools': + specifier: ^4.29.17 + version: 4.29.17(@tanstack/react-query@4.29.17)(react-dom@18.2.0)(react@18.2.0) '@tanstack/react-virtual': specifier: 3.0.0-beta.54 version: 3.0.0-beta.54(react@18.2.0) @@ -828,12 +831,34 @@ packages: tailwindcss: 3.3.2 dev: true - /@tanstack/query-core@4.29.15: - resolution: {integrity: sha512-Recc1d5rjHesKhzlH3Aw66v+vQxtB9OHEXP/vxgEcEJ0DwEpfe3EQ4id20vuBJHY2XRjfgWGmUs6ZgK6PSsTXA==} + /@tanstack/match-sorter-utils@8.8.4: + resolution: {integrity: sha512-rKH8LjZiszWEvmi01NR72QWZ8m4xmXre0OOwlRGnjU01Eqz/QnN+cqpty2PJ0efHblq09+KilvyR7lsbzmXVEw==} + engines: {node: '>=12'} + dependencies: + remove-accents: 0.4.2 dev: false - /@tanstack/react-query@4.29.15(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-1zDkv95ljuJ623hhbYU8YIprPW2x6774kh3IQNEuZav62+S+Zr26uUOrE2zGRp9I1uO5Liw/0uYB3dWXQP5+3Q==} + /@tanstack/query-core@4.29.17: + resolution: {integrity: sha512-iDbO8yZOpm1lqgq6L8mpxGbKaoiyZSjthxEB3WGU7mNPYss9q4H3Q67+e2xXGwkemEVmtEX/WwvtFitrvVU8TA==} + dev: false + + /@tanstack/react-query-devtools@4.29.17(@tanstack/react-query@4.29.17)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-Dgd7c7ToCzJrpuyDZ0Rwx5bXSqWICOaB8sNSzo8YtwpWXuJcQ074qgb0kko5/CzIVDxhbG8WX5dnUwr5Xqa++g==} + peerDependencies: + '@tanstack/react-query': 4.29.17 + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + dependencies: + '@tanstack/match-sorter-utils': 8.8.4 + '@tanstack/react-query': 4.29.17(react-dom@18.2.0)(react@18.2.0) + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + superjson: 1.12.4 + use-sync-external-store: 1.2.0(react@18.2.0) + dev: false + + /@tanstack/react-query@4.29.17(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-udOy/jgqiBHBAP93YPAU3QoVYO+Rtx9HT/10xGDQzC8iQU/wIxcIaT/usX+1NSzoUFYU5hUcPaNErPWZnR7XgA==} peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 @@ -844,7 +869,8 @@ packages: react-native: optional: true dependencies: - '@tanstack/query-core': 4.29.15 + '@tanstack/query-core': 4.29.17 + client-only: 0.0.1 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) use-sync-external-store: 1.2.0(react@18.2.0) @@ -1384,7 +1410,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.21.9 - caniuse-lite: 1.0.30001507 + caniuse-lite: 1.0.30001508 fraction.js: 4.2.0 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -1432,7 +1458,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001507 + caniuse-lite: 1.0.30001508 electron-to-chromium: 1.4.440 node-releases: 2.0.12 update-browserslist-db: 1.0.11(browserslist@4.21.9) @@ -1495,8 +1521,8 @@ packages: engines: {node: '>=6'} dev: false - /caniuse-lite@1.0.30001507: - resolution: {integrity: sha512-SFpUDoSLCaE5XYL2jfqe9ova/pbQHEmbheDf5r4diNwbAgR3qxM9NQtfsiSscjqoya5K7kFcHPUQ+VsUkIJR4A==} + /caniuse-lite@1.0.30001508: + resolution: {integrity: sha512-sdQZOJdmt3GJs1UMNpCCCyeuS2IEGLXnHyAo9yIO5JJDjbjoVRij4M1qep6P6gFpptD1PqIYgzM+gwJbOi92mw==} dev: true /chalk@2.4.2: @@ -1645,6 +1671,13 @@ packages: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} dev: false + /copy-anything@3.0.5: + resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} + engines: {node: '>=12.13'} + dependencies: + is-what: 4.1.15 + dev: false + /create-esm-loader@0.2.3: resolution: {integrity: sha512-cllzD6IU/mzXBs5OdQVWL3+ne5Elpu3Wdm7h5OldMbGXk76yr9XzHlQXWJ4zfs0ZAibe26rkbs4KvMAJm7fIZA==} engines: {node: '>=14.x'} @@ -2937,6 +2970,11 @@ packages: call-bind: 1.0.2 dev: false + /is-what@4.1.15: + resolution: {integrity: sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==} + engines: {node: '>=12.13'} + dev: false + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -4076,6 +4114,10 @@ packages: functions-have-names: 1.2.3 dev: false + /remove-accents@0.4.2: + resolution: {integrity: sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==} + dev: false + /resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -4477,6 +4519,13 @@ packages: ts-interface-checker: 0.1.13 dev: true + /superjson@1.12.4: + resolution: {integrity: sha512-vkpPQAxdCg9SLfPv5GPC5fnGrui/WryktoN9O5+Zif/14QIMjw+RITf/5LbBh+9QpBFb3KNvJth+puz2H8o6GQ==} + engines: {node: '>=10'} + dependencies: + copy-anything: 3.0.5 + dev: false + /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} diff --git a/src/app/auth/onboarding.tsx b/src/app/auth/onboarding.tsx index f4805c6b..1fe6f73f 100644 --- a/src/app/auth/onboarding.tsx +++ b/src/app/auth/onboarding.tsx @@ -1,37 +1,29 @@ -import { NDKEvent, NDKPrivateKeySigner } from "@nostr-dev-kit/ndk"; +import { usePublish } from "@libs/ndk"; import { LoaderIcon } from "@shared/icons"; import { ArrowRightCircleIcon } from "@shared/icons/arrowRightCircle"; -import { RelayContext } from "@shared/relayProvider"; import { User } from "@shared/user"; -import { dateToUnix } from "@utils/date"; import { useAccount } from "@utils/hooks/useAccount"; -import { useContext, useState } from "react"; +import { useState } from "react"; import { Link, useNavigate } from "react-router-dom"; export function OnboardingScreen() { - const ndk = useContext(RelayContext); + const publish = usePublish(); const navigate = useNavigate(); const { status, account } = useAccount(); const [loading, setLoading] = useState(false); - const publish = async () => { + const submit = async () => { try { setLoading(true); - const event = new NDKEvent(ndk); - const signer = new NDKPrivateKeySigner(account.privkey); - ndk.signer = signer; - - event.content = - "Running Lume, fighting for better future, join us here: https://lume.nu"; - event.created_at = dateToUnix(); - event.pubkey = account.pubkey; - event.kind = 1; - event.tags = []; - // publish event - event.publish(); + publish({ + content: + "Running Lume, fighting for better future, join us here: https://lume.nu", + kind: 1, + tags: [], + }); // redirect to home setTimeout(() => navigate("/", { replace: true }), 1200); @@ -81,7 +73,7 @@ export function OnboardingScreen() {