MetadataCache -> CachedMetadata, addCachedMetadataToFuzzySearch
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { MetadataCache } from "@snort/system";
|
||||
import { CachedMetadata } from "@snort/system";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
@ -10,7 +10,7 @@ export class BackupKeyTask extends BaseUITask {
|
||||
id = "backup-key";
|
||||
noBaseStyle = true;
|
||||
|
||||
check(_: MetadataCache, session: LoginSession): boolean {
|
||||
check(_: CachedMetadata, session: LoginSession): boolean {
|
||||
return !this.state.muted && session.type == "private_key";
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MetadataCache } from "@snort/system";
|
||||
import { CachedMetadata } from "@snort/system";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
@ -7,7 +7,7 @@ import { BaseUITask } from "@/Components/Tasks/index";
|
||||
export class Nip5Task extends BaseUITask {
|
||||
id = "buy-nip5";
|
||||
|
||||
check(user: MetadataCache): boolean {
|
||||
check(user: CachedMetadata): boolean {
|
||||
return !this.state.muted && !user.nip05;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MetadataCache } from "@snort/system";
|
||||
import { CachedMetadata } from "@snort/system";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import { BaseUITask } from "@/Components/Tasks/index";
|
||||
@ -9,7 +9,7 @@ import { getCurrentSubscription } from "@/Utils/Subscription";
|
||||
export class RenewSubTask extends BaseUITask {
|
||||
id = "renew-sub";
|
||||
|
||||
check(user: MetadataCache, session: LoginSession): boolean {
|
||||
check(user: CachedMetadata, session: LoginSession): boolean {
|
||||
const sub = getCurrentSubscription(session.subscriptions);
|
||||
return !sub && session.subscriptions.length > 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MetadataCache } from "@snort/system";
|
||||
import { CachedMetadata } from "@snort/system";
|
||||
|
||||
import { LoginSession } from "@/Utils/Login";
|
||||
|
||||
@ -8,7 +8,7 @@ export interface UITask {
|
||||
/**
|
||||
* Run checks to determine if this Task should be triggered for this user
|
||||
*/
|
||||
check(user: MetadataCache, session: LoginSession): boolean;
|
||||
check(user: CachedMetadata, session: LoginSession): boolean;
|
||||
mute(): void;
|
||||
load(cb: () => void): void;
|
||||
render(): JSX.Element;
|
||||
@ -26,7 +26,7 @@ export abstract class BaseUITask implements UITask {
|
||||
|
||||
abstract id: string;
|
||||
noBaseStyle = false;
|
||||
abstract check(user: MetadataCache, session: LoginSession): boolean;
|
||||
abstract check(user: CachedMetadata, session: LoginSession): boolean;
|
||||
abstract render(): JSX.Element;
|
||||
|
||||
constructor() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import "@webscopeio/react-textarea-autocomplete/style.css";
|
||||
import "./Textarea.css";
|
||||
|
||||
import { MetadataCache, NostrPrefix } from "@snort/system";
|
||||
import { CachedMetadata, NostrPrefix } from "@snort/system";
|
||||
import ReactTextareaAutocomplete from "@webscopeio/react-textarea-autocomplete";
|
||||
import { useIntl } from "react-intl";
|
||||
import TextareaAutosize from "react-textarea-autosize";
|
||||
@ -28,7 +28,7 @@ const EmojiItem = ({ entity: { name, char } }: { entity: EmojiItemProps }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const UserItem = (metadata: MetadataCache) => {
|
||||
const UserItem = (metadata: CachedMetadata) => {
|
||||
const { pubkey, display_name, nip05, ...rest } = metadata;
|
||||
return (
|
||||
<div key={pubkey} className="user-item">
|
||||
@ -84,7 +84,7 @@ const Textarea = (props: TextareaProps) => {
|
||||
"@": {
|
||||
afterWhitespace: true,
|
||||
dataProvider: userDataProvider,
|
||||
component: (props: { entity: MetadataCache }) => <UserItem {...props.entity} />,
|
||||
component: (props: { entity: CachedMetadata }) => <UserItem {...props.entity} />,
|
||||
output: (item: { pubkey: string }) => `@${hexToBech32(NostrPrefix.PublicKey, item.pubkey)}`,
|
||||
},
|
||||
}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MetadataCache, NostrLink, NostrPrefix, UserMetadata } from "@snort/system";
|
||||
import { CachedMetadata, NostrLink, NostrPrefix, UserMetadata } from "@snort/system";
|
||||
import { SnortContext } from "@snort/system-react";
|
||||
import { ReactNode, useContext } from "react";
|
||||
import { Link, LinkProps } from "react-router-dom";
|
||||
@ -13,7 +13,7 @@ export function ProfileLink({
|
||||
...others
|
||||
}: {
|
||||
pubkey: string;
|
||||
user?: UserMetadata | MetadataCache;
|
||||
user?: UserMetadata | CachedMetadata;
|
||||
explicitLink?: string;
|
||||
children?: ReactNode;
|
||||
} & Omit<LinkProps, "to">) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import "./UserWebsiteLink.css";
|
||||
|
||||
import { MetadataCache, UserMetadata } from "@snort/system";
|
||||
import { CachedMetadata, UserMetadata } from "@snort/system";
|
||||
|
||||
import Icon from "@/Components/Icons/Icon";
|
||||
|
||||
export function UserWebsiteLink({ user }: { user?: MetadataCache | UserMetadata }) {
|
||||
export function UserWebsiteLink({ user }: { user?: CachedMetadata | UserMetadata }) {
|
||||
const website_url =
|
||||
user?.website && !user.website.startsWith("http") ? "https://" + user.website : user?.website || "";
|
||||
|
||||
|
Reference in New Issue
Block a user