This implementation adds two key features to the employer dashboard:
- Enhanced Sidebar Active States - Refined visual feedback with glow effects, left border indicators, and smooth transitions
- Transaction Pending Overlay - Real-time transaction notifications with WebSocket integration
Location: frontend/src/components/EmployerLayout.tsx
Improvements:
- Active state now includes:
- Accent-colored left border indicator (1px rounded)
- Subtle glow effect using box-shadow
- Enhanced color contrast with 18% accent background
- Smooth transitions (200ms duration)
- Hover states:
- Icon scale animation (110% on hover)
- Subtle translate-x effect (0.5px shift)
- Background overlay on hover
- Accessibility maintained with proper ARIA labels and focus states
Visual Changes:
Active State:
- Left border: 1px rounded accent color
- Background: accent color at 18% opacity
- Text: accent color
- Shadow: 0 0 20px rgba(74,240,184,0.15)
Hover State:
- Icon scales to 110%
- Slight horizontal shift (0.5px)
- Background overlay (white/5)Components Created:
- Fixed position overlay (bottom-right corner)
- Supports multiple simultaneous notifications (max 5)
- Three states: pending, confirmed, failed
- Auto-dismiss after 5 seconds for completed transactions
- Smooth slide-in/out animations
- Links to Stellar Explorer for transaction details
Features:
- Real-time status updates via WebSocket
- Progress bar animation for pending transactions
- Status-specific icons (spinner, checkmark, error)
- Dismissible notifications
- Responsive design (mobile-friendly)
- Accessibility compliant (ARIA labels, live regions)
- Manages transaction notification state
- WebSocket integration for real-time updates
- Auto-dismiss logic for completed transactions
- Maximum 5 notifications displayed at once
- Timestamp tracking for each transaction
- Global state management for transaction notifications
- Makes notifications accessible throughout the app
- Provides
useTransactionNotificationshook
frontend/src/
├── components/
│ ├── EmployerLayout.tsx (modified)
│ └── TransactionPendingOverlay.tsx (new)
├── hooks/
│ └── usePendingTransactions.ts (new)
├── contexts/
│ └── TransactionContext.tsx (new)
└── examples/
└── TransactionNotificationExample.tsx (new)
import { useTransactionNotifications } from '../contexts/TransactionContext';
function MyPaymentComponent() {
const { addTransaction, updateTransaction } = useTransactionNotifications();
const handlePayment = async () => {
// Add pending notification
const txId = addTransaction({
id: `payment-${Date.now()}`,
type: 'payment',
status: 'pending',
description: 'Processing payroll payment to 5 employees',
});
try {
// Process payment...
const result = await processPayment();
// Update to confirmed
updateTransaction(txId, {
status: 'confirmed',
hash: result.transactionHash,
});
} catch (error) {
// Update to failed
updateTransaction(txId, {
status: 'failed',
description: `Payment failed: ${error.message}`,
});
}
};
return <button onClick={handlePayment}>Send Payment</button>;
}interface PendingTransaction {
id: string; // Unique identifier
type: string; // Transaction type (e.g., 'payment', 'bulk-upload')
status: "pending" | "confirmed" | "failed";
hash?: string; // Stellar transaction hash (for explorer link)
timestamp: number; // Unix timestamp
description?: string; // Human-readable description
}The overlay listens for transaction:update events:
socket.on("transaction:update", (data) => {
// data: { id, status, hash }
});The overlay is automatically integrated into:
EmployerLayout- Wraps all employer routes- All pages under
/employer/*have access to notifications
Uses the existing design system:
- CSS variables from
index.css - Tailwind CSS utilities
- Consistent with app theme (dark/light mode support)
- Backdrop blur effects for modern glass-morphism
Key CSS Variables Used:
--surface- Background color--accent- Primary accent color--success- Success state color--danger- Error state color--border-hi- Border color--text- Text color--muted- Muted text color
Both features maintain WCAG compliance:
Sidebar:
- Proper ARIA labels on navigation
- Focus visible states with outline
- Keyboard navigation support
- Screen reader friendly
Overlay:
role="status"for notificationsaria-live="polite"for updatesaria-labelon interactive elements- Dismissible with keyboard
- Maximum 5 notifications displayed
- Auto-dismiss prevents notification buildup
- Smooth CSS transitions (GPU-accelerated)
- Efficient WebSocket event handling
- Debounced state updates
- Modern browsers (Chrome, Firefox, Safari, Edge)
- CSS Grid and Flexbox
- CSS custom properties
- Backdrop filter support
- WebSocket API
To test the implementation:
- Navigate to any employer route
- Trigger a transaction (payment, bulk upload, etc.)
- Observe the notification appear in bottom-right
- Check active state on sidebar navigation
- Verify WebSocket updates work in real-time
See frontend/src/examples/TransactionNotificationExample.tsx for a test component.
Possible improvements:
- Sound notifications (optional)
- Notification history panel
- Grouped notifications for bulk operations
- Custom notification templates
- Notification preferences/settings
- Desktop notifications API integration
- Undo/retry actions for failed transactions
No new dependencies added. Uses existing:
- React 19.0.0
- React Router 7.9.6
- Tailwind CSS 4.2.0
- Lucide React (icons)
- @stellar/design-system
- The overlay is positioned fixed and won't interfere with page content
- Mobile responsive (adjusts to smaller screens)
- Works with existing WebSocket infrastructure
- Compatible with existing transaction history page
- No breaking changes to existing code