feat(web): sprint1 ui core with global toasts and improved chat layout
Some checks failed
CI / test (push) Failing after 19s
Some checks failed
CI / test (push) Failing after 19s
This commit is contained in:
@@ -17,6 +17,7 @@ import { blockUser, getUserById, listBlockedUsers, searchUsers, unblockUser } fr
|
||||
import type { AuthUser, ChatAttachment, ChatDetail, ChatMember, UserSearchItem } from "../chat/types";
|
||||
import { useAuthStore } from "../store/authStore";
|
||||
import { useChatStore } from "../store/chatStore";
|
||||
import { useUiStore } from "../store/uiStore";
|
||||
|
||||
interface Props {
|
||||
chatId: number | null;
|
||||
@@ -28,6 +29,7 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
|
||||
const me = useAuthStore((s) => s.me);
|
||||
const loadChats = useChatStore((s) => s.loadChats);
|
||||
const setActiveChatId = useChatStore((s) => s.setActiveChatId);
|
||||
const showToast = useUiStore((s) => s.showToast);
|
||||
const [chat, setChat] = useState<ChatDetail | null>(null);
|
||||
const [members, setMembers] = useState<ChatMember[]>([]);
|
||||
const [memberUsers, setMemberUsers] = useState<Record<number, AuthUser>>({});
|
||||
@@ -223,6 +225,7 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
|
||||
setInviteLink(link.invite_url);
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(link.invite_url);
|
||||
showToast("Invite link copied");
|
||||
}
|
||||
} catch {
|
||||
setError("Failed to create invite link");
|
||||
@@ -489,7 +492,9 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
|
||||
onClick={async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(attachmentCtx.url);
|
||||
showToast("Link copied");
|
||||
} catch {
|
||||
showToast("Copy failed");
|
||||
return;
|
||||
} finally {
|
||||
setAttachmentCtx(null);
|
||||
|
||||
Reference in New Issue
Block a user