Spaces:
Running
Enhance the existing TaxWizard Pro interface to work with user accounts and saved portfolios:
Browse files**PORTFOLIO SELECTION:**
- Add portfolio selector dropdown in the main interface
- "Load from saved portfolio" option alongside file upload
- Portfolio metadata display (last updated, total value, holdings count)
- Quick switch between portfolios
**ENHANCED UPLOAD SECTION:**
- "Upload new statement" vs "Load saved portfolio" toggle
- File upload with automatic portfolio creation option
- "Save as new portfolio" checkbox after successful upload
- Portfolio naming and description fields
**SAVE FUNCTIONALITY:**
- "Save Portfolio" button in the main interface
- Save current analysis as new portfolio option
- Overwrite existing portfolio option
- Auto-save draft functionality
- Save status indicators
**ANALYSIS HISTORY:**
- "Previous Analyses" section showing past runs
- Comparison between different analysis runs
- Export historical data
- Restore previous analysis settings
**ACCOUNT INTEGRATION:**
- User-specific settings persistence (tax rates, preferences)
- Portfolio sharing options (Premium feature)
- Analysis export with user branding
- Usage tracking and limits display
**DESIGN REQUIREMENTS:**
- Seamlessly integrate with existing TaxWizard interface
- Maintain current workflow and visual design
- Add subtle account indicators and user context
- Responsive design for all new elements
- Consistent with existing component styling
**FUNCTIONALITY:**
- Portfolio data persistence
- User preference storage
- Analysis history tracking
- Account limit enforcement
- Seamless switching between file upload and saved data
8 unmodified lines910111213141569 unmodified lines858687888990919224 unmodified lines117118119120121122123124125126127128129130131132133134135128 unmodified lines2642652662672682692708 unmodified lines<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script><script>tailwind.config = {darkMode: 'class',theme: {extend: {69 unmodified lines<div class="md:flex"><!-- Left Panel --><div class="md:w-1/2 p-8 md:p-10" id="uploadPanel"><div class="mb-8"><div class="flex items-center mb-4"><div class="bg-primary-100 dark:bg-primary-900 p-2 rounded-full mr-3"><i data-feather="bar-chart-2" class="text-primary-600 dark:text-primary-400 w-5 h-5"></i></div>24 unmodified lines</div></div></div><!-- Upload Section --><div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition"><i data-feather="upload-cloud" class="w-12 h-12 mx-auto text-gray-400 mb-3"></i><h3 class="text-lg font-medium mb-1">Upload Statement</h3><p class="text-gray-500 dark:text-gray-400 text-sm mb-4">Drag & drop your statement here (PDF, CSV, XLSX)</p><button class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-2 rounded-lg text-sm font-medium transition">Select File</button></div><div class="flex items-start text-sm"><input type="checkbox" id="privacy" class="mt-1 mr-2 bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600"><label for="privacy" class="text-gray-600 dark:text-gray-400">I agree to the <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Privacy Notice</a></label></div></div>128 unmodified lines</div><!-- Bottom Action Bar --><div class="fixed bottom-0 left-0 w-full bg-white/90 dark:bg-gray-800/90 backdrop-blur-sm border-t border-gray-200 dark:border-gray-700 p-4 z-50"><div class="max-w-6xl mx-auto flex flex-col md:flex-row items-center gap-4"><div class="flex-1 min-w-[150px]"><label class="text-sm text-gray-600 dark:text-gray-400">Max Tax Budget ($)</label><input type="number" id="maxBudget" placeholder="e.g., 3000" class="mt-1 w-full bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded px-3 py-2 dark:text-white">8 unmodified lines910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012169 unmodified lines19119219319419519619719819920020120220320420520620720820921021121221321421521624 unmodified lines241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315128 unmodified lines4444454464474484494504514524534544554564574584594604614624634644654664678 unmodified lines<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script><script>// Portfolio managementlet currentPortfolio = null;let portfolios = [{id: 'retirement',name: 'Retirement Portfolio',lastUpdated: '2023-10-15',totalValue: 125342,holdingsCount: 12,taxSavings: 1245,description: 'Primary retirement account'},{id: 'taxable',name: 'Taxable Account',lastUpdated: '2023-09-28',totalValue: 87321,holdingsCount: 8,taxSavings: 842,description: 'Brokerage account for active trading'}];// Initialize portfolio dropdownfunction updatePortfolioDropdown() {const select = document.getElementById('portfolioSelect');select.innerHTML = '<option value="">Select a portfolio...</option><option value="new">+ Create New Portfolio</option>';portfolios.forEach(portfolio => {const option = document.createElement('option');option.value = portfolio.id;option.textContent = portfolio.name;select.appendChild(option);});}// Load portfolio datafunction loadPortfolio(portfolioId) {if (!portfolioId || portfolioId === 'new') {currentPortfolio = null;document.getElementById('portfolioInfo').classList.add('hidden');document.getElementById('saveOptions').classList.remove('hidden');return;}const portfolio = portfolios.find(p => p.id === portfolioId);if (portfolio) {currentPortfolio = portfolio;document.getElementById('portfolioName').textContent = portfolio.name;document.getElementById('lastUpdated').textContent = new Date(portfolio.lastUpdated).toLocaleDateString();document.getElementById('totalValue').textContent = `${portfolio.totalValue.toLocaleString()}`;document.getElementById('holdingsCount').textContent = portfolio.holdingsCount;document.getElementById('taxSavings').textContent = `${portfolio.taxSavings.toLocaleString()}`;document.getElementById('portfolioInfo').classList.remove('hidden');document.getElementById('saveOptions').classList.add('hidden');}}// Toggle between upload and load modesdocument.getElementById('uploadToggle').addEventListener('click', function() {this.classList.add('bg-white', 'dark:bg-gray-800', 'shadow-sm');this.classList.remove('text-gray-500', 'dark:text-gray-400');document.getElementById('loadToggle').classList.remove('bg-white', 'dark:bg-gray-800', 'shadow-sm');document.getElementById('loadToggle').classList.add('text-gray-500', 'dark:text-gray-400');document.getElementById('portfolioSelect').value = '';loadPortfolio(null);});document.getElementById('loadToggle').addEventListener('click', function() {this.classList.add('bg-white', 'dark:bg-gray-800', 'shadow-sm');this.classList.remove('text-gray-500', 'dark:text-gray-400');document.getElementById('uploadToggle').classList.remove('bg-white', 'dark:bg-gray-800', 'shadow-sm');document.getElementById('uploadToggle').classList.add('text-gray-500', 'dark:text-gray-400');document.getElementById('portfolioSelect').value = portfolios[0].id;loadPortfolio(portfolios[0].id);});// Portfolio selection handlerdocument.getElementById('portfolioSelect').addEventListener('change', function() {loadPortfolio(this.value);});// Save portfolio handlerdocument.getElementById('savePortfolioBtn').addEventListener('click', function() {const saveStatus = document.getElementById('saveStatus');saveStatus.innerHTML = '<i data-feather="loader" class="w-3 h-3 mr-1 animate-spin"></i> Saving...';feather.replace();// Simulate savesetTimeout(() => {saveStatus.innerHTML = '<i data-feather="check-circle" class="w-3 h-3 mr-1 text-green-500"></i> Saved';feather.replace();// Reset status after 3 secondssetTimeout(() => {saveStatus.innerHTML = '<i data-feather="circle" class="w-3 h-3 mr-1 text-gray-400"></i> Saved';feather.replace();}, 3000);}, 1500);});// Initializedocument.addEventListener('DOMContentLoaded', function() {updatePortfolioDropdown();feather.replace();});tailwind.config = {darkMode: 'class',theme: {extend: {69 unmodified lines<div class="md:flex"><!-- Left Panel --><div class="md:w-1/2 p-8 md:p-10" id="uploadPanel"><!-- Portfolio Selection Dropdown --><div class="mb-4 flex items-center justify-between"><div class="relative w-full mr-2"><select id="portfolioSelect" class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"><option value="">Select a portfolio...</option><option value="new">+ Create New Portfolio</option><option value="retirement">Retirement Portfolio</option><option value="taxable">Taxable Account</option></select><div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"><i data-feather="chevron-down" class="w-4 h-4 text-gray-400"></i></div></div><button id="refreshPortfolios" class="p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"><i data-feather="refresh-cw" class="w-4 h-4"></i></button></div><div class="mb-8"><div class="flex items-center mb-4"><div class="bg-primary-100 dark:bg-primary-900 p-2 rounded-full mr-3"><i data-feather="bar-chart-2" class="text-primary-600 dark:text-primary-400 w-5 h-5"></i></div>24 unmodified lines</div></div></div><!-- Upload/Load Toggle --><div class="flex mb-4 bg-gray-100 dark:bg-gray-700 rounded-lg p-1"><button id="uploadToggle" class="flex-1 py-2 px-4 rounded-md font-medium text-center bg-white dark:bg-gray-800 shadow-sm">Upload New</button><button id="loadToggle" class="flex-1 py-2 px-4 rounded-md font-medium text-center text-gray-500 dark:text-gray-400">Load Saved</button></div><!-- Upload Section --><div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition"><div id="portfolioInfo" class="hidden text-left mb-4 p-4 bg-white dark:bg-gray-800 rounded-lg"><div class="flex justify-between items-start mb-2"><h4 class="font-semibold" id="portfolioName">Portfolio Name</h4><span class="text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded-full">Active</span></div><div class="grid grid-cols-2 gap-2 text-sm"><div><p class="text-gray-500 dark:text-gray-400">Last Updated</p><p id="lastUpdated">Oct 15, 2023</p></div><div><p class="text-gray-500 dark:text-gray-400">Total Value</p><p id="totalValue">$125,342</p></div><div><p class="text-gray-500 dark:text-gray-400">Holdings</p><p id="holdingsCount">12</p></div><div><p class="text-gray-500 dark:text-gray-400">Tax Savings</p><p id="taxSavings">$1,245</p></div></div></div><i data-feather="upload-cloud" class="w-12 h-12 mx-auto text-gray-400 mb-3"></i><h3 class="text-lg font-medium mb-1">Upload Statement</h3><p class="text-gray-500 dark:text-gray-400 text-sm mb-4">Drag & drop your statement here (PDF, CSV, XLSX)</p><button class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-2 rounded-lg text-sm font-medium transition">Select File</button></div><!-- Save Options --><div id="saveOptions" class="hidden mb-4 p-4 bg-gray-50 dark:bg-gray-700 rounded-lg"><div class="flex items-center mb-3"><input type="checkbox" id="savePortfolio" class="mr-2" checked><label for="savePortfolio" class="font-medium">Save to Portfolio</label></div><div id="saveFields" class="space-y-3"><div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Portfolio Name</label><input type="text" id="portfolioNameInput" class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg"></div><div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Description</label><textarea id="portfolioDescription" rows="2" class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg"></textarea></div><div class="flex items-center"><input type="radio" id="saveNew" name="saveOption" value="new" class="mr-2" checked><label for="saveNew" class="mr-4">Save as new</label><input type="radio" id="saveOverwrite" name="saveOption" value="overwrite" class="mr-2"><label for="saveOverwrite">Overwrite existing</label></div></div></div><div class="flex items-start text-sm"><input type="checkbox" id="privacy" class="mt-1 mr-2 bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600"><label for="privacy" class="text-gray-600 dark:text-gray-400">I agree to the <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Privacy Notice</a></label></div></div>128 unmodified lines</div><!-- Bottom Action Bar --><div class="fixed bottom-0 left-0 w-full bg-white/90 dark:bg-gray-800/90 backdrop-blur-sm border-t border-gray-200 dark:border-gray-700 p-4 z-50"><div class="flex items-center justify-between mb-2"><div class="flex items-center text-sm text-gray-600 dark:text-gray-400"><span id="saveStatus" class="flex items-center"><i data-feather="circle" class="w-3 h-3 mr-1 text-gray-400"></i>Not saved</span><span class="mx-2">•</span><span id="autoSaveStatus" class="flex items-center"><i data-feather="clock" class="w-3 h-3 mr-1 text-gray-400"></i>Auto-save off</span></div><button id="savePortfolioBtn" class="flex items-center text-blue-600 dark:text-blue-400 hover:underline"><i data-feather="save" class="w-4 h-4 mr-1"></i>Save Portfolio</button></div><div class="max-w-6xl mx-auto flex flex-col md:flex-row items-center gap-4"><div class="flex-1 min-w-[150px]"><label class="text-sm text-gray-600 dark:text-gray-400">Max Tax Budget ($)</label><input type="number" id="maxBudget" placeholder="e.g., 3000" class="mt-1 w-full bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded px-3 py-2 dark:text-white">