Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@supabase/supabase-js": "^2.53.0",
"axios": "^1.8.3",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"framer-motion": "^12.5.0",
"lucide-react": "^0.344.0",
Expand Down
29 changes: 23 additions & 6 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,30 @@ import LoginPage from './components/pages/LoginPage';
import ProfilePage from './components/pages/ProfilePage';
import SignUpPage from './components/pages/SignUpPage';
import { supabase } from './lib/supabaseClient';
import ForgotPasswrdPage from './components/pages/ForgotPasswrdPage';
import ForgotPasswordPage from './components/pages/ForgotPasswordPage';
import ResetPasswordPage from './components/pages/ResetPasswordPage';

// Define proper TypeScript interfaces
interface RepositoryData {
id: string;
name: string;
full_name: string;
description?: string;
html_url: string;
stargazers_count: number;
forks_count: number;
language?: string;
created_at: string;
updated_at: string;
owner: {
login: string;
avatar_url: string;
};
}

function App() {
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
const [repoData, setRepoData] = useState<any>(null);
const [repoData, setRepoData] = useState<RepositoryData | null>(null);
const [isAuthenticated, setIsAuthenticated] = useState(false);

// Auto login if user has already logged in
Expand All @@ -37,7 +55,6 @@ function App() {

const { data: subscription } = supabase.auth.onAuthStateChange(
(event, session) => {
console.log("Auth event:", event, session);
switch (event) {
case "SIGNED_IN":
setIsAuthenticated(true);
Expand All @@ -54,10 +71,10 @@ function App() {
toast("Check your email to reset your password.");
break;
case "TOKEN_REFRESHED":
console.log("Session refreshed");
// Session refreshed silently
break;
case "USER_UPDATED":
console.log("User updated", session?.user);
// User profile updated
break;
}
}
Expand Down Expand Up @@ -126,7 +143,7 @@ function App() {
isAuthenticated ? (
<Navigate to="/" replace />
) : (
<ForgotPasswrdPage />
<ForgotPasswordPage />
)
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const InputField = ({ icon: Icon, ...props }: InputFieldProps) => (
);


export default function ForgotPasswrdPage() {
export default function ForgotPasswordPage() {
const navigate = useNavigate();
const [isLoading, setIsLoading] = useState<boolean>(false);
const [mailPage, setMailPage] = useState<boolean>(false);
Expand All @@ -65,14 +65,12 @@ export default function ForgotPasswrdPage() {
const redirectTo = new URL('/reset-password', base).toString();
const { error } = await supabase.auth.resetPasswordForEmail(email, { redirectTo });
if (error) {
console.error('resetPasswordForEmail failed', error);
toast.error(error.message || 'Could not send reset email.');
return;
}
toast.success('Password reset email sent.');
setMailPage(true);
} catch (err) {
console.error('resetPasswordForEmail unexpected error', err);
toast.error("Something went wrong. Please try again.");
} finally {
setIsLoading(false);
Expand Down
13 changes: 0 additions & 13 deletions frontend/src/components/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';

/**
* Combines Tailwind CSS classes conditionally and merges duplicates.
* @param inputs Tailwind class strings
* @returns Optimized className string
*/
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

/**
* Generates a random API key
* @returns {string} The generated API key
*/
export const generateApiKey = (): string => {
console.log('hello');
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const length = 32;
let result = 'pk_';
Expand Down