Skip to content

Commit

Permalink
Merge branch 'dev' into test/profile-settings-popup
Browse files Browse the repository at this point in the history
  • Loading branch information
serapieTuyishime committed Jul 10, 2024
2 parents 03c6532 + fedcdab commit 590e63b
Show file tree
Hide file tree
Showing 131 changed files with 2,983 additions and 1,733 deletions.
15 changes: 15 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
reviews:
profile: "chill"
request_changes_workflow: false
high_level_summary: false
poem: false
review_status: true
collapse_walkthrough: true
auto_review:
enabled: true
drafts: false
chat:
auto_reply: true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v21.0.0
v20.14.0
76 changes: 76 additions & 0 deletions __mocks__/fixtures/bounty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { Bounty, BountyCourse } from "@/types/bounty";
import { colors } from "./colors";
import { mockMetadata } from "./community";

export const mockBountyCourse: BountyCourse = {
duration: 0,
slug: "intoduction-to-blockchain",
active: false,
id: "123",
ref: "courses/123",
created_at: new Date(),
updated_at: new Date(),
summary: "this is a course",
level: 0,
name: "introduction to blockchain",
description: "",
objectives: [],
locale: "",
community: "icp",
introduction: {
text: "Introduction",
},
certificateIcon: "",
certificateData: {
narrative: "",
icon: "",
},
timestamp: 0,
learningModules: [],
translations: [],
};
export const mockBounty: Bounty = {
url: "",
image: undefined,
id: "",
ref: "",
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
icon: "",
active: false,
colors,
description: "",
summary: "",
name: "",
slug: "",
metadata: mockMetadata,
timestamp: 0,
course: mockBountyCourse,
challenge: "",
reward: {
id: "",
ref: "",
created_at: new Date(),
updated_at: new Date(),
challenge: "",
type: "",
community: "",
token: "",
stable: false,
fiatCurrency: undefined,
amount: 0,
timestamp: 0,
distribution: undefined,
},
community: "",
};
export const mockTrailer = {
summary: "trailer summary",
description: "trailer descriptio",
video: "trailer video",
duration: 4,
info: {
items: ["item 1", "item 2"],
title: "info title",
},
};
172 changes: 172 additions & 0 deletions __mocks__/fixtures/challenge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import { mockFormat, mockCertificateData, mockCourse, mockLearningModule, mockRatingCriteria } from "./course";
import { mockCommunity, mockMetadata } from "./community";
import { reward } from "./reward";
import { Evaluation, Submission } from "@/types/bounty";
import { AdditionalInfo, Challenge } from "@/types/course";
import { GRADING_CRITERIA, TEAM_FORMATION } from "@/constants/challengeInfo";
import { Team, TeamMember } from "@/types/challenge";
import { Feedback } from "@/types/feedback";
import { mockUser } from "./user";

export const mockAdditionalInfo: { [type: string]: AdditionalInfo } = {
type: { type: "additional type", text: "additional text" },
};

export const challenge: Challenge = {
id: "challenge",
ref: "challenge ref",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
hint: "Hint",
name: "challenge name",
format: mockFormat,
description: "challenge description",
course: mockCourse,
type: "course",
isTeamChallenge: false,
objectives: ["objectives 1", "Objectives 2", "Objectives 3", "Objectives 4"],
threshold: 8,
community: mockCommunity,
reviewTime: 9,
metadata: mockMetadata,
level: 58,
courses: [mockCourse],
learningModules: [mockLearningModule],
expiresAt: "2025",
reward: reward,
certificateIcon: "certificate",
certificateData: mockCertificateData,
ratingCriteria: [mockRatingCriteria],
timestamp: 6,
maxPoints: 299,
minPoints: 9,
rewards: [reward],
feedbacks: {},
feedbackInfo: [{}],
bestSubmissions: [{}],
teamLimit: 5,
isHackathon: false,
additionalInfo: {
[TEAM_FORMATION]: {
type: "teamFormation",
text: "Form your team details here",
},
[GRADING_CRITERIA]: { type: "teamFormation", text: "Sample grading criteria text" },
},
};
export const evaluation: Evaluation = {
evaluator: mockUser,
created_at: new Date("2022-05-01T12:00:00Z"),
comment: "comment",
criteria: [],
metadata: {
language: "language",
},
points: 10,
totalPoints: 1,
reward: {
amount: 10,
token: "token",
},
};

export const submission: Submission = {
length: 0,
id: "submission_id",
ref: "reference",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
link: "/submissions/reference",
community: mockCommunity,
user_id: "user_id",
challenge: challenge,
text: "Submission",
reviewDeadline: new Date(),
metadata: {
applicableReward: {
ref: "",
amount: 0,
updated_at: "",
challenge: "",
created_at: "",
id: "",
type: "",
community: "",
timestamp: 0,
token: "",
},
reviewed: false,
feedbacks: 0,
language: "",
evaluation: {
points: 8,
reward: reward,
score: 80,
totalPoints: 10,
},
},
evaluation: evaluation,
timestamp: 0,
user: mockUser,
reviewable: false,
status: "",
reward: reward,
map: () => {
throw new Error("Function not implemented.");
},
};

export const mockInvite = {
created_at: new Date().toISOString(),
id: "invite",
ref: "invitation ref",
status: "invitation status",
team_ref: "team reference",
timestamp: 3,
updated_at: new Date().toISOString(),
user: mockUser,
user_id: "user id",
};

export const mockTeamMember: TeamMember = {
created_at: new Date().toISOString(),
id: "id",
joined_on: "joined_on",
ref: "ref",
team_ref: "team reference",
timestamp: 3,
updated_at: new Date().toISOString(),
user: mockUser,
};

export const mockTeam: Team = {
challenge: challenge,
challenge_ref: "challenge ref",
created_at: new Date().toISOString(),
id: "id",
locked: true,
name: "Master",
organizer: mockUser,
organizer_id: "organizer id",
invites: [mockInvite],
members: [mockTeamMember],
ref: "",
timestamp: "",
updated_at: new Date().toISOString(),
};

export const mockFeedback: Feedback = {
submission: submission,
id: "234-4231243",
ref: "feedbacks/234-4231243",
created_at: new Date(),
updated_at: "",
criteria: ["criteria 1", "criteria 2"],
positive: false,
name: "The person who made a submission",
challenge: "challenge name",
timestamp: undefined,
user: mockUser,
ranking: 0,
text: "I am providing a feedback",
};
File renamed without changes.
57 changes: 57 additions & 0 deletions __mocks__/fixtures/community.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { Community } from "@/types/community";
import { colors } from "./colors";

export const mockMetadata = {
invite_id: "abc123",
submissions: 5,
bestSubmissions: ["submission1", "submission2"],
feedbacks: 10,
name: "Project XYZ",
issuedOn: "2024-01-29T12:00:00Z",
image: "image_url",
title: "Title of the project",
description: "Description of the project",
narrative: "Narrative of the project",
recipientName: "John Doe",
issuerName: "Jane Smith",
comment: "This is a comment",
linkToWork: "link_to_work",
submission: "submission_details",
};

const mockReward = {
id: "123456789",
ref: "ref123",
created_at: new Date("2024-01-29T08:00:00Z"),
updated_at: new Date("2024-01-29T08:30:00Z"),
challenge: "Challenge Name",
type: "SUBMISSION",
community: "Community Name",
token: "Token ID",
stable: true,
amount: 100,
timestamp: 1643424000,
};

export const mockCommunity: Community = {
id: "ew-43",
ref: "community/ref",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
summary: "this is the summary",
icon: "public/img/communities/aeternity.svg",
name: "aeternity",
image: "public/img/communities/aeternity.svg",
colors: colors,
slug: "ae",
active: true,
description: "this is a aeternity community",
metadata: mockMetadata,
timestamp: 182044800000,
rewards: [mockReward],
reward: mockReward,
courses: 3,
duration: 4,
can_mint_certificates: true,
challenges: 3,
};
Loading

0 comments on commit 590e63b

Please sign in to comment.