Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

notes added

tilakpatel2221f1d1a8bf98
diff --git a/fincept-terminal-desktop/src/App.tsx b/fincept-terminal-desktop/src/App.tsx
index b7090c449..e104c5e91 100644
--- a/fincept-terminal-desktop/src/App.tsx
+++ b/fincept-terminal-desktop/src/App.tsx
@@ -28,6 +28,7 @@ import Header from './components/common/Header';
import Footer from './components/common/Footer';
import PaymentOverlay from './components/payment/PaymentOverlay';
import SetupScreen from './components/setup/SetupScreen';
+import { Toaster } from 'sonner';
export type Screen =
| 'login'
@@ -264,6 +265,8 @@ const App: React.FC = () => {
</ProviderProvider>
{/* In-App Payment Window Overlay */}
<PaymentOverlay paymentWindow={paymentWindow} />
+ {/* Toast Notifications */}
+ <Toaster position="top-right" richColors closeButton />
</>
);
}
diff --git a/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx b/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx
index fe766a4fc..49165e928 100644
--- a/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx
+++ b/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx
@@ -1,6 +1,7 @@
import React, { useState, useRef, useEffect } from 'react';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Maximize, Minimize, Download, Settings, RefreshCw, User, Database, Eye, HelpCircle, LogOut, CheckCircle2, XCircle, MessageSquare, Terminal, Bot } from 'lucide-react';
+import { tabConfigService } from '@/services/tabConfigService';
import { useAuth } from '@/contexts/AuthContext';
import { useNavigation } from '@/contexts/NavigationContext';
import { InterfaceModeProvider, useInterfaceMode } from '@/contexts/InterfaceModeContext';
@@ -19,6 +20,7 @@ import NewsTab from '@/components/tabs/NewsTab';
import WatchlistTab from '@/components/tabs/WatchlistTab';
import GeopoliticsTab from '@/components/tabs/GeopoliticsTab';
import ChatTab from '@/components/tabs/ChatTab';
+import { NotesTab } from '@/components/tabs/NotesTab';
import ProfileTab from '@/components/tabs/ProfileTab';
import MarketplaceTab from '@/components/tabs/MarketplaceTab';
import PortfolioTab from '@/components/tabs/portfolio-tab/PortfolioTab';
@@ -161,6 +163,17 @@ function FinxeptTerminalContent() {
const [statusMessage, setStatusMessage] = useState("");
const { updateAvailable, updateInfo, isInstalling, installProgress, error, installUpdate, dismissUpdate } = useAutoUpdater();
+ // Dynamic tab configuration
+ const [tabConfig, setTabConfig] = useState(() => tabConfigService.getConfiguration());
+
+ // Subscribe to tab configuration changes
+ React.useEffect(() => {
+ const unsubscribe = tabConfigService.subscribe((newConfig) => {
+ setTabConfig(newConfig);
+ });
+ return unsubscribe;
+ }, []);
+
React.useEffect(() => {
document.body.style.margin = '0';
document.body.style.padding = '0';
@@ -784,98 +797,22 @@ function FinxeptTerminalContent() {
width: 'max-content',
minWidth: '100%'
}}>
- {/* PRIMARY TABS - F1 to F12 */}
- <TabsTrigger
- value="dashboard"
- style={activeTab === 'dashboard' ? tabStyles.active : tabStyles.default}
- title="Dashboard (F1)"
- >
- Dashboard
- </TabsTrigger>
- <TabsTrigger
- value="markets"
- style={activeTab === 'markets' ? tabStyles.active : tabStyles.default}
- title="Markets (F2)"
- >
- Markets
- </TabsTrigger>
- <TabsTrigger
- value="news"
- style={activeTab === 'news' ? tabStyles.active : tabStyles.default}
- title="News (F3)"
- >
- News
- </TabsTrigger>
- <TabsTrigger
- value="portfolio"
- style={activeTab === 'portfolio' ? tabStyles.active : tabStyles.default}
- title="Portfolio (F4)"
- >
- Portfolio
- </TabsTrigger>
- <TabsTrigger
- value="backtesting"
- style={activeTab === 'backtesting' ? tabStyles.active : tabStyles.default}
- title="Backtesting (F5)"
- >
- Backtesting
- </TabsTrigger>
- <TabsTrigger
- value="watchlist"
- style={activeTab === 'watchlist' ? tabStyles.active : tabStyles.default}
- title="Watchlist (F6)"
- >
- Watchlist
- </TabsTrigger>
- <TabsTrigger
- value="research"
- style={activeTab === 'research' ? tabStyles.active : tabStyles.default}
- title="Equity Research (F7)"
- >
- Research
- </TabsTrigger>
- <TabsTrigger
- value="screener"
- style={activeTab === 'screener' ? tabStyles.active : tabStyles.default}
- title="Screener (F8)"
- >
- Screener
- </TabsTrigger>
- <TabsTrigger
- value="trading"
- style={activeTab === 'trading' ? tabStyles.active : tabStyles.default}
- title="Trading (F9)"
- >
- Trading
- </TabsTrigger>
- <TabsTrigger
- value="chat"
- style={activeTab === 'chat' ? tabStyles.active : tabStyles.default}
- title="AI Chat (F10)"
- >
- AI Chat
- </TabsTrigger>
- <TabsTrigger
- value="agents"
- style={activeTab === 'agents' ? tabStyles.active : tabStyles.default}
- title="Agent Config"
- >
- Agents
- </TabsTrigger>
- <TabsTrigger
- value="settings"
- style={activeTab === 'settings' ? tabStyles.active : tabStyles.default}
- title="Settings"
- >
- Settings
- </TabsTrigger>
- <TabsTrigger
- value="profile"
- style={activeTab === 'profile' ? tabStyles.active : tabStyles.default}
- title="Profile (F12)"
- >
- Profile
- </TabsTrigger>
+ {/* DYNAMIC TABS - Rendered from tab configuration */}
+ {tabConfig.headerTabs.map((tabId) => {
+ const tabDef = tabConfigService.getTabById(tabId);
+ if (!tabDef) return null;
+
+ return (
+ <TabsTrigger
+ key={tabId}
+ value={tabDef.value}
+ style={activeTab === tabDef.value ? tabStyles.active : tabStyles.default}
+ title={tabDef.shortcut ? `${tabDef.label} (${tabDef.shortcut})` : tabDef.label}
+ >
+ {tabDef.label}
+ </TabsTrigger>
+ );
+ })}
</TabsList>
</Tabs>
</div>
@@ -970,6 +907,9 @@ function FinxeptTerminalContent() {
onNavigateToTab={(tabName) => setActiveTab(tabName)}
/>
</TabsContent>
+ <TabsContent value="notes" className="h-full m-0 p-0">
+ <NotesTab />
+ </TabsContent>
<TabsContent value="fyers" className="h-full m-0 p-0">
<FyersTab />
</TabsContent>
diff --git a/fincept-terminal-desktop/src/components/settings/TerminalConfigPanel.tsx b/fincept-terminal-desktop/src/components/settings/TerminalConfigPanel.tsx
index 2b4a857e2..5987153c3 100644
--- a/fincept-terminal-desktop/src/components/settings/TerminalConfigPanel.tsx
+++ b/fincept-terminal-desktop/src/components/settings/TerminalConfigPanel.tsx
@@ -5,25 +5,46 @@ import { CSS } from '@dnd-kit/utilities';
import { tabConfigService } from '@/services/tabConfigService';
import { TabConfiguration, MenuSection, DEFAULT_TABS } from '@/types/tabConfig';
import { GripVertical, Plus, Trash2, RotateCcw, ArrowRight, ArrowLeft } from 'lucide-react';
+import { useTerminalTheme } from '@/contexts/ThemeContext';
+import { useTranslation } from 'react-i18next';
-const SortableTab = ({ id, label }: { id: string; label: string }) => {
+const SortableTab = ({ id, label, colors }: { id: string; label: string; colors: any }) => {
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });
+ const [isHovered, setIsHovered] = useState(false);
const style = {
transform: CSS.Transform.toString(transform),
- transition
+ transition,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '8px',
+ background: isHovered ? '#1a1a1a' : colors.panel,
+ border: '1px solid #2a2a2a',
+ borderRadius: '3px',
+ padding: '10px 12px',
+ cursor: 'move',
+ fontSize: '11px',
+ fontWeight: 500
};
return (
- <div ref={setNodeRef} style={style} {...attributes} {...listeners}
- className="flex items-center gap-2 bg-zinc-800 border border-zinc-700 rounded px-3 py-2 cursor-move hover:bg-zinc-700">
- <GripVertical size={16} className="text-zinc-500" />
- <span className="text-sm text-white">{label}</span>
+ <div
+ ref={setNodeRef}
+ style={style}
+ {...attributes}
+ {...listeners}
+ onMouseEnter={() => setIsHovered(true)}
+ onMouseLeave={() => setIsHovered(false)}
+ >
+ <GripVertical size={14} color="#666" />
+ <span style={{ color: colors.text }}>{label}</span>
</div>
);
};
export const TerminalConfigPanel: React.FC = () => {
+ const { t } = useTranslation('settings');
+ const { colors } = useTerminalTheme();
const [config, setConfig] = useState<TabConfiguration>(tabConfigService.getConfiguration());
const [newSectionName, setNewSectionName] = useState('');
const [showNewSection, setShowNewSection] = useState(false);
@@ -143,28 +164,127 @@ export const TerminalConfigPanel: React.FC = () => {
};
return (
- <div className="p-6 space-y-6 max-w-6xl">
- <div className="flex items-center justify-between">
- <h2 className="text-xl font-bold text-white">Terminal Tab Configuration</h2>
+ <div style={{ padding: '24px', maxWidth: '1400px' }}>
+ {/* Header */}
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ marginBottom: '24px',
+ paddingBottom: '12px',
+ borderBottom: `2px solid ${colors.primary}`
+ }}>
+ <h2 style={{
+ color: colors.primary,
+ fontSize: '14px',
+ fontWeight: 'bold',
+ letterSpacing: '1px',
+ margin: 0
+ }}>
+ {t('terminalConfig.title')}
+ </h2>
<button
onClick={resetToDefault}
- className="flex items-center gap-2 px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded text-sm"
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ padding: '8px 16px',
+ background: '#3a0a0a',
+ border: '1px solid #ff4444',
+ color: '#ff4444',
+ borderRadius: '3px',
+ fontSize: '10px',
+ fontWeight: 'bold',
+ cursor: 'pointer',
+ letterSpacing: '0.5px'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.background = '#4a0a0a';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.background = '#3a0a0a';
+ }}
>
- <RotateCcw size={16} />
- Reset to Default
+ <RotateCcw size={14} />
+ {t('terminalConfig.resetToDefault')}
</button>
</div>
{/* Header Tabs */}
- <div className="bg-zinc-900 border border-zinc-800 rounded-lg p-4">
- <h3 className="text-lg font-semibold text-white mb-3">Header Tabs (Main Tab Bar)</h3>
- <p className="text-sm text-zinc-400 mb-4">Drag to reorder. These tabs appear in the main header.</p>
+ <div style={{
+ background: colors.panel,
+ border: '1px solid #1a1a1a',
+ borderLeft: `3px solid ${colors.primary}`,
+ borderRadius: '4px',
+ padding: '16px',
+ marginBottom: '20px'
+ }}>
+ <h3 style={{
+ color: colors.text,
+ fontSize: '12px',
+ fontWeight: 'bold',
+ marginBottom: '8px',
+ letterSpacing: '0.5px'
+ }}>
+ {t('terminalConfig.headerTabs')}
+ </h3>
+ <p style={{
+ color: colors.textMuted,
+ fontSize: '10px',
+ marginBottom: '16px'
+ }}>
+ {t('terminalConfig.headerTabsDesc')}
+ </p>
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleHeaderDragEnd}>
<SortableContext items={config.headerTabs} strategy={verticalListSortingStrategy}>
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2">
+ <div style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))',
+ gap: '8px'
+ }}>
{config.headerTabs.map((tabId) => (
- <SortableTab key={tabId} id={tabId} label={getTabLabel(tabId)} />
+ <div key={tabId} style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <div style={{ flex: 1 }}>
+ <SortableTab id={tabId} label={getTabLabel(tabId)} colors={colors} />
+ </div>
+ <div style={{ position: 'relative' }}>
+ <select
+ onChange={(e) => {
+ if (e.target.value) {
+ moveToMenu(tabId, e.target.value);
+ e.target.value = ''; // Reset selection
+ }
+ }}
+ style={{
+ padding: '8px',
+ background: '#2a2a2a',
+ border: '1px solid #3a3a3a',
+ color: colors.primary,
+ borderRadius: '3px',
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 'bold',
+ outline: 'none'
+ }}
+ title="Move to menu section"
+ onMouseEnter={(e) => {
+ e.currentTarget.style.background = '#3a3a3a';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.background = '#2a2a2a';
+ }}
+ >
+ <option value="">{t('terminalConfig.moveTo')}</option>
+ {config.menuSections.map((section) => (
+ <option key={section.id} value={section.id}>
+ {section.label}
+ </option>
+ ))}
+ </select>
+ </div>
+ </div>
))}
</div>
</SortableContext>
@@ -172,62 +292,191 @@ export const TerminalConfigPanel: React.FC = () => {
</div>
{/* Menu Sections */}
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <h3 className="text-lg font-semibold text-white">Toolbar Menu Sections</h3>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between'
+ }}>
+ <h3 style={{
+ color: colors.text,
+ fontSize: '12px',
+ fontWeight: 'bold',
+ letterSpacing: '0.5px'
+ }}>
+ {t('terminalConfig.toolbarSections')}
+ </h3>
<button
onClick={() => setShowNewSection(true)}
- className="flex items-center gap-2 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded text-sm"
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ padding: '6px 12px',
+ background: colors.primary,
+ border: 'none',
+ color: colors.background,
+ borderRadius: '3px',
+ fontSize: '10px',
+ fontWeight: 'bold',
+ cursor: 'pointer',
+ letterSpacing: '0.5px'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.opacity = '0.9';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.opacity = '1';
+ }}
>
- <Plus size={16} />
- New Section
+ <Plus size={14} />
+ {t('terminalConfig.newSection')}
</button>
</div>
{showNewSection && (
- <div className="bg-zinc-900 border border-zinc-700 rounded-lg p-4 flex gap-2">
+ <div style={{
+ background: colors.panel,
+ border: '1px solid #2a2a2a',
+ borderRadius: '4px',
+ padding: '16px',
+ display: 'flex',
+ gap: '8px',
+ alignItems: 'center'
+ }}>
<input
type="text"
value={newSectionName}
onChange={(e) => setNewSectionName(e.target.value)}
placeholder="Section name..."
- className="flex-1 bg-zinc-800 border border-zinc-700 rounded px-3 py-2 text-white text-sm"
+ style={{
+ flex: 1,
+ background: colors.background,
+ border: '1px solid #2a2a2a',
+ borderRadius: '3px',
+ padding: '8px 12px',
+ color: colors.text,
+ fontSize: '11px',
+ outline: 'none'
+ }}
onKeyPress={(e) => e.key === 'Enter' && addNewSection()}
/>
- <button onClick={addNewSection} className="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded text-sm">
- Add
+ <button
+ onClick={addNewSection}
+ style={{
+ padding: '8px 16px',
+ background: '#0a3a0a',
+ border: '1px solid #00ff00',
+ color: '#00ff00',
+ borderRadius: '3px',
+ fontSize: '10px',
+ fontWeight: 'bold',
+ cursor: 'pointer',
+ whiteSpace: 'nowrap'
+ }}
+ >
+ {t('buttons.add')}
</button>
- <button onClick={() => setShowNewSection(false)} className="px-4 py-2 bg-zinc-700 hover:bg-zinc-600 text-white rounded text-sm">
- Cancel
+ <button
+ onClick={() => setShowNewSection(false)}
+ style={{
+ padding: '8px 16px',
+ background: '#2a2a2a',
+ border: '1px solid #3a3a3a',
+ color: colors.text,
+ borderRadius: '3px',
+ fontSize: '10px',
+ fontWeight: 'bold',
+ cursor: 'pointer',
+ whiteSpace: 'nowrap'
+ }}
+ >
+ {t('buttons.cancel')}
</button>
</div>
)}
{config.menuSections.map((section) => (
- <div key={section.id} className="bg-zinc-900 border border-zinc-800 rounded-lg p-4">
- <div className="flex items-center justify-between mb-3">
- <h4 className="font-semibold text-white">{section.label}</h4>
+ <div key={section.id} style={{
+ background: colors.panel,
+ border: '1px solid #1a1a1a',
+ borderRadius: '4px',
+ padding: '16px'
+ }}>
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ marginBottom: '12px'
+ }}>
+ <h4 style={{
+ color: colors.text,
+ fontSize: '11px',
+ fontWeight: 'bold',
+ letterSpacing: '0.5px'
+ }}>
+ {section.label}
+ </h4>
<button
onClick={() => deleteSection(section.id)}
- className="flex items-center gap-1 px-2 py-1 text-red-400 hover:text-red-300 text-sm"
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ padding: '4px 8px',
+ background: 'transparent',
+ border: '1px solid #ff4444',
+ color: '#ff4444',
+ borderRadius: '3px',
+ fontSize: '9px',
+ fontWeight: 'bold',
+ cursor: 'pointer'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.background = '#3a0a0a';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.background = 'transparent';
+ }}
>
- <Trash2 size={14} />
- Delete
+ <Trash2 size={12} />
+ {t('terminalConfig.deleteSection')}
</button>
</div>
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleMenuDragEnd(section.id)}>
<SortableContext items={section.tabs} strategy={verticalListSortingStrategy}>
- <div className="grid grid-cols-1 md:grid-cols-2 gap-2">
+ <div style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))',
+ gap: '8px'
+ }}>
{section.tabs.map((tabId) => (
- <div key={tabId} className="flex items-center gap-2">
- <SortableTab id={tabId} label={getTabLabel(tabId)} />
+ <div key={tabId} style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <div style={{ flex: 1 }}>
+ <SortableTab id={tabId} label={getTabLabel(tabId)} colors={colors} />
+ </div>
<button
onClick={() => moveToHeader(tabId, section.id)}
- className="p-2 bg-zinc-700 hover:bg-zinc-600 rounded"
title="Move to header"
+ style={{
+ padding: '8px',
+ background: '#2a2a2a',
+ border: '1px solid #3a3a3a',
+ borderRadius: '3px',
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.background = '#3a3a3a';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.background = '#2a2a2a';
+ }}
>
- <ArrowRight size={16} className="text-white" />
+ <ArrowRight size={14} color={colors.primary} />
</button>
</div>
))}
@@ -236,15 +485,35 @@ export const TerminalConfigPanel: React.FC = () => {
</DndContext>
{section.tabs.length === 0 && (
- <p className="text-sm text-zinc-500 italic">No tabs in this section</p>
+ <p style={{
+ color: '#666',
+ fontSize: '10px',
+ fontStyle: 'italic',
+ margin: 0
+ }}>
+ {t('terminalConfig.noTabsInSection')}
+ </p>
)}
</div>
))}
</div>
- <div className="bg-blue-900/20 border border-blue-500/50 rounded-lg p-4">
- <p className="text-sm text-blue-300">
- <strong>Tip:</strong> Drag tabs to reorder them. Use arrow buttons to move tabs between header and menu sections. Changes are saved automatically.
+ {/* Info Box */}
+ <div style={{
+ marginTop: '20px',
+ background: '#0a1a2a',
+ border: '1px solid #1a4a6a',
+ borderLeft: `3px solid ${colors.primary}`,
+ borderRadius: '4px',
+ padding: '12px'
+ }}>
+ <p style={{
+ color: colors.primary,
+ fontSize: '10px',
+ margin: 0,
+ lineHeight: '1.5'
+ }}>
+ {t('terminalConfig.tip')}
</p>
</div>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/NotesTab.tsx b/fincept-terminal-desktop/src/components/tabs/NotesTab.tsx
new file mode 100644
index 000000000..4fa4fc379
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/NotesTab.tsx
@@ -0,0 +1,1573 @@
+// File: src/components/tabs/NotesTab.tsx
+// Professional Bloomberg Terminal-Grade Financial Note-Taking Interface
+
+import React, { useState, useEffect, useCallback } from 'react';
+import {
+ FileText, Plus, Search, Star, Archive, Tag, Calendar, TrendingUp,
+ TrendingDown, AlertCircle, Edit3, Trash2, Save, X, Clock, Filter,
+ BookOpen, Briefcase, PieChart, DollarSign, Globe, ChevronDown,
+ ChevronRight, Copy, Download, Upload, RefreshCw, Maximize2, Minimize2, Bell
+} from 'lucide-react';
+import { notesService, Note, NoteTemplate } from '../../services/notesService';
+import { noteReminderService } from '../../services/noteReminderService';
+import { toast } from 'sonner';
+
+// Bloomberg Professional Color Palette
+const BLOOMBERG = {
+ ORANGE: '#FF8800',
+ WHITE: '#FFFFFF',
+ RED: '#FF3B3B',
+ GREEN: '#00D66F',
+ GRAY: '#787878',
+ DARK_BG: '#000000',
+ PANEL_BG: '#0F0F0F',
+ HEADER_BG: '#1A1A1A',
+ CYAN: '#00E5FF',
+ YELLOW: '#FFD700',
+ BLUE: '#0088FF',
+ PURPLE: '#9D4EDD',
+ BORDER: '#2A2A2A',
+ HOVER: '#1F1F1F',
+ MUTED: '#4A4A4A'
+};
+
+const CATEGORIES = [
+ { id: 'ALL', label: 'ALL NOTES', icon: FileText },
+ { id: 'TRADE_IDEA', label: 'TRADE IDEAS', icon: TrendingUp },
+ { id: 'RESEARCH', label: 'RESEARCH', icon: BookOpen },
+ { id: 'MARKET_ANALYSIS', label: 'MARKET ANALYSIS', icon: PieChart },
+ { id: 'EARNINGS', label: 'EARNINGS', icon: DollarSign },
+ { id: 'ECONOMIC', label: 'ECONOMIC', icon: Globe },
+ { id: 'PORTFOLIO', label: 'PORTFOLIO', icon: Briefcase },
+ { id: 'GENERAL', label: 'GENERAL', icon: FileText }
+];
+
+const PRIORITIES = ['HIGH', 'MEDIUM', 'LOW'];
+const SENTIMENTS = ['BULLISH', 'BEARISH', 'NEUTRAL'];
+const COLOR_CODES = ['#FF8800', '#00D66F', '#FF3B3B', '#00E5FF', '#FFD700', '#9D4EDD', '#0088FF'];
+
+export function NotesTab() {
+ const [currentTime, setCurrentTime] = useState(new Date());
+ const [notes, setNotes] = useState<Note[]>([]);
+ const [filteredNotes, setFilteredNotes] = useState<Note[]>([]);
+ const [templates, setTemplates] = useState<NoteTemplate[]>([]);
+ const [selectedCategory, setSelectedCategory] = useState('ALL');
+ const [selectedNote, setSelectedNote] = useState<Note | null>(null);
+ const [isEditing, setIsEditing] = useState(false);
+ const [isCreating, setIsCreating] = useState(false);
+ const [searchQuery, setSearchQuery] = useState('');
+ const [showTemplates, setShowTemplates] = useState(false);
+ const [showFilters, setShowFilters] = useState(false);
+ const [statistics, setStatistics] = useState<any>(null);
+ const [upcomingReminders, setUpcomingReminders] = useState<Array<{ note: Note; hoursUntil: number }>>([]);
+ const [showReminders, setShowReminders] = useState(false);
+
+ // Editor state
+ const [editTitle, setEditTitle] = useState('');
+ const [editContent, setEditContent] = useState('');
+ const [editCategory, setEditCategory] = useState('GENERAL');
+ const [editPriority, setEditPriority] = useState('MEDIUM');
+ const [editSentiment, setEditSentiment] = useState('NEUTRAL');
+ const [editTags, setEditTags] = useState('');
+ const [editTickers, setEditTickers] = useState('');
+ const [editColorCode, setEditColorCode] = useState('#FF8800');
+ const [editReminderDate, setEditReminderDate] = useState('');
+
+ // Filters
+ const [filterPriority, setFilterPriority] = useState<string | null>(null);
+ const [filterSentiment, setFilterSentiment] = useState<string | null>(null);
+ const [showFavorites, setShowFavorites] = useState(false);
+ const [showArchived, setShowArchived] = useState(false);
+
+ // UI State
+ const [isRightPanelMinimized, setIsRightPanelMinimized] = useState(false);
+
+ // Update time
+ useEffect(() => {
+ const timer = setInterval(() => setCurrentTime(new Date()), 1000);
+ return () => clearInterval(timer);
+ }, []);
+
+ // Initialize reminder service
+ useEffect(() => {
+ noteReminderService.start();
+ loadUpcomingReminders();
+
+ // Listen for openNote events from reminder notifications
+ const handleOpenNote = async (event: CustomEvent) => {
+ const { noteId } = event.detail;
+ const note = await notesService.getNoteById(noteId);
+ if (note) {
+ setSelectedNote(note);
+ setIsEditing(false);
+ setIsCreating(false);
+ toast.success('Note opened from reminder');
+ }
+ };
+
+ window.addEventListener('openNote', handleOpenNote as EventListener);
+
+ return () => {
+ window.removeEventListener('openNote', handleOpenNote as EventListener);
+ };
+ }, []);
+
+ // Load upcoming reminders
+ const loadUpcomingReminders = useCallback(async () => {
+ try {
+ const upcoming = await noteReminderService.getUpcomingReminders();
+ setUpcomingReminders(upcoming);
+ } catch (error) {
+ console.error('[NotesTab] Failed to load upcoming reminders:', error);
+ }
+ }, []);
+
+ // Load notes
+ const loadNotes = useCallback(async () => {
+ try {
+ let loadedNotes: Note[];
+ if (showFavorites) {
+ loadedNotes = await notesService.getFavoriteNotes();
+ } else if (selectedCategory === 'ALL') {
+ loadedNotes = await notesService.getAllNotes(showArchived);
+ } else {
+ loadedNotes = await notesService.getNotesByCategory(selectedCategory, showArchived);
+ }
+ setNotes(loadedNotes);
+ applyFilters(loadedNotes);
+ } catch (error) {
+ console.error('[NotesTab] Failed to load notes:', error);
+ }
+ }, [selectedCategory, showFavorites, showArchived]);
+
+ // Load templates
+ const loadTemplates = useCallback(async () => {
+ try {
+ const loadedTemplates = await notesService.getTemplates();
+ setTemplates(loadedTemplates);
+ } catch (error) {
+ console.error('[NotesTab] Failed to load templates:', error);
+ }
+ }, []);
+
+ // Load statistics
+ const loadStatistics = useCallback(async () => {
+ try {
+ const stats = await notesService.getStatistics();
+ setStatistics(stats);
+ } catch (error) {
+ console.error('[NotesTab] Failed to load statistics:', error);
+ }
+ }, []);
+
+ // Apply filters
+ const applyFilters = useCallback((notesToFilter: Note[]) => {
+ let filtered = [...notesToFilter];
+
+ if (searchQuery) {
+ filtered = filtered.filter(note =>
+ note.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ note.content.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ note.tags?.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ note.tickers?.toLowerCase().includes(searchQuery.toLowerCase())
+ );
+ }
+
+ if (filterPriority) {
+ filtered = filtered.filter(note => note.priority === filterPriority);
+ }
+
+ if (filterSentiment) {
+ filtered = filtered.filter(note => note.sentiment === filterSentiment);
+ }
+
+ setFilteredNotes(filtered);
+ }, [searchQuery, filterPriority, filterSentiment]);
+
+ useEffect(() => {
+ loadNotes();
+ loadTemplates();
+ loadStatistics();
+ }, [loadNotes, loadTemplates, loadStatistics]);
+
+ useEffect(() => {
+ applyFilters(notes);
+ }, [notes, applyFilters]);
+
+ // Create new note
+ const handleCreateNote = async () => {
+ if (!editTitle.trim()) {
+ alert('Please enter a title');
+ return;
+ }
+
+ try {
+ const wordCount = editContent.trim().split(/\s+/).filter(w => w.length > 0).length;
+ const newNote: Omit<Note, 'id'> = {
+ title: editTitle,
+ content: editContent,
+ category: editCategory,
+ priority: editPriority,
+ tags: editTags,
+ tickers: editTickers,
+ sentiment: editSentiment,
+ is_favorite: 0,
+ is_archived: 0,
+ color_code: editColorCode,
+ attachments: '[]',
+ created_at: new Date().toISOString(),
+ updated_at: new Date().toISOString(),
+ reminder_date: editReminderDate || null,
+ word_count: wordCount
+ };
+
+ await notesService.createNote(newNote);
+ await loadNotes();
+ await loadStatistics();
+ await loadUpcomingReminders();
+ if (editReminderDate) {
+ toast.success(`Note created with reminder set for ${new Date(editReminderDate).toLocaleString()}`);
+ }
+ resetEditor();
+ setIsCreating(false);
+ } catch (error) {
+ console.error('[NotesTab] Failed to create note:', error);
+ alert('Failed to create note');
+ }
+ };
+
+ // Update note
+ const handleUpdateNote = async () => {
+ if (!selectedNote) return;
+
+ try {
+ const wordCount = editContent.trim().split(/\s+/).filter(w => w.length > 0).length;
+ await notesService.updateNote(selectedNote.id!, {
+ title: editTitle,
+ content: editContent,
+ category: editCategory,
+ priority: editPriority,
+ tags: editTags,
+ tickers: editTickers,
+ sentiment: editSentiment,
+ color_code: editColorCode,
+ reminder_date: editReminderDate || null,
+ word_count: wordCount
+ });
+
+ await loadNotes();
+ await loadStatistics();
+ await loadUpcomingReminders();
+ if (editReminderDate) {
+ toast.success(`Reminder updated for ${new Date(editReminderDate).toLocaleString()}`);
+ }
+ setIsEditing(false);
+
+ // Update selectedNote to reflect changes
+ const updatedNote = await notesService.getNoteById(selectedNote.id!);
+ setSelectedNote(updatedNote);
+ } catch (error) {
+ console.error('[NotesTab] Failed to update note:', error);
+ alert('Failed to update note');
+ }
+ };
+
+ // Delete note
+ const handleDeleteNote = async (id: number) => {
+ if (!confirm('Are you sure you want to delete this note?')) return;
+
+ try {
+ await notesService.deleteNote(id);
+ await loadNotes();
+ await loadStatistics();
+ if (selectedNote?.id === id) {
+ setSelectedNote(null);
+ }
+ } catch (error) {
+ console.error('[NotesTab] Failed to delete note:', error);
+ alert('Failed to delete note');
+ }
+ };
+
+ // Toggle favorite
+ const handleToggleFavorite = async (note: Note) => {
+ try {
+ await notesService.updateNote(note.id!, {
+ is_favorite: note.is_favorite === 1 ? 0 : 1
+ });
+ await loadNotes();
+ } catch (error) {
+ console.error('[NotesTab] Failed to toggle favorite:', error);
+ }
+ };
+
+ // Toggle archive
+ const handleToggleArchive = async (note: Note) => {
+ try {
+ await notesService.updateNote(note.id!, {
+ is_archived: note.is_archived === 1 ? 0 : 1
+ });
+ await loadNotes();
+ await loadStatistics();
+ if (selectedNote?.id === note.id) {
+ setSelectedNote(null);
+ }
+ } catch (error) {
+ console.error('[NotesTab] Failed to toggle archive:', error);
+ }
+ };
+
+ // Start editing
+ const startEditing = (note: Note) => {
+ setSelectedNote(note);
+ setEditTitle(note.title);
+ setEditContent(note.content);
+ setEditCategory(note.category);
+ setEditPriority(note.priority);
+ setEditSentiment(note.sentiment);
+ setEditTags(note.tags || '');
+ setEditTickers(note.tickers || '');
+ setEditColorCode(note.color_code);
+ setEditReminderDate(note.reminder_date || '');
+ setIsEditing(true);
+ };
+
+ // Start creating from template
+ const createFromTemplate = (template: NoteTemplate) => {
+ setEditTitle(`New ${template.name}`);
+ setEditContent(template.content);
+ setEditCategory(template.category);
+ setEditPriority('MEDIUM');
+ setEditSentiment('NEUTRAL');
+ setEditTags('');
+ setEditTickers('');
+ setEditColorCode('#FF8800');
+ setEditReminderDate('');
+ setIsCreating(true);
+ setShowTemplates(false);
+ };
+
+ // Reset editor
+ const resetEditor = () => {
+ setEditTitle('');
+ setEditContent('');
+ setEditCategory('GENERAL');
+ setEditPriority('MEDIUM');
+ setEditSentiment('NEUTRAL');
+ setEditTags('');
+ setEditTickers('');
+ setEditColorCode('#FF8800');
+ setEditReminderDate('');
+ };
+
+ const getPriorityColor = (priority: string) => {
+ switch (priority) {
+ case 'HIGH': return BLOOMBERG.RED;
+ case 'MEDIUM': return BLOOMBERG.YELLOW;
+ case 'LOW': return BLOOMBERG.GREEN;
+ default: return BLOOMBERG.GRAY;
+ }
+ };
+
+ const getSentimentColor = (sentiment: string) => {
+ switch (sentiment) {
+ case 'BULLISH': return BLOOMBERG.GREEN;
+ case 'BEARISH': return BLOOMBERG.RED;
+ case 'NEUTRAL': return BLOOMBERG.YELLOW;
+ default: return BLOOMBERG.GRAY;
+ }
+ };
+
+ return (
+ <div style={{
+ height: '100%',
+ backgroundColor: BLOOMBERG.DARK_BG,
+ color: BLOOMBERG.WHITE,
+ fontFamily: '"IBM Plex Mono", "Consolas", monospace',
+ overflow: 'hidden',
+ display: 'flex',
+ flexDirection: 'column'
+ }}>
+ <style>{`
+ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');
+
+ *::-webkit-scrollbar { width: 6px; height: 6px; }
+ *::-webkit-scrollbar-track { background: ${BLOOMBERG.DARK_BG}; }
+ *::-webkit-scrollbar-thumb { background: ${BLOOMBERG.BORDER}; border-radius: 3px; }
+ *::-webkit-scrollbar-thumb:hover { background: ${BLOOMBERG.MUTED}; }
+
+ .terminal-glow {
+ text-shadow: 0 0 10px ${BLOOMBERG.ORANGE}40;
+ }
+ `}</style>
+
+ {/* ========== TOP NAVIGATION BAR ========== */}
+ <div style={{
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ borderBottom: `2px solid ${BLOOMBERG.ORANGE}`,
+ padding: '6px 12px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ flexShrink: 0,
+ boxShadow: `0 2px 8px ${BLOOMBERG.ORANGE}20`
+ }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <FileText size={18} color={BLOOMBERG.ORANGE} style={{ filter: 'drop-shadow(0 0 4px ' + BLOOMBERG.ORANGE + ')' }} />
+ <span style={{
+ color: BLOOMBERG.ORANGE,
+ fontWeight: 700,
+ fontSize: '14px',
+ letterSpacing: '0.5px',
+ textShadow: `0 0 10px ${BLOOMBERG.ORANGE}40`
+ }}>
+ FINANCIAL NOTES
+ </span>
+ </div>
+
+ <div style={{ height: '16px', width: '1px', backgroundColor: BLOOMBERG.BORDER }} />
+
+ {statistics && (
+ <>
+ <div style={{ fontSize: '10px', color: BLOOMBERG.CYAN }}>
+ TOTAL: <span style={{ fontWeight: 700 }}>{statistics.total}</span>
+ </div>
+ <div style={{ fontSize: '10px', color: BLOOMBERG.YELLOW }}>
+ FAVORITES: <span style={{ fontWeight: 700 }}>{statistics.favorites}</span>
+ </div>
+ <div style={{ fontSize: '10px', color: BLOOMBERG.PURPLE }}>
+ WORDS: <span style={{ fontWeight: 700 }}>{statistics.totalWords.toLocaleString()}</span>
+ </div>
+ </>
+ )}
+ </div>
+
+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '4px', fontSize: '10px', color: BLOOMBERG.CYAN }}>
+ <Clock size={12} />
+ {currentTime.toLocaleTimeString('en-US', { hour12: false })}
+ </div>
+
+ <button
+ onClick={() => {
+ loadNotes();
+ loadUpcomingReminders();
+ }}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: 'transparent',
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ fontSize: '10px',
+ transition: 'all 0.2s'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.borderColor = BLOOMBERG.ORANGE;
+ e.currentTarget.style.color = BLOOMBERG.ORANGE;
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.borderColor = BLOOMBERG.BORDER;
+ e.currentTarget.style.color = BLOOMBERG.GRAY;
+ }}
+ >
+ <RefreshCw size={12} />
+ REFRESH
+ </button>
+
+ <button
+ onClick={() => setShowReminders(!showReminders)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: showReminders ? BLOOMBERG.YELLOW : 'transparent',
+ border: `1px solid ${upcomingReminders.length > 0 ? BLOOMBERG.YELLOW : BLOOMBERG.BORDER}`,
+ color: showReminders ? BLOOMBERG.DARK_BG : upcomingReminders.length > 0 ? BLOOMBERG.YELLOW : BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ fontSize: '10px',
+ fontWeight: 700,
+ transition: 'all 0.2s'
+ }}
+ title="View upcoming reminders"
+ >
+ <Bell size={12} />
+ {upcomingReminders.length > 0 && `(${upcomingReminders.length})`}
+ </button>
+ </div>
+ </div>
+
+ {/* ========== TOOLBAR ========== */}
+ <div style={{
+ backgroundColor: BLOOMBERG.PANEL_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ padding: '8px 12px',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '12px',
+ flexShrink: 0
+ }}>
+ {/* Search */}
+ <div style={{ position: 'relative', flex: 1, maxWidth: '400px' }}>
+ <Search size={14} style={{ position: 'absolute', left: '8px', top: '50%', transform: 'translateY(-50%)', color: BLOOMBERG.GRAY }} />
+ <input
+ type="text"
+ placeholder="Search notes, tags, tickers..."
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px 8px 6px 32px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '11px',
+ outline: 'none'
+ }}
+ />
+ </div>
+
+ {/* Action Buttons */}
+ <button
+ onClick={() => {
+ resetEditor();
+ setIsCreating(true);
+ }}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: BLOOMBERG.GREEN,
+ border: 'none',
+ color: BLOOMBERG.DARK_BG,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Plus size={14} />
+ NEW NOTE
+ </button>
+
+ <button
+ onClick={() => setShowTemplates(!showTemplates)}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: showTemplates ? BLOOMBERG.ORANGE : BLOOMBERG.PANEL_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: showTemplates ? BLOOMBERG.DARK_BG : BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <BookOpen size={14} />
+ TEMPLATES
+ </button>
+
+ <button
+ onClick={() => setShowFavorites(!showFavorites)}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: showFavorites ? BLOOMBERG.YELLOW : BLOOMBERG.PANEL_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: showFavorites ? BLOOMBERG.DARK_BG : BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Star size={14} fill={showFavorites ? BLOOMBERG.DARK_BG : 'none'} />
+ FAVORITES
+ </button>
+
+ <button
+ onClick={() => setShowFilters(!showFilters)}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: showFilters ? BLOOMBERG.CYAN : BLOOMBERG.PANEL_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: showFilters ? BLOOMBERG.DARK_BG : BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Filter size={14} />
+ FILTERS
+ </button>
+
+ <button
+ onClick={() => setShowArchived(!showArchived)}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: showArchived ? BLOOMBERG.PURPLE : BLOOMBERG.PANEL_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: showArchived ? BLOOMBERG.WHITE : BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Archive size={14} />
+ ARCHIVED
+ </button>
+ </div>
+
+ {/* ========== FILTERS PANEL ========== */}
+ {showFilters && (
+ <div style={{
+ backgroundColor: BLOOMBERG.PANEL_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ padding: '8px 12px',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '16px',
+ flexShrink: 0,
+ fontSize: '10px'
+ }}>
+ <span style={{ color: BLOOMBERG.ORANGE, fontWeight: 700 }}>FILTERS:</span>
+
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <span style={{ color: BLOOMBERG.GRAY }}>Priority:</span>
+ {PRIORITIES.map(priority => (
+ <button
+ key={priority}
+ onClick={() => setFilterPriority(filterPriority === priority ? null : priority)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: filterPriority === priority ? getPriorityColor(priority) : BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: filterPriority === priority ? BLOOMBERG.DARK_BG : getPriorityColor(priority),
+ cursor: 'pointer',
+ fontSize: '9px',
+ fontWeight: 700
+ }}
+ >
+ {priority}
+ </button>
+ ))}
+ </div>
+
+ <div style={{ height: '16px', width: '1px', backgroundColor: BLOOMBERG.BORDER }} />
+
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <span style={{ color: BLOOMBERG.GRAY }}>Sentiment:</span>
+ {SENTIMENTS.map(sentiment => (
+ <button
+ key={sentiment}
+ onClick={() => setFilterSentiment(filterSentiment === sentiment ? null : sentiment)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: filterSentiment === sentiment ? getSentimentColor(sentiment) : BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: filterSentiment === sentiment ? BLOOMBERG.DARK_BG : getSentimentColor(sentiment),
+ cursor: 'pointer',
+ fontSize: '9px',
+ fontWeight: 700
+ }}
+ >
+ {sentiment}
+ </button>
+ ))}
+ </div>
+
+ <button
+ onClick={() => {
+ setFilterPriority(null);
+ setFilterSentiment(null);
+ }}
+ style={{
+ marginLeft: 'auto',
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.RED,
+ border: 'none',
+ color: BLOOMBERG.WHITE,
+ cursor: 'pointer',
+ fontSize: '9px',
+ fontWeight: 700
+ }}
+ >
+ CLEAR FILTERS
+ </button>
+ </div>
+ )}
+
+ {/* ========== TEMPLATES PANEL ========== */}
+ {showTemplates && (
+ <div style={{
+ backgroundColor: BLOOMBERG.PANEL_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ padding: '12px',
+ flexShrink: 0
+ }}>
+ <div style={{ color: BLOOMBERG.ORANGE, fontSize: '11px', fontWeight: 700, marginBottom: '8px' }}>
+ SELECT TEMPLATE
+ </div>
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: '8px' }}>
+ {templates.map(template => (
+ <div
+ key={template.id}
+ onClick={() => createFromTemplate(template)}
+ style={{
+ padding: '12px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ cursor: 'pointer',
+ transition: 'all 0.2s'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.borderColor = BLOOMBERG.ORANGE;
+ e.currentTarget.style.backgroundColor = BLOOMBERG.HOVER;
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.borderColor = BLOOMBERG.BORDER;
+ e.currentTarget.style.backgroundColor = BLOOMBERG.HEADER_BG;
+ }}
+ >
+ <div style={{ color: BLOOMBERG.CYAN, fontSize: '11px', fontWeight: 700, marginBottom: '4px' }}>
+ {template.name}
+ </div>
+ <div style={{ color: BLOOMBERG.GRAY, fontSize: '9px', lineHeight: '1.4' }}>
+ {template.description}
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* ========== UPCOMING REMINDERS PANEL ========== */}
+ {showReminders && (
+ <div style={{
+ backgroundColor: BLOOMBERG.PANEL_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ padding: '12px',
+ flexShrink: 0
+ }}>
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '8px' }}>
+ <div style={{ color: BLOOMBERG.YELLOW, fontSize: '11px', fontWeight: 700, display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <Bell size={14} />
+ UPCOMING REMINDERS (24H)
+ </div>
+ <button
+ onClick={async () => {
+ await loadUpcomingReminders();
+ toast.success('Reminders refreshed');
+ }}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ fontSize: '9px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <RefreshCw size={10} />
+ REFRESH
+ </button>
+ </div>
+ {upcomingReminders.length === 0 ? (
+ <div style={{
+ padding: '20px',
+ textAlign: 'center',
+ color: BLOOMBERG.GRAY,
+ fontSize: '10px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`
+ }}>
+ No upcoming reminders in the next 24 hours
+ </div>
+ ) : (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>
+ {upcomingReminders.map(({ note, hoursUntil }) => {
+ const isUrgent = hoursUntil < 1;
+ const minutesUntil = Math.round(hoursUntil * 60);
+ const timeText = hoursUntil < 1
+ ? `${minutesUntil} minute${minutesUntil !== 1 ? 's' : ''}`
+ : `${Math.round(hoursUntil)} hour${Math.round(hoursUntil) !== 1 ? 's' : ''}`;
+
+ return (
+ <div
+ key={note.id}
+ onClick={() => {
+ setSelectedNote(note);
+ setIsEditing(false);
+ setIsCreating(false);
+ setShowReminders(false);
+ }}
+ style={{
+ padding: '10px',
+ backgroundColor: isUrgent ? `${BLOOMBERG.RED}10` : BLOOMBERG.HEADER_BG,
+ border: `1px solid ${isUrgent ? BLOOMBERG.RED : BLOOMBERG.BORDER}`,
+ borderLeft: `4px solid ${note.color_code}`,
+ cursor: 'pointer',
+ transition: 'all 0.2s'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.backgroundColor = BLOOMBERG.HOVER;
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.backgroundColor = isUrgent ? `${BLOOMBERG.RED}10` : BLOOMBERG.HEADER_BG;
+ }}
+ >
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '4px' }}>
+ <div style={{ color: BLOOMBERG.WHITE, fontSize: '11px', fontWeight: 700 }}>
+ {note.title}
+ </div>
+ <div style={{
+ padding: '2px 6px',
+ backgroundColor: isUrgent ? BLOOMBERG.RED : BLOOMBERG.YELLOW,
+ color: BLOOMBERG.DARK_BG,
+ fontSize: '8px',
+ fontWeight: 700
+ }}>
+ {isUrgent ? '🔴 URGENT' : `⏰ ${timeText.toUpperCase()}`}
+ </div>
+ </div>
+ <div style={{ display: 'flex', gap: '8px', fontSize: '9px', color: BLOOMBERG.GRAY }}>
+ <span style={{ color: getPriorityColor(note.priority) }}>{note.priority}</span>
+ <span>•</span>
+ <span style={{ color: getSentimentColor(note.sentiment) }}>{note.sentiment}</span>
+ <span>•</span>
+ <span>{note.category}</span>
+ {note.tickers && (
+ <>
+ <span>•</span>
+ <span style={{ color: BLOOMBERG.CYAN }}>{note.tickers}</span>
+ </>
+ )}
+ </div>
+ <div style={{ fontSize: '8px', color: BLOOMBERG.MUTED, marginTop: '4px' }}>
+ Due: {new Date(note.reminder_date!).toLocaleString()}
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ )}
+ </div>
+ )}
+
+ {/* ========== MAIN CONTENT ========== */}
+ <div style={{ flex: 1, display: 'flex', overflow: 'hidden' }}>
+ {/* LEFT SIDEBAR - Categories */}
+ <div style={{
+ width: '220px',
+ backgroundColor: BLOOMBERG.PANEL_BG,
+ borderRight: `1px solid ${BLOOMBERG.BORDER}`,
+ display: 'flex',
+ flexDirection: 'column',
+ overflow: 'hidden'
+ }}>
+ <div style={{
+ padding: '8px 12px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ fontSize: '10px',
+ fontWeight: 700,
+ color: BLOOMBERG.ORANGE,
+ letterSpacing: '0.5px'
+ }}>
+ CATEGORIES
+ </div>
+
+ <div style={{ flex: 1, overflow: 'auto' }}>
+ {CATEGORIES.map(category => {
+ const Icon = category.icon;
+ const count = statistics?.byCategory?.find((s: any) => s.category === category.id)?.count || 0;
+
+ return (
+ <div
+ key={category.id}
+ onClick={() => {
+ setSelectedCategory(category.id);
+ setShowFavorites(false);
+ }}
+ style={{
+ padding: '10px 12px',
+ cursor: 'pointer',
+ backgroundColor: selectedCategory === category.id ? `${BLOOMBERG.ORANGE}20` : 'transparent',
+ borderLeft: selectedCategory === category.id ? `3px solid ${BLOOMBERG.ORANGE}` : '3px solid transparent',
+ transition: 'all 0.2s',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between'
+ }}
+ onMouseEnter={(e) => {
+ if (selectedCategory !== category.id) {
+ e.currentTarget.style.backgroundColor = BLOOMBERG.HOVER;
+ }
+ }}
+ onMouseLeave={(e) => {
+ if (selectedCategory !== category.id) {
+ e.currentTarget.style.backgroundColor = 'transparent';
+ }
+ }}
+ >
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <Icon size={14} color={selectedCategory === category.id ? BLOOMBERG.ORANGE : BLOOMBERG.GRAY} />
+ <span style={{
+ fontSize: '10px',
+ fontWeight: 600,
+ color: selectedCategory === category.id ? BLOOMBERG.ORANGE : BLOOMBERG.WHITE
+ }}>
+ {category.label}
+ </span>
+ </div>
+ {category.id !== 'ALL' && (
+ <span style={{
+ fontSize: '9px',
+ color: BLOOMBERG.CYAN,
+ fontWeight: 700
+ }}>
+ {count}
+ </span>
+ )}
+ </div>
+ );
+ })}
+ </div>
+ </div>
+
+ {/* CENTER - Notes List */}
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
+ <div style={{
+ padding: '8px 12px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ fontSize: '10px',
+ fontWeight: 700,
+ color: BLOOMBERG.ORANGE,
+ letterSpacing: '0.5px',
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center'
+ }}>
+ <span>NOTES ({filteredNotes.length})</span>
+ <span style={{ fontSize: '9px', color: BLOOMBERG.GRAY }}>
+ SORTED BY: RECENTLY UPDATED
+ </span>
+ </div>
+
+ <div style={{ flex: 1, overflow: 'auto', padding: '8px' }}>
+ {filteredNotes.length === 0 ? (
+ <div style={{
+ padding: '40px',
+ textAlign: 'center',
+ color: BLOOMBERG.GRAY,
+ fontSize: '11px'
+ }}>
+ {searchQuery ? 'No notes found matching your search' : 'No notes yet. Create your first note!'}
+ </div>
+ ) : (
+ filteredNotes.map(note => (
+ <div
+ key={note.id}
+ onClick={() => {
+ setSelectedNote(note);
+ setIsEditing(false);
+ setIsCreating(false);
+ }}
+ style={{
+ marginBottom: '8px',
+ padding: '12px',
+ backgroundColor: selectedNote?.id === note.id ? `${BLOOMBERG.ORANGE}15` : BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ borderLeft: `4px solid ${note.color_code}`,
+ cursor: 'pointer',
+ transition: 'all 0.2s'
+ }}
+ onMouseEnter={(e) => {
+ if (selectedNote?.id !== note.id) {
+ e.currentTarget.style.backgroundColor = BLOOMBERG.HOVER;
+ }
+ }}
+ onMouseLeave={(e) => {
+ if (selectedNote?.id !== note.id) {
+ e.currentTarget.style.backgroundColor = BLOOMBERG.HEADER_BG;
+ }
+ }}
+ >
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '6px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px', flex: 1 }}>
+ <span style={{ color: BLOOMBERG.WHITE, fontSize: '11px', fontWeight: 700 }}>
+ {note.title}
+ </span>
+ {note.is_favorite === 1 && <Star size={12} fill={BLOOMBERG.YELLOW} color={BLOOMBERG.YELLOW} />}
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
+ <span style={{
+ padding: '2px 6px',
+ backgroundColor: getPriorityColor(note.priority),
+ color: BLOOMBERG.DARK_BG,
+ fontSize: '8px',
+ fontWeight: 700
+ }}>
+ {note.priority}
+ </span>
+ <span style={{
+ padding: '2px 6px',
+ backgroundColor: getSentimentColor(note.sentiment),
+ color: BLOOMBERG.DARK_BG,
+ fontSize: '8px',
+ fontWeight: 700
+ }}>
+ {note.sentiment}
+ </span>
+ </div>
+ </div>
+
+ <div style={{ color: BLOOMBERG.GRAY, fontSize: '9px', lineHeight: '1.4', marginBottom: '6px' }}>
+ {note.content.substring(0, 120)}{note.content.length > 120 ? '...' : ''}
+ </div>
+
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', fontSize: '8px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', color: BLOOMBERG.MUTED }}>
+ <span>{new Date(note.updated_at).toLocaleDateString()}</span>
+ {note.word_count > 0 && <span>{note.word_count} words</span>}
+ {note.tickers && <span style={{ color: BLOOMBERG.CYAN }}>{note.tickers}</span>}
+ </div>
+ {note.tags && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
+ <Tag size={10} color={BLOOMBERG.PURPLE} />
+ <span style={{ color: BLOOMBERG.PURPLE }}>{note.tags.split(',').slice(0, 2).join(', ')}</span>
+ </div>
+ )}
+ </div>
+ </div>
+ ))
+ )}
+ </div>
+ </div>
+
+ {/* RIGHT PANEL - Note Viewer/Editor */}
+ {!isRightPanelMinimized && (
+ <div style={{
+ width: '500px',
+ backgroundColor: BLOOMBERG.PANEL_BG,
+ borderLeft: `1px solid ${BLOOMBERG.BORDER}`,
+ display: 'flex',
+ flexDirection: 'column',
+ overflow: 'hidden'
+ }}>
+ {(isEditing || isCreating) ? (
+ // EDITOR MODE
+ <>
+ <div style={{
+ padding: '8px 12px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ fontSize: '10px',
+ fontWeight: 700,
+ color: BLOOMBERG.ORANGE,
+ letterSpacing: '0.5px',
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center'
+ }}>
+ <span>{isCreating ? 'CREATE NOTE' : 'EDIT NOTE'}</span>
+ <div style={{ display: 'flex', gap: '4px' }}>
+ <button
+ onClick={isCreating ? handleCreateNote : handleUpdateNote}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.GREEN,
+ border: 'none',
+ color: BLOOMBERG.DARK_BG,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Save size={12} />
+ SAVE
+ </button>
+ <button
+ onClick={() => {
+ setIsEditing(false);
+ setIsCreating(false);
+ resetEditor();
+ }}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.RED,
+ border: 'none',
+ color: BLOOMBERG.WHITE,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <X size={12} />
+ CANCEL
+ </button>
+ </div>
+ </div>
+
+ <div style={{ flex: 1, overflow: 'auto', padding: '12px' }}>
+ {/* Title */}
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ TITLE *
+ </label>
+ <input
+ type="text"
+ value={editTitle}
+ onChange={(e) => setEditTitle(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '8px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '12px',
+ fontWeight: 700,
+ outline: 'none'
+ }}
+ placeholder="Enter note title..."
+ />
+ </div>
+
+ {/* Metadata Row 1 */}
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '8px', marginBottom: '12px' }}>
+ <div>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ CATEGORY
+ </label>
+ <select
+ value={editCategory}
+ onChange={(e) => setEditCategory(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '10px',
+ outline: 'none'
+ }}
+ >
+ {CATEGORIES.filter(c => c.id !== 'ALL').map(cat => (
+ <option key={cat.id} value={cat.id}>{cat.label}</option>
+ ))}
+ </select>
+ </div>
+
+ <div>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ PRIORITY
+ </label>
+ <select
+ value={editPriority}
+ onChange={(e) => setEditPriority(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '10px',
+ outline: 'none'
+ }}
+ >
+ {PRIORITIES.map(p => (
+ <option key={p} value={p}>{p}</option>
+ ))}
+ </select>
+ </div>
+ </div>
+
+ {/* Metadata Row 2 */}
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '8px', marginBottom: '12px' }}>
+ <div>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ SENTIMENT
+ </label>
+ <select
+ value={editSentiment}
+ onChange={(e) => setEditSentiment(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '10px',
+ outline: 'none'
+ }}
+ >
+ {SENTIMENTS.map(s => (
+ <option key={s} value={s}>{s}</option>
+ ))}
+ </select>
+ </div>
+
+ <div>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ COLOR
+ </label>
+ <div style={{ display: 'flex', gap: '4px' }}>
+ {COLOR_CODES.map(color => (
+ <div
+ key={color}
+ onClick={() => setEditColorCode(color)}
+ style={{
+ width: '24px',
+ height: '24px',
+ backgroundColor: color,
+ border: editColorCode === color ? `2px solid ${BLOOMBERG.WHITE}` : `1px solid ${BLOOMBERG.BORDER}`,
+ cursor: 'pointer'
+ }}
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+
+ {/* Tags & Tickers */}
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ TAGS (comma-separated)
+ </label>
+ <input
+ type="text"
+ value={editTags}
+ onChange={(e) => setEditTags(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '10px',
+ outline: 'none'
+ }}
+ placeholder="growth, tech, semiconductor"
+ />
+ </div>
+
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ TICKERS (comma-separated)
+ </label>
+ <input
+ type="text"
+ value={editTickers}
+ onChange={(e) => setEditTickers(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '10px',
+ outline: 'none'
+ }}
+ placeholder="AAPL, MSFT, NVDA"
+ />
+ </div>
+
+ {/* Reminder Date */}
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ REMINDER DATE
+ </label>
+ <input
+ type="datetime-local"
+ value={editReminderDate}
+ onChange={(e) => setEditReminderDate(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '6px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '10px',
+ outline: 'none'
+ }}
+ />
+ </div>
+
+ {/* Content */}
+ <div>
+ <label style={{ color: BLOOMBERG.GRAY, fontSize: '9px', fontWeight: 700, marginBottom: '4px', display: 'block' }}>
+ CONTENT *
+ </label>
+ <textarea
+ value={editContent}
+ onChange={(e) => setEditContent(e.target.value)}
+ style={{
+ width: '100%',
+ height: '400px',
+ padding: '8px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: BLOOMBERG.WHITE,
+ fontSize: '11px',
+ lineHeight: '1.6',
+ outline: 'none',
+ resize: 'vertical',
+ fontFamily: '"IBM Plex Mono", monospace'
+ }}
+ placeholder="Write your note content here... Supports Markdown formatting."
+ />
+ </div>
+ </div>
+ </>
+ ) : selectedNote ? (
+ // VIEWER MODE
+ <>
+ <div style={{
+ padding: '8px 12px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ borderBottom: `1px solid ${BLOOMBERG.BORDER}`,
+ fontSize: '10px',
+ fontWeight: 700,
+ color: BLOOMBERG.ORANGE,
+ letterSpacing: '0.5px',
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center'
+ }}>
+ <span>NOTE DETAILS</span>
+ <div style={{ display: 'flex', gap: '4px' }}>
+ <button
+ onClick={() => handleToggleFavorite(selectedNote)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: 'transparent',
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ color: selectedNote.is_favorite === 1 ? BLOOMBERG.YELLOW : BLOOMBERG.GRAY,
+ cursor: 'pointer',
+ fontSize: '10px',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Star size={12} fill={selectedNote.is_favorite === 1 ? BLOOMBERG.YELLOW : 'none'} />
+ </button>
+ <button
+ onClick={() => startEditing(selectedNote)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.BLUE,
+ border: 'none',
+ color: BLOOMBERG.WHITE,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Edit3 size={12} />
+ EDIT
+ </button>
+ <button
+ onClick={() => handleToggleArchive(selectedNote)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.PURPLE,
+ border: 'none',
+ color: BLOOMBERG.WHITE,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Archive size={12} />
+ {selectedNote.is_archived === 1 ? 'UNARCHIVE' : 'ARCHIVE'}
+ </button>
+ <button
+ onClick={() => handleDeleteNote(selectedNote.id!)}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: BLOOMBERG.RED,
+ border: 'none',
+ color: BLOOMBERG.WHITE,
+ cursor: 'pointer',
+ fontSize: '10px',
+ fontWeight: 700,
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px'
+ }}
+ >
+ <Trash2 size={12} />
+ DELETE
+ </button>
+ </div>
+ </div>
+
+ <div style={{ flex: 1, overflow: 'auto', padding: '16px' }}>
+ {/* Title */}
+ <div style={{
+ color: BLOOMBERG.WHITE,
+ fontSize: '16px',
+ fontWeight: 700,
+ marginBottom: '12px',
+ paddingBottom: '12px',
+ borderBottom: `2px solid ${selectedNote.color_code}`
+ }}>
+ {selectedNote.title}
+ </div>
+
+ {/* Metadata */}
+ <div style={{
+ display: 'grid',
+ gridTemplateColumns: '1fr 1fr',
+ gap: '8px',
+ marginBottom: '16px',
+ padding: '12px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ border: `1px solid ${BLOOMBERG.BORDER}`,
+ fontSize: '9px'
+ }}>
+ <div>
+ <span style={{ color: BLOOMBERG.GRAY }}>CATEGORY: </span>
+ <span style={{ color: BLOOMBERG.CYAN, fontWeight: 700 }}>{selectedNote.category}</span>
+ </div>
+ <div>
+ <span style={{ color: BLOOMBERG.GRAY }}>PRIORITY: </span>
+ <span style={{ color: getPriorityColor(selectedNote.priority), fontWeight: 700 }}>{selectedNote.priority}</span>
+ </div>
+ <div>
+ <span style={{ color: BLOOMBERG.GRAY }}>SENTIMENT: </span>
+ <span style={{ color: getSentimentColor(selectedNote.sentiment), fontWeight: 700 }}>{selectedNote.sentiment}</span>
+ </div>
+ <div>
+ <span style={{ color: BLOOMBERG.GRAY }}>WORDS: </span>
+ <span style={{ color: BLOOMBERG.WHITE, fontWeight: 700 }}>{selectedNote.word_count}</span>
+ </div>
+ {selectedNote.tickers && (
+ <div style={{ gridColumn: '1 / -1' }}>
+ <span style={{ color: BLOOMBERG.GRAY }}>TICKERS: </span>
+ <span style={{ color: BLOOMBERG.CYAN, fontWeight: 700 }}>{selectedNote.tickers}</span>
+ </div>
+ )}
+ {selectedNote.tags && (
+ <div style={{ gridColumn: '1 / -1' }}>
+ <span style={{ color: BLOOMBERG.GRAY }}>TAGS: </span>
+ <span style={{ color: BLOOMBERG.PURPLE, fontWeight: 700 }}>{selectedNote.tags}</span>
+ </div>
+ )}
+ <div>
+ <span style={{ color: BLOOMBERG.GRAY }}>CREATED: </span>
+ <span style={{ color: BLOOMBERG.WHITE }}>{new Date(selectedNote.created_at).toLocaleString()}</span>
+ </div>
+ <div>
+ <span style={{ color: BLOOMBERG.GRAY }}>UPDATED: </span>
+ <span style={{ color: BLOOMBERG.WHITE }}>{new Date(selectedNote.updated_at).toLocaleString()}</span>
+ </div>
+ {selectedNote.reminder_date && (
+ <div style={{ gridColumn: '1 / -1' }}>
+ <span style={{ color: BLOOMBERG.GRAY }}>REMINDER: </span>
+ <span style={{ color: BLOOMBERG.YELLOW, fontWeight: 700 }}>{new Date(selectedNote.reminder_date).toLocaleString()}</span>
+ </div>
+ )}
+ </div>
+
+ {/* Content */}
+ <div style={{
+ color: BLOOMBERG.WHITE,
+ fontSize: '11px',
+ lineHeight: '1.8',
+ whiteSpace: 'pre-wrap',
+ fontFamily: '"IBM Plex Mono", monospace'
+ }}>
+ {selectedNote.content}
+ </div>
+ </div>
+ </>
+ ) : (
+ // NO SELECTION
+ <div style={{
+ flex: 1,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ color: BLOOMBERG.GRAY,
+ fontSize: '11px',
+ flexDirection: 'column',
+ gap: '12px'
+ }}>
+ <FileText size={48} color={BLOOMBERG.MUTED} />
+ <div>Select a note to view or create a new one</div>
+ </div>
+ )}
+ </div>
+ )}
+
+ {/* Minimize/Maximize Toggle for Right Panel */}
+ <div style={{
+ width: '20px',
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ borderLeft: `1px solid ${BLOOMBERG.BORDER}`,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ cursor: 'pointer'
+ }}
+ onClick={() => setIsRightPanelMinimized(!isRightPanelMinimized)}
+ >
+ {isRightPanelMinimized ? <ChevronRight size={14} color={BLOOMBERG.GRAY} /> : <ChevronDown size={14} color={BLOOMBERG.GRAY} />}
+ </div>
+ </div>
+
+ {/* ========== STATUS BAR ========== */}
+ <div style={{
+ borderTop: `1px solid ${BLOOMBERG.BORDER}`,
+ backgroundColor: BLOOMBERG.HEADER_BG,
+ padding: '4px 12px',
+ fontSize: '9px',
+ color: BLOOMBERG.GRAY,
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ flexShrink: 0
+ }}>
+ <span>Fincept Terminal v3.0.12 | Professional Financial Notes</span>
+ <span>
+ Notes: <span style={{ color: BLOOMBERG.ORANGE }}>{statistics?.total || 0}</span> |
+ Category: <span style={{ color: BLOOMBERG.CYAN }}>{selectedCategory}</span> |
+ Displayed: <span style={{ color: BLOOMBERG.YELLOW }}>{filteredNotes.length}</span>
+ </span>
+ </div>
+ </div>
+ );
+}
diff --git a/fincept-terminal-desktop/src/components/tabs/SettingsTab.tsx b/fincept-terminal-desktop/src/components/tabs/SettingsTab.tsx
index 013e87031..654190c0e 100644
--- a/fincept-terminal-desktop/src/components/tabs/SettingsTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/SettingsTab.tsx
@@ -12,8 +12,10 @@ import { LanguageSelector } from '@/components/settings/LanguageSelector';
import { TerminalConfigPanel } from '@/components/settings/TerminalConfigPanel';
import { useTimezone, TIMEZONE_OPTIONS } from '@/contexts/TimezoneContext';
import { Clock } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
export default function SettingsTab() {
+ const { t } = useTranslation('settings');
const { theme, updateTheme, resetTheme, colors, fontSize: themeFontSize, fontFamily: themeFontFamily, fontWeight: themeFontWeight, fontStyle } = useTerminalTheme();
const { defaultTimezone, setDefaultTimezone, options: timezoneOptions } = useTimezone();
const [activeSection, setActiveSection] = useState<'credentials' | 'terminal' | 'terminalConfig' | 'llm' | 'dataConnections' | 'backtesting' | 'language'>('credentials');
@@ -618,7 +620,7 @@ export default function SettingsTab() {
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<SettingsIcon size={20} color={colors.primary} />
<span style={{ color: colors.primary, fontSize: '16px', fontWeight: 'bold', letterSpacing: '1px' }}>
- TERMINAL SETTINGS
+ {t('title')}
</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
@@ -630,7 +632,7 @@ export default function SettingsTab() {
}}>
<span style={{ color: dbInitialized ? '#00ff00' : '#ff0000', fontSize: '9px', fontWeight: 'bold' }}>
<Database size={10} style={{ display: 'inline', marginRight: '4px' }} />
- SQLite: {dbInitialized ? 'CONNECTED' : 'DISCONNECTED'}
+ SQLite: {dbInitialized ? t('llm.connected') : t('llm.disconnected')}
</span>
</div>
</div>
@@ -657,13 +659,13 @@ export default function SettingsTab() {
<div style={{ width: '220px', borderRight: '1px solid #1a1a1a', background: colors.panel, flexShrink: 0 }}>
<div style={{ padding: '16px 0' }}>
{[
- { id: 'credentials', icon: Lock, label: 'Credentials' },
- { id: 'llm', icon: Bot, label: 'LLM Configuration' },
- { id: 'dataConnections', icon: Database, label: 'Data Sources' },
- { id: 'backtesting', icon: Activity, label: 'Backtesting Providers' },
- { id: 'terminalConfig', icon: SettingsIcon, label: 'Tab Layout' },
- { id: 'terminal', icon: Terminal, label: 'Appearance' },
- { id: 'language', icon: Globe, label: 'Language' }
+ { id: 'credentials', icon: Lock, label: t('sections.credentials') },
+ { id: 'llm', icon: Bot, label: t('sections.llm') },
+ { id: 'dataConnections', icon: Database, label: t('sections.dataConnections') },
+ { id: 'backtesting', icon: Activity, label: t('sections.backtesting') },
+ { id: 'terminalConfig', icon: SettingsIcon, label: t('sections.terminalConfig') },
+ { id: 'terminal', icon: Terminal, label: t('sections.terminal') },
+ { id: 'language', icon: Globe, label: t('sections.language') }
].map((item) => (
<div
key={item.id}
@@ -703,10 +705,10 @@ export default function SettingsTab() {
<div>
<div style={{ marginBottom: '24px' }}>
<h2 style={{ color: colors.primary, fontSize: '14px', fontWeight: 'bold', marginBottom: '8px' }}>
- API KEY MANAGEMENT
+ {t('credentials.title')}
</h2>
<p style={{ color: colors.text, fontSize: '10px' }}>
- Configure API keys for data providers. All keys are stored locally and encrypted.
+ {t('credentials.description')}
</p>
</div>
@@ -732,13 +734,13 @@ export default function SettingsTab() {
<div style={{ display: 'grid', gridTemplateColumns: '1fr auto', gap: '12px', alignItems: 'end' }}>
<div>
<label style={{ color: colors.text, fontSize: '9px', display: 'block', marginBottom: '4px' }}>
- API KEY
+ {t('credentials.apiKey')}
</label>
<input
type="password"
value={apiKeys[key] || ''}
onChange={(e) => setApiKeys({ ...apiKeys, [key]: e.target.value })}
- placeholder="Enter API key"
+ placeholder={t('credentials.enterValue')}
style={{
width: '100%',
background: colors.background,
@@ -771,7 +773,7 @@ export default function SettingsTab() {
}}
>
<Save size={14} />
- SAVE
+ {t('buttons.save')}
</button>
</div>
</div>
@@ -785,17 +787,17 @@ export default function SettingsTab() {
<div>
<div style={{ marginBottom: '24px' }}>
<h2 style={{ color: colors.primary, fontSize: '14px', fontWeight: 'bold', marginBottom: '8px' }}>
- LLM CONFIGURATION
+ {t('llm.title')}
</h2>
<p style={{ color: colors.text, fontSize: '10px' }}>
- Configure AI providers for the Chat tab. Changes here are reflected in both Chat and Settings screens.
+ {t('llm.description')}
</p>
</div>
{/* Provider Selection */}
<div style={{ marginBottom: '20px' }}>
<h3 style={{ color: colors.text, fontSize: '12px', fontWeight: 'bold', marginBottom: '8px' }}>
- Select Active Provider
+ {t('llm.provider')}
</h3>
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
{llmConfigs.map(config => (
@@ -1419,7 +1421,7 @@ export default function SettingsTab() {
margin: 0,
textShadow: `0 0 10px ${colors.primary}40`
}}>
- TERMINAL CONFIGURATION
+ {t('terminal.title')}
</h2>
</div>
@@ -1437,7 +1439,7 @@ export default function SettingsTab() {
margin: 0,
lineHeight: '1.6'
}}>
- Customize terminal appearance including fonts, colors, and themes. Changes apply across the entire application.
+ {t('terminal.description')}
</p>
</div>
@@ -1452,12 +1454,12 @@ export default function SettingsTab() {
}}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '16px' }}>
<Type size={18} color={colors.primary} style={{ filter: `drop-shadow(0 0 2px ${colors.primary})` }} />
- <span style={{ color: colors.primary, fontSize: '14px', fontWeight: 'bold', letterSpacing: '0.5px' }}>FONT SETTINGS</span>
+ <span style={{ color: colors.primary, fontSize: '14px', fontWeight: 'bold', letterSpacing: '0.5px' }}>{t('terminal.currentSettings')}</span>
</div>
{/* Font Family */}
<div style={{ marginBottom: '16px' }}>
- <label style={{ color: colors.text, fontSize: '10px', display: 'block', marginBottom: '6px', fontWeight: 600, letterSpacing: '0.5px' }}>FONT FAMILY</label>
+ <label style={{ color: colors.text, fontSize: '10px', display: 'block', marginBottom: '6px', fontWeight: 600, letterSpacing: '0.5px' }}>{t('terminal.fontFamily')}</label>
<select value={fontFamily} onChange={(e) => setFontFamily(e.target.value)} style={{
width: '100%',
padding: '10px',
diff --git a/fincept-terminal-desktop/src/services/noteReminderService.ts b/fincept-terminal-desktop/src/services/noteReminderService.ts
new file mode 100644
index 000000000..0aa660ebf
--- /dev/null
+++ b/fincept-terminal-desktop/src/services/noteReminderService.ts
@@ -0,0 +1,200 @@
+import { notesService, Note } from './notesService';
+import { toast } from 'sonner';
+
+class NoteReminderService {
+ private checkInterval: NodeJS.Timeout | null = null;
+ private notifiedReminders: Set<number> = new Set();
+ private readonly CHECK_INTERVAL_MS = 60000; // Check every minute
+
+ /**
+ * Start monitoring for note reminders
+ */
+ start() {
+ if (this.checkInterval) {
+ console.log('[NoteReminderService] Already running');
+ return;
+ }
+
+ console.log('[NoteReminderService] Starting reminder monitoring');
+ this.checkReminders(); // Check immediately
+ this.checkInterval = setInterval(() => this.checkReminders(), this.CHECK_INTERVAL_MS);
+ }
+
+ /**
+ * Stop monitoring for note reminders
+ */
+ stop() {
+ if (this.checkInterval) {
+ clearInterval(this.checkInterval);
+ this.checkInterval = null;
+ console.log('[NoteReminderService] Stopped reminder monitoring');
+ }
+ }
+
+ /**
+ * Check for due reminders and show notifications
+ */
+ private async checkReminders() {
+ try {
+ const notesWithReminders = await notesService.getNotesWithReminders();
+ const now = new Date();
+
+ for (const note of notesWithReminders) {
+ if (!note.reminder_date || !note.id) continue;
+
+ const reminderDate = new Date(note.reminder_date);
+ const timeDiff = reminderDate.getTime() - now.getTime();
+
+ // Show reminder if it's due (within the next minute or overdue)
+ if (timeDiff <= 60000 && timeDiff > -60000) {
+ if (!this.notifiedReminders.has(note.id)) {
+ this.showReminderNotification(note);
+ this.notifiedReminders.add(note.id);
+ }
+ }
+ // Clean up old notifications from the set
+ else if (timeDiff < -60000) {
+ this.notifiedReminders.delete(note.id);
+ }
+ }
+ } catch (error) {
+ console.error('[NoteReminderService] Failed to check reminders:', error);
+ }
+ }
+
+ /**
+ * Show a toast notification for a note reminder
+ */
+ private showReminderNotification(note: Note) {
+ const priorityEmoji = this.getPriorityEmoji(note.priority);
+ const sentimentEmoji = this.getSentimentEmoji(note.sentiment);
+
+ toast(
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
+ <div style={{ fontWeight: 700, fontSize: '13px', color: '#FF8800' }}>
+ {priorityEmoji} NOTE REMINDER
+ </div>
+ <div style={{ fontSize: '12px', fontWeight: 600 }}>
+ {note.title}
+ </div>
+ <div style={{ fontSize: '10px', color: '#999', display: 'flex', gap: '8px' }}>
+ <span>{sentimentEmoji} {note.sentiment}</span>
+ <span>•</span>
+ <span>{note.category}</span>
+ {note.tickers && (
+ <>
+ <span>•</span>
+ <span style={{ color: '#00E5FF' }}>{note.tickers}</span>
+ </>
+ )}
+ </div>
+ {note.content && (
+ <div style={{ fontSize: '11px', color: '#aaa', marginTop: '4px', lineHeight: '1.4' }}>
+ {note.content.substring(0, 100)}{note.content.length > 100 ? '...' : ''}
+ </div>
+ )}
+ </div>,
+ {
+ duration: 10000, // Show for 10 seconds
+ position: 'top-right',
+ className: 'note-reminder-toast',
+ style: {
+ backgroundColor: '#1A1A1A',
+ border: '2px solid #FF8800',
+ borderRadius: '4px',
+ padding: '12px',
+ boxShadow: '0 4px 16px rgba(255, 136, 0, 0.3)'
+ },
+ action: {
+ label: 'View',
+ onClick: () => {
+ // Emit custom event to open the note
+ window.dispatchEvent(new CustomEvent('openNote', { detail: { noteId: note.id } }));
+ }
+ }
+ }
+ );
+
+ console.log(`[NoteReminderService] Showed reminder for note: ${note.title}`);
+ }
+
+ /**
+ * Get emoji for priority level
+ */
+ private getPriorityEmoji(priority: string): string {
+ switch (priority) {
+ case 'HIGH':
+ return '🔴';
+ case 'MEDIUM':
+ return '🟡';
+ case 'LOW':
+ return '🟢';
+ default:
+ return '⚪';
+ }
+ }
+
+ /**
+ * Get emoji for sentiment
+ */
+ private getSentimentEmoji(sentiment: string): string {
+ switch (sentiment) {
+ case 'BULLISH':
+ return '📈';
+ case 'BEARISH':
+ return '📉';
+ case 'NEUTRAL':
+ return '➡️';
+ default:
+ return '📊';
+ }
+ }
+
+ /**
+ * Manually trigger a reminder check (useful for testing or immediate updates)
+ */
+ async triggerCheck() {
+ await this.checkReminders();
+ }
+
+ /**
+ * Clear the notification history for a specific note
+ */
+ clearNotificationHistory(noteId: number) {
+ this.notifiedReminders.delete(noteId);
+ }
+
+ /**
+ * Get upcoming reminders (within next 24 hours)
+ */
+ async getUpcomingReminders(): Promise<Array<{ note: Note; hoursUntil: number }>> {
+ try {
+ const notesWithReminders = await notesService.getNotesWithReminders();
+ const now = new Date();
+ const upcoming: Array<{ note: Note; hoursUntil: number }> = [];
+
+ for (const note of notesWithReminders) {
+ if (!note.reminder_date) continue;
+
+ const reminderDate = new Date(note.reminder_date);
+ const timeDiff = reminderDate.getTime() - now.getTime();
+ const hoursUntil = timeDiff / (1000 * 60 * 60);
+
+ if (hoursUntil >= 0 && hoursUntil <= 24) {
+ upcoming.push({ note, hoursUntil });
+ }
+ }
+
+ // Sort by closest first
+ upcoming.sort((a, b) => a.hoursUntil - b.hoursUntil);
+
+ return upcoming;
+ } catch (error) {
+ console.error('[NoteReminderService] Failed to get upcoming reminders:', error);
+ return [];
+ }
+ }
+}
+
+// Singleton instance
+export const noteReminderService = new NoteReminderService();
diff --git a/fincept-terminal-desktop/src/services/notesService.ts b/fincept-terminal-desktop/src/services/notesService.ts
new file mode 100644
index 000000000..b5b722372
--- /dev/null
+++ b/fincept-terminal-desktop/src/services/notesService.ts
@@ -0,0 +1,595 @@
+import Database from '@tauri-apps/plugin-sql';
+
+export interface Note {
+ id?: number;
+ title: string;
+ content: string;
+ category: string; // RESEARCH, TRADE_IDEA, MARKET_ANALYSIS, EARNINGS, ECONOMIC, PORTFOLIO, GENERAL
+ priority: string; // HIGH, MEDIUM, LOW
+ tags: string; // Comma-separated tags
+ tickers: string; // Comma-separated ticker symbols
+ sentiment: string; // BULLISH, BEARISH, NEUTRAL
+ is_favorite: number; // 0 or 1
+ is_archived: number; // 0 or 1
+ color_code: string; // Hex color for visual organization
+ attachments: string; // JSON array of attachment paths
+ created_at: string;
+ updated_at: string;
+ reminder_date: string | null; // ISO date string for reminders
+ word_count: number;
+}
+
+export interface NoteTemplate {
+ id?: number;
+ name: string;
+ description: string;
+ content: string;
+ category: string;
+ created_at: string;
+}
+
+class NotesService {
+ private db: Database | null = null;
+ private isInitialized = false;
+
+ async initialize() {
+ if (this.isInitialized) return;
+
+ try {
+ this.db = await Database.load('sqlite:financial_notes.db');
+
+ // Create notes table with financial-specific fields
+ await this.db.execute(`
+ CREATE TABLE IF NOT EXISTS financial_notes (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ title TEXT NOT NULL,
+ content TEXT NOT NULL,
+ category TEXT NOT NULL,
+ priority TEXT DEFAULT 'MEDIUM',
+ tags TEXT,
+ tickers TEXT,
+ sentiment TEXT DEFAULT 'NEUTRAL',
+ is_favorite INTEGER DEFAULT 0,
+ is_archived INTEGER DEFAULT 0,
+ color_code TEXT DEFAULT '#FF8800',
+ attachments TEXT,
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL,
+ reminder_date TEXT,
+ word_count INTEGER DEFAULT 0
+ )
+ `);
+
+ // Create note templates table
+ await this.db.execute(`
+ CREATE TABLE IF NOT EXISTS note_templates (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ name TEXT NOT NULL,
+ description TEXT,
+ content TEXT NOT NULL,
+ category TEXT NOT NULL,
+ created_at TEXT NOT NULL
+ )
+ `);
+
+ // Create indexes for performance
+ await this.db.execute(`
+ CREATE INDEX IF NOT EXISTS idx_notes_category ON financial_notes(category)
+ `);
+ await this.db.execute(`
+ CREATE INDEX IF NOT EXISTS idx_notes_updated ON financial_notes(updated_at DESC)
+ `);
+ await this.db.execute(`
+ CREATE INDEX IF NOT EXISTS idx_notes_favorite ON financial_notes(is_favorite)
+ `);
+ await this.db.execute(`
+ CREATE INDEX IF NOT EXISTS idx_notes_archived ON financial_notes(is_archived)
+ `);
+ await this.db.execute(`
+ CREATE INDEX IF NOT EXISTS idx_notes_priority ON financial_notes(priority)
+ `);
+
+ // Insert default templates if they don't exist
+ const existingTemplates = await this.db.select<NoteTemplate[]>(
+ 'SELECT COUNT(*) as count FROM note_templates'
+ );
+
+ if (!existingTemplates || (existingTemplates as any)[0]?.count === 0) {
+ await this.insertDefaultTemplates();
+ }
+
+ this.isInitialized = true;
+ console.log('[NotesService] Initialized successfully');
+ } catch (error) {
+ console.error('[NotesService] Failed to initialize:', error);
+ throw error;
+ }
+ }
+
+ private async insertDefaultTemplates() {
+ const templates: Omit<NoteTemplate, 'id'>[] = [
+ {
+ name: 'Trade Idea',
+ description: 'Document a new trading opportunity',
+ category: 'TRADE_IDEA',
+ content: `# Trade Idea
+
+## Overview
+**Ticker:** [SYMBOL]
+**Entry Price:** $[PRICE]
+**Target Price:** $[TARGET]
+**Stop Loss:** $[STOP]
+**Position Size:** [SIZE]
+
+## Thesis
+[Write your investment thesis here]
+
+## Catalysts
+- [Key catalyst 1]
+- [Key catalyst 2]
+
+## Risk Factors
+- [Risk 1]
+- [Risk 2]
+
+## Timeline
+**Expected Duration:** [TIMEFRAME]
+**Key Dates:** [EVENTS]`,
+ created_at: new Date().toISOString()
+ },
+ {
+ name: 'Market Analysis',
+ description: 'Analyze overall market conditions',
+ category: 'MARKET_ANALYSIS',
+ content: `# Market Analysis - [DATE]
+
+## Market Overview
+**Sentiment:** [BULLISH/BEARISH/NEUTRAL]
+**Key Indices:**
+- S&P 500: [LEVEL] ([CHANGE]%)
+- NASDAQ: [LEVEL] ([CHANGE]%)
+- VIX: [LEVEL]
+
+## Sector Performance
+- Best: [SECTOR] (+[%])
+- Worst: [SECTOR] (-[%])
+
+## Key Developments
+1. [Development 1]
+2. [Development 2]
+
+## Technical Indicators
+- **RSI:** [VALUE]
+- **Moving Averages:** [ANALYSIS]
+
+## Outlook
+[Your market outlook for the next period]`,
+ created_at: new Date().toISOString()
+ },
+ {
+ name: 'Earnings Notes',
+ description: 'Track company earnings and guidance',
+ category: 'EARNINGS',
+ content: `# Earnings Report - [TICKER]
+
+## Report Date
+**Quarter:** [Q1/Q2/Q3/Q4] [YEAR]
+**Release Date:** [DATE]
+
+## Key Metrics
+- **EPS:** $[ACTUAL] vs $[ESTIMATE] (Expected)
+- **Revenue:** $[ACTUAL] vs $[ESTIMATE]
+- **Guidance:** [RAISED/LOWERED/MAINTAINED]
+
+## Highlights
+- [Highlight 1]
+- [Highlight 2]
+
+## Management Commentary
+[Key quotes or insights from management]
+
+## Market Reaction
+**Stock Movement:** [+/-][%]
+**After Hours:** [PRICE]
+
+## Analysis
+[Your analysis of the results]`,
+ created_at: new Date().toISOString()
+ },
+ {
+ name: 'Economic Data',
+ description: 'Track important economic releases',
+ category: 'ECONOMIC',
+ content: `# Economic Data Release
+
+## Indicator
+**Name:** [INDICATOR NAME]
+**Date:** [RELEASE DATE]
+
+## Results
+**Actual:** [VALUE]
+**Expected:** [VALUE]
+**Previous:** [VALUE]
+
+## Market Impact
+**Asset Class Impact:**
+- Equities: [ANALYSIS]
+- Bonds: [ANALYSIS]
+- Currencies: [ANALYSIS]
+
+## Implications
+[Analysis of what this data means for markets]`,
+ created_at: new Date().toISOString()
+ },
+ {
+ name: 'Research Note',
+ description: 'Deep dive research on a company or theme',
+ category: 'RESEARCH',
+ content: `# Research: [COMPANY/THEME]
+
+## Executive Summary
+[Brief overview]
+
+## Investment Thesis
+[Detailed thesis]
+
+## Business Model
+[How the company makes money]
+
+## Competitive Advantages
+1. [Moat 1]
+2. [Moat 2]
+
+## Financial Analysis
+**Margins:** [DATA]
+**Growth:** [DATA]
+**Valuation:** [P/E], [P/S], [EV/EBITDA]
+
+## Risks
+- [Risk 1]
+- [Risk 2]
+
+## Conclusion
+[Buy/Hold/Sell recommendation and price target]`,
+ created_at: new Date().toISOString()
+ },
+ {
+ name: 'Portfolio Review',
+ description: 'Review and analyze your portfolio',
+ category: 'PORTFOLIO',
+ content: `# Portfolio Review - [DATE]
+
+## Performance Summary
+**Total Return:** [+/-][%]
+**vs S&P 500:** [+/-][%]
+
+## Top Performers
+1. [TICKER]: [+%] - [REASON]
+2. [TICKER]: [+%] - [REASON]
+
+## Underperformers
+1. [TICKER]: [-%%] - [REASON]
+2. [TICKER]: [-%%] - [REASON]
+
+## Allocation Analysis
+- **Equities:** [%]
+- **Fixed Income:** [%]
+- **Cash:** [%]
+
+## Adjustments Needed
+- [ ] [Action item 1]
+- [ ] [Action item 2]
+
+## Next Review Date
+[DATE]`,
+ created_at: new Date().toISOString()
+ }
+ ];
+
+ for (const template of templates) {
+ await this.db!.execute(
+ `INSERT INTO note_templates (name, description, content, category, created_at)
+ VALUES (?, ?, ?, ?, ?)`,
+ [template.name, template.description, template.content, template.category, template.created_at]
+ );
+ }
+ }
+
+ async createNote(note: Omit<Note, 'id'>): Promise<number> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.execute(
+ `INSERT INTO financial_notes
+ (title, content, category, priority, tags, tickers, sentiment, is_favorite,
+ is_archived, color_code, attachments, created_at, updated_at, reminder_date, word_count)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
+ [
+ note.title,
+ note.content,
+ note.category,
+ note.priority,
+ note.tags || '',
+ note.tickers || '',
+ note.sentiment,
+ note.is_favorite || 0,
+ note.is_archived || 0,
+ note.color_code || '#FF8800',
+ note.attachments || '[]',
+ note.created_at,
+ note.updated_at,
+ note.reminder_date || null,
+ note.word_count || 0
+ ]
+ );
+
+ return result.lastInsertId || 0;
+ } catch (error) {
+ console.error('[NotesService] Failed to create note:', error);
+ throw error;
+ }
+ }
+
+ async updateNote(id: number, updates: Partial<Note>): Promise<void> {
+ await this.initialize();
+
+ try {
+ const setParts: string[] = [];
+ const values: any[] = [];
+
+ if (updates.title !== undefined) {
+ setParts.push('title = ?');
+ values.push(updates.title);
+ }
+ if (updates.content !== undefined) {
+ setParts.push('content = ?');
+ values.push(updates.content);
+ }
+ if (updates.category !== undefined) {
+ setParts.push('category = ?');
+ values.push(updates.category);
+ }
+ if (updates.priority !== undefined) {
+ setParts.push('priority = ?');
+ values.push(updates.priority);
+ }
+ if (updates.tags !== undefined) {
+ setParts.push('tags = ?');
+ values.push(updates.tags);
+ }
+ if (updates.tickers !== undefined) {
+ setParts.push('tickers = ?');
+ values.push(updates.tickers);
+ }
+ if (updates.sentiment !== undefined) {
+ setParts.push('sentiment = ?');
+ values.push(updates.sentiment);
+ }
+ if (updates.is_favorite !== undefined) {
+ setParts.push('is_favorite = ?');
+ values.push(updates.is_favorite);
+ }
+ if (updates.is_archived !== undefined) {
+ setParts.push('is_archived = ?');
+ values.push(updates.is_archived);
+ }
+ if (updates.color_code !== undefined) {
+ setParts.push('color_code = ?');
+ values.push(updates.color_code);
+ }
+ if (updates.attachments !== undefined) {
+ setParts.push('attachments = ?');
+ values.push(updates.attachments);
+ }
+ if (updates.reminder_date !== undefined) {
+ setParts.push('reminder_date = ?');
+ values.push(updates.reminder_date);
+ }
+ if (updates.word_count !== undefined) {
+ setParts.push('word_count = ?');
+ values.push(updates.word_count);
+ }
+
+ setParts.push('updated_at = ?');
+ values.push(new Date().toISOString());
+
+ values.push(id);
+
+ await this.db!.execute(
+ `UPDATE financial_notes SET ${setParts.join(', ')} WHERE id = ?`,
+ values
+ );
+ } catch (error) {
+ console.error('[NotesService] Failed to update note:', error);
+ throw error;
+ }
+ }
+
+ async deleteNote(id: number): Promise<void> {
+ await this.initialize();
+
+ try {
+ await this.db!.execute('DELETE FROM financial_notes WHERE id = ?', [id]);
+ } catch (error) {
+ console.error('[NotesService] Failed to delete note:', error);
+ throw error;
+ }
+ }
+
+ async getNoteById(id: number): Promise<Note | null> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.select<Note[]>(
+ 'SELECT * FROM financial_notes WHERE id = ?',
+ [id]
+ );
+ return result.length > 0 ? result[0] : null;
+ } catch (error) {
+ console.error('[NotesService] Failed to get note by ID:', error);
+ return null;
+ }
+ }
+
+ async getAllNotes(includeArchived = false): Promise<Note[]> {
+ await this.initialize();
+
+ try {
+ const query = includeArchived
+ ? 'SELECT * FROM financial_notes ORDER BY updated_at DESC'
+ : 'SELECT * FROM financial_notes WHERE is_archived = 0 ORDER BY updated_at DESC';
+
+ const result = await this.db!.select<Note[]>(query);
+ return result;
+ } catch (error) {
+ console.error('[NotesService] Failed to get all notes:', error);
+ return [];
+ }
+ }
+
+ async getNotesByCategory(category: string, includeArchived = false): Promise<Note[]> {
+ await this.initialize();
+
+ try {
+ const query = includeArchived
+ ? 'SELECT * FROM financial_notes WHERE category = ? ORDER BY updated_at DESC'
+ : 'SELECT * FROM financial_notes WHERE category = ? AND is_archived = 0 ORDER BY updated_at DESC';
+
+ const result = await this.db!.select<Note[]>(query, [category]);
+ return result;
+ } catch (error) {
+ console.error('[NotesService] Failed to get notes by category:', error);
+ return [];
+ }
+ }
+
+ async getFavoriteNotes(): Promise<Note[]> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.select<Note[]>(
+ 'SELECT * FROM financial_notes WHERE is_favorite = 1 AND is_archived = 0 ORDER BY updated_at DESC'
+ );
+ return result;
+ } catch (error) {
+ console.error('[NotesService] Failed to get favorite notes:', error);
+ return [];
+ }
+ }
+
+ async searchNotes(query: string): Promise<Note[]> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.select<Note[]>(
+ `SELECT * FROM financial_notes
+ WHERE (title LIKE ? OR content LIKE ? OR tags LIKE ? OR tickers LIKE ?)
+ AND is_archived = 0
+ ORDER BY updated_at DESC`,
+ [`%${query}%`, `%${query}%`, `%${query}%`, `%${query}%`]
+ );
+ return result;
+ } catch (error) {
+ console.error('[NotesService] Failed to search notes:', error);
+ return [];
+ }
+ }
+
+ async getNotesWithReminders(): Promise<Note[]> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.select<Note[]>(
+ `SELECT * FROM financial_notes
+ WHERE reminder_date IS NOT NULL AND is_archived = 0
+ ORDER BY reminder_date ASC`
+ );
+ return result;
+ } catch (error) {
+ console.error('[NotesService] Failed to get notes with reminders:', error);
+ return [];
+ }
+ }
+
+ async getTemplates(): Promise<NoteTemplate[]> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.select<NoteTemplate[]>(
+ 'SELECT * FROM note_templates ORDER BY name ASC'
+ );
+ return result;
+ } catch (error) {
+ console.error('[NotesService] Failed to get templates:', error);
+ return [];
+ }
+ }
+
+ async createTemplate(template: Omit<NoteTemplate, 'id'>): Promise<number> {
+ await this.initialize();
+
+ try {
+ const result = await this.db!.execute(
+ `INSERT INTO note_templates (name, description, content, category, created_at)
+ VALUES (?, ?, ?, ?, ?)`,
+ [template.name, template.description, template.content, template.category, template.created_at]
+ );
+ return result.lastInsertId || 0;
+ } catch (error) {
+ console.error('[NotesService] Failed to create template:', error);
+ throw error;
+ }
+ }
+
+ async deleteTemplate(id: number): Promise<void> {
+ await this.initialize();
+
+ try {
+ await this.db!.execute('DELETE FROM note_templates WHERE id = ?', [id]);
+ } catch (error) {
+ console.error('[NotesService] Failed to delete template:', error);
+ throw error;
+ }
+ }
+
+ async getStatistics() {
+ await this.initialize();
+
+ try {
+ const totalNotes = await this.db!.select<any[]>(
+ 'SELECT COUNT(*) as count FROM financial_notes WHERE is_archived = 0'
+ );
+ const archivedNotes = await this.db!.select<any[]>(
+ 'SELECT COUNT(*) as count FROM financial_notes WHERE is_archived = 1'
+ );
+ const favoriteNotes = await this.db!.select<any[]>(
+ 'SELECT COUNT(*) as count FROM financial_notes WHERE is_favorite = 1'
+ );
+ const categoryStats = await this.db!.select<any[]>(
+ 'SELECT category, COUNT(*) as count FROM financial_notes WHERE is_archived = 0 GROUP BY category'
+ );
+ const totalWords = await this.db!.select<any[]>(
+ 'SELECT SUM(word_count) as total FROM financial_notes WHERE is_archived = 0'
+ );
+
+ return {
+ total: totalNotes[0]?.count || 0,
+ archived: archivedNotes[0]?.count || 0,
+ favorites: favoriteNotes[0]?.count || 0,
+ byCategory: categoryStats,
+ totalWords: totalWords[0]?.total || 0
+ };
+ } catch (error) {
+ console.error('[NotesService] Failed to get statistics:', error);
+ return {
+ total: 0,
+ archived: 0,
+ favorites: 0,
+ byCategory: [],
+ totalWords: 0
+ };
+ }
+ }
+}
+
+export const notesService = new NotesService();
diff --git a/fincept-terminal-desktop/src/services/tabConfigService.ts b/fincept-terminal-desktop/src/services/tabConfigService.ts
index d905a3d84..d1910fdea 100644
--- a/fincept-terminal-desktop/src/services/tabConfigService.ts
+++ b/fincept-terminal-desktop/src/services/tabConfigService.ts
@@ -2,8 +2,11 @@
import { TabConfiguration, DEFAULT_TAB_CONFIG, DEFAULT_TABS, TabDefinition } from '@/types/tabConfig';
const STORAGE_KEY = 'terminal-tab-configuration';
+const STORAGE_EVENT = 'tab-config-changed';
class TabConfigService {
+ private listeners: Set<(config: TabConfiguration) => void> = new Set();
+
getConfiguration(): TabConfiguration {
try {
const stored = localStorage.getItem(STORAGE_KEY);
@@ -19,6 +22,10 @@ class TabConfigService {
saveConfiguration(config: TabConfiguration): void {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
+ // Notify all listeners
+ this.notifyListeners(config);
+ // Dispatch storage event for cross-window sync
+ window.dispatchEvent(new CustomEvent(STORAGE_EVENT, { detail: config }));
} catch (error) {
console.error('Failed to save tab configuration:', error);
}
@@ -26,6 +33,19 @@ class TabConfigService {
resetToDefault(): void {
localStorage.removeItem(STORAGE_KEY);
+ this.notifyListeners(DEFAULT_TAB_CONFIG);
+ window.dispatchEvent(new CustomEvent(STORAGE_EVENT, { detail: DEFAULT_TAB_CONFIG }));
+ }
+
+ subscribe(listener: (config: TabConfiguration) => void): () => void {
+ this.listeners.add(listener);
+ return () => {
+ this.listeners.delete(listener);
+ };
+ }
+
+ private notifyListeners(config: TabConfiguration): void {
+ this.listeners.forEach(listener => listener(config));
}
getAllTabs(): TabDefinition[] {
diff --git a/fincept-terminal-desktop/src/types/tabConfig.ts b/fincept-terminal-desktop/src/types/tabConfig.ts
index 3ee462178..b6faf4046 100644
--- a/fincept-terminal-desktop/src/types/tabConfig.ts
+++ b/fincept-terminal-desktop/src/types/tabConfig.ts
@@ -29,6 +29,7 @@ export const DEFAULT_TABS: TabDefinition[] = [
{ id: 'screener', label: 'Screener', value: 'screener', shortcut: 'F8', component: 'ScreenerTab' },
{ id: 'trading', label: 'Trading', value: 'trading', shortcut: 'F9', component: 'TradingTab' },
{ id: 'chat', label: 'AI Chat', value: 'chat', shortcut: 'F10', component: 'ChatTab' },
+ { id: 'notes', label: 'Notes', value: 'notes', shortcut: 'F11', component: 'NotesTab' },
{ id: 'settings', label: 'Settings', value: 'settings', component: 'SettingsTab' },
{ id: 'profile', label: 'Profile', value: 'profile', shortcut: 'F12', component: 'ProfileTab' },
{ id: 'polygon', label: 'Polygon Data', value: 'polygon', component: 'PolygonEqTab' },
@@ -47,15 +48,17 @@ export const DEFAULT_TABS: TabDefinition[] = [
{ id: 'forum', label: 'Forum', value: 'forum', component: 'ForumTab' },
{ id: 'marketplace', label: 'Marketplace', value: 'marketplace', component: 'MarketplaceTab' },
{ id: 'docs', label: 'Documentation', value: 'docs', component: 'DocsTab' },
- { id: 'support', label: 'Support', value: 'support', component: 'SupportTicketTab' }
+ { id: 'support', label: 'Support', value: 'support', component: 'SupportTicketTab' },
+ { id: 'agents', label: 'Agents', value: 'agents', component: 'AgentConfigTab' },
+ { id: 'alpha-arena', label: 'Alpha Arena', value: 'alpha-arena', component: 'AlphaArenaTab' }
];
export const DEFAULT_TAB_CONFIG: TabConfiguration = {
- headerTabs: ['dashboard', 'markets', 'news', 'portfolio', 'backtesting', 'watchlist', 'research', 'screener', 'trading', 'chat', 'settings', 'profile'],
+ headerTabs: ['dashboard', 'markets', 'news', 'portfolio', 'backtesting', 'watchlist', 'research', 'screener', 'trading', 'chat', 'notes', 'agents', 'settings', 'profile'],
menuSections: [
{ id: 'markets-menu', label: 'Markets', tabs: ['polygon', 'economics', 'dbnomics'] },
{ id: 'research-menu', label: 'Research', tabs: ['geopolitics', 'maritime'] },
- { id: 'trading-menu', label: 'Trading', tabs: ['fyers'] },
+ { id: 'trading-menu', label: 'Trading', tabs: ['fyers', 'alpha-arena'] },
{ id: 'tools-menu', label: 'Tools', tabs: ['mcp', 'nodes', 'code', 'datasources', 'datamapping', 'reportbuilder', 'contexts'] },
{ id: 'community-menu', label: 'Community', tabs: ['forum', 'marketplace', 'docs'] },
{ id: 'help-menu', label: 'Help', tabs: ['support'] }