blowater/UI/search_model.ts

36 lines
773 B
TypeScript
Raw Normal View History

2023-08-28 17:58:05 +00:00
import { PublicKey } from "../lib/nostr-ts/key.ts";
2023-07-14 10:59:25 +00:00
import { ProfileData } from "../features/profile.ts";
2023-06-30 14:05:57 +00:00
2023-09-23 21:33:30 +00:00
export type SearchUpdate = Cancel | SearchPublicKey | SelectConversation | Start;
2023-06-30 14:05:57 +00:00
export type Start = {
type: "StartSearch";
};
export type Cancel = {
2023-07-30 06:39:53 +00:00
type: "CancelPopOver";
2023-06-30 14:05:57 +00:00
};
export type SearchPublicKey = {
type: "Search";
text: string;
};
2023-09-23 21:33:30 +00:00
export type SelectConversation = {
type: "SelectConversation";
2023-06-30 14:05:57 +00:00
pubkey: PublicKey;
2023-10-04 21:34:43 +00:00
isGroupChat: boolean;
2023-06-30 14:05:57 +00:00
};
export type SearchModel = {
isSearching: boolean;
searchResults: {
pubkey: PublicKey;
profile: ProfileData | undefined;
}[];
};
export const SearchInitModel = (): SearchModel => {
return {
searchResults: [],
isSearching: false,
};
};