Skip to content

Commit

Permalink
Show average in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiebe committed Jun 26, 2024
1 parent 1afa3e4 commit 270cd29
Show file tree
Hide file tree
Showing 43 changed files with 1,245 additions and 9 deletions.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_1_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_1_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_2_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_2_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_3_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_3_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_4_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_4_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_5_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_5_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_6_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_6_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_7_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_7_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_8_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_8_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_9_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/bottombar/grades/box_9_outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package nl.tiebe.otarium.logic.root.home

import androidx.compose.material3.*
import androidx.compose.material3.Badge
import androidx.compose.material3.BadgedBox
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState
import com.arkivanov.decompose.value.MutableValue
Expand All @@ -10,10 +13,38 @@ import dev.icerock.moko.resources.StringResource
import nl.tiebe.otarium.Data
import nl.tiebe.otarium.MR
import nl.tiebe.otarium.utils.OtariumIcons
import nl.tiebe.otarium.utils.calculateAverageGrade
import nl.tiebe.otarium.utils.otariumicons.Bottombar
import nl.tiebe.otarium.utils.otariumicons.bottombar.*
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.*
import kotlin.math.roundToInt

val unreadMessages = MutableValue(Data.selectedAccount.messageFolders.sumOf { it.unreadCount })
val filledIcons = listOf(
OtariumIcons.Bottombar.Grades.Box1Filled,
OtariumIcons.Bottombar.Grades.Box2Filled,
OtariumIcons.Bottombar.Grades.Box3Filled,
OtariumIcons.Bottombar.Grades.Box4Filled,
OtariumIcons.Bottombar.Grades.Box5Filled,
OtariumIcons.Bottombar.Grades.Box6Filled,
OtariumIcons.Bottombar.Grades.Box7Filled,
OtariumIcons.Bottombar.Grades.Box8Filled,
OtariumIcons.Bottombar.Grades.Box9Filled,
OtariumIcons.Bottombar.Grades.Box10Filled,
)

val outlineIcons = listOf(
OtariumIcons.Bottombar.Grades.Box1Outline,
OtariumIcons.Bottombar.Grades.Box2Outline,
OtariumIcons.Bottombar.Grades.Box3Outline,
OtariumIcons.Bottombar.Grades.Box4Outline,
OtariumIcons.Bottombar.Grades.Box5Outline,
OtariumIcons.Bottombar.Grades.Box6Outline,
OtariumIcons.Bottombar.Grades.Box7Outline,
OtariumIcons.Bottombar.Grades.Box8Outline,
OtariumIcons.Bottombar.Grades.Box9Outline,
OtariumIcons.Bottombar.Grades.Box10Outline,
)

@Parcelize
sealed class MenuItems(val resourceId: StringResource, val icon: @Composable () -> Unit, val iconSelected: @Composable () -> Unit):
Expand All @@ -26,11 +57,18 @@ sealed class MenuItems(val resourceId: StringResource, val icon: @Composable ()

object Grades: MenuItems(
MR.strings.gradesItem,
{ Icon(OtariumIcons.Bottombar.Box10Outline, "Grades") },
{ Icon(OtariumIcons.Bottombar.Box10Filled, "Grades") },
{
val average = calculateAverageGrade(Data.selectedAccount.fullGradeList).roundToInt()
if (average < 1 || average > 10) Icon(OtariumIcons.Bottombar.Grades.Box10Outline, "Grades")
else Icon(outlineIcons[average - 1], "Grades")
},
{
val average = calculateAverageGrade(Data.selectedAccount.fullGradeList).roundToInt()
if (average < 1 || average > 10) Icon(OtariumIcons.Bottombar.Grades.Box10Filled, "Grades")
else Icon(filledIcons[average - 1], "Grades")
},
)

@OptIn(ExperimentalMaterial3Api::class)
object Messages: MenuItems(
MR.strings.messagesItem,
{ BadgedBox(badge = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package nl.tiebe.otarium.utils.otariumicons

import androidx.compose.ui.graphics.vector.ImageVector
import nl.tiebe.otarium.utils.OtariumIcons
import nl.tiebe.otarium.utils.otariumicons.bottombar.AllAssets
import nl.tiebe.otarium.utils.otariumicons.bottombar.BookOpenFilled
import nl.tiebe.otarium.utils.otariumicons.bottombar.BookOpenOutline
import nl.tiebe.otarium.utils.otariumicons.bottombar.Box10Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.Box10Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.CalendarTodayFilled
import nl.tiebe.otarium.utils.otariumicons.bottombar.CalendarTodayOutline
import nl.tiebe.otarium.utils.otariumicons.bottombar.ChartFilled
Expand All @@ -14,6 +13,7 @@ import nl.tiebe.otarium.utils.otariumicons.bottombar.CogFilled
import nl.tiebe.otarium.utils.otariumicons.bottombar.CogOutline
import nl.tiebe.otarium.utils.otariumicons.bottombar.EmailFilled
import nl.tiebe.otarium.utils.otariumicons.bottombar.EmailOutline
import nl.tiebe.otarium.utils.otariumicons.bottombar.Grades
import kotlin.collections.List as ____KtList

public object BottombarGroup
Expand All @@ -28,8 +28,8 @@ public val BottombarGroup.AllAssets: ____KtList<ImageVector>
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets= listOf(BookOpenFilled, BookOpenOutline, Box10Filled, Box10Outline,
CalendarTodayFilled, CalendarTodayOutline, ChartFilled, ChartOutline, CogFilled, CogOutline,
EmailFilled, EmailOutline)
__AllAssets= Grades.AllAssets + listOf(BookOpenFilled, BookOpenOutline, CalendarTodayFilled,
CalendarTodayOutline, ChartFilled, ChartOutline, CogFilled, CogOutline, EmailFilled,
EmailOutline)
return __AllAssets!!
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package nl.tiebe.otarium.utils.otariumicons.bottombar

import androidx.compose.ui.graphics.vector.ImageVector
import nl.tiebe.otarium.utils.otariumicons.BottombarGroup
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box10Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box10Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box1Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box1Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box2Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box2Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box3Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box3Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box4Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box4Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box5Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box5Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box6Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box6Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box7Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box7Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box8Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box8Outline
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box9Filled
import nl.tiebe.otarium.utils.otariumicons.bottombar.grades.Box9Outline
import kotlin.collections.List as ____KtList

public object GradesGroup

public val BottombarGroup.Grades: GradesGroup
get() = GradesGroup

private var __AllAssets: ____KtList<ImageVector>? = null

public val GradesGroup.AllAssets: ____KtList<ImageVector>
get() {
if (__AllAssets != null) {
return __AllAssets!!
}
__AllAssets= listOf(Box10Filled, Box10Outline, Box1Filled, Box1Outline, Box2Filled, Box2Outline,
Box3Filled, Box3Outline, Box4Filled, Box4Outline, Box5Filled, Box5Outline, Box6Filled,
Box6Outline, Box7Filled, Box7Outline, Box8Filled, Box8Outline, Box9Filled, Box9Outline)
return __AllAssets!!
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package nl.tiebe.otarium.utils.otariumicons.bottombar.grades

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import nl.tiebe.otarium.utils.otariumicons.bottombar.GradesGroup

public val GradesGroup.Box10Filled: ImageVector
get() {
if (_box10Filled != null) {
return _box10Filled!!
}
_box10Filled = Builder(name = "Box10Filled", defaultWidth = 24.0.dp, defaultHeight =
24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(14.0f, 9.0f)
horizontalLineTo(16.0f)
verticalLineTo(15.0f)
horizontalLineTo(14.0f)
verticalLineTo(9.0f)
moveTo(21.0f, 5.0f)
verticalLineTo(19.0f)
curveTo(21.0f, 20.11f, 20.11f, 21.0f, 19.0f, 21.0f)
horizontalLineTo(5.0f)
arcTo(2.0f, 2.0f, 0.0f, false, true, 3.0f, 19.0f)
verticalLineTo(5.0f)
arcTo(2.0f, 2.0f, 0.0f, false, true, 5.0f, 3.0f)
horizontalLineTo(19.0f)
curveTo(20.11f, 3.0f, 21.0f, 3.9f, 21.0f, 5.0f)
moveTo(10.0f, 7.0f)
horizontalLineTo(6.0f)
verticalLineTo(9.0f)
horizontalLineTo(8.0f)
verticalLineTo(17.0f)
horizontalLineTo(10.0f)
verticalLineTo(7.0f)
moveTo(18.0f, 9.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 16.0f, 7.0f)
horizontalLineTo(14.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 12.0f, 9.0f)
verticalLineTo(15.0f)
curveTo(12.0f, 16.11f, 12.9f, 17.0f, 14.0f, 17.0f)
horizontalLineTo(16.0f)
curveTo(17.11f, 17.0f, 18.0f, 16.11f, 18.0f, 15.0f)
verticalLineTo(9.0f)
close()
}
}
.build()
return _box10Filled!!
}

private var _box10Filled: ImageVector? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package nl.tiebe.otarium.utils.otariumicons.bottombar.grades

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import nl.tiebe.otarium.utils.otariumicons.bottombar.GradesGroup

public val GradesGroup.Box10Outline: ImageVector
get() {
if (_box10Outline != null) {
return _box10Outline!!
}
_box10Outline = Builder(name = "Box10Outline", defaultWidth = 24.0.dp, defaultHeight =
24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(19.0f, 19.0f)
horizontalLineTo(5.0f)
verticalLineTo(5.0f)
horizontalLineTo(19.0f)
moveTo(19.0f, 3.0f)
horizontalLineTo(5.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 3.0f, 5.0f)
verticalLineTo(19.0f)
curveTo(3.0f, 20.11f, 3.9f, 21.0f, 5.0f, 21.0f)
horizontalLineTo(19.0f)
curveTo(20.11f, 21.0f, 21.0f, 20.11f, 21.0f, 19.0f)
verticalLineTo(5.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 19.0f, 3.0f)
moveTo(8.0f, 17.0f)
horizontalLineTo(10.0f)
verticalLineTo(7.0f)
horizontalLineTo(6.0f)
verticalLineTo(9.0f)
horizontalLineTo(8.0f)
moveTo(14.0f, 7.0f)
horizontalLineTo(16.0f)
curveTo(17.11f, 7.0f, 18.0f, 7.9f, 18.0f, 9.0f)
verticalLineTo(15.0f)
curveTo(18.0f, 16.11f, 17.11f, 17.0f, 16.0f, 17.0f)
horizontalLineTo(14.0f)
arcTo(2.0f, 2.0f, 0.0f, false, true, 12.0f, 15.0f)
verticalLineTo(9.0f)
arcTo(2.0f, 2.0f, 0.0f, false, true, 14.0f, 7.0f)
moveTo(14.0f, 9.0f)
verticalLineTo(15.0f)
horizontalLineTo(16.0f)
verticalLineTo(9.0f)
horizontalLineTo(14.0f)
close()
}
}
.build()
return _box10Outline!!
}

private var _box10Outline: ImageVector? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package nl.tiebe.otarium.utils.otariumicons.bottombar.grades

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import nl.tiebe.otarium.utils.otariumicons.bottombar.GradesGroup

public val GradesGroup.Box1Filled: ImageVector
get() {
if (_box1Filled != null) {
return _box1Filled!!
}
_box1Filled = Builder(name = "Box1Filled", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(14.0f, 17.0f)
horizontalLineTo(12.0f)
verticalLineTo(9.0f)
horizontalLineTo(10.0f)
verticalLineTo(7.0f)
horizontalLineTo(14.0f)
moveTo(19.0f, 3.0f)
horizontalLineTo(5.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 3.0f, 5.0f)
verticalLineTo(19.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 5.0f, 21.0f)
horizontalLineTo(19.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 21.0f, 19.0f)
verticalLineTo(5.0f)
arcTo(2.0f, 2.0f, 0.0f, false, false, 19.0f, 3.0f)
close()
}
}
.build()
return _box1Filled!!
}

private var _box1Filled: ImageVector? = null
Loading

0 comments on commit 270cd29

Please sign in to comment.