diff --git a/frontend/app/study-groups/page.tsx b/frontend/app/study-groups/page.tsx index 6baa738..599eaa1 100644 --- a/frontend/app/study-groups/page.tsx +++ b/frontend/app/study-groups/page.tsx @@ -12,81 +12,67 @@ 'use client'; -import type { ChangeEvent } from 'react'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; -import { Button, Heading, Pane, Text, TextInputField, majorScale, useTheme } from 'evergreen-ui'; +import { Button, Heading, Pane, Text, majorScale, useTheme } from 'evergreen-ui'; import Link from 'next/link'; -/** - * A React component that renders a form for user interaction, allowing users to input their name - * and select an option from a dropdown menu. It uses Evergreen UI components for styling and - * integrates with Auth0 for user authentication. The form submission triggers an async action that - * simulates an API call and provides feedback through toast notifications. - * - * @returns {JSX.Element} The form component with user interaction elements. - */ +import { getAllStudyGroup } from '@/api/studyGroupService'; +import StudyGroupCard from '@/components/StudyGroupCard/StudyGroupCard'; + export function StudyGroups() { - /** - * Handles the input field which can perform queries - */ const theme = useTheme(); - const [inputValue, setInputValue] = useState(''); - const handleChange = (e: ChangeEvent) => { - setInputValue(e.target.value); - }; + const [studyGroups, setStudyGroups] = + useState>>(null); - /** - * Handles the button click - */ - const handleSubmit = () => { - // Placeholder for button click action - }; + useEffect(() => { + getAllStudyGroup().then(setStudyGroups); + }, []); return ( - {/* Main header */} - + Study Groups - {/* Subtitle */} - - Find classmates and form study groups - - - + Find classmates and form study groups - - + + - + + - - - - - + + {studyGroups === null ? ( + Loading study groups... + ) : studyGroups.length === 0 ? ( + No study groups found. + ) : ( + studyGroups.map((group) => ( + {}} + /> + )) + )} );