global update and global fix

This commit is contained in:
lendry
2026-06-25 23:48:57 +03:00
parent 3880c68d59
commit b0ea87e898
121 changed files with 13759 additions and 663 deletions

View File

@@ -2,14 +2,16 @@
import Link from 'next/link';
import { useState } from 'react';
import { Loader2, Search, UsersRound } from 'lucide-react';
import { Loader2, Plus, Search, UsersRound } from 'lucide-react';
import { AvatarWithPresence } from '@/components/family/avatar-with-presence';
import { FamilyGroupSelector } from '@/components/family/family-group-selector';
import { FamilyInviteDialog } from '@/components/family/family-invite-dialog';
import { useFamilyOverlay } from '@/components/family/family-overlay-provider';
import { useAuth } from '@/components/id/auth-provider';
import { useSelectedFamily } from '@/hooks/use-primary-family';
import { addBotFatherToFamily, getApiErrorMessage } from '@/lib/api';
import { Button } from '@/components/ui/button';
import { useToast } from '@/components/id/toast-provider';
import { cn } from '@/lib/utils';
export function FamilySidebarPanel() {
@@ -25,7 +27,9 @@ export function FamilySidebarPanel() {
refresh
} = useSelectedFamily(Boolean(user && token));
const { openChatWithMember } = useFamilyOverlay();
const { showToast } = useToast();
const [inviteOpen, setInviteOpen] = useState(false);
const [addingBotFather, setAddingBotFather] = useState(false);
if (!user || !token) return null;
@@ -81,7 +85,12 @@ export function FamilySidebarPanel() {
'flex w-full items-center gap-2 rounded-xl px-2 py-1.5 text-left transition hover:bg-[#f4f5f8]',
isSelf && 'bg-[#fafbfd]'
)}
onClick={() => openChatWithMember(member.userId, member.displayName)}
onClick={() =>
openChatWithMember(member.userId, member.displayName, {
isBot: member.isBot,
botUsername: member.botUsername
})
}
title={isSelf ? 'Вы' : `Написать ${member.displayName}`}
>
<AvatarWithPresence
@@ -97,17 +106,44 @@ export function FamilySidebarPanel() {
<div className="min-w-0 flex-1">
<p className="truncate text-[12px] font-medium leading-tight">
{member.displayName}
{member.isBot ? ' 🤖' : ''}
{isSelf ? ' (Вы)' : ''}
</p>
{!isSelf ? (
<p className={cn('truncate text-[10px]', presence?.online ? 'text-emerald-600' : 'text-[#a8adbc]')}>
{presence?.online ? 'В сети' : 'Не в сети'}
<p className={cn('truncate text-[10px]', member.isBot ? 'text-[#3390ec]' : presence?.online ? 'text-emerald-600' : 'text-[#a8adbc]')}>
{member.isBot ? 'Бот' : presence?.online ? 'В сети' : 'Не в сети'}
</p>
) : null}
</div>
</button>
);
})}
{group?.botFatherAvailable ? (
<button
type="button"
disabled={addingBotFather}
className="flex w-full items-center gap-2 rounded-xl border border-dashed border-[#d5dbe8] px-2 py-2 text-left transition hover:bg-[#f4f5f8] disabled:opacity-60"
onClick={() => {
if (!group || !token) return;
setAddingBotFather(true);
void addBotFatherToFamily(group.id, token)
.then(() => {
showToast('BotFather добавлен в семью');
void refresh();
})
.catch((error) => showToast(getApiErrorMessage(error, 'Не удалось добавить BotFather') ?? 'Ошибка'))
.finally(() => setAddingBotFather(false));
}}
>
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-[#eef4ff] text-[#3390ec]">
{addingBotFather ? <Loader2 className="h-4 w-4 animate-spin" /> : <Plus className="h-4 w-4" />}
</div>
<div className="min-w-0 flex-1">
<p className="truncate text-[12px] font-medium leading-tight">Добавить BotFather 🤖</p>
<p className="truncate text-[10px] text-[#667085]">Создавайте ботов через чат</p>
</div>
</button>
) : null}
</div>
) : (
<div className="rounded-xl bg-[#f4f5f8] px-2 py-3 text-[11px] text-[#667085]">
@@ -120,6 +156,7 @@ export function FamilySidebarPanel() {
{hasFamily ? (
<FamilyInviteDialog
groupId={group!.id}
group={group}
open={inviteOpen}
onOpenChange={setInviteOpen}
onInvited={() => void refresh()}