Skip to content

Add Nova Platform #2228

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

Merged
merged 38 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2a36638
feat(nova): set up route for challenges
phatgg221 Jan 23, 2025
13feead
feat(nova): Basic problem page
phatgg221 Feb 2, 2025
f8a3c87
update: update chatbox field
phatgg221 Feb 3, 2025
b4dbe54
feat: update problem set, numbers of problems
phatgg221 Feb 3, 2025
490b1ea
fixed id promise bug
phatgg221 Feb 8, 2025
f3a683a
chore: add real problem data
phatgg221 Feb 8, 2025
3d078e8
fix: delete unused variables
phatgg221 Feb 8, 2025
363f63d
fix!: await bugs for challenge Id
phatgg221 Feb 8, 2025
30a7775
fix: css styling
phatgg221 Feb 8, 2025
fc8856a
chore: AI prompt routes
phatgg221 Feb 9, 2025
5cbfcb6
update google api
phatgg221 Feb 9, 2025
72979f2
feat: test the chatbot evaluation based on the example problem and te…
phatgg221 Feb 9, 2025
966418f
fix: build errors
phatgg221 Feb 9, 2025
1d536db
feat: AI chatbot Json format response
phatgg221 Feb 10, 2025
61399e8
chore: set up routes for prompting history and leaderboards
phatgg221 Feb 11, 2025
20fd82c
chore(nova): change testcase type
phatgg221 Feb 11, 2025
b86ccce
feat: user input and give score
phatgg221 Feb 11, 2025
548b7f3
fix!: add more criteria for marking process
phatgg221 Feb 12, 2025
e204b52
fix!: Marking prompt
phatgg221 Feb 12, 2025
c8ab714
feat: adding loading indicator
phatgg221 Feb 12, 2025
aff5525
feat: save prompt history
phatgg221 Feb 14, 2025
2e6bf70
faet: Update history with to show all history
phatgg221 Feb 14, 2025
de11d71
feat: add styling for last attempts
phatgg221 Feb 14, 2025
8a63127
feat: add switching page confirmation
phatgg221 Feb 14, 2025
4e947f8
feat: add start time mark for user
phatgg221 Feb 15, 2025
3ce3cbf
feat: add timer into the test space
phatgg221 Feb 17, 2025
3bc7e84
feat: add resume test
phatgg221 Feb 17, 2025
6bb9ec2
feat: update start challenge button
phatgg221 Feb 17, 2025
243dc33
chore(nova): report page for each problem
phatgg221 Feb 20, 2025
2f0f176
chore(nova): add routing for report page
phatgg221 Feb 20, 2025
04bf549
fix: build errors
phatgg221 Feb 21, 2025
3cad901
Merge branch 'main' into feat/Nova-projects
vhpx Feb 21, 2025
4c714ae
Merge remote-tracking branch 'origin/feat/Nova-projects' into feat/No…
vhpx Feb 21, 2025
9e7c18d
chore(deps): remove unused dependencies
vhpx Feb 21, 2025
c5a1f8b
chore: remove unused Google Chat route file
vhpx Feb 21, 2025
4085e99
chore: remove unused chat panel and layout components
vhpx Feb 21, 2025
52bb30c
chore: remove obsolete migration files and update column names in que…
vhpx Feb 21, 2025
e3b2c63
chore: refactor user authentication checks and standardize database f…
vhpx Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 267 additions & 0 deletions apps/db/supabase/migrations/20250221165359_add_nova_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
create table "public"."nova_leaderboard" (
"id" uuid not null default gen_random_uuid(),
"score" real,
"user_id" uuid,
"problem_id" text,
"created_at" timestamp with time zone not null default now()
);

alter table
"public"."nova_leaderboard" enable row level security;

create table "public"."nova_test_timer_record" (
"id" uuid not null default gen_random_uuid(),
"duration" integer,
"problem_id" text,
"user_id" uuid,
"test_status" text,
"created_at" timestamp with time zone not null default now()
);

alter table
"public"."nova_test_timer_record" enable row level security;

create table "public"."nova_users_problem_history" (
"id" bigint generated by default as identity not null,
"problem_id" text,
"user_id" uuid,
"score" real,
"feedback" text,
"user_prompt" text,
"problem_set_id" text,
"created_at" timestamp with time zone not null default now()
);

alter table
"public"."nova_users_problem_history" enable row level security;

CREATE UNIQUE INDEX nova_leaderboard_pkey ON public.nova_leaderboard USING btree (id);

CREATE UNIQUE INDEX nova_test_timer_record_pkey ON public.nova_test_timer_record USING btree (id);

CREATE UNIQUE INDEX nova_users_problem_history_pkey ON public.nova_users_problem_history USING btree (id);

alter table
"public"."nova_leaderboard"
add
constraint "nova_leaderboard_pkey" PRIMARY KEY using index "nova_leaderboard_pkey";

alter table
"public"."nova_test_timer_record"
add
constraint "nova_test_timer_record_pkey" PRIMARY KEY using index "nova_test_timer_record_pkey";

alter table
"public"."nova_users_problem_history"
add
constraint "nova_users_problem_history_pkey" PRIMARY KEY using index "nova_users_problem_history_pkey";

alter table
"public"."nova_leaderboard"
add
constraint "nova_leaderboard_userId_fkey" FOREIGN KEY (user_id) REFERENCES workspace_users(id) not valid;

alter table
"public"."nova_leaderboard" validate constraint "nova_leaderboard_userId_fkey";

alter table
"public"."nova_test_timer_record"
add
constraint "nova_test_timer_record_userId_fkey" FOREIGN KEY (user_id) REFERENCES users(id) not valid;

alter table
"public"."nova_test_timer_record" validate constraint "nova_test_timer_record_userId_fkey";

alter table
"public"."nova_users_problem_history"
add
constraint "nova_users_problem_history_userId_fkey" FOREIGN KEY (user_id) REFERENCES users(id) not valid;

alter table
"public"."nova_users_problem_history" validate constraint "nova_users_problem_history_userId_fkey";

grant delete on table "public"."nova_leaderboard" to "anon";

grant
insert
on table "public"."nova_leaderboard" to "anon";

grant references on table "public"."nova_leaderboard" to "anon";

grant
select
on table "public"."nova_leaderboard" to "anon";

grant trigger on table "public"."nova_leaderboard" to "anon";

grant truncate on table "public"."nova_leaderboard" to "anon";

grant
update
on table "public"."nova_leaderboard" to "anon";

grant delete on table "public"."nova_leaderboard" to "authenticated";

grant
insert
on table "public"."nova_leaderboard" to "authenticated";

grant references on table "public"."nova_leaderboard" to "authenticated";

grant
select
on table "public"."nova_leaderboard" to "authenticated";

grant trigger on table "public"."nova_leaderboard" to "authenticated";

grant truncate on table "public"."nova_leaderboard" to "authenticated";

grant
update
on table "public"."nova_leaderboard" to "authenticated";

grant delete on table "public"."nova_leaderboard" to "service_role";

grant
insert
on table "public"."nova_leaderboard" to "service_role";

grant references on table "public"."nova_leaderboard" to "service_role";

grant
select
on table "public"."nova_leaderboard" to "service_role";

grant trigger on table "public"."nova_leaderboard" to "service_role";

grant truncate on table "public"."nova_leaderboard" to "service_role";

grant
update
on table "public"."nova_leaderboard" to "service_role";

grant delete on table "public"."nova_test_timer_record" to "anon";

grant
insert
on table "public"."nova_test_timer_record" to "anon";

grant references on table "public"."nova_test_timer_record" to "anon";

grant
select
on table "public"."nova_test_timer_record" to "anon";

grant trigger on table "public"."nova_test_timer_record" to "anon";

grant truncate on table "public"."nova_test_timer_record" to "anon";

grant
update
on table "public"."nova_test_timer_record" to "anon";

grant delete on table "public"."nova_test_timer_record" to "authenticated";

grant
insert
on table "public"."nova_test_timer_record" to "authenticated";

grant references on table "public"."nova_test_timer_record" to "authenticated";

grant
select
on table "public"."nova_test_timer_record" to "authenticated";

grant trigger on table "public"."nova_test_timer_record" to "authenticated";

grant truncate on table "public"."nova_test_timer_record" to "authenticated";

grant
update
on table "public"."nova_test_timer_record" to "authenticated";

grant delete on table "public"."nova_test_timer_record" to "service_role";

grant
insert
on table "public"."nova_test_timer_record" to "service_role";

grant references on table "public"."nova_test_timer_record" to "service_role";

grant
select
on table "public"."nova_test_timer_record" to "service_role";

grant trigger on table "public"."nova_test_timer_record" to "service_role";

grant truncate on table "public"."nova_test_timer_record" to "service_role";

grant
update
on table "public"."nova_test_timer_record" to "service_role";

grant delete on table "public"."nova_users_problem_history" to "anon";

grant
insert
on table "public"."nova_users_problem_history" to "anon";

grant references on table "public"."nova_users_problem_history" to "anon";

grant
select
on table "public"."nova_users_problem_history" to "anon";

grant trigger on table "public"."nova_users_problem_history" to "anon";

grant truncate on table "public"."nova_users_problem_history" to "anon";

grant
update
on table "public"."nova_users_problem_history" to "anon";

grant delete on table "public"."nova_users_problem_history" to "authenticated";

grant
insert
on table "public"."nova_users_problem_history" to "authenticated";

grant references on table "public"."nova_users_problem_history" to "authenticated";

grant
select
on table "public"."nova_users_problem_history" to "authenticated";

grant trigger on table "public"."nova_users_problem_history" to "authenticated";

grant truncate on table "public"."nova_users_problem_history" to "authenticated";

grant
update
on table "public"."nova_users_problem_history" to "authenticated";

grant delete on table "public"."nova_users_problem_history" to "service_role";

grant
insert
on table "public"."nova_users_problem_history" to "service_role";

grant references on table "public"."nova_users_problem_history" to "service_role";

grant
select
on table "public"."nova_users_problem_history" to "service_role";

grant trigger on table "public"."nova_users_problem_history" to "service_role";

grant truncate on table "public"."nova_users_problem_history" to "service_role";

grant
update
on table "public"."nova_users_problem_history" to "service_role";

create policy "Enable all access for current user" on "public"."nova_leaderboard" as permissive for all to authenticated using ((user_id = auth.uid())) with check ((user_id = auth.uid()));

create policy "Enable all access for current user" on "public"."nova_test_timer_record" as permissive for all to public using ((user_id = auth.uid())) with check ((user_id = auth.uid()));

create policy "Enable all access for current user" on "public"."nova_users_problem_history" as permissive for all to public using ((user_id = auth.uid())) with check ((user_id = auth.uid()));
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use client';

import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';

interface CountdownTimerProps {
createdAt: string;
duration: number;
problemId: number;
wsId: string;
// onUpdateDuration: (remainingTime: number) => void;
}

export default function CountdownTimer({
createdAt,
duration,
problemId,
wsId,
// onUpdateDuration,
}: CountdownTimerProps) {
const router = useRouter();
const [timeLeft, setTimeLeft] = useState(duration * 60);
console.log(duration);
useEffect(() => {
if (!createdAt || !duration) return;

const startTime = new Date(createdAt).getTime();
const endTime = startTime + duration * 60000;

const updateTimer = () => {
const now = new Date().getTime();
const remaining = Math.max(0, Math.floor((endTime - now) / 1000)); // Get remaining seconds
setTimeLeft(remaining);

if (remaining === 0) {
// onUpdateDuration(0);
router.push(`/${wsId}/challenges/${problemId}/test-ended`);
}
};

const interval = setInterval(updateTimer, 1000);
updateTimer();

return () => clearInterval(interval);
}, [createdAt, duration, router]);

const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;

return (
<div className="text-xl font-bold text-red-600">
Time Left: {minutes}:{seconds < 10 ? `0${seconds}` : seconds}
</div>
);
}
Loading