diff --git a/lumina/app/layout.tsx b/lumina/app/layout.tsx index 3bb2953..ccf0699 100644 --- a/lumina/app/layout.tsx +++ b/lumina/app/layout.tsx @@ -2,6 +2,8 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; import "./globals.css"; import { ThemeProvider } from "@/components/theme-provider"; +import { DropdownThemeMode } from "@/components/DropdownThemeMode"; +import { Navigation } from "@/components/Navigation"; const inter = Inter({ subsets: ["latin"] }); @@ -24,6 +26,7 @@ export default function RootLayout({ enableSystem disableTransitionOnChange > + {children} diff --git a/lumina/app/profile/[pubkey]/layout.tsx b/lumina/app/profile/[pubkey]/layout.tsx deleted file mode 100644 index 3e95819..0000000 --- a/lumina/app/profile/[pubkey]/layout.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import { ThemeProvider } from "@/components/theme-provider"; - -const inter = Inter({ subsets: ["latin"] }); - -export const metadata: Metadata = { - title: "LUMINA Profile", - description: "LUMINA.rocks", -}; - -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - return ( - - - - {children} - - - - ); -} diff --git a/lumina/bun.lockb b/lumina/bun.lockb index c2d852d..03a51a8 100755 Binary files a/lumina/bun.lockb and b/lumina/bun.lockb differ diff --git a/lumina/components/DropdownThemeMode.tsx b/lumina/components/DropdownThemeMode.tsx new file mode 100644 index 0000000..f56bb74 --- /dev/null +++ b/lumina/components/DropdownThemeMode.tsx @@ -0,0 +1,40 @@ +"use client" + +import * as React from "react" +import { MoonIcon, SunIcon } from "@radix-ui/react-icons" +import { useTheme } from "next-themes" + +import { Button } from "@/components/ui/button" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" + +export function DropdownThemeMode() { + const { setTheme } = useTheme() + + return ( + + + + + + setTheme("light")}> + Light + + setTheme("dark")}> + Dark + + setTheme("system")}> + System + + + + ) +} diff --git a/lumina/components/GlobalFeed.tsx b/lumina/components/GlobalFeed.tsx index 3171a59..f40db3a 100644 --- a/lumina/components/GlobalFeed.tsx +++ b/lumina/components/GlobalFeed.tsx @@ -21,7 +21,7 @@ const GlobalFeed: React.FC = () => { // now filter all events with a tag[0] == t and tag[1] == nsfw filteredEvents = filteredEvents.filter((event) => event.tags.map((tag) => tag[0] == "t" && tag[1] == "nsfw")); // filter out all replies - filteredEvents = filteredEvents.filter((event) => event.tags.map((tag) => tag[0] == "e")); + filteredEvents = filteredEvents.filter((event) => !event.tags.some((tag) => { return tag[0] == 'e' })); return ( <> diff --git a/lumina/components/Navigation.tsx b/lumina/components/Navigation.tsx new file mode 100644 index 0000000..fc3f125 --- /dev/null +++ b/lumina/components/Navigation.tsx @@ -0,0 +1,16 @@ +"use client" + +import * as React from "react" +import { MoonIcon, SunIcon } from "@radix-ui/react-icons" +import { DropdownThemeMode } from "@/components/DropdownThemeMode" + +export function Navigation() { + + return ( +
+
+ +
+
+ ) +} diff --git a/lumina/components/TrendingAccounts.tsx b/lumina/components/TrendingAccounts.tsx new file mode 100644 index 0000000..d64ad5d --- /dev/null +++ b/lumina/components/TrendingAccounts.tsx @@ -0,0 +1,39 @@ +import { useRef } from "react"; +import { useNostrEvents, dateToUnix } from "nostr-react"; +import NoteCard from './NoteCard'; + +const TrendingAccounts: React.FC = () => { + const now = useRef(new Date()); // Make sure current time isn't re-rendered + + const { events } = useNostrEvents({ + filter: { + // since: dateToUnix(now.current), // all new events from now + // since: 0, + limit: 100, + kinds: [1], + }, + }); + + // const filteredEvents = events.filter((event) => event.content.includes(".jpg")); + // filter events with regex that checks for png, jpg, or gif + let filteredEvents = events.filter((event) => event.content.match(/https?:\/\/.*\.(?:png|jpg|gif)/g)?.[0]); + + // now filter all events with a tag[0] == t and tag[1] == nsfw + filteredEvents = filteredEvents.filter((event) => event.tags.map((tag) => tag[0] == "t" && tag[1] == "nsfw")); + // filter out all replies + filteredEvents = filteredEvents.filter((event) => event.tags.map((tag) => tag[0] == "e")); + + return ( + <> +

Global Feed

+ {filteredEvents.map((event) => ( + //

{event.pubkey} posted: {event.content}

+
+ +
+ ))} + + ); +} + +export default TrendingAccounts; \ No newline at end of file diff --git a/lumina/components/ui/dropdown-menu.tsx b/lumina/components/ui/dropdown-menu.tsx new file mode 100644 index 0000000..f69a0d6 --- /dev/null +++ b/lumina/components/ui/dropdown-menu.tsx @@ -0,0 +1,200 @@ +"use client" + +import * as React from "react" +import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" +import { Check, ChevronRight, Circle } from "lucide-react" + +import { cn } from "@/lib/utils" + +const DropdownMenu = DropdownMenuPrimitive.Root + +const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger + +const DropdownMenuGroup = DropdownMenuPrimitive.Group + +const DropdownMenuPortal = DropdownMenuPrimitive.Portal + +const DropdownMenuSub = DropdownMenuPrimitive.Sub + +const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup + +const DropdownMenuSubTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + inset?: boolean + } +>(({ className, inset, children, ...props }, ref) => ( + + {children} + + +)) +DropdownMenuSubTrigger.displayName = + DropdownMenuPrimitive.SubTrigger.displayName + +const DropdownMenuSubContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DropdownMenuSubContent.displayName = + DropdownMenuPrimitive.SubContent.displayName + +const DropdownMenuContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, sideOffset = 4, ...props }, ref) => ( + + + +)) +DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName + +const DropdownMenuItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + inset?: boolean + } +>(({ className, inset, ...props }, ref) => ( + +)) +DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName + +const DropdownMenuCheckboxItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, checked, ...props }, ref) => ( + + + + + + + {children} + +)) +DropdownMenuCheckboxItem.displayName = + DropdownMenuPrimitive.CheckboxItem.displayName + +const DropdownMenuRadioItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + + + + {children} + +)) +DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName + +const DropdownMenuLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + inset?: boolean + } +>(({ className, inset, ...props }, ref) => ( + +)) +DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName + +const DropdownMenuSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName + +const DropdownMenuShortcut = ({ + className, + ...props +}: React.HTMLAttributes) => { + return ( + + ) +} +DropdownMenuShortcut.displayName = "DropdownMenuShortcut" + +export { + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuCheckboxItem, + DropdownMenuRadioItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuGroup, + DropdownMenuPortal, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuRadioGroup, +} diff --git a/lumina/package.json b/lumina/package.json index d72c708..8b3bd08 100644 --- a/lumina/package.json +++ b/lumina/package.json @@ -11,6 +11,7 @@ "dependencies": { "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-dropdown-menu": "^2.0.6", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-navigation-menu": "^1.1.4", "@radix-ui/react-slot": "^1.0.2",