Skip to content

Conversation

@Kyra-Code79
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Kyra-Code79, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where elections scheduled to start in the future, but already in an 'active' state, were not displayed to voters. It introduces a new data fetching mechanism and a dedicated user interface section to ensure that users can clearly see and anticipate upcoming elections on their dashboard.

Highlights

  • Upcoming Elections Feature: Implemented functionality to fetch and display elections that are active but have a start date in the future, addressing the issue where 'soon' elections were not visible.
  • Dedicated UI Tab: Added a new 'Upcoming' tab to the voter dashboard, providing a clear section for users to view these future elections.
  • API Enhancement: The voter dashboard API (/api/voter/dashboard) now returns upcomingElections data, separating them from currently active elections.
  • Status Enum Consistency: Standardized election status checks and type definitions to use uppercase enum values (e.g., 'ACTIVE' instead of 'active'), aligning with backend Prisma definitions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new 'Upcoming Elections' feature to the voter dashboard. The API endpoint (/api/voter/dashboard) was updated to fetch upcoming elections based on their start date and active status, and the frontend (VoterDashboard.tsx) was modified to include a new 'Upcoming' tab and display these elections. Additionally, the Election status enum was standardized to use uppercase values (e.g., 'ACTIVE'). Minor code formatting and cleanup were also performed. However, the review comments indicate two regressions: the 'Voting History' tab inadvertently lost the 'See Results' button for ended elections, and the page footer containing copyright information was removed.

Comment on lines +976 to 981
<div className="flex flex-col items-end justify-center">
<div className="flex items-center text-emerald-500 font-medium">
<CheckCircle size={20} className="mr-2" />
Recorded on Blockchain
</div>
</div>

Choose a reason for hiding this comment

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

high

The refactoring of the 'Voting History' tab has removed the 'See Results' button for ended elections. This is a functional regression, as users can no longer navigate to the results page for elections they have participated in. Please restore this functionality.

                    <div className="flex flex-col items-end justify-center">
                      <div className="flex items-center text-emerald-500 font-medium">
                        <CheckCircle size={20} className="mr-2" />
                        Recorded on Blockchain
                      </div>
                      {history.election.status === 'ENDED' && (
                         <button onClick={() => router.push(`/voter/election/${history.election.id}/results`)} className="mt-4 px-4 py-2 text-sm border border-emerald-500 text-emerald-500 rounded hover:bg-emerald-500 hover:text-white transition-colors">
                            See Results
                         </button>
                      )}
                    </div>

Comment on lines +941 to -945
)}
</div>
)}

{/* --- TAB: HISTORY --- */}
{/* --- TAB: VOTING HISTORY --- */}
{activeTab === "history" && (
<div className="space-y-4">
<div className="space-y-6">
{voteHistory.length === 0 ? (
<div className={`text-center py-12 rounded-lg border border-dashed ${darkMode ? "border-gray-700 text-gray-400" : "border-gray-300 text-gray-500"}`}>
You haven&apos;t voted in any elections yet.
</div>
<p>No voting history found.</p>
</div>
) : (
voteHistory.map((vote) => (
<div key={vote.id} className={`p-6 rounded-xl border shadow-sm ${darkMode ? "bg-neutral-900 border-emerald-800" : "bg-white border-gray-200"}`}>
voteHistory.map((history) => (
<div key={history.id} className={`p-6 rounded-lg border shadow-sm ${darkMode ? "bg-neutral-900 border-emerald-800" : "bg-white border-gray-200"}`}>
<div className="flex flex-col md:flex-row justify-between gap-4">
<div>
<div className="flex items-center gap-2 mb-1">
<h4 className={`text-lg font-bold ${darkMode ? "text-emerald-500" : "text-emerald-700"}`}>{vote.election.title}</h4>
<span className={`px-2 py-0.5 text-xs rounded-full ${darkMode ? "bg-gray-800 text-gray-400" : "bg-gray-100 text-gray-600"}`}>
{vote.election.status}
</span>
</div>
<p className={`text-sm mb-4 ${darkMode ? "opacity-70" : "text-gray-600"}`}>{vote.election.description}</p>

<div className="space-y-1">
<div className={`flex items-center text-xs font-mono ${darkMode ? "opacity-60" : "text-gray-500"}`}>
<span className="w-24">Block Hash:</span>
<span className="truncate max-w-[200px] md:max-w-md">{vote.blockHash}</span>
<h3 className={`text-lg font-bold ${darkMode ? "text-white" : "text-gray-900"}`}>
{history.election.title}
</h3>
<p className={`text-sm mt-1 ${darkMode ? "text-gray-400" : "text-gray-600"}`}>
Voted on: {new Date(history.votedAt).toLocaleString()}
</p>
<div className="mt-4 space-y-2">
<div className="flex items-center gap-2 text-xs font-mono">
<span className={`px-2 py-1 rounded ${darkMode ? "bg-gray-800 text-gray-400" : "bg-gray-100 text-gray-600"}`}>
Tx: {history.transactionHash.substring(0, 20)}...
</span>
</div>
<div className={`flex items-center text-xs font-mono ${darkMode ? "opacity-60" : "text-gray-500"}`}>
<span className="w-24">Tx Hash:</span>
<span className="truncate max-w-[200px] md:max-w-md">{vote.transactionHash}</span>
<div className="flex items-center gap-2 text-xs font-mono">
<span className={`px-2 py-1 rounded ${darkMode ? "bg-gray-800 text-gray-400" : "bg-gray-100 text-gray-600"}`}>
Block: {history.blockHash.substring(0, 20)}...
</span>
</div>
</div>
</div>

<div className="flex flex-col items-end justify-between">
<div className={`text-right text-sm ${darkMode ? "opacity-70" : "text-gray-500"}`}>
<div>Voted At</div>
<div className={`font-medium ${darkMode ? "text-white" : "text-gray-900"}`}>{new Date(vote.votedAt).toLocaleString()}</div>
</div>

{vote.election.status === 'ended' && (
<button onClick={() => router.push(`/voter/election/${vote.election.id}/results`)} className="mt-4 px-4 py-2 text-sm border border-emerald-500 text-emerald-500 rounded hover:bg-emerald-500 hover:text-white transition-colors">
See Results
</button>
)}
<div className="flex flex-col items-end justify-center">
<div className="flex items-center text-emerald-500 font-medium">
<CheckCircle size={20} className="mr-2" />
Recorded on Blockchain
</div>
</div>
</div>
</div>
))
)}
</div>
)}

</main>

<footer className={darkMode ? "mt-auto border-t border-emerald-800/30 py-8 bg-neutral-950/30 text-center text-sm text-emerald-300" : "mt-auto border-t border-gray-200 py-8 bg-white text-center text-sm text-gray-500"}>
<div className="max-w-7xl mx-auto px-4">
© 2025 BlockVote — Secure blockchain voting
</div>
</footer>

Choose a reason for hiding this comment

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

medium

The page footer containing copyright information was removed. This seems unintentional and should be restored to maintain a consistent page layout. It should be placed after the <main> tag and before the modals.

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.

1 participant