mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-11 16:07:15 +02:00
fix: resolve remaining TypeScript strict type errors
## BaseEventRenderer - Import React namespace for React.MouseEvent types ## thread-builder - Remove unused EventPointer and AddressPointer imports - Remove unused isReplaceable variable - Add type annotation for tag array parameter (t: string[]) - Remove unused npub variable, add TODO comment ## ComposeDialog - Replace Badge component with div to avoid asChild prop issue - Use inline-flex with Tailwind classes for mention badges ## RelaySelector - Add explicit string[] type assertion for knownRelays array - Fixes "unknown[]" inference from Map.keys() All type errors fixed except environmental issues (missing deps).
This commit is contained in:
@@ -391,13 +391,9 @@ function MentionBadge({
|
||||
const displayName = getDisplayName(pubkey, profile);
|
||||
|
||||
return (
|
||||
<Badge
|
||||
variant="secondary"
|
||||
className="pl-2 pr-1 py-1 flex items-center gap-2"
|
||||
asChild={false}
|
||||
>
|
||||
<div className="inline-flex items-center gap-2 pl-2 pr-1 py-1 rounded-full bg-secondary text-secondary-foreground">
|
||||
<AtSign className="w-3 h-3" />
|
||||
<span>{displayName}</span>
|
||||
<span className="text-sm">{displayName}</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
@@ -407,6 +403,6 @@ function MentionBadge({
|
||||
<X className="h-3 w-3" />
|
||||
<span className="sr-only">Remove {displayName}</span>
|
||||
</Button>
|
||||
</Badge>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export function RelaySelector({
|
||||
);
|
||||
|
||||
// Get all known relays from pool
|
||||
const knownRelays = Array.from(relayStats.keys());
|
||||
const knownRelays: string[] = Array.from(relayStats.keys()) as string[];
|
||||
|
||||
return (
|
||||
<Popover open={isOpen} onOpenChange={setIsOpen}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { NostrEvent } from "@/types/nostr";
|
||||
import { UserName } from "../UserName";
|
||||
import { KindBadge } from "@/components/KindBadge";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { NostrEvent } from "nostr-tools/core";
|
||||
import type { EventPointer, AddressPointer } from "nostr-tools/nip19";
|
||||
import { getNip10References } from "applesauce-common/helpers/threading";
|
||||
|
||||
/**
|
||||
@@ -108,13 +107,12 @@ export function buildNip22Tags(
|
||||
// Add K tag (kind of parent event)
|
||||
tags.push(["K", String(replyTo.kind)]);
|
||||
|
||||
// Check if this is a replaceable event (30000-39999)
|
||||
const isReplaceable = replyTo.kind >= 30000 && replyTo.kind < 40000;
|
||||
// Check if this is a parameterized replaceable event (30000-39999)
|
||||
const isParameterized = replyTo.kind >= 30000 && replyTo.kind < 40000;
|
||||
|
||||
if (isParameterized) {
|
||||
// Use A tag for parameterized replaceable events
|
||||
const dTag = replyTo.tags.find((t) => t[0] === "d")?.[1] || "";
|
||||
const dTag = replyTo.tags.find((t: string[]) => t[0] === "d")?.[1] || "";
|
||||
const coordinate = `${replyTo.kind}:${replyTo.pubkey}:${dTag}`;
|
||||
const relay = replyTo.relay;
|
||||
tags.push(relay ? ["A", coordinate, relay] : ["A", coordinate]);
|
||||
@@ -187,10 +185,10 @@ export function extractMentionsFromContent(content: string): string[] {
|
||||
|
||||
for (const match of matches) {
|
||||
try {
|
||||
// Remove "nostr:" prefix and decode npub
|
||||
const npub = match.replace("nostr:", "");
|
||||
// We'll need to decode this - for now just extract the pattern
|
||||
// Remove "nostr:" prefix
|
||||
// TODO: decode npub to pubkey
|
||||
// The MentionEditor already handles encoding, so we can extract from tags instead
|
||||
// This function is a placeholder for future enhancement
|
||||
} catch {
|
||||
// Skip invalid npubs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user