diff --git a/index.html b/index.html index e5873d8fa..8264698ca 100644 --- a/index.html +++ b/index.html @@ -3,12 +3,10 @@ - + personal-nostr-client +
diff --git a/src/classes/nostr-subscription.ts b/src/classes/nostr-subscription.ts index de4b7f956..796ec619b 100644 --- a/src/classes/nostr-subscription.ts +++ b/src/classes/nostr-subscription.ts @@ -22,7 +22,7 @@ export class NostrSubscription { seenEvents = new Set(); constructor(relayUrls: string[], query?: NostrQuery, name?: string) { - this.id = String(name||lastId++); + this.id = String(name || lastId++); this.query = query; this.name = name; this.relayUrls = relayUrls; diff --git a/src/components/error-boundary.tsx b/src/components/error-boundary.tsx index aae33605d..daf4fb612 100644 --- a/src/components/error-boundary.tsx +++ b/src/components/error-boundary.tsx @@ -1,14 +1,6 @@ import React from "react"; -import { - ErrorBoundary as ErrorBoundaryHelper, - FallbackProps, -} from "react-error-boundary"; -import { - Alert, - AlertIcon, - AlertTitle, - AlertDescription, -} from "@chakra-ui/react"; +import { ErrorBoundary as ErrorBoundaryHelper, FallbackProps } from "react-error-boundary"; +import { Alert, AlertIcon, AlertTitle, AlertDescription } from "@chakra-ui/react"; export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) { return ( @@ -20,12 +12,7 @@ export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) { ); } -export const ErrorBoundary = ({ - children, - ...props -}: { - children: React.ReactNode; -}) => ( +export const ErrorBoundary = ({ children, ...props }: { children: React.ReactNode }) => ( {children} diff --git a/src/components/menu-icon-button.tsx b/src/components/menu-icon-button.tsx index 7cb9771b5..bb8d8be82 100644 --- a/src/components/menu-icon-button.tsx +++ b/src/components/menu-icon-button.tsx @@ -1,10 +1,4 @@ -import { - Menu, - MenuButton, - MenuList, - IconButton, - MenuListProps, -} from "@chakra-ui/react"; +import { Menu, MenuButton, MenuList, IconButton, MenuListProps } from "@chakra-ui/react"; import { MoreIcon } from "./icons"; export type MenuIconButtonProps = { @@ -13,13 +7,7 @@ export type MenuIconButtonProps = { export const MenuIconButton = ({ children }: MenuIconButtonProps) => ( - } - aria-label="view raw" - title="view raw" - size="xs" - /> + } aria-label="view raw" title="view raw" size="xs" /> {children} ); diff --git a/src/components/profile-button.tsx b/src/components/profile-button.tsx index 5d6f01686..998dc3259 100644 --- a/src/components/profile-button.tsx +++ b/src/components/profile-button.tsx @@ -15,17 +15,7 @@ export const ProfileButton = ({ to }: ProfileButtonProps) => { const metadata = useUserMetadata(pubkey); return ( - + {metadata?.name} diff --git a/src/components/user-avatar-link.tsx b/src/components/user-avatar-link.tsx index 2200f50af..cdc825a30 100644 --- a/src/components/user-avatar-link.tsx +++ b/src/components/user-avatar-link.tsx @@ -6,19 +6,15 @@ import { useUserMetadata } from "../hooks/use-user-metadata"; import { UserAvatar, UserAvatarProps } from "./user-avatar"; import { getUserDisplayName } from "../helpers/user-metadata"; -export const UserAvatarLink = React.memo( - ({ pubkey, ...props }: UserAvatarProps) => { - const metadata = useUserMetadata(pubkey); - const label = metadata - ? getUserDisplayName(metadata, pubkey) - : "Loading..."; +export const UserAvatarLink = React.memo(({ pubkey, ...props }: UserAvatarProps) => { + const metadata = useUserMetadata(pubkey); + const label = metadata ? getUserDisplayName(metadata, pubkey) : "Loading..."; - return ( - - - - - - ); - } -); + return ( + + + + + + ); +}); diff --git a/src/helpers/bolt11.ts b/src/helpers/bolt11.ts index db85d309d..ab8001af0 100644 --- a/src/helpers/bolt11.ts +++ b/src/helpers/bolt11.ts @@ -1,10 +1,4 @@ -import { - decode, - Section, - AmountSection, - DescriptionSection, - TimestampSection, -} from "light-bolt11-decoder"; +import { decode, Section, AmountSection, DescriptionSection, TimestampSection } from "light-bolt11-decoder"; import { convertTimestampToDate } from "./date"; export type ParsedInvoice = { diff --git a/src/helpers/nip-19.ts b/src/helpers/nip-19.ts index 7f6701369..ccdb240b1 100644 --- a/src/helpers/nip-19.ts +++ b/src/helpers/nip-19.ts @@ -59,10 +59,7 @@ export function fromHexString(str: string) { return buffer; } -export function normalizeToBech32( - key: string, - prefix: Bech32Prefix = Bech32Prefix.Pubkey -) { +export function normalizeToBech32(key: string, prefix: Bech32Prefix = Bech32Prefix.Pubkey) { if (isHex(key)) return hexToBech32(key, prefix); if (isBech32Key(key)) return key; return null; diff --git a/src/helpers/user-metadata.ts b/src/helpers/user-metadata.ts index 05f329bd9..9f0fe2327 100644 --- a/src/helpers/user-metadata.ts +++ b/src/helpers/user-metadata.ts @@ -2,10 +2,7 @@ import { Kind0ParsedContent } from "../types/nostr-event"; import { normalizeToBech32 } from "./nip-19"; import { truncatedId } from "./nostr-event"; -export function getUserDisplayName( - metadata: Kind0ParsedContent | undefined, - pubkey: string -) { +export function getUserDisplayName(metadata: Kind0ParsedContent | undefined, pubkey: string) { if (metadata?.display_name && metadata?.name) { return `${metadata.display_name} (${metadata.name})`; } else if (metadata?.name) { diff --git a/src/types/nostr-extensions.d.ts b/src/types/nostr-extensions.d.ts index d08ad9a48..f80097086 100644 --- a/src/types/nostr-extensions.d.ts +++ b/src/types/nostr-extensions.d.ts @@ -6,18 +6,10 @@ declare global { enabled: boolean; getPublicKey: () => Promise | string; signEvent: (event: NostrEvent) => Promise | NostrEvent; - getRelays: () => - | Record - | string[]; + getRelays: () => Record | string[]; nip04?: { - encrypt: ( - pubkey: string, - plaintext: string - ) => Promise | string; - decrypt: ( - pubkey: string, - ciphertext: string - ) => Promise | string; + encrypt: (pubkey: string, plaintext: string) => Promise | string; + decrypt: (pubkey: string, ciphertext: string) => Promise | string; }; }; } diff --git a/src/types/nostr-query.ts b/src/types/nostr-query.ts index 073f6e16b..0e002b010 100644 --- a/src/types/nostr-query.ts +++ b/src/types/nostr-query.ts @@ -4,10 +4,7 @@ export type NostrOutgoingEvent = ["EVENT", NostrEvent]; export type NostrOutgoingRequest = ["REQ", string, NostrQuery]; export type NostrOutgoingClose = ["CLOSE", string]; -export type NostrOutgoingMessage = - | NostrOutgoingEvent - | NostrOutgoingRequest - | NostrOutgoingClose; +export type NostrOutgoingMessage = NostrOutgoingEvent | NostrOutgoingRequest | NostrOutgoingClose; export type NostrQuery = { ids?: string[]; diff --git a/src/views/login.tsx b/src/views/login.tsx index 5cda19923..85e745267 100644 --- a/src/views/login.tsx +++ b/src/views/login.tsx @@ -14,9 +14,7 @@ export const LoginView = () => { return ( Login - + ); }; diff --git a/src/views/profile/edit.tsx b/src/views/profile/edit.tsx index ff9a6d1b9..d9be77e39 100644 --- a/src/views/profile/edit.tsx +++ b/src/views/profile/edit.tsx @@ -1,13 +1,4 @@ -import { - Avatar, - Button, - Flex, - FormControl, - FormLabel, - Input, - SkeletonText, - Textarea, -} from "@chakra-ui/react"; +import { Avatar, Button, Flex, FormControl, FormLabel, Input, SkeletonText, Textarea } from "@chakra-ui/react"; import { useMemo } from "react"; import { useForm } from "react-hook-form"; import useSubject from "../../hooks/use-subject"; @@ -55,12 +46,7 @@ const MetadataForm = ({ defaultValues, onSubmit }: MetadataFormProps) => { About -