Add username search and improve chat creation UX
All checks were successful
CI / test (push) Successful in 23s
All checks were successful
CI / test (push) Successful in 23s
Backend user search: - Added users search endpoint for @username lookup. - Implemented repository/service/router support with bounded result limits. Web chat creation: - Added API client for /users/search. - Added NewChatPanel for creating private chats via @username search. - Added group/channel creation flow from sidebar. UX refinement: - Hide message composer when no chat is selected. - Show explicit placeholder: 'Выберите чат, чтобы начать переписку'. - Added tsbuildinfo ignore rule.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { http } from "./http";
|
||||
import type { Chat, Message, MessageType } from "../chat/types";
|
||||
import type { Chat, ChatType, Message, MessageType } from "../chat/types";
|
||||
|
||||
export async function getChats(): Promise<Chat[]> {
|
||||
const { data } = await http.get<Chat[]>("/chats");
|
||||
@@ -7,10 +7,14 @@ export async function getChats(): Promise<Chat[]> {
|
||||
}
|
||||
|
||||
export async function createPrivateChat(memberId: number): Promise<Chat> {
|
||||
return createChat("private", null, [memberId]);
|
||||
}
|
||||
|
||||
export async function createChat(type: ChatType, title: string | null, memberIds: number[] = []): Promise<Chat> {
|
||||
const { data } = await http.post<Chat>("/chats", {
|
||||
type: "private",
|
||||
title: null,
|
||||
member_ids: [memberId]
|
||||
type,
|
||||
title,
|
||||
member_ids: memberIds
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user