diff --git a/app/(app)/(profile)/[npub]/page.tsx b/app/(app)/(profile)/[npub]/page.tsx index 3a5b550..1843108 100644 --- a/app/(app)/(profile)/[npub]/page.tsx +++ b/app/(app)/(profile)/[npub]/page.tsx @@ -111,7 +111,7 @@ export default function ProfilePage({
{demo.map((e) => ( - + ))}
diff --git a/app/(app)/_layout/Keystone.tsx b/app/(app)/_layout/Keystone.tsx index 3d017fc..1cf41bb 100644 --- a/app/(app)/_layout/Keystone.tsx +++ b/app/(app)/_layout/Keystone.tsx @@ -4,7 +4,7 @@ export default function Keystone() { return (
diff --git a/app/(app)/_layout/components/AuthActions.tsx b/app/(app)/_layout/components/AuthActions.tsx index 5c08cad..65a9bc5 100644 --- a/app/(app)/_layout/components/AuthActions.tsx +++ b/app/(app)/_layout/components/AuthActions.tsx @@ -1,4 +1,5 @@ "use client"; +import { useEffect } from "react"; import Link from "next/link"; import dynamic from "next/dynamic"; import useCurrentUser from "@/lib/hooks/useCurrentUser"; @@ -17,18 +18,26 @@ import { } from "@/components/ui/dropdown-menu"; import { RiNotification4Line } from "react-icons/ri"; import { SiRelay } from "react-icons/si"; -import { RELAYS } from "@/constants"; import StatusIndicator from "@/components/StatusIndicator"; import { type NDKUser } from "@nostr-dev-kit/ndk"; import { truncateText, getTwoLetters } from "@/lib/utils"; import { useNDK } from "@/app/_providers/ndk"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; const LoginModal = dynamic(() => import("@/components/Modals/Login"), { ssr: false, }); export default function AuthActions() { const modal = useModal(); - const { currentUser, logout } = useCurrentUser(); + const { currentUser, logout, attemptLogin } = useCurrentUser(); + useEffect(() => { + attemptLogin(); + }, []); if (currentUser) { return ( <> @@ -53,59 +62,77 @@ export default function AuthActions() { export function Notifications({ user }: { user: NDKUser }) { return ( - - - - - - -
- {user.profile?.displayName || user.profile?.name ? ( - <> -

- {user.profile?.displayName ?? user.profile.name} -

-

- m@example.com -

- - ) : ( -

- {truncateText(user.npub)} -

- )} -
-
- - - - Profile - ⇧⌘P - - - Billing - ⌘B - - - Settings - ⌘S - - New Team - - - - Log out - ⇧⌘Q - -
-
+ + + + + + +

Coming Soon

+
+
+
); + // return ( + // + // + // + // + // + // + //
+ // {user.profile?.displayName || user.profile?.name ? ( + // <> + //

+ // {user.profile?.displayName ?? user.profile.name} + //

+ //

+ // m@example.com + //

+ // + // ) : ( + //

+ // {truncateText(user.npub)} + //

+ // )} + //
+ //
+ // + // + // + // Profile + // ⇧⌘P + // + // + // Billing + // ⌘B + // + // + // Settings + // ⌘S + // + // New Team + // + // + // + // Log out + // ⇧⌘Q + // + //
+ //
+ // ); } export function Relays() { const { ndk } = useNDK(); diff --git a/app/(app)/app/_sections/HorizontalCarousel.tsx b/app/(app)/app/_sections/HorizontalCarousel.tsx index 97ecc06..4bf66ee 100644 --- a/app/(app)/app/_sections/HorizontalCarousel.tsx +++ b/app/(app)/app/_sections/HorizontalCarousel.tsx @@ -48,7 +48,10 @@ export default function HorizontalCarousel() { return (
{cards.map((creator, index) => ( -
+
))} diff --git a/app/_providers/modal/index.tsx b/app/_providers/modal/index.tsx index 8c74247..88a5113 100644 --- a/app/_providers/modal/index.tsx +++ b/app/_providers/modal/index.tsx @@ -86,7 +86,7 @@ export default function Modal({ void; + type: "button"; +}; +type Option = { + label: string; +} & (OptionLink | OptionButton); + +type DropDownMenuProps = { + options: Option[]; + children: ReactNode; +}; + +export default function DropDownMenu({ children, options }: DropDownMenuProps) { + return ( + + {children} + + + {options.map((o) => { + if (o.type === "button") { + return ( + + + + ); + } else { + return ( + + + {o.label} + + + ); + } + })} + + + + ); +} diff --git a/components/KindCard/1.tsx b/components/KindCard/1.tsx index 9182790..437e34d 100644 --- a/components/KindCard/1.tsx +++ b/components/KindCard/1.tsx @@ -4,10 +4,34 @@ import { type Event } from "nostr-tools"; import { RenderText } from "../TextRendering"; import { getTagsValues } from "@/lib/nostr/utils"; import LinkCard from "@/components/LinkCard"; -export default function Kind1({ content, tags }: Event) { +import { copyText } from "@/lib/utils"; +import { nip19 } from "nostr-tools"; +import { toast } from "sonner"; + +export default function Kind1(props: Event) { + const { content, pubkey, tags } = props; const r = getTagsValues("r", tags); + const npub = nip19.npubEncode(pubkey); + return ( - + { + void copyText(JSON.stringify(props)); + toast.success("Copied Text!"); + }, + }, + ]} + > diff --git a/components/KindCard/30023.tsx b/components/KindCard/30023.tsx index 993237d..3f65e15 100644 --- a/components/KindCard/30023.tsx +++ b/components/KindCard/30023.tsx @@ -5,13 +5,13 @@ import { getTagValues, getTagsValues } from "@/lib/nostr/utils"; import { type Event } from "nostr-tools"; import { removeDuplicates } from "@/lib/utils"; -export default function Kind30023({ content, tags }: Event) { +export default function Kind30023({ content, pubkey, tags }: Event) { const title = getTagValues("title", tags); const summary = getTagValues("summary", tags); const contentTags = removeDuplicates(getTagsValues("t", tags)); return ( - + {title} diff --git a/components/KindCard/3745.tsx b/components/KindCard/3745.tsx index 9d9e839..bfe572a 100644 --- a/components/KindCard/3745.tsx +++ b/components/KindCard/3745.tsx @@ -2,9 +2,9 @@ import Container from "./components/Container"; import { CardTitle, CardDescription } from "@/components/ui/card"; import { type Event } from "nostr-tools"; -export default function Kind3745({}: Event) { +export default function Kind3745({ pubkey }: Event) { return ( - + The start of the Nostr revolution diff --git a/components/KindCard/components/Container.tsx b/components/KindCard/components/Container.tsx index 1b91571..3d48f26 100644 --- a/components/KindCard/components/Container.tsx +++ b/components/KindCard/components/Container.tsx @@ -9,23 +9,48 @@ import { ReactNode } from "react"; import ProfileHeader from "./ProfileHeader"; import Actions from "./Actions"; import Tags from "./Tags"; -import { type Event } from "nostr-tools"; +import DropDownMenu from "@/components/DropDownMenu"; + +type OptionLink = { + href: string; + type: "link"; +}; +type OptionButton = { + onClick: () => void; + type: "button"; +}; +type Option = { + label: string; +} & (OptionLink | OptionButton); type CreatorCardProps = { + pubkey: string; contentTags?: string[]; children: ReactNode; + actionOptions?: Option[]; }; -export default function Container({ children, contentTags }: CreatorCardProps) { +export default function Container({ + children, + contentTags, + pubkey, + actionOptions = [], +}: CreatorCardProps) { return ( - +
{formatDate(new Date("10-5-23"), "MMM Do")} - + + +
diff --git a/components/KindCard/components/ProfileHeader.tsx b/components/KindCard/components/ProfileHeader.tsx index db627fb..d7b1e1a 100644 --- a/components/KindCard/components/ProfileHeader.tsx +++ b/components/KindCard/components/ProfileHeader.tsx @@ -1,25 +1,30 @@ import { Avatar, AvatarImage, AvatarFallback } from "@radix-ui/react-avatar"; import { HiCheckBadge } from "react-icons/hi2"; +import Link from "next/link"; +import useProfile from "@/lib/hooks/useProfile"; +import { nip19 } from "nostr-tools"; +import { getTwoLetters, getNameToShow } from "@/lib/utils"; -type ProfileHeaderProps = {}; -export default function ProfileHeader({}: ProfileHeaderProps) { +type ProfileHeaderProps = { + pubkey: string; +}; +export default function ProfileHeader({ pubkey }: ProfileHeaderProps) { + const { profile } = useProfile(pubkey); + const npub = nip19.npubEncode(pubkey); return ( -
+ - - SC + + + {getTwoLetters({ npub, profile })} +
- - Derek Seivers + + {getNameToShow({ npub, profile })} - + {!!profile.nip05 && }
-
+ ); } diff --git a/components/KindCard/default.tsx b/components/KindCard/default.tsx index c53af98..d73adff 100644 --- a/components/KindCard/default.tsx +++ b/components/KindCard/default.tsx @@ -2,9 +2,9 @@ import Container from "./components/Container"; import { CardTitle, CardDescription } from "@/components/ui/card"; import { type Event } from "nostr-tools"; -export default function KindDefault({}: Event) { +export default function KindDefault({ pubkey }: Event) { return ( - + The start of the Nostr revolution diff --git a/components/Modals/Login.tsx b/components/Modals/Login.tsx index 5de2f00..604fb84 100644 --- a/components/Modals/Login.tsx +++ b/components/Modals/Login.tsx @@ -10,7 +10,7 @@ import useCurrentUser from "@/lib/hooks/useCurrentUser"; export default function LoginModal() { const { loginWithNip07 } = useNDK(); - const { loginWithPubkey } = useCurrentUser(); + const { loginWithPubkey, currentUser } = useCurrentUser(); const [isLoading, setIsLoading] = useState(false); const modal = useModal(); @@ -29,9 +29,7 @@ export default function LoginModal() { if (!user) { throw new Error("NO auth"); } - console.log("LOGIN", user); await loginWithPubkey(nip19.decode(user.npub).data.toString()); - // keys?.setKeys({ // privkey: "", // pubkey: , @@ -56,6 +54,11 @@ export default function LoginModal() { getConnected(shouldReconnect); } }, []); + useEffect(() => { + if (currentUser) { + modal?.hide(); + } + }, [currentUser]); async function handleLogin() { setIsLoading(true); diff --git a/components/Modals/Template.tsx b/components/Modals/Template.tsx index d78b0ea..8fe4a47 100644 --- a/components/Modals/Template.tsx +++ b/components/Modals/Template.tsx @@ -17,7 +17,10 @@ export default function Template({ title, children, className }: ModalProps) { return (