chore: minor fixes and updates

This commit is contained in:
2024-01-09 08:35:30 +07:00
parent c172c0f80f
commit 73f90ebaf9
13 changed files with 97 additions and 48 deletions

View File

@@ -1,11 +1,24 @@
import { CheckIcon } from "@lume/icons";
import { onboardingAtom } from "@lume/utils";
import { useQueryClient } from "@tanstack/react-query";
import { motion } from "framer-motion";
import { useSetAtom } from "jotai";
export function OnboardingFinishScreen() {
const queryClient = useQueryClient();
const setOnboarding = useSetAtom(onboardingAtom);
const finish = async () => {
const queryCache = queryClient.getQueryCache();
const queryKeys = queryCache.getAll().map((cache) => cache.queryKey);
for (const key of queryKeys) {
await queryClient.refetchQueries({ queryKey: key });
}
setOnboarding(false);
};
return (
<motion.div
initial={{ opacity: 0, x: -20 }}
@@ -23,7 +36,7 @@ export function OnboardingFinishScreen() {
<div className="mt-4 flex flex-col gap-2 items-center">
<button
type="button"
onClick={() => setOnboarding(false)}
onClick={finish}
className="inline-flex items-center justify-center gap-2 w-44 font-medium h-11 rounded-xl bg-blue-100 text-blue-500 hover:bg-blue-200 dark:bg-blue-900 dark:text-blue-500 dark:hover:bg-blue-800"
>
Close

View File

@@ -1,6 +1,6 @@
import { useArk, useStorage } from "@lume/ark";
import { ArrowLeftIcon, LoaderIcon } from "@lume/icons";
import { NDKKind } from "@nostr-dev-kit/ndk";
import { NDKKind, NDKUserProfile } from "@nostr-dev-kit/ndk";
import { motion } from "framer-motion";
import { minidenticon } from "minidenticons";
import { useState } from "react";
@@ -35,11 +35,11 @@ export function OnboardingProfileSettingsScreen() {
const oldProfile = await ark.getUserProfile({
pubkey: storage.account.pubkey,
});
const ensureOldProfile = oldProfile ? oldProfile : {};
const profile = {
const profile: NDKUserProfile = {
...data,
...ensureOldProfile,
lud16: oldProfile?.lud16 || "",
nip05: oldProfile?.nip05 || "",
display_name: data.name,
bio: data.about,
picture: picture,
@@ -60,7 +60,9 @@ export function OnboardingProfileSettingsScreen() {
setLoading(false);
}
} catch (e) {
return toast.error(e);
setLoading(false);
console.log(e);
toast.error("Cannot publish your profile, please try again later.");
}
};