Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion src/components/Room/ChatBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const MarkdownRenderer = React.lazy(() =>
);

interface ChatBoxProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
messages: any[];

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove the explicit any usages before removing their suppressions.

These files still contain explicit any after their no-explicit-any suppressions were removed:

  • src/components/Room/ChatBox.tsx#L12-L13: replace messages: any[] with the actual message type.
  • src/components/Room/InviteMenu.tsx#L17-L18: call the typed invite_to_study_room RPC without as any.
  • src/pages/Discover.tsx#L1-L1: type peer data, connection rows, state, and Supabase operations.
  • src/pages/Leaderboard.tsx#L1-L1: use generated database types for RPCs, tables, and mapped rows.
  • src/pages/Notifications.tsx#L1-L1: define the alert row type and remove the Supabase cast.
📍 Affects 5 files
  • src/components/Room/ChatBox.tsx#L12-L13 (this comment)
  • src/components/Room/InviteMenu.tsx#L17-L18
  • src/pages/Discover.tsx#L1-L1
  • src/pages/Leaderboard.tsx#L1-L1
  • src/pages/Notifications.tsx#L1-L1
🤖 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 - 13, Remove the remaining
explicit any usages: in src/components/Room/ChatBox.tsx:12-13, replace messages:
any[] with the actual message type; in src/components/Room/InviteMenu.tsx:17-18,
call the typed invite_to_study_room RPC without an any cast; in
src/pages/Discover.tsx:1-1, type peer data, connection rows, state, and Supabase
operations; in src/pages/Leaderboard.tsx:1-1, use generated database types for
RPCs, tables, and mapped rows; and in src/pages/Notifications.tsx:1-1, define
the alert row type and remove the Supabase cast.

user: User | null;
onSendMessage: (msg: string) => Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Room/InviteMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +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", {
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
8 changes: 4 additions & 4 deletions src/hooks/useRoomPresence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { supabase } from "@/integrations/supabase/client";
import { User } from "@supabase/supabase-js";

export function useRoomPresence(id: string | undefined, user: User | null, fetchMessages: () => void, setActivities: React.Dispatch<React.SetStateAction<string[]>>) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [participants, setParticipants] = useState<any[]>([]);

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

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let roomChannel: any;
let cancelled = false;

const initializeChat = async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { data } = await supabase.from('profiles' as any).select('name').eq('id', user.id).single() as any;

// The effect may have been cleaned up (user left/switched rooms) while
Expand All @@ -31,7 +31,7 @@ export function useRoomPresence(id: string | undefined, user: User | null, fetch
roomChannel
.on('presence', { event: 'sync' }, () => {
const newState = roomChannel.presenceState();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const onlineUsers = Object.values(newState).map((p: any) => p[0]);

setParticipants(onlineUsers);
Expand Down
Loading
Loading