mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-12 08:27:27 +02:00
fix: correct AddressPointer import and apply prettier formatting
- Change AddressPointer import from applesauce-core/helpers to nostr-tools/nip19 to match codebase conventions - Auto-fix prettier formatting for nip89 files
This commit is contained in:
@@ -11,7 +11,13 @@ import { KindBadge } from "@/components/KindBadge";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { useCopy } from "@/hooks/useCopy";
|
||||
import { UserName } from "../UserName";
|
||||
import { Copy, CopyCheck, Globe, Smartphone, TabletSmartphone } from "lucide-react";
|
||||
import {
|
||||
Copy,
|
||||
CopyCheck,
|
||||
Globe,
|
||||
Smartphone,
|
||||
TabletSmartphone,
|
||||
} from "lucide-react";
|
||||
import { CopyableJsonViewer } from "@/components/JsonViewer";
|
||||
import { useMemo } from "react";
|
||||
|
||||
@@ -200,10 +206,7 @@ export function ApplicationHandlerDetailRenderer({
|
||||
Event ID:{" "}
|
||||
<code className="font-mono text-xs bg-muted px-1">{event.id}</code>
|
||||
</div>
|
||||
<div>
|
||||
Created:{" "}
|
||||
{new Date(event.created_at * 1000).toLocaleString()}
|
||||
</div>
|
||||
<div>Created: {new Date(event.created_at * 1000).toLocaleString()}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -14,12 +14,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { useNostrEvent } from "@/hooks/useNostrEvent";
|
||||
import { useGrimoire } from "@/core/state";
|
||||
import { UserName } from "../UserName";
|
||||
import {
|
||||
Globe,
|
||||
Smartphone,
|
||||
TabletSmartphone,
|
||||
Package,
|
||||
} from "lucide-react";
|
||||
import { Globe, Smartphone, TabletSmartphone, Package } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
|
||||
interface HandlerRecommendationDetailRendererProps {
|
||||
@@ -104,7 +99,8 @@ function HandlerCard({
|
||||
{supportedKinds.length > 0 && (
|
||||
<div className="flex flex-col gap-2">
|
||||
<h4 className="text-xs font-semibold text-muted-foreground uppercase">
|
||||
Handles {supportedKinds.length} kind{supportedKinds.length > 1 ? "s" : ""}
|
||||
Handles {supportedKinds.length} kind
|
||||
{supportedKinds.length > 1 ? "s" : ""}
|
||||
</h4>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{supportedKinds.slice(0, 10).map((kind) => (
|
||||
@@ -151,13 +147,14 @@ function HandlerCard({
|
||||
<div className="flex flex-col gap-1 pt-2 border-t border-border text-xs text-muted-foreground">
|
||||
{platform && (
|
||||
<div>
|
||||
Recommended for: <Badge variant="outline" className="text-[10px] ml-1">{platform}</Badge>
|
||||
Recommended for:{" "}
|
||||
<Badge variant="outline" className="text-[10px] ml-1">
|
||||
{platform}
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
{relayHint && (
|
||||
<div className="font-mono">
|
||||
Relay hint: {relayHint}
|
||||
</div>
|
||||
<div className="font-mono">Relay hint: {relayHint}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -227,7 +224,7 @@ export function HandlerRecommendationDetailRenderer({
|
||||
</button>
|
||||
{platforms.map((platform) => {
|
||||
const count = allHandlers.filter(
|
||||
(h) => h.platform === platform
|
||||
(h) => h.platform === platform,
|
||||
).length;
|
||||
return (
|
||||
<button
|
||||
|
||||
@@ -19,9 +19,7 @@ import {
|
||||
import { NostrEvent } from "@/types/nostr";
|
||||
|
||||
// Helper to create a minimal kind 31990 event
|
||||
function createHandlerEvent(
|
||||
overrides?: Partial<NostrEvent>
|
||||
): NostrEvent {
|
||||
function createHandlerEvent(overrides?: Partial<NostrEvent>): NostrEvent {
|
||||
return {
|
||||
id: "test-id",
|
||||
pubkey: "test-pubkey",
|
||||
@@ -36,7 +34,7 @@ function createHandlerEvent(
|
||||
|
||||
// Helper to create a minimal kind 31989 event
|
||||
function createRecommendationEvent(
|
||||
overrides?: Partial<NostrEvent>
|
||||
overrides?: Partial<NostrEvent>,
|
||||
): NostrEvent {
|
||||
return {
|
||||
id: "test-id",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NostrEvent } from "@/types/nostr";
|
||||
import { getTagValue } from "applesauce-core/helpers";
|
||||
import { AddressPointer } from "applesauce-core/helpers";
|
||||
import { AddressPointer } from "nostr-tools/nip19";
|
||||
|
||||
/**
|
||||
* NIP-89 Helper Functions
|
||||
@@ -88,9 +88,7 @@ export function getSupportedKinds(event: NostrEvent): number[] {
|
||||
* Get platform-specific URL templates from kind 31990 event
|
||||
* Returns a map of platform name to URL template
|
||||
*/
|
||||
export function getPlatformUrls(
|
||||
event: NostrEvent
|
||||
): Record<string, string> {
|
||||
export function getPlatformUrls(event: NostrEvent): Record<string, string> {
|
||||
if (event.kind !== 31990) return {};
|
||||
|
||||
const platforms: Record<string, string> = {};
|
||||
@@ -220,7 +218,7 @@ export function getHandlerReferences(event: NostrEvent): HandlerReference[] {
|
||||
*/
|
||||
export function getHandlersByPlatform(
|
||||
event: NostrEvent,
|
||||
platform?: string
|
||||
platform?: string,
|
||||
): HandlerReference[] {
|
||||
const allRefs = getHandlerReferences(event);
|
||||
|
||||
@@ -254,7 +252,7 @@ export function getRecommendedPlatforms(event: NostrEvent): string[] {
|
||||
*/
|
||||
export function substituteTemplate(
|
||||
template: string,
|
||||
bech32Entity: string
|
||||
bech32Entity: string,
|
||||
): string {
|
||||
return template.replace(/<bech32>/g, bech32Entity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user