Skip to content

Harsh changes#20

Merged
AkshitMaheshwari merged 4 commits into
mainfrom
harsh-changes
Apr 4, 2026
Merged

Harsh changes#20
AkshitMaheshwari merged 4 commits into
mainfrom
harsh-changes

Conversation

@Harsh-Pachauri
Copy link
Copy Markdown
Collaborator

Summary

Scope

  • Frontend
  • Backend
  • Docs
  • Infra / Config
  • Bug fix
  • New feature
  • Refactor

Changes Made

Related Issue

Closes #

Testing

  • I tested this locally
  • I added or updated automated tests
  • No automated tests were needed for this change

Test Details

Screenshots / API Examples

N/A

Checklist

  • My PR is focused and reasonably small
  • I reviewed my own changes before requesting review
  • I updated relevant documentation
  • I removed debug code, logs, and commented-out code
  • I considered error handling and edge cases
  • I considered performance impact where relevant
  • I considered security/privacy impact where relevant
  • This change does not break existing functionality

Notes For Reviewers

Copilot AI review requested due to automatic review settings April 4, 2026 04:30
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tax-ai Ready Ready Preview, Comment Apr 4, 2026 4:33am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the frontend to target a localhost backend by default and expands several UI screens (Transactions, Filing results, AI Assistant) with richer client-side behavior and API-driven responses.

Changes:

  • Switches multiple API base URLs from the hosted endpoint to http://localhost:8000 (including .env and src/utils/api.js fallback).
  • Replaces the Transactions page sample data with live API fetching plus filtering, summary metrics, and pagination.
  • Enhances Filing results display to show additional “process” response data, and adds a simple markdown renderer for formatted AI responses in the AI Assistant.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
Frontend/src/utils/api.js Changes default API base URL fallback to localhost.
Frontend/.env Updates VITE_API_URL to localhost.
Frontend/src/pages/Upload.jsx Switches hardcoded backend URL to localhost.
Frontend/src/pages/Dashboard.jsx Switches hardcoded backend URL to localhost.
Frontend/src/pages/Transactions.jsx Implements API-backed transactions list with filters, summary cards, delete, and pagination.
Frontend/src/pages/Filing.jsx Adds processResponse plumbing and renders computation/process data in ResultsDisplay.
Frontend/src/pages/AIAssistant.jsx Adds markdown-like rendering for formatted responses; calls API for financial advisor; adds (but does not fully wire) a transactions tab section.
Comments suppressed due to low confidence (1)

Frontend/src/pages/AIAssistant.jsx:186

  • A transactions tab is rendered later (activeTab === 'transactions'), but it’s not included in the tabs array, so it’s unreachable via the UI. Either add the missing tab entry or remove the dead tab section to avoid confusing/unused code paths.
  const tabs = [
    { id: 'tax', label: 'Tax Assistant' },
    { id: 'financial', label: 'Financial Advisor' },
    { id: 'personal', label: 'Personal Q&A' },
  ];

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Frontend/src/utils/api.js
Comment on lines 1 to 2
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaulting API base URL to http://localhost:8000 will break any environment where VITE_API_URL isn’t set (e.g., deployed builds or preview environments) by silently pointing the frontend at the user’s own machine. Prefer leaving the fallback as the production/staging API URL, or remove the fallback and fail fast if VITE_API_URL is missing (with a clear error).

Suggested change
const rawBaseUrl =
typeof import.meta.env.VITE_API_URL === 'string'
? import.meta.env.VITE_API_URL.trim()
: '';
if (!rawBaseUrl) {
throw new Error('Missing required VITE_API_URL environment variable');
}

Copilot uses AI. Check for mistakes.
Comment thread Frontend/.env
@@ -1,2 +1,2 @@
# Backend API URL
VITE_API_URL=https://taxai-77xc.onrender.com
VITE_API_URL=http://localhost:8000
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committing .env with VITE_API_URL=http://localhost:8000 makes the repo default to a developer-local backend and can break other developers’ setups and any build that consumes repo env files. This value is usually kept in an untracked .env.local (or only in .env.example) while .env remains production-safe or absent.

Suggested change
VITE_API_URL=http://localhost:8000

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding API_URL to http://localhost:8000 will break non-local environments. Use import.meta.env.VITE_API_URL (or the shared API_BASE_URL from src/utils/api.js) so the backend URL is configured per environment.

Suggested change
const API_URL = import.meta.env.VITE_API_URL;

Copilot uses AI. Check for mistakes.
import AppLayout from '../components/AppLayout';

const API_URL = 'https://taxai-77xc.onrender.com';
const API_URL = 'http://localhost:8000';
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding API_URL to http://localhost:8000 will break non-local environments. Use import.meta.env.VITE_API_URL (or the shared API_BASE_URL from src/utils/api.js) so the backend URL is configured per environment.

Suggested change
const API_URL = 'http://localhost:8000';
const API_URL = import.meta.env.VITE_API_URL;

Copilot uses AI. Check for mistakes.
import { useAuth } from '../context/AuthContext';
import AppLayout from '../components/AppLayout';

const API_URL = 'https://taxai-77xc.onrender.com';
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding API_URL to http://localhost:8000 will break non-local environments. Use import.meta.env.VITE_API_URL (or the shared API_BASE_URL from src/utils/api.js) so the backend URL is configured per environment.

Suggested change
const API_URL = import.meta.env.VITE_API_URL;

Copilot uses AI. Check for mistakes.

if (!response.ok) throw new Error('Failed to delete transaction');

setTransactions(transactions.filter((txn) => txn.id !== txnId));
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setTransactions(transactions.filter(...)) uses the transactions value from the render closure, which can be stale if multiple deletes/updates happen quickly. Use a functional state update (setTransactions(prev => prev.filter(...))) to ensure the latest state is used.

Suggested change
setTransactions(transactions.filter((txn) => txn.id !== txnId));
setTransactions((prevTransactions) =>
prevTransactions.filter((txn) => txn.id !== txnId)
);

Copilot uses AI. Check for mistakes.
Comment on lines +113 to +114
if (!value) return '₹0';
return '₹' + value.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatCurrency treats 0 as falsy and returns ₹0 (without decimals), while other amounts include 2 decimals. If a transaction/summary value is legitimately 0, this will render inconsistently. Consider checking value == null instead of !value and always formatting with the same options.

Suggested change
if (!value) return '₹0';
return '₹' + value.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
const amount = value == null ? 0 : value;
return '₹' + amount.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });

Copilot uses AI. Check for mistakes.
@@ -3,6 +3,152 @@ import AppLayout from '../components/AppLayout';

const API_URL = 'https://taxai-77xc.onrender.com';
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding API_URL to http://localhost:8000 will break non-local environments. Use import.meta.env.VITE_API_URL (or the shared API_BASE_URL from src/utils/api.js) so the backend URL is configured per environment.

Suggested change
const API_URL = 'https://taxai-77xc.onrender.com';
const API_URL = import.meta.env.VITE_API_URL;

Copilot uses AI. Check for mistakes.

i++;
}

Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renderMarkdown only flushes tableRows when a non-table line is encountered. If the content ends while inTable is true (markdown ends with a table), the table rows are never rendered. Add an after-loop flush when inTable && tableRows.length to render trailing tables.

Suggested change
if (inTable && tableRows.length) {
const headers = tableRows[0];
const dataRows = tableRows.slice(1);
elements.push(
<div key={`table-${elements.length}`} style={{ marginBottom: '1rem', overflowX: 'auto' }}>
<table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: "'DM Sans', sans-serif" }}>
<thead>
<tr>
{headers.map((header, idx) => (
<th
key={idx}
style={{
border: '1px solid rgba(255, 255, 255, 0.2)',
padding: '0.75rem',
backgroundColor: 'rgba(255, 255, 255, 0.08)',
color: '#FAFAF7',
textAlign: 'left',
fontWeight: '600',
}}
>
{header}
</th>
))}
</tr>
</thead>
<tbody>
{dataRows.map((row, rowIdx) => (
<tr key={rowIdx}>
{row.map((cell, cellIdx) => (
<td
key={cellIdx}
style={{
border: '1px solid rgba(255, 255, 255, 0.2)',
padding: '0.75rem',
color: '#FAFAF7',
}}
>
{cell}
</td>
))}
</tr>
))}
</tbody>
</table>
</div>
);
}

Copilot uses AI. Check for mistakes.
Comment on lines +1078 to +1095
{/* TRANSACTIONS TAB */}
{activeTab === 'transactions' && (
<>
<div className="mb-6 space-y-4">
<div
className="bg-[#f5f3ed] border-l-4 border-[#c9a961] p-4"
style={{
fontFamily: "'DM Sans', sans-serif",
fontSize: "0.875rem",
color: "#5a5550",
}}
>
All transactions extracted from your uploaded documents ({transactionCount} total)
</div>
</div>

{transactionsLoading ? (
<div
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transactions tab UI references identifiers like transactionsLoading, transactionsError, transactions, transactionCount, handleEditTransaction, and handleDeleteTransaction, but they are not defined in this component. If activeTab is ever set to transactions, this will crash at runtime; define the missing state/handlers (and data fetching) or remove this section until it’s wired up.

Copilot uses AI. Check for mistakes.
@AkshitMaheshwari AkshitMaheshwari merged commit db4bd24 into main Apr 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants