mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +00:00
chore: improvements
This commit is contained in:
parent
1d86a43406
commit
1984de3281
@ -16,7 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@opchan/react": "file:../packages/react",
|
||||
"@opchan/core": "1.0.0",
|
||||
"@opchan/core": "file:../packages/core",
|
||||
"@hookform/resolvers": "^3.9.0",
|
||||
"@noble/ed25519": "^2.2.3",
|
||||
"@noble/hashes": "^1.8.0",
|
||||
@ -52,7 +52,6 @@
|
||||
"@reown/appkit-adapter-wagmi": "^1.7.17",
|
||||
"@reown/appkit-wallet-button": "^1.7.17",
|
||||
"@tanstack/react-query": "^5.84.1",
|
||||
"@waku/sdk": "^0.0.35-67a7287.0",
|
||||
"buffer": "^6.0.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@ -62,7 +61,6 @@
|
||||
"input-otp": "^1.2.4",
|
||||
"lucide-react": "^0.462.0",
|
||||
"next-themes": "^0.3.0",
|
||||
"ordiscan": "^1.3.0",
|
||||
"re-resizable": "6.11.2",
|
||||
"react": "^18.3.1",
|
||||
"react-day-picker": "^8.10.1",
|
||||
|
||||
@ -24,8 +24,8 @@ import {
|
||||
import { CypherImage } from './ui/CypherImage';
|
||||
import { RelevanceIndicator } from './ui/relevance-indicator';
|
||||
import { ModerationToggle } from './ui/moderation-toggle';
|
||||
import { sortCells, SortOption } from '@opchan/core';
|
||||
import { Cell } from '@opchan/core';
|
||||
import { sortCells, SortOption } from '@/utils/sorting';
|
||||
import type { Cell } from '@opchan/core';
|
||||
import { useForum } from '@opchan/react';
|
||||
import { ShareButton } from './ui/ShareButton';
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ import {
|
||||
DialogTrigger,
|
||||
} from '@/components/ui/dialog';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { urlLoads } from '@opchan/core';
|
||||
import { urlLoads } from '@/utils';
|
||||
|
||||
const formSchema = z.object({
|
||||
title: z
|
||||
|
||||
@ -61,19 +61,17 @@ const Header = () => {
|
||||
const { toast } = useToast();
|
||||
const forumContext = useForumContext();
|
||||
|
||||
// Use AppKit hooks for multi-chain support
|
||||
const bitcoinAccount = useAppKitAccount({ namespace: 'bip122' });
|
||||
const ethereumAccount = useAppKitAccount({ namespace: 'eip155' });
|
||||
const { disconnect } = useDisconnect();
|
||||
|
||||
// Determine which account is connected
|
||||
const isBitcoinConnected = bitcoinAccount.isConnected;
|
||||
const isEthereumConnected = ethereumAccount.isConnected;
|
||||
const isConnected = isBitcoinConnected || isEthereumConnected;
|
||||
|
||||
const isConnected = bitcoinAccount.isConnected || ethereumAccount.isConnected;
|
||||
|
||||
|
||||
|
||||
// Use currentUser address (which has ENS details) instead of raw AppKit address
|
||||
const address = currentUser?.address || (isConnected
|
||||
? isBitcoinConnected
|
||||
? bitcoinAccount.isConnected
|
||||
? bitcoinAccount.address
|
||||
: ethereumAccount.address
|
||||
: undefined);
|
||||
@ -81,12 +79,9 @@ const Header = () => {
|
||||
const [walletWizardOpen, setWalletWizardOpen] = useState(false);
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||
|
||||
// ✅ Use UserIdentityService via useUserDisplay hook for centralized display logic
|
||||
const { displayName, verificationLevel } = useUserDisplay(address || '');
|
||||
|
||||
// ✅ Removed console.log to prevent spam during development
|
||||
|
||||
// Load delegation status
|
||||
React.useEffect(() => {
|
||||
getDelegationStatus().then(setDelegationInfo).catch(console.error);
|
||||
}, [getDelegationStatus]);
|
||||
@ -158,7 +153,6 @@ const Header = () => {
|
||||
const getStatusIcon = () => {
|
||||
if (!isConnected) return <CircleSlash className="w-4 h-4" />;
|
||||
|
||||
// Use verification level from UserIdentityService (central database store)
|
||||
if (
|
||||
verificationLevel === EVerificationStatus.ENS_ORDINAL_VERIFIED &&
|
||||
delegationInfo?.isValid
|
||||
|
||||
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { ArrowUp, ArrowDown, MessageSquare } from 'lucide-react';
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
import { Post } from '@opchan/core';
|
||||
import type { Post } from '@opchan/core';
|
||||
// Removed unused imports
|
||||
import { RelevanceIndicator } from '@/components/ui/relevance-indicator';
|
||||
import { AuthorDisplay } from '@/components/ui/author-display';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
type CypherImageProps = {
|
||||
src?: string;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Share2 } from 'lucide-react';
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { useToast } from '../ui/use-toast';
|
||||
|
||||
interface ShareButtonProps {
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Accordion = AccordionPrimitive.Root;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { buttonVariants } from '@/components/ui/button-variants';
|
||||
|
||||
const AlertDialog = AlertDialogPrimitive.Root;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const alertVariants = cva(
|
||||
'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Avatar = React.forwardRef<
|
||||
React.ElementRef<typeof AvatarPrimitive.Root>,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const badgeVariants = cva(
|
||||
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Bookmark, BookmarkCheck } from 'lucide-react';
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
interface BookmarkButtonProps {
|
||||
isBookmarked: boolean;
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { Bookmark, BookmarkType } from '@opchan/core';
|
||||
import { useUserDisplay } from '@/hooks';
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { ChevronRight, MoreHorizontal } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Breadcrumb = React.forwardRef<
|
||||
HTMLElement,
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import { type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { buttonVariants } from './button-variants';
|
||||
|
||||
export interface ButtonProps
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { DayPicker } from 'react-day-picker';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { buttonVariants } from '@/components/ui/button-variants';
|
||||
|
||||
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Card = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
||||
@ -4,7 +4,7 @@ import useEmblaCarousel, {
|
||||
} from 'embla-carousel-react';
|
||||
import { ArrowLeft, ArrowRight } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type CarouselApi = UseEmblaCarouselType[1];
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as RechartsPrimitive from 'recharts';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
// Format: { THEME_NAME: CSS_SELECTOR }
|
||||
const THEMES = { light: '', dark: '.dark' } as const;
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
||||
import { Check } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Checkbox = React.forwardRef<
|
||||
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
||||
|
||||
@ -3,7 +3,7 @@ import { type DialogProps } from '@radix-ui/react-dialog';
|
||||
import { Command as CommandPrimitive } from 'cmdk';
|
||||
import { Search } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
||||
|
||||
const Command = React.forwardRef<
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
||||
import { Check, ChevronRight, Circle } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const ContextMenu = ContextMenuPrimitive.Root;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
||||
import { X } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Dialog = DialogPrimitive.Root;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Drawer as DrawerPrimitive } from 'vaul';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Drawer = ({
|
||||
shouldScaleBackground = true,
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
||||
import { Check, ChevronRight, Circle } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root;
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
useFormContext,
|
||||
} from 'react-hook-form';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
const Form = FormProvider;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const HoverCard = HoverCardPrimitive.Root;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import { OTPInput, OTPInputContext } from 'input-otp';
|
||||
import { Dot } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const InputOTP = React.forwardRef<
|
||||
React.ElementRef<typeof OTPInput>,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(
|
||||
({ className, type, ...props }, ref) => {
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as LabelPrimitive from '@radix-ui/react-label';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const labelVariants = cva(
|
||||
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as MenubarPrimitive from '@radix-ui/react-menubar';
|
||||
import { Check, ChevronRight, Circle } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const MenubarMenu = MenubarPrimitive.Menu;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
|
||||
import { cva } from 'class-variance-authority';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const NavigationMenu = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { ButtonProps } from '@/components/ui/button';
|
||||
import { buttonVariants } from '@/components/ui/button-variants';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Popover = PopoverPrimitive.Root;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Progress = React.forwardRef<
|
||||
React.ElementRef<typeof ProgressPrimitive.Root>,
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
||||
import { Circle } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const RadioGroup = React.forwardRef<
|
||||
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Resizable } from 're-resizable';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
|
||||
type ResizableTextareaProps =
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { GripVertical } from 'lucide-react';
|
||||
import * as ResizablePrimitive from 'react-resizable-panels';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const ResizablePanelGroup = ({
|
||||
className,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const ScrollArea = React.forwardRef<
|
||||
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Select = SelectPrimitive.Root;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Separator = React.forwardRef<
|
||||
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
||||
|
||||
@ -3,7 +3,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import { X } from 'lucide-react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Sheet = SheetPrimitive.Root;
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import { VariantProps, cva } from 'class-variance-authority';
|
||||
import { PanelLeft } from 'lucide-react';
|
||||
|
||||
import { useIsMobile } from '@/hooks/use-mobile';
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils';
|
||||
|
||||
function Skeleton({
|
||||
className,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as SliderPrimitive from '@radix-ui/react-slider';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils';
|
||||
|
||||
const Slider = React.forwardRef<
|
||||
React.ElementRef<typeof SliderPrimitive.Root>,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Switch = React.forwardRef<
|
||||
React.ElementRef<typeof SwitchPrimitives.Root>,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Table = React.forwardRef<
|
||||
HTMLTableElement,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Tabs = TabsPrimitive.Root;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const Textarea = React.forwardRef<
|
||||
HTMLTextAreaElement,
|
||||
|
||||
@ -3,7 +3,7 @@ import * as ToastPrimitives from '@radix-ui/react-toast';
|
||||
import { cva, type VariantProps } from 'class-variance-authority';
|
||||
import { X } from 'lucide-react';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const ToastProvider = ToastPrimitives.Provider;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
||||
import { type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { toggleVariants } from '@/components/ui/toggle-variants';
|
||||
|
||||
const ToggleGroupContext = React.createContext<
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
||||
import { type VariantProps } from 'class-variance-authority';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
import { toggleVariants } from './toggle-variants';
|
||||
|
||||
const Toggle = React.forwardRef<
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
||||
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Wifi, WifiOff, AlertTriangle, CheckCircle } from 'lucide-react';
|
||||
import { Wifi, WifiOff, CheckCircle } from 'lucide-react';
|
||||
import { useNetworkStatus } from '@opchan/react';
|
||||
import { cn } from '@opchan/core';
|
||||
import { cn } from '../../utils'
|
||||
|
||||
interface WakuHealthIndicatorProps {
|
||||
className?: string;
|
||||
@ -24,12 +24,8 @@ export function WakuHealthIndicator({
|
||||
switch (connectionStatus) {
|
||||
case 'connected':
|
||||
return <CheckCircle className="text-green-500" />;
|
||||
case 'connecting':
|
||||
return <Wifi className="text-yellow-500 animate-pulse" />;
|
||||
case 'disconnected':
|
||||
return <WifiOff className="text-red-500" />;
|
||||
case 'error':
|
||||
return <AlertTriangle className="text-red-500" />;
|
||||
default:
|
||||
return <Wifi className="text-gray-500" />;
|
||||
}
|
||||
|
||||
@ -15,8 +15,7 @@ import { ModerationToggle } from '@/components/ui/moderation-toggle';
|
||||
import { useForumData, useAuth } from '@/hooks';
|
||||
import { useForum } from '@opchan/react';
|
||||
import { EVerificationStatus } from '@opchan/core';
|
||||
import { sortPosts, SortOption } from '@opchan/core';
|
||||
|
||||
import { sortPosts, SortOption } from '@/utils/sorting';
|
||||
const FeedPage: React.FC = () => {
|
||||
const forumData = useForumData();
|
||||
const { verificationStatus } = useAuth();
|
||||
|
||||
9
app/src/utils/index.ts
Normal file
9
app/src/utils/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export { urlLoads } from './urlLoads';
|
||||
@ -1,4 +1,4 @@
|
||||
import { Post, Comment, Cell } from '../../types/forum';
|
||||
import { Post, Comment, Cell } from '../../../packages/core/src/types/forum';
|
||||
|
||||
export type SortOption = 'relevance' | 'time';
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
|
||||
}
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -30,7 +30,7 @@
|
||||
"@hookform/resolvers": "^3.9.0",
|
||||
"@noble/ed25519": "^2.2.3",
|
||||
"@noble/hashes": "^1.8.0",
|
||||
"@opchan/core": "1.0.0",
|
||||
"@opchan/core": "file:../packages/core",
|
||||
"@opchan/react": "file:../packages/react",
|
||||
"@radix-ui/react-accordion": "^1.2.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||
@ -64,7 +64,6 @@
|
||||
"@reown/appkit-adapter-wagmi": "^1.7.17",
|
||||
"@reown/appkit-wallet-button": "^1.7.17",
|
||||
"@tanstack/react-query": "^5.84.1",
|
||||
"@waku/sdk": "^0.0.35-67a7287.0",
|
||||
"buffer": "^6.0.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@ -74,7 +73,6 @@
|
||||
"input-otp": "^1.2.4",
|
||||
"lucide-react": "^0.462.0",
|
||||
"next-themes": "^0.3.0",
|
||||
"ordiscan": "^1.3.0",
|
||||
"re-resizable": "6.11.2",
|
||||
"react": "^18.3.1",
|
||||
"react-day-picker": "^8.10.1",
|
||||
|
||||
@ -35,8 +35,6 @@ export { ordinals } from './lib/services/Ordinals';
|
||||
// Export utilities
|
||||
export * from './lib/utils';
|
||||
export { MessageValidator } from './lib/utils/MessageValidator';
|
||||
export * from './lib/utils/sorting';
|
||||
export { urlLoads } from './lib/utils/urlLoads';
|
||||
export { environment, type EnvironmentConfig } from './lib/utils/environment';
|
||||
|
||||
// Export Waku networking
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function bytesToHex(bytes: Uint8Array): string {
|
||||
return Array.from(bytes)
|
||||
.map(b => b.toString(16).padStart(2, '0'))
|
||||
|
||||
@ -76,12 +76,10 @@ export function useNetworkStatus(): NetworkStatusData {
|
||||
try {
|
||||
const nowReady = Boolean(client?.messageManager?.isReady);
|
||||
setWakuReady(nowReady);
|
||||
console.debug('[useNetworkStatus] primed wakuReady from client', { nowReady });
|
||||
} catch {}
|
||||
|
||||
const off = client?.messageManager?.onHealthChange?.(
|
||||
(ready: boolean) => {
|
||||
console.debug('[useNetworkStatus] onHealthChange -> wakuReady', { ready });
|
||||
setWakuReady(Boolean(ready));
|
||||
}
|
||||
);
|
||||
@ -119,18 +117,6 @@ export function useNetworkStatus(): NetworkStatusData {
|
||||
const lastSync = Date.now(); // This would come from actual sync tracking
|
||||
const syncAge = lastSync ? formatTimeAgo(lastSync) : null;
|
||||
|
||||
// Debug: surface the raw inputs to health computation
|
||||
console.debug('[useNetworkStatus] health', {
|
||||
forumIsNetworkConnected: isNetworkConnected,
|
||||
fallbackConnected,
|
||||
effectiveConnected,
|
||||
isInitialLoading,
|
||||
isRefreshing,
|
||||
error,
|
||||
delegationValid: delegationInfo?.isValid,
|
||||
issues,
|
||||
});
|
||||
|
||||
return {
|
||||
isConnected: effectiveConnected,
|
||||
isHealthy,
|
||||
@ -185,13 +171,6 @@ export function useNetworkStatus(): NetworkStatusData {
|
||||
// Helper methods
|
||||
const getStatusMessage = useMemo(() => {
|
||||
return (): string => {
|
||||
console.debug('[useNetworkStatus] statusMessage inputs', {
|
||||
isInitialLoading,
|
||||
isRefreshing,
|
||||
isNetworkConnected,
|
||||
error,
|
||||
issues: health.issues,
|
||||
});
|
||||
if (isInitialLoading) return 'Loading forum data...';
|
||||
if (isRefreshing) return 'Refreshing data...';
|
||||
const fallbackConnected = Boolean(wakuReady);
|
||||
@ -213,12 +192,6 @@ export function useNetworkStatus(): NetworkStatusData {
|
||||
|
||||
const getHealthColor = useMemo(() => {
|
||||
return (): 'green' | 'yellow' | 'red' => {
|
||||
console.debug('[useNetworkStatus] healthColor inputs', {
|
||||
isNetworkConnected,
|
||||
error,
|
||||
issues: health.issues,
|
||||
delegationValid: delegationInfo?.isValid,
|
||||
});
|
||||
const fallbackConnected = Boolean(wakuReady);
|
||||
const effectiveConnected = isNetworkConnected || fallbackConnected;
|
||||
if (!effectiveConnected || error) return 'red';
|
||||
|
||||
@ -1,26 +1,9 @@
|
||||
// Providers only (context hooks are internal)
|
||||
export * from './provider/OpChanProvider';
|
||||
export { ClientProvider, useClient } from './contexts/ClientContext';
|
||||
export { AuthProvider, useAuth } from './contexts/AuthContext';
|
||||
export { ForumProvider, useForum as useForumContext } from './contexts/ForumContext';
|
||||
export { ModerationProvider, useModeration } from './contexts/ModerationContext';
|
||||
|
||||
// Public hooks and types
|
||||
export * from './hooks';
|
||||
export { useForumApi as useForum } from './hooks/useForum';
|
||||
|
||||
// Re-export core types for convenience
|
||||
export type {
|
||||
User,
|
||||
EVerificationStatus,
|
||||
EDisplayPreference,
|
||||
DelegationDuration,
|
||||
Cell,
|
||||
Post,
|
||||
Comment,
|
||||
Bookmark,
|
||||
BookmarkType,
|
||||
RelevanceScoreDetails,
|
||||
} from '@opchan/core';
|
||||
|
||||
|
||||
|
||||
@ -19,6 +19,6 @@
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
},
|
||||
"include": ["packages/*/src/**/*"],
|
||||
"include": ["packages/*/src/**/*", "app/utils/urlLoads.test.ts", "app/utils/urlLoads.ts"],
|
||||
"exclude": ["node_modules", "**/dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
8
vercel.json
Normal file
8
vercel.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"installCommand": "npm ci --workspaces",
|
||||
"buildCommand": "npm run -w packages/core build && npm run -w packages/react build && npm run -w app build",
|
||||
"outputDirectory": "app/dist",
|
||||
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user