Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
107 changes: 107 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@radix-ui/react-toggle": "^1.1.9",
"@radix-ui/react-toggle-group": "^1.1.10",
"@radix-ui/react-tooltip": "^1.2.7",
"@sentry/react": "^10.67.0",
"@supabase/supabase-js": "^2.102.1",
"@tanstack/react-query": "^5.83.0",
"@tanstack/react-virtual": "^3.14.2",
Expand Down
6 changes: 4 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function AppContent() {
<MouseSparkles />
<CookieConsentBanner />

<Routes>
<ErrorBoundary>
<Routes>
<Route
path="/"
element={user ? <Navigate to="/dashboard" replace /> : <WithNav><Index /></WithNav>}
Expand Down Expand Up @@ -380,7 +381,8 @@ function AppContent() {
/>

<Route path="*" element={<NotFound />} />
</Routes>
</Routes>
</ErrorBoundary>

{user && (
<>
Expand Down
1 change: 0 additions & 1 deletion src/components/AvatarUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useRef, useState } from "react";
import { Camera, Loader2 } from "lucide-react";
import { supabase } from "@/integrations/supabase/client";
import { API_BASE_URL } from "@/config/api";

type AvatarUploadProps = {
currentAvatarUrl: string;
onUploadSuccess: (url: string) => void;
Expand Down
7 changes: 6 additions & 1 deletion src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import * as Sentry from "@sentry/react";
import { AlertTriangle, RefreshCw, Home } from "lucide-react";

interface Props {
Expand All @@ -20,8 +21,12 @@ class ErrorBoundary extends React.Component<Props, State> {
}

componentDidCatch(error: Error, info: React.ErrorInfo) {
// TODO: hook this up to an error tracking service later
console.error("ErrorBoundary caught an error:", error, info.componentStack);
Sentry.captureException(error, {
extra: {
componentStack: info.componentStack,
},
});
}

resetError = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FloatingAI.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState } from "react";
import { Bot, Send, X, User } from "lucide-react";
import { API_BASE_URL } from "@/config/api";
Expand Down
2 changes: 1 addition & 1 deletion src/components/NotificationsDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect, useRef } from "react";
import { Bell } from "lucide-react";
import { supabase } from "@/integrations/supabase/client";
Expand Down
8 changes: 6 additions & 2 deletions src/components/Room/ChatBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ const MarkdownRenderer = React.lazy(() =>
);

interface ChatBoxProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
messages: any[];
messages: {
id: string;
profile_id: string;
content: string;
profiles?: { name: string | null } | null;
}[];
Comment on lines +12 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep profile_id nullable.

The generated study_room_messages row defines profile_id as string | null, but this prop requires string. Typed Supabase rows with anonymous messages will not satisfy ChatBoxProps.

Proposed fix
   messages: {
     id: string;
-    profile_id: string;
+    profile_id: string | null;
     content: string;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
messages: {
id: string;
profile_id: string;
content: string;
profiles?: { name: string | null } | null;
}[];
messages: {
id: string;
profile_id: string | null;
content: string;
profiles?: { name: string | null } | null;
}[];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Room/ChatBox.tsx` around lines 12 - 17, Update the messages
prop type in ChatBoxProps to declare profile_id as string | null, matching the
generated study_room_messages row and allowing anonymous messages. Preserve the
existing id, content, and profiles field definitions.

user: User | null;
onSendMessage: (msg: string) => Promise<void>;
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Room/InviteMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const InviteMenu = React.memo(function InviteMenu({ roomId }: InviteMenuP
const handleInvite = async () => {
if (!inviteEmail.trim()) return;
setIsInviting(true);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { error } = await (supabase.rpc as any)("invite_to_study_room", {
const { error } = await supabase.rpc("invite_to_study_room", {
p_room_id: roomId,
p_user_email: inviteEmail,
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sparkles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import React, { useEffect, useRef } from 'react';

const Sparkles: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/StudyRooms.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { supabase } from '@/integrations/supabase/client';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Whiteboard/Canvas.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useCallback, useEffect, useRef, useState } from "react";
import { supabase } from "@/integrations/supabase/client";
import { useAuth } from "@/contexts/useAuth";
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/RecentActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function RecentActivity() {
supabase
.from("resources")
.select("id, title, created_at")
.eq("user_id", user.id)
.eq("uploaded_by", user.id)
.order("created_at", { ascending: false })
.limit(3),
supabase
Expand Down
34 changes: 18 additions & 16 deletions src/components/landing/Testimonials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,7 @@ function mapDbRowToTestimonial(row: {
};
}

export function Testimonials() {
const scrollRef = useRef<HTMLDivElement | null>(null);
const testimonialAutoScrollRef = useRef<number | null>(null);
const testimonialPausedRef = useRef(false);
const { user } = useAuth();

const [name, setName] = useState("");
const [rating, setRating] = useState(0);
const [review, setReview] = useState("");
const [submitted, setSubmitted] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
const [liveTestimonials, setLiveTestimonials] = useState<Testimonial[]>([]);

// Seeded fallback content — always shown so the carousel never looks empty
// while real submissions are still trickling in.
const seedTestimonials: Testimonial[] = [
const seedTestimonials: Testimonial[] = [
{
text: "PeerLearn helped me crack my first internship interview.",
name: "Aisha Khan",
Expand Down Expand Up @@ -128,6 +113,23 @@ export function Testimonials() {
},
];

export function Testimonials() {
const scrollRef = useRef<HTMLDivElement | null>(null);
const testimonialAutoScrollRef = useRef<number | null>(null);
const testimonialPausedRef = useRef(false);
const { user } = useAuth();

const [name, setName] = useState("");
const [rating, setRating] = useState(0);
const [review, setReview] = useState("");
const [submitted, setSubmitted] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
const [liveTestimonials, setLiveTestimonials] = useState<Testimonial[]>([]);

// Seeded fallback content — always shown so the carousel never looks empty
// while real submissions are still trickling in.


const fetchTestimonials = useCallback(async () => {
const { data, error } = await supabase
.from("testimonials")
Expand Down
1 change: 1 addition & 0 deletions src/components/markdown/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* eslint-disable react-refresh/only-export-components */
export { MarkdownRenderer, default } from "@/components/MarkdownRenderer";
1 change: 1 addition & 0 deletions src/components/mentor/MentorForm.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { useState, useEffect } from "react";
import { motion } from "framer-motion";
import { CheckCircle2, Loader2, Plus, X } from "lucide-react";
Expand Down
1 change: 1 addition & 0 deletions src/components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* eslint-disable react-refresh/only-export-components */
export { ThemeProvider, useTheme } from "@/contexts/ThemeContext";
1 change: 1 addition & 0 deletions src/components/ui/sonner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-refresh/only-export-components */
import { Toaster as Sonner, toast } from "sonner";

type ToasterProps = React.ComponentProps<typeof Sonner>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type, no-unsafe-finally, @typescript-eslint/no-unused-expressions, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-require-imports */
import * as React from "react";

import { cn } from "@/lib/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/features/notifications/pushNotifications.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { supabase } from "@/integrations/supabase/client";
import { env } from "@/env";
import { sanitizeNotificationActionUrl } from "./actionUrl";
Expand Down
4 changes: 2 additions & 2 deletions src/features/notifications/useNotifications.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { supabase } from "@/integrations/supabase/client";
import type { Notification } from "./types";
import { showBrowserNotification } from "./pushNotifications";
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAwardXP.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { supabase } from "@/integrations/supabase/client";
import { getXPForActivity } from "@/lib/gamification";
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useRoomChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { supabase } from "@/integrations/supabase/client";
import { User } from "@supabase/supabase-js";

export function useRoomChat(id: string | undefined, user: User | null) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [messages, setMessages] = useState<any[]>([]);

const fetchMessages = useCallback(async () => {
if (!id) return;
const { data, error } = await supabase
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.from('study_room_messages' as any)
.select('*, profiles(name, avatar_url)')
.eq('room_id', id)
Expand All @@ -30,7 +30,7 @@ export function useRoomChat(id: string | undefined, user: User | null) {
const handleSendMessage = useCallback(async (newMessage: string) => {
if (!newMessage.trim() || !user || !id) return false;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { error } = await supabase.from('study_room_messages' as any).insert([
{ room_id: id, profile_id: user.id, content: newMessage }
]);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useRoomDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { supabase } from "@/integrations/supabase/client";
import { User } from "@supabase/supabase-js";

export function useRoomDetails(id: string | undefined, user: User | null) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [room, setRoom] = useState<any>(null);
const navigate = useNavigate();

useEffect(() => {
if (!id) return;

const fetchRoomDetails = async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { data, error } = await supabase.from('study_rooms' as any).select('*').eq('id', id).single();
if (error) {
console.error("Error fetching room:", error);
Expand Down
Loading
Loading