Skip to content
Merged
1 change: 1 addition & 0 deletions config/constants/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
RESOURCE_ROLES_API_URL: `${DEV_API_HOSTNAME}/v6/resource-roles`,
SUBMISSIONS_API_URL: `${DEV_API_HOSTNAME}/v6/submissions`,
REVIEW_TYPE_API_URL: `${DEV_API_HOSTNAME}/v6/reviewTypes`,
SCORECARDS_API_URL: `${DEV_API_HOSTNAME}/v6/scorecards`,
SUBMISSION_REVIEW_APP_URL: `https://submission-review.${DOMAIN}/challenges`,
STUDIO_URL: `https://studio.${DOMAIN}`,
CONNECT_APP_URL: `https://connect.${DOMAIN}`,
Expand Down
1 change: 1 addition & 0 deletions config/constants/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
RESOURCE_ROLES_API_URL: `${PROD_API_HOSTNAME}/v5/resource-roles`,
SUBMISSIONS_API_URL: `${PROD_API_HOSTNAME}/v5/submissions`,
REVIEW_TYPE_API_URL: `${PROD_API_HOSTNAME}/v5/reviewTypes`,
SCORECARDS_API_URL: `${PROD_API_HOSTNAME}/v5/scorecards`, //update to use v6
SUBMISSION_REVIEW_APP_URL: `https://submission-review.${DOMAIN}/challenges`,
STUDIO_URL: `https://studio.${DOMAIN}`,
CONNECT_APP_URL: `https://connect.${DOMAIN}`,
Expand Down
54 changes: 53 additions & 1 deletion src/actions/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import {
createChallenge as createChallengeAPI,
createResource as createResourceAPI,
deleteResource as deleteResourceAPI,
updateChallengeSkillsApi
updateChallengeSkillsApi,
fetchDefaultReviewers,
fetchScorecards
} from '../services/challenges'
import { searchProfilesByUserIds } from '../services/user'
import {
Expand Down Expand Up @@ -765,3 +767,53 @@ export function updateChallengeSkills (challengeId, skills) {
}
}
}

/**
* Load scorecards
* @param {Object} filters filters for scorecards
*/
export function loadScorecards (filters = {}) {
return async (dispatch) => {
try {
const scorecards = await fetchScorecards(filters)
dispatch({
type: LOAD_CHALLENGE_METADATA_SUCCESS,
metadataKey: 'scorecards',
metadataValue: scorecards.scoreCards || []
})
} catch (error) {
console.error('Error loading scorecards:', error)
Copy link

Choose a reason for hiding this comment

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

Using console.error for error logging is fine for development, but consider using a more robust logging mechanism for production environments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vas3a Do I need to remove console.error ?

// Return empty array on error to maintain consistency
dispatch({
type: LOAD_CHALLENGE_METADATA_SUCCESS,
metadataKey: 'scorecards',
metadataValue: []
})
}
}
}

/**
* Load default reviewers
* @param {Object} filters filters for default reviewers
*/
export function loadDefaultReviewers (filters = {}) {
return async (dispatch) => {
try {
const defaultReviewers = await fetchDefaultReviewers(filters)
dispatch({
type: LOAD_CHALLENGE_METADATA_SUCCESS,
metadataKey: 'defaultReviewers',
metadataValue: defaultReviewers
})
} catch (error) {
console.error('Error loading default reviewers:', error)
Copy link

Choose a reason for hiding this comment

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

Using console.error for error logging is fine for development, but consider using a more robust logging mechanism for production environments.

// Return empty array on error to maintain consistency
dispatch({
type: LOAD_CHALLENGE_METADATA_SUCCESS,
metadataKey: 'defaultReviewers',
metadataValue: []
})
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
@import '../../../styles/includes';

.row {
box-sizing: border-box;
display: flex;
flex-direction: row;
margin: 30px 30px 0 30px;
align-content: space-between;
justify-content: flex-start;

.field {
@include upto-sm {
display: block;
padding-bottom: 10px;
}

label {
@include roboto-bold();
font-size: 16px;
line-height: 19px;
font-weight: 500;
color: $tc-gray-80;
}

&.col1 {
max-width: 185px;
min-width: 185px;
margin-right: 14px;
white-space: nowrap;
display: flex;
align-items: center;
}

&.col2 {
align-self: flex-end;
margin-bottom: auto;
margin-top: auto;
display: flex;
flex-direction: column;
width: 600px;
}
}
}

.description {
color: #666;
margin-bottom: 20px;
font-size: 14px;
line-height: 1.4;
}

.noReviewers {
text-align: center;
padding: 30px;
color: #999;
font-style: italic;
background-color: #f5f5f5;
border-radius: 4px;
margin-bottom: 20px;
}

.defaultReviewerNote {
margin-top: 20px;
padding: 15px;
background-color: #e3f2fd;
border: 1px solid #bbdefb;
border-radius: 4px;
}

.defaultReviewerNote p {
margin: 0 0 15px 0;
color: #1976d2;
font-style: normal;
}

.reviewerForm {
background-color: white;
border: 1px solid #ddd;
border-radius: 4px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.reviewerHeader {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}

.reviewerHeader h4 {
margin: 0;
color: #333;
font-size: 16px;
font-weight: 600;
}

.formRow {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 15px;
}

.formGroup {
flex: 1;
min-width: 200px;
}

.formGroup label {
display: block;
margin-bottom: 5px;
font-weight: 500;
color: #555;
font-size: 14px;
}

.formGroup input,
.formGroup select {
width: 100%;
padding: 8px 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
background-color: white;
}

.formGroup input:focus,
.formGroup select:focus {
outline: none;
border-color: #0066cc;
box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.addButton {
text-align: center;
margin-top: 20px;
}

.summary {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 4px;
padding: 20px;
margin: 20px 0;
}

.summary h4 {
margin: 0 0 15px 0;
color: #333;
font-size: 16px;
font-weight: 600;
}

.summaryRow {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
border-bottom: 1px solid #eee;
}

.summaryRow:last-child {
border-bottom: none;
font-weight: 600;
color: #0066cc;
}

.summaryRow span:first-child {
color: #666;
}

.summaryRow span:last-child {
font-weight: 500;
}

.loading {
text-align: center;
padding: 40px;
color: #666;
font-style: italic;
}

.error {
color: $tc-red;
background-color: #ffebee;
padding: 15px;
border-radius: 4px;
border: 1px solid #ffcdd2;
margin-bottom: 20px;
}

.validationErrors {
background-color: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 4px;
padding: 10px;
margin-bottom: 15px;
}

.validationError {
color: #856404;
font-size: 13px;
margin-bottom: 5px;
}

.validationError:last-child {
margin-bottom: 0;
}

// Responsive adjustments
@media (max-width: 768px) {
.formRow {
flex-direction: column;
gap: 15px;
}

.formGroup {
min-width: 100%;
}

.reviewerHeader {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
}
Loading