Skip to content

Conversation

@navillanueva
Copy link
Contributor

No description provided.

Riot-pls and others added 30 commits July 20, 2025 11:29
- Removed unnecessary console logs and improved code formatting for consistency.
- Enhanced the project submission context by adding new state properties and actions for better management of project-related dialogs.
- Updated the project creation logic to use atomic transactions for improved reliability.
- Refactored the submission form to streamline data handling and validation processes.
…submission

BUGFIX: Solve duplicate project submissions
- Removed the submission restriction check in the GeneralSecure component for a smoother user experience.
- Updated the project submission context to correctly access the project ID from the response data structure.
- Added useEffect for reactive validation in the submission form hook, improving user feedback during input.
- Improved the FormSchema by adding detailed validation messages for various fields.
- Implemented preprocessing for GitHub repository and demo link inputs to ensure valid formats and uniqueness.
- Updated the useEffect for reactive validation to ensure fields are validated as the user types.
- Added a refinement to require an explanation when the idea is pre-existing.
…submission

Voyager ship/bugfix project submission
- Updated the invitation generation logic to return detailed results, including success status and invitation links.
- Improved error handling in the invitation process to provide clearer feedback on failures.
- Enhanced the MembersComponent to display invitation results and links for manual sharing.
- Added toast notifications for better user experience during the invitation process.
…submission

refactor: enhance invitation process and improve error handling
- Enhanced the GeneralSecure component by removing unnecessary dispatch calls and cleaning up the loading state.
- Updated the InvalidInvitationDialog and JoinTeamDialog to include toast notifications for better user feedback during modal interactions.
- Refactored the ProjectMemberWarningDialog to handle modal closure with action tracking, ensuring users are redirected appropriately.
- Improved the Members component by centralizing modal close logic and resetting state variables upon closure.
- Adjusted the ProjectSubmissionContext to correctly set team names based on project data.
- Introduced a debounced progress state to improve performance and user experience.
- Extracted progress calculation logic into a separate function for better readability and maintainability.
- Updated the ProgressBar to utilize the debounced progress value, ensuring smoother updates during form interactions.
- Updated hackathon validation logic to improve readability and maintainability.
- Changed date fields in HackathonHeader type from Date to string for better compatibility with API responses.
- Improved error handling in create and update hackathon functions to ensure proper validation and timezone handling.
- Refactored getFilteredHackathons function to streamline filtering and pagination logic.
…submission

Voyager ship/bugfix project submission
- Commented out the Reward Board link in the UserButton component to streamline the user interface.
- Maintained the existing structure for potential future use.
…submission

refactor: comment out Reward Board link in UserButton component
…ard functionality

- Implemented a modal in the layout to prompt new users to complete their profile before proceeding.
- Enhanced the reward board to include badge requirements and improved data handling for unlocked badges.
- Updated the badge model to include requirements and adjusted related services for better data retrieval.
- Refactored reward card component to display requirements and handle card flipping for additional information.
…mission form

- Changed validation messages for GitHub repository links to be more descriptive and user-friendly.
- Enhanced the link validation logic to ensure proper URL formats and uniqueness.
- Updated class names for error handling in form components for better styling consistency.
- Changed badge retrieval logic to use the new badge service, enhancing data handling.
- Updated components to reflect changes in badge data structure, including support for multiple badges.
- Refactored badge notification and reward board components to improve user experience and display logic.
- Added role-based authentication for badge assignment and enhanced error handling in badge awarding process.
- Updated Prisma schema to include new fields for badges and user badges, ensuring better tracking of badge status and requirements.
…mponents

- Added functionality to retrieve user badges associated with a project and pass them to the ProjectOverview and TeamMembers components.
- Updated ProjectOverview to display badges alongside project details.
- Enhanced TeamMembers component to show badges in tooltips for confirmed members, improving user experience and information accessibility.
- Introduced new badge retrieval service to streamline badge data handling.
SebasianDev and others added 2 commits November 7, 2025 10:45
- Removed unnecessary margin from the RequirementsPanel header to enhance visual consistency.
- Adjusted the header class for better alignment and readability.
Signed-off-by: katherineavalabs <katherine.sullivan@avalabs.org>
comment out point system for badges requirements in Staging_badges + comment out hackathon logic + change to achievements board in ui
@navillanueva navillanueva added the DO NOT MERGE This PR is not meant to be merged in its current state label Nov 19, 2025
SebasianDev and others added 4 commits December 2, 2025 00:37
…omponents

- Updated the RewardBoard component to determine badge unlocking based on completion of all requirements instead of mere existence of user badges.
- Introduced a default image for badges in the BadgeNotification component to ensure consistent display when no image is provided.
- Cleaned up code for improved readability and maintainability across both components.
- Introduced useMemo to format the user's email into local part and domain for better readability.
- Updated the rendering logic to conditionally display the formatted email or a fallback message when no email is available.
@martineckardt martineckardt requested a review from Copilot December 2, 2025 15:35
Copy link

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 pull request implements a comprehensive badge system for the platform, introducing a new "staging badges" feature that enables badge assignment based on various requirements including academy courses, hackathon participation, and social interactions. The implementation uses a Strategy pattern for flexible badge assignment and includes UI components for displaying and managing badges across the platform.

Key Changes:

  • Implemented a badge system with multiple assignment strategies (academy, project, social/requirement-based)
  • Added UI components for displaying badges in 3D with interactive modals
  • Integrated badge assignment workflows into authentication, course completion, and project management flows

Reviewed changes

Copilot reviewed 55 out of 57 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
types/badge.ts Refactored badge type definitions to support requirements-based badges and new status fields
server/services/badge.ts Created core badge service with assignment logic for academy badges
server/services/badgeStrategy.ts Implemented Strategy pattern for different badge assignment types
server/services/badgeAssignmentService.ts Service layer coordinating badge assignment across strategies
server/services/socialBadge.ts Implemented social badge assignment based on specific requirements
server/services/project-badge.ts Implemented project-level badge assignment for hackathon projects
server/services/userBadge.ts Service for retrieving user badges
server/services/rewardBoard.ts Refactored reward board to support new badge structure
server/services/exportShowcase.ts Added Excel export functionality for project showcase
components/profile/reward-board/ Complete redesign of badge display with 3D rendering using Three.js
components/showcase/ Enhanced showcase with badge display, assignment UI, and export features
lib/auth/authOptions.ts Integrated badge assignment into GitHub authentication flow
app/api/badge/ New API routes for badge operations (assign, validate, get)
package.json Added dependencies for 3D rendering and Excel generation
Comments suppressed due to low confidence (1)

server/services/inviteProjectMember.ts:1

  • The findFirst query only filters by email and project_id, but if an invitedUser exists with a user_id, there could be a race condition where two members exist: one with just email and another with user_id. The query should also check for user_id when invitedUser is present: where: { OR: [{ email, project_id: projectId }, ...(invitedUser ? [{ user_id: invitedUser.id, project_id: projectId }] : [])] }
import { prisma } from "@/prisma/prisma";

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


export async function getRegisterFormByUserId(userId:string){

const registerForm = await prisma.registerForm.findFirst({})
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Function declares a return type but never returns a value. The function also accepts a userId parameter but doesn't use it in the query, which will return an arbitrary register form instead of the one for the specified user. Add a where clause using the userId parameter and return the result.

Suggested change
const registerForm = await prisma.registerForm.findFirst({})
const registerForm = await prisma.registerForm.findFirst({
where: { userId }
});
return registerForm;

Copilot uses AI. Check for mistakes.
const text = await axiosError.response.data.text();
const errorData = JSON.parse(text);
errorMessage = errorData.message || errorMessage;
} catch {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Empty catch block silently swallows errors. At minimum, log the caught error to help with debugging: catch (parseError) { console.error('Failed to parse error response:', parseError); errorMessage = '...' }

Suggested change
} catch {
} catch (parseError) {
console.error('Failed to parse error response:', parseError);

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +39

const response = await axios.get("/api/badge/get-all");
const filteredBadges = response.data.filter(
(badge: Badge) => badge.category == "hackathon"
);
setOptionsWithLabel(
filteredBadges.map((option: Badge) => ({
label: option.name,
value: option.id,
}))
);
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Missing error handling for the axios request. Wrap the request in a try-catch block to handle potential network errors or API failures gracefully.

Suggested change
const response = await axios.get("/api/badge/get-all");
const filteredBadges = response.data.filter(
(badge: Badge) => badge.category == "hackathon"
);
setOptionsWithLabel(
filteredBadges.map((option: Badge) => ({
label: option.name,
value: option.id,
}))
);
try {
const response = await axios.get("/api/badge/get-all");
const filteredBadges = response.data.filter(
(badge: Badge) => badge.category == "hackathon"
);
setOptionsWithLabel(
filteredBadges.map((option: Badge) => ({
label: option.name,
value: option.id,
}))
);
} catch (error) {
toast({
title: "Failed to fetch badges",
description: "An error occurred while fetching badges.",
variant: "destructive",
duration: 3000,
});
}

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +93
console.error('Error exporting:', error);
toast({
title: "Error exporting projects",
description: error,
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Variable mismatch: catching err but logging error. Should be console.error('Error exporting:', err);

Suggested change
console.error('Error exporting:', error);
toast({
title: "Error exporting projects",
description: error,
console.error('Error exporting:', err);
toast({
title: "Error exporting projects",
description: String(err),

Copilot uses AI. Check for mistakes.
import React, { useEffect, useState } from "react";
import axios from "axios";
import { Button } from "@/components/ui/button";
import { set } from "date-fns";
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Unused import. The set function from date-fns is imported but never used in this file. Remove this import.

Suggested change
import { set } from "date-fns";

Copilot uses AI. Check for mistakes.
Comment on lines 7 to 30
export function SubmissionWrapperSecure({
searchParams,
}: {
searchParams: { [key: string]: string | string[] | undefined };
}) {
const [showComponent, setShowComponent] = useState(false);

const handleShowComponent = (show: boolean) => {
setShowComponent(show);
};

return (
<ProjectSubmissionProvider>
<GeneralSecureComponent searchParams={searchParams} />
{!showComponent && (
<UserNotRegistered
hackathonId={searchParams.hackathon as string}
onToggle={handleShowComponent}
/>
)}
{showComponent && <GeneralSecureComponent searchParams={searchParams} />}
</ProjectSubmissionProvider>
);
}
}
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The component doesn't handle the case where searchParams.hackathon is undefined or an array. This could cause the UserNotRegistered component to receive an invalid hackathonId. Add validation: const hackathonId = typeof searchParams.hackathon === 'string' ? searchParams.hackathon : ''; if (!hackathonId) { return <Error />; }

Copilot uses AI. Check for mistakes.
requirements: userBadge?.requirements || badge.requirements,
};

}).sort(element=>element.is_unlocked ? -1 : 1);
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

[nitpick] Arrow function missing explicit return statement. For clarity, use explicit return: .sort((element) => (element.is_unlocked ? -1 : 1))

Suggested change
}).sort(element=>element.is_unlocked ? -1 : 1);
}).sort(element => { return element.is_unlocked ? -1 : 1; });

Copilot uses AI. Check for mistakes.
Comment on lines +52 to 54
// Show confirmation modal and redirect immediately
setShowModal(true);
router.replace("/profile");
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Setting modal state before navigation is problematic because the redirect happens immediately. The modal may not render before the navigation occurs. Consider using router events or moving the redirect inside the modal's continue handler.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +24
export function withAuthRole(role: string, handler: (request: NextRequest, context: any, session: any) => Promise<NextResponse>) {
return async function (request: NextRequest, context: any) {
const session = await getAuthSession();
const hasRole= session?.user.custom_attributes.includes(role)
if (!session || !hasRole) {
return NextResponse.json({ error: 'Forbidden' }, { status: 401 });
}

return handler(request, context, session);
};
}
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Missing null/undefined check for custom_attributes. If session.user.custom_attributes is undefined, calling .includes() will throw a TypeError. Add a safe check: const hasRole = session?.user.custom_attributes?.includes(role) ?? false

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE This PR is not meant to be merged in its current state

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants