diff --git a/src/app/auth/components/user.tsx b/src/app/auth/components/user.tsx index 3d836750..0cd962b3 100644 --- a/src/app/auth/components/user.tsx +++ b/src/app/auth/components/user.tsx @@ -34,7 +34,7 @@ export function User({ pubkey, fallback }: { pubkey: string; fallback?: string } {user?.name || user?.displayName || user?.display_name} - + {user?.nip05?.toLowerCase() || shortenKey(pubkey)} diff --git a/src/app/auth/create/step-3.tsx b/src/app/auth/create/step-3.tsx index e370ec7c..2f2271a6 100644 --- a/src/app/auth/create/step-3.tsx +++ b/src/app/auth/create/step-3.tsx @@ -24,12 +24,13 @@ export function CreateStep3Screen() { formState: { isDirty, isValid }, } = useForm(); - const onSubmit = (data: any) => { + const onSubmit = (data: { name: string; about: string }) => { setLoading(true); try { const profile = { ...data, username: data.name, + name: data.name, display_name: data.name, bio: data.about, }; diff --git a/src/app/auth/onboarding.tsx b/src/app/auth/onboarding.tsx index 15977e30..dc53955d 100644 --- a/src/app/auth/onboarding.tsx +++ b/src/app/auth/onboarding.tsx @@ -22,7 +22,7 @@ export function OnboardingScreen() { // publish event publish({ - content: 'Running Lume, join with me: https://lume.nu', + content: 'Running Lume, join with me #nostr #lume : https://lume.nu', kind: 1, tags: [], }); @@ -55,7 +55,7 @@ export function OnboardingScreen() { )}
-

Running Lume, join with me

+

Running Lume, join with me #nostr #lume

))} +
)} diff --git a/src/libs/storage.tsx b/src/libs/storage.tsx index 36ad79c8..69dd8dab 100644 --- a/src/libs/storage.tsx +++ b/src/libs/storage.tsx @@ -55,7 +55,7 @@ export async function createAccount( await createBlock( 0, 'Have fun together!', - 'https://i.nostrimg.com/cf7bdc227592686a0fcefcecb63fa860aab74c3c36dcd1cb6b09530188db7791/file.jpg' + 'https://void.cat/d/N5KUHEQCVg7SywXUPiJ7yq.jpg' ); } const getAccount = await getActiveAccount(); diff --git a/src/shared/avatarUploader.tsx b/src/shared/avatarUploader.tsx index c54ef84b..f77e5c90 100644 --- a/src/shared/avatarUploader.tsx +++ b/src/shared/avatarUploader.tsx @@ -1,54 +1,18 @@ -import { open } from '@tauri-apps/api/dialog'; -import { Body, fetch } from '@tauri-apps/api/http'; import { useState } from 'react'; import { LoaderIcon, PlusIcon } from '@shared/icons'; -import { createBlobFromFile } from '@utils/createBlobFromFile'; +import { useImageUploader } from '@utils/hooks/useUploader'; export function AvatarUploader({ setPicture }: { setPicture: any }) { + const upload = useImageUploader(); const [loading, setLoading] = useState(false); - const openFileDialog = async () => { - const selected: any = await open({ - multiple: false, - filters: [ - { - name: 'Image', - extensions: ['png', 'jpeg', 'jpg', 'gif'], - }, - ], - }); - if (Array.isArray(selected)) { - // user selected multiple files - } else if (selected === null) { - // user cancelled the selection - } else { - setLoading(true); - - const filename = selected.split('/').pop(); - const file = await createBlobFromFile(selected); - const buf = await file.arrayBuffer(); - - const res: { data: { file: { id: string } } } = await fetch( - 'https://void.cat/upload?cli=false', - { - method: 'POST', - timeout: 5, - headers: { - accept: '*/*', - 'Content-Type': 'application/octet-stream', - 'V-Filename': filename, - 'V-Description': 'Upload from https://lume.nu', - 'V-Strip-Metadata': 'true', - }, - body: Body.bytes(buf), - } - ); - const image = `https://void.cat/d/${res.data.file.id}.jpg`; - + const uploadAvatar = async () => { + const image = await upload(null); + if (image.url) { // update parent state - setPicture(image); + setPicture(image.url); // disable loader setLoading(false); @@ -58,7 +22,7 @@ export function AvatarUploader({ setPicture }: { setPicture: any }) { return (