feat(db,admin): Add logo URL support and refactor bot schema with owner relationships

- Add logo_url column to nodes table for custom branding
- Refactor bots table to use owner_id foreign key relationship with users
- Add is_bot and bot_owner_id columns to users table for bot account tracking
- Add bot_id foreign key to posts table for bot-generated content tracking
- Create database indexes on owner_id, bot_id, is_bot, and bot_owner_id for query performance
- Remove bot handle, bio, avatar_url, and cryptographic keys from bots table (moved to user accounts)
- Update bot_content_sources schema and remove fetch_interval_minutes column
- Fix bot_content_items foreign key constraint with set null on delete
- Remove hardcoded NODE_NAME and NODE_DESCRIPTION from environment configuration
- Update admin panel, bot settings, and layout components to support new schema
- Add AccentColorContext and ToastContext for improved UI state management
- Update PostCard, Sidebar, RightSidebar, and LayoutWrapper components for context integration
This commit is contained in:
AskIt
2026-01-25 20:15:35 +01:00
parent d36c1c93e5
commit b9316552c2
16 changed files with 3386 additions and 61 deletions
+8 -6
View File
@@ -6,6 +6,7 @@ import { HeartIcon, RepeatIcon, MessageIcon, FlagIcon, TrashIcon } from '@/compo
import { Bot } from 'lucide-react';
import { Post } from '@/lib/types';
import { useAuth } from '@/lib/contexts/AuthContext';
import { useToast } from '@/lib/contexts/ToastContext';
import { VideoEmbed } from '@/components/VideoEmbed';
import { formatFullHandle } from '@/lib/utils/handle';
@@ -37,6 +38,7 @@ interface PostCardProps {
export function PostCard({ post, onLike, onRepost, onComment, onDelete, isDetail }: PostCardProps) {
const { user: currentUser } = useAuth();
const { showToast } = useToast();
const [liked, setLiked] = useState(post.isLiked || false);
const [reposted, setReposted] = useState(post.isReposted || false);
const [reporting, setReporting] = useState(false);
@@ -112,15 +114,15 @@ export function PostCard({ post, onLike, onRepost, onComment, onDelete, isDetail
});
if (!res.ok) {
if (res.status === 401) {
alert('Please log in to report.');
showToast('Please log in to report.', 'error');
} else {
alert('Report failed. Please try again.');
showToast('Report failed. Please try again.', 'error');
}
} else {
alert('Report submitted. Thank you.');
showToast('Report submitted. Thank you.', 'success');
}
} catch {
alert('Report failed. Please try again.');
showToast('Report failed. Please try again.', 'error');
} finally {
setReporting(false);
}
@@ -139,10 +141,10 @@ export function PostCard({ post, onLike, onRepost, onComment, onDelete, isDetail
onDelete?.(post.id);
} else {
const data = await res.json();
alert(data.error || 'Failed to delete post');
showToast(data.error || 'Failed to delete post', 'error');
}
} catch {
alert('Failed to delete post');
showToast('Failed to delete post', 'error');
} finally {
setDeleting(false);
}