From 186e1e25c80737d8e6aa5411f95b48bc9dfab371 Mon Sep 17 00:00:00 2001 From: iliyangermanov Date: Sat, 4 May 2024 21:03:40 +0300 Subject: [PATCH] Improve UI + WIP content --- .../ui/screen/home/composable/CourseCard.kt | 6 +++--- .../kotlin/ivy/learn/data/cms/TopicsContent.kt | 18 +++++++++++++++--- .../learn/data/cms/course/CoursesContent.kt | 3 ++- .../data/cms/course/GeneralProgramming.kt | 14 -------------- .../course/programming/ProgrammingBasics.kt | 15 +++++++++++++++ .../programming/ProgrammingFundamentals.kt | 10 ++++++++++ .../kotlin/ivy/learn/api/CoursesApiTest.kt | 8 ++++---- 7 files changed, 49 insertions(+), 25 deletions(-) delete mode 100644 server/src/main/kotlin/ivy/learn/data/cms/course/GeneralProgramming.kt create mode 100644 server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingBasics.kt create mode 100644 server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingFundamentals.kt diff --git a/composeApp/src/commonMain/kotlin/ui/screen/home/composable/CourseCard.kt b/composeApp/src/commonMain/kotlin/ui/screen/home/composable/CourseCard.kt index 056322d..7c284d0 100644 --- a/composeApp/src/commonMain/kotlin/ui/screen/home/composable/CourseCard.kt +++ b/composeApp/src/commonMain/kotlin/ui/screen/home/composable/CourseCard.kt @@ -39,7 +39,7 @@ fun CourseCard( imageUrl = course.imageUrl, onClick = onCourseClick ) - Spacer(Modifier.height(12.dp)) + Spacer(Modifier.height(16.dp)) Title( modifier = Modifier.padding(horizontal = 16.dp), text = course.name, @@ -50,7 +50,7 @@ fun CourseCard( modifier = Modifier.padding(horizontal = 16.dp), text = course.tagline ) - Spacer(Modifier.height(12.dp)) + Spacer(Modifier.height(16.dp)) } } } @@ -65,7 +65,7 @@ private fun Banner( KamelImage( modifier = modifier .fillMaxWidth() - .height(160.dp), + .height(148.dp), contentScale = ContentScale.FillWidth, resource = asyncPainterResource(imageUrl), contentDescription = null diff --git a/server/src/main/kotlin/ivy/learn/data/cms/TopicsContent.kt b/server/src/main/kotlin/ivy/learn/data/cms/TopicsContent.kt index eb43e12..993d898 100644 --- a/server/src/main/kotlin/ivy/learn/data/cms/TopicsContent.kt +++ b/server/src/main/kotlin/ivy/learn/data/cms/TopicsContent.kt @@ -1,10 +1,22 @@ package ivy.learn.data.cms -import ivy.learn.data.cms.course.GeneralProgramming +import ivy.learn.data.cms.course.programming.ProgrammingBasics import ivy.learn.data.cms.dsl.TopicsDsl object TopicsContent : TopicsDsl({ - topic("General Programming") { - course(GeneralProgramming) + topic("Programming") { + course(ProgrammingBasics) + } + topic("Functional Programming") { + + } + topic("Object Oriented Programming") { + + } + topic("Kotlin") { + + } + topic("Compose") { + } }) \ No newline at end of file diff --git a/server/src/main/kotlin/ivy/learn/data/cms/course/CoursesContent.kt b/server/src/main/kotlin/ivy/learn/data/cms/course/CoursesContent.kt index 9299ff3..eb08f71 100644 --- a/server/src/main/kotlin/ivy/learn/data/cms/course/CoursesContent.kt +++ b/server/src/main/kotlin/ivy/learn/data/cms/course/CoursesContent.kt @@ -1,7 +1,8 @@ package ivy.learn.data.cms.course +import ivy.learn.data.cms.course.programming.ProgrammingBasics import ivy.learn.data.cms.dsl.CoursesDsl object CoursesContent : CoursesDsl({ - course(GeneralProgramming) + course(ProgrammingBasics) }) \ No newline at end of file diff --git a/server/src/main/kotlin/ivy/learn/data/cms/course/GeneralProgramming.kt b/server/src/main/kotlin/ivy/learn/data/cms/course/GeneralProgramming.kt deleted file mode 100644 index 5c2e984..0000000 --- a/server/src/main/kotlin/ivy/learn/data/cms/course/GeneralProgramming.kt +++ /dev/null @@ -1,14 +0,0 @@ -package ivy.learn.data.cms.course - -import ivy.learn.data.cms.dsl.CourseDsl - -object GeneralProgramming : CourseDsl({ - name = "General Programming" - tagline = "Learn the basics of programming" - imageUrl = "tbd" - lesson( - name = "Programming Fundamentals 101", - tagline = "Learn the basics of programming", - imageUrl = "tbd" - ) -}) \ No newline at end of file diff --git a/server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingBasics.kt b/server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingBasics.kt new file mode 100644 index 0000000..f4d4881 --- /dev/null +++ b/server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingBasics.kt @@ -0,0 +1,15 @@ +package ivy.learn.data.cms.course.programming + +import ivy.learn.data.cms.dsl.CourseDsl + +object ProgrammingBasics : CourseDsl({ + name = "Programming Basics" + tagline = "Learn the basics of programming from a different perspective." + imageUrl = + "https://i.ibb.co/nMLdcD5/DALL-E-2024-05-04-20-50-03-A-wide-banner-image-for-a-course-titled-Programming-Basics-with-the-tagli.webp" + lesson( + name = "What is programming?", + tagline = "Learn the basics of programming", + imageUrl = "tbd" + ) +}) \ No newline at end of file diff --git a/server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingFundamentals.kt b/server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingFundamentals.kt new file mode 100644 index 0000000..c6e9e55 --- /dev/null +++ b/server/src/main/kotlin/ivy/learn/data/cms/course/programming/ProgrammingFundamentals.kt @@ -0,0 +1,10 @@ +package ivy.learn.data.cms.course.programming + +import ivy.learn.data.cms.dsl.CourseDsl + +object ProgrammingFundamentals : CourseDsl({ + name = "Programming Fundamentals" + tagline = "Learn the basics of programming from a different perspective." + imageUrl = + "https://i.ibb.co/nMLdcD5/DALL-E-2024-05-04-20-50-03-A-wide-banner-image-for-a-course-titled-Programming-Basics-with-the-tagli.webp" +}) \ No newline at end of file diff --git a/server/src/test/kotlin/ivy/learn/api/CoursesApiTest.kt b/server/src/test/kotlin/ivy/learn/api/CoursesApiTest.kt index 5cc596e..3864179 100644 --- a/server/src/test/kotlin/ivy/learn/api/CoursesApiTest.kt +++ b/server/src/test/kotlin/ivy/learn/api/CoursesApiTest.kt @@ -5,7 +5,7 @@ import io.kotest.matchers.shouldBe import ivy.data.source.CoursesDataSource import ivy.data.source.model.CourseResponse import ivy.di.Di -import ivy.learn.data.cms.course.GeneralProgramming +import ivy.learn.data.cms.course.programming.ProgrammingBasics import ivy.learn.testsupport.ApiTest import org.junit.Test @@ -16,12 +16,12 @@ class CoursesApiTest : ApiTest() { val datasource: CoursesDataSource = Di.get() // When - val result = datasource.fetchCourseById(GeneralProgramming.course.id) + val result = datasource.fetchCourseById(ProgrammingBasics.course.id) // Then result.shouldBeRight() shouldBe CourseResponse( - course = GeneralProgramming.course, - lessons = GeneralProgramming.lessons, + course = ProgrammingBasics.course, + lessons = ProgrammingBasics.lessons, ) } } \ No newline at end of file