ALwrity Chatbot, SEO, Social media, Settings, Dashboard UI styling changes

This commit is contained in:
ajaysi
2025-06-08 05:59:22 +05:30
parent fad9647b46
commit bbe56a364d
24 changed files with 7248 additions and 2222 deletions

View File

@@ -40,7 +40,17 @@ class Sidebar:
with st.sidebar:
# Logo and title
if self.logo:
st.image(self.logo, width=50)
try:
import os
if os.path.exists(self.logo):
st.image(self.logo, width=50)
else:
# Show a placeholder or just skip the logo
st.markdown("🐦", help="Twitter Tools Logo")
except Exception as e:
# If there's any error loading the image, show an emoji instead
st.markdown("🐦", help="Twitter Tools Logo")
st.markdown(f"""
<h2 style="margin: {Theme.SPACING["sm"]} 0;">{self.title}</h2>
""", unsafe_allow_html=True)

View File

@@ -9,35 +9,43 @@ from .components.cards import FeatureCard, TweetCard
from .components.forms import TweetForm, SettingsForm
from .components.navigation import Sidebar, Header, Tabs, Breadcrumbs
from .styles.theme import Theme
import os
class TwitterDashboard:
"""Main dashboard class for Twitter UI."""
def __init__(self):
self.setup_page()
"""Initialize the Twitter dashboard."""
self.setup_theme()
self.setup_navigation()
self.setup_state()
def setup_page(self) -> None:
"""Configure the Streamlit page settings."""
st.set_page_config(
page_title="Twitter Tools",
page_icon="🐦",
layout="wide",
initial_sidebar_state="expanded"
)
def get_logo_path(self) -> str:
"""Get the best available logo path with fallbacks."""
# List of potential logo paths in order of preference
logo_paths = [
"lib/workspace/alwrity_logo.png",
"lib/workspace/AskAlwrity-min.ico",
"lib/workspace/alwrity_ai_writer.png"
]
for path in logo_paths:
if os.path.exists(path):
return path
# If no logo files are found, return None
return None
def setup_theme(self) -> None:
"""Apply the theme to the dashboard."""
Theme().apply()
"""Setup theme and styling."""
Theme.apply()
def setup_navigation(self) -> None:
"""Setup navigation components."""
# Sidebar
self.sidebar = Sidebar(
title="Twitter Tools",
logo="assets/logo.png"
logo=self.get_logo_path()
)
# Add menu items
@@ -92,7 +100,7 @@ class TwitterDashboard:
def refresh_dashboard(self) -> None:
"""Refresh dashboard data."""
st.experimental_rerun()
st.rerun()
def render_overview(self) -> None:
"""Render the overview tab content."""