import { Box, Divider, Flex, FormControl, FormLabel, Icon, Link, Stack, Text, } from '@chakra-ui/react'; import { __ } from '@wordpress/i18n'; import React from 'react'; import { BiBook, BiLinkExternal } from 'react-icons/bi'; import { accountPageFormLabelStyles } from '../../../../../../assets/js/account/utils/general'; interface Course { id: number; title: string; permalink?: string; } interface LinkedCoursesProps { courses: Course[]; } const LinkedCourses: React.FC = ({ courses }) => { // Use singular or plural based on course count const courseLabel = courses && courses.length === 1 ? __('Enrolled Course', 'learning-management-system') : __('Enrolled Courses', 'learning-management-system'); if (!courses || courses.length === 0) { return ( {courseLabel} {__( 'No courses are enrolled for this group.', 'learning-management-system', )} ); } return ( {courseLabel} {courses.map((course, index) => ( {course.permalink ? ( {course.title} ) : ( {course.title} )} {index < courses.length - 1 && } ))} ); }; export default LinkedCourses;