-
Notifications
You must be signed in to change notification settings - Fork 1
Fixing Soon Feature on Upcoming Election that doesn't showup on active elections #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
| <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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
| )} | ||
| </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'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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.