Skip to content

Commit

Permalink
Merge pull request #20 from guiBrisson/feature/new-operations
Browse files Browse the repository at this point in the history
Added NewOperationScreen ui components.
  • Loading branch information
guiBrisson authored Mar 19, 2024
2 parents b674259 + 13fbf5c commit f459237
Show file tree
Hide file tree
Showing 24 changed files with 648 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="16dp" android:viewportHeight="12"
android:viewportWidth="12" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffffff" android:pathData="M3.97,1.227C3.829,1.368 3.75,1.558 3.75,1.757C3.75,1.956 3.829,2.147 3.97,2.287L7.682,6L3.97,9.712C3.833,9.854 3.757,10.043 3.759,10.24C3.761,10.437 3.84,10.625 3.979,10.764C4.118,10.903 4.306,10.982 4.503,10.983C4.699,10.985 4.889,10.91 5.03,10.773L9.273,6.53C9.414,6.39 9.493,6.199 9.493,6C9.493,5.801 9.414,5.61 9.273,5.47L5.03,1.227C4.89,1.086 4.699,1.007 4.5,1.007C4.301,1.007 4.11,1.086 3.97,1.227Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#059669" android:pathData="M4.257,6.646L4.75,6.144C5.299,5.595 6.209,5.595 6.777,6.182L6.796,6.211C7.261,6.684 7.876,6.912 8.549,6.978C9.468,7.063 10.359,7.556 10.946,8.446C11.591,9.469 11.581,10.834 10.908,11.847C10.655,12.249 10.313,12.587 9.91,12.838C9.507,13.089 9.053,13.245 8.58,13.295C8.108,13.345 7.631,13.288 7.184,13.127C6.737,12.967 6.333,12.707 6,12.368C5.47,11.847 5.167,11.175 5.091,10.474C5.015,9.782 4.74,9.128 4.257,8.645C3.707,8.105 3.707,7.196 4.257,6.646ZM8.236,14.263C7.128,14.263 6.095,13.837 5.328,13.05C4.664,12.368 4.248,11.516 4.143,10.587C4.115,10.303 4.03,9.934 3.802,9.593C3.234,10.379 2.893,11.326 2.893,12.368C2.893,13.922 3.651,15.296 4.816,16.158H17.105V15.21C17.105,11.8 14.84,8.911 11.742,7.963C12.585,9.289 12.566,11.061 11.704,12.368C10.946,13.553 9.639,14.263 8.236,14.263ZM13.106,6.267H14.31C15.134,6.267 15.854,6.845 15.854,7.878V8.579H17.039V7.632C17.039,6.211 15.778,5.131 14.31,5.131H13.106C12.32,5.131 11.647,4.354 11.647,3.558C11.647,2.762 12.32,2.175 13.106,2.175V1C11.647,1 10.472,2.175 10.472,3.634C10.472,5.093 11.647,6.267 13.106,6.267ZM3.366,6.258C3.423,6.163 3.499,6.068 3.584,5.974L4.077,5.481C4.162,5.396 4.257,5.329 4.352,5.263L3.016,3.908C3.148,3.653 3.101,3.321 2.893,3.103C2.757,2.971 2.575,2.897 2.386,2.897C2.196,2.897 2.014,2.971 1.879,3.103C1.746,3.236 1.68,3.397 1.67,3.567C1.5,3.577 1.339,3.643 1.206,3.776C0.931,4.051 0.931,4.505 1.206,4.789C1.424,4.998 1.746,5.045 2.011,4.913L3.366,6.258ZM16.527,3.264C17.01,2.781 17.313,2.127 17.313,1.398H16.129C16.129,2.184 15.466,2.847 14.679,2.847V4.022C16.442,4.022 17.825,5.462 17.825,7.224V9.526H19V7.224C19.005,6.398 18.775,5.587 18.337,4.886C17.899,4.185 17.272,3.623 16.527,3.264ZM3.84,19H17.105C18.157,19 19,18.157 19,17.105H1.945C1.945,17.608 2.145,18.09 2.5,18.445C2.856,18.8 3.338,19 3.84,19Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<group>
<clip-path android:pathData="M0,0h20v20h-20z"/>
<path android:fillColor="#0891B2" android:pathData="M3.33,8L10,12L20,6L10,0L0,6H10V8H3.33ZM0,8V16L2,13.78V9.2L0,8ZM10,20L5,17L3,15.8V9.8L10,14L17,9.8V15.8L10,20Z"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<group>
<clip-path android:pathData="M0,0h20v20h-20z"/>
<path android:fillColor="#EA580C" android:fillType="evenOdd" android:pathData="M1.904,4.129C0.663,5.835 -0.003,7.891 0,10C-0.003,12.109 0.664,14.165 1.904,15.872C2.842,15.241 3.598,14.377 4.1,13.364C4.623,12.32 4.893,11.168 4.89,10C4.893,8.832 4.622,7.68 4.1,6.636C3.598,5.624 2.842,4.759 1.904,4.129ZM3.084,2.776C4.19,3.565 5.086,4.614 5.693,5.83C6.34,7.109 6.676,8.544 6.676,10C6.679,11.448 6.342,12.877 5.693,14.172C5.086,15.387 4.19,16.435 3.084,17.224C4.722,18.795 6.847,19.76 9.107,19.96V0.04C6.779,0.246 4.679,1.25 3.084,2.776ZM10.893,19.962C13.154,19.761 15.278,18.796 16.916,17.224C15.809,16.435 14.914,15.386 14.307,14.17C13.658,12.876 13.321,11.448 13.324,10C13.324,8.543 13.66,7.109 14.307,5.829C14.914,4.613 15.809,3.565 16.914,2.776C15.278,1.205 13.154,0.24 10.894,0.04V19.96L10.893,19.962ZM20,10C20.003,12.109 19.337,14.165 18.096,15.872C17.159,15.241 16.402,14.377 15.9,13.364C15.377,12.32 15.107,11.168 15.11,10C15.11,8.817 15.383,7.657 15.9,6.636C16.402,5.624 17.159,4.759 18.096,4.129C19.337,5.835 20.003,7.891 20,10Z"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#DB2777" android:pathData="M7.55,1.608C5.975,1.6 4.442,3.117 5.142,5H2.5C2.058,5 1.634,5.176 1.322,5.488C1.009,5.801 0.833,6.225 0.833,6.667V8.333C0.833,8.554 0.921,8.766 1.077,8.923C1.234,9.079 1.446,9.167 1.667,9.167H9.167V6.667H10.833V9.167H18.333C18.554,9.167 18.766,9.079 18.923,8.923C19.079,8.766 19.167,8.554 19.167,8.333V6.667C19.167,6.225 18.991,5.801 18.679,5.488C18.366,5.176 17.942,5 17.5,5H14.858C15.833,2.275 12.167,0.35 10.475,2.7L10,3.333L9.525,2.683C9,1.942 8.275,1.617 7.55,1.608ZM7.5,3.333C8.242,3.333 8.617,4.233 8.092,4.758C7.567,5.283 6.667,4.908 6.667,4.167C6.667,3.946 6.755,3.734 6.911,3.578C7.067,3.421 7.279,3.333 7.5,3.333ZM12.5,3.333C13.242,3.333 13.617,4.233 13.092,4.758C12.567,5.283 11.667,4.908 11.667,4.167C11.667,3.946 11.755,3.734 11.911,3.578C12.067,3.421 12.279,3.333 12.5,3.333ZM1.667,10V16.667C1.667,17.109 1.842,17.533 2.155,17.845C2.467,18.158 2.891,18.333 3.333,18.333H16.667C17.109,18.333 17.533,18.158 17.845,17.845C18.158,17.533 18.333,17.109 18.333,16.667V10H10.833V16.667H9.167V10H1.667Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<group>
<clip-path android:pathData="M0,0h20v20h-20z"/>
<path android:fillColor="#2563EB" android:pathData="M15.05,19.167H16.433C17.133,19.167 17.708,18.625 17.792,17.942L19.167,4.208H15V0.833H13.358V4.208H9.217L9.467,6.158C10.892,6.55 12.225,7.258 13.025,8.042C14.225,9.225 15.05,10.45 15.05,12.45V19.167ZM0.833,18.333V17.5H13.358V18.333C13.358,18.783 12.983,19.167 12.5,19.167H1.667C1.208,19.167 0.833,18.783 0.833,18.333ZM13.358,12.5C13.358,5.833 0.833,5.833 0.833,12.5H13.358ZM0.833,14.167H13.333V15.833H0.833V14.167Z"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<group>
<clip-path android:pathData="M0,0h20v20h-20z"/>
<path android:fillColor="#DC2626" android:pathData="M5.855,19.167V14.145H0.833V10.518H6.6L8.521,13.399C8.568,13.471 8.625,13.527 8.694,13.567C8.763,13.607 8.844,13.627 8.936,13.627C9.055,13.627 9.16,13.594 9.251,13.529C9.341,13.464 9.408,13.375 9.45,13.26L11.188,8.048L12.666,10.271C12.718,10.345 12.783,10.404 12.861,10.45C12.939,10.495 13.022,10.518 13.109,10.518H19.167V14.145H14.145V19.167H5.855ZM8.813,11.953L7.308,9.709C7.262,9.637 7.204,9.581 7.135,9.542C7.066,9.502 6.985,9.482 6.891,9.482H0.833V5.855H5.855V0.833H14.145V5.855H19.167V9.482H13.374L11.472,6.601C11.427,6.533 11.365,6.478 11.285,6.435C11.205,6.394 11.12,6.373 11.031,6.373C10.916,6.373 10.817,6.406 10.736,6.47C10.654,6.535 10.592,6.625 10.549,6.74L8.813,11.953Z"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000"
android:pathData="M1,15.714H19M1,18H19M4,6V4.286H5.8M14.2,4.286H16V6M4,9.429V11.143H5.8M14.2,11.143H16V9.429M10,10C9.363,10 8.753,9.759 8.303,9.331C7.853,8.902 7.6,8.321 7.6,7.714C7.6,7.108 7.853,6.527 8.303,6.098C8.753,5.669 9.363,5.429 10,5.429C10.637,5.429 11.247,5.669 11.697,6.098C12.147,6.527 12.4,7.108 12.4,7.714C12.4,8.321 12.147,8.902 11.697,9.331C11.247,9.759 10.637,10 10,10ZM2.8,2H17.2C17.518,2 17.823,2.12 18.049,2.335C18.274,2.549 18.4,2.84 18.4,3.143V12.286C18.4,12.589 18.274,12.88 18.049,13.094C17.823,13.308 17.518,13.429 17.2,13.429H2.8C2.482,13.429 2.177,13.308 1.951,13.094C1.726,12.88 1.6,12.589 1.6,12.286V3.143C1.6,2.84 1.726,2.549 1.951,2.335C2.177,2.12 2.482,2 2.8,2Z"
android:strokeColor="#65A30D" android:strokeWidth="1"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#E11D48" android:pathData="M15,10.833L15.824,17.396C15.839,17.513 15.829,17.632 15.794,17.745C15.759,17.858 15.701,17.962 15.622,18.051C15.544,18.14 15.448,18.211 15.34,18.259C15.233,18.308 15.116,18.333 14.998,18.333H5.003C4.884,18.333 4.767,18.308 4.66,18.259C4.552,18.211 4.456,18.14 4.378,18.051C4.299,17.962 4.241,17.858 4.206,17.745C4.171,17.632 4.161,17.513 4.176,17.396L5,10.833H15ZM17.5,8.333H2.5V10H17.5V8.333ZM12.262,4.837C12.427,4.306 12.508,3.752 12.5,3.196C12.5,1.892 12.127,0.833 11.667,0.833C11.207,0.833 10.833,1.892 10.833,3.196C10.832,3.559 10.864,3.922 10.929,4.28C10.318,4.128 9.679,4.128 9.068,4.281C9.134,3.923 9.167,3.56 9.167,3.196C9.167,1.892 8.793,0.833 8.333,0.833C7.873,0.833 7.5,1.892 7.5,3.196C7.491,3.752 7.571,4.307 7.736,4.838C7.259,5.135 6.845,5.522 6.519,5.979C6.192,6.436 5.959,6.953 5.833,7.5H7.5C7.5,7.279 7.588,7.067 7.744,6.911C7.9,6.754 8.112,6.667 8.333,6.667C8.554,6.667 8.766,6.754 8.923,6.911C9.079,7.067 9.167,7.279 9.167,7.5H10.833C10.833,7.279 10.921,7.067 11.077,6.911C11.234,6.754 11.446,6.667 11.667,6.667C11.888,6.667 12.1,6.754 12.256,6.911C12.412,7.067 12.5,7.279 12.5,7.5H14.167C14.041,6.952 13.807,6.435 13.48,5.978C13.153,5.521 12.739,5.133 12.262,4.837Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="19.2dp" android:viewportHeight="16"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#F59E0B" android:pathData="M0,14C0,14.552 0.448,15 1,15H19C19.552,15 20,14.552 20,14V4H0V14ZM14,7.5C14,7.224 14.224,7 14.5,7H17.5C17.776,7 18,7.224 18,7.5V8.5C18,8.776 17.776,9 17.5,9H14.5C14.224,9 14,8.776 14,8.5V7.5ZM14,11.25C14,11.112 14.112,11 14.25,11H17.75C17.888,11 18,11.112 18,11.25V11.75C18,11.888 17.888,12 17.75,12H14.25C14.112,12 14,11.888 14,11.75V11.25ZM2,8.25C2,8.112 2.112,8 2.25,8H11.75C11.888,8 12,8.112 12,8.25V8.75C12,8.888 11.888,9 11.75,9H2.25C2.112,9 2,8.888 2,8.75V8.25ZM2,11.25C2,11.112 2.112,11 2.25,11H7.75C7.888,11 8,11.112 8,11.25V11.75C8,11.888 7.888,12 7.75,12H2.25C2.112,12 2,11.888 2,11.75V11.25ZM19.5,1H0.5C0.224,1 0,1.224 0,1.5V3H20V1.5C20,1.224 19.776,1 19.5,1Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#9333EA" android:pathData="M15.833,16.667H4.167V17.5C4.167,17.721 4.079,17.933 3.923,18.089C3.766,18.246 3.554,18.333 3.333,18.333H2.5C2.279,18.333 2.067,18.246 1.911,18.089C1.754,17.933 1.667,17.721 1.667,17.5V10L3.761,4.415C3.88,4.097 4.093,3.823 4.372,3.63C4.651,3.437 4.982,3.333 5.322,3.333H14.678C15.018,3.333 15.349,3.437 15.628,3.63C15.907,3.823 16.12,4.097 16.239,4.415L18.333,10V17.5C18.333,17.721 18.246,17.933 18.089,18.089C17.933,18.246 17.721,18.333 17.5,18.333H16.667C16.446,18.333 16.234,18.246 16.077,18.089C15.921,17.933 15.833,17.721 15.833,17.5V16.667ZM3.447,10H16.553L14.678,5H5.322L3.447,10ZM5.417,14.167C5.748,14.167 6.066,14.035 6.301,13.8C6.535,13.566 6.667,13.248 6.667,12.917C6.667,12.585 6.535,12.267 6.301,12.033C6.066,11.798 5.748,11.667 5.417,11.667C5.085,11.667 4.767,11.798 4.533,12.033C4.298,12.267 4.167,12.585 4.167,12.917C4.167,13.248 4.298,13.566 4.533,13.8C4.767,14.035 5.085,14.167 5.417,14.167ZM14.583,14.167C14.915,14.167 15.233,14.035 15.467,13.8C15.702,13.566 15.833,13.248 15.833,12.917C15.833,12.585 15.702,12.267 15.467,12.033C15.233,11.798 14.915,11.667 14.583,11.667C14.252,11.667 13.934,11.798 13.699,12.033C13.465,12.267 13.333,12.585 13.333,12.917C13.333,13.248 13.465,13.566 13.699,13.8C13.934,14.035 14.252,14.167 14.583,14.167Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#6366F1" android:pathData="M4.667,15.328L1.362,13.517L2.446,12.431L5.029,12.793L9.057,8.759L1,4.362L2.446,2.914L12.311,5.448L16.366,1.44C16.659,1.147 17.025,1 17.464,1C17.903,1 18.269,1.147 18.561,1.44C18.854,1.733 19,2.099 19,2.539C19,2.979 18.854,3.346 18.561,3.638L14.532,7.672L17.063,17.552L15.617,19L11.227,10.931L7.198,14.965L7.56,17.552L6.475,18.638L4.667,15.328Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package data.datasource.local

import com.github.guibrisson.db.MoneyMateDatabase
import com.github.guibrisson.db.OperationTable
import data.datasource.OperationDataSource
import domain.model.Category
import domain.model.Operation
import domain.model.OperationType
import kotlinx.datetime.LocalDateTime
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
Expand All @@ -19,9 +20,9 @@ class LocalOperationDataSource: KoinComponent, OperationDataSource {
id = -1,
amount = 0.0,
description = "Test",
type = "",
category = "",
date = LocalDateTime(2024, 3, 6, 1, 1, 1, 1),
type = OperationType.INCOME,
category = Category.EDUCATION,
date = LocalDateTime(2024, 3, 6, 1, 1 ,1, 1),
isPeriodic = false,
)
)
Expand Down
59 changes: 57 additions & 2 deletions composeApp/src/commonMain/kotlin/domain/model/Category.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,59 @@
package domain.model

// TODO: implement properly
typealias Category = String
import androidx.compose.ui.graphics.Color
import moneymate.composeapp.generated.resources.Res
import moneymate.composeapp.generated.resources.ic_dining_out
import moneymate.composeapp.generated.resources.ic_education
import moneymate.composeapp.generated.resources.ic_entertainment
import moneymate.composeapp.generated.resources.ic_gifts
import moneymate.composeapp.generated.resources.ic_groceries
import moneymate.composeapp.generated.resources.ic_health
import moneymate.composeapp.generated.resources.ic_income
import moneymate.composeapp.generated.resources.ic_miscellaneous
import moneymate.composeapp.generated.resources.ic_subscription
import moneymate.composeapp.generated.resources.ic_transport
import moneymate.composeapp.generated.resources.ic_travel
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
import presentation.theme.amber500
import presentation.theme.amber600
import presentation.theme.blue500
import presentation.theme.blue600
import presentation.theme.cyan500
import presentation.theme.cyan600
import presentation.theme.emerald500
import presentation.theme.emerald600
import presentation.theme.indigo500
import presentation.theme.indigo600
import presentation.theme.lime500
import presentation.theme.lime600
import presentation.theme.orange500
import presentation.theme.orange600
import presentation.theme.pink500
import presentation.theme.pink600
import presentation.theme.purple500
import presentation.theme.purple600
import presentation.theme.red500
import presentation.theme.red600
import presentation.theme.rose500
import presentation.theme.rose600

@OptIn(ExperimentalResourceApi::class)
enum class Category(val categoryName: String, val primaryColor: Color,
val secondaryColor: Color, val icon: DrawableResource) {
HEALTH_WELLNESS("Health & Wellness", red600, red500, Res.drawable.ic_health),
ENTERTAINMENT("Entertainment", orange600, orange500, Res.drawable.ic_entertainment),
SUBSCRIPTION("Subscription", amber500, amber600, Res.drawable.ic_subscription),
INCOME("Income", lime600, lime500, Res.drawable.ic_income),
DINING_OUT("Dining Out", emerald600, emerald500, Res.drawable.ic_dining_out),
EDUCATION("Education", cyan600, cyan500, Res.drawable.ic_education),
GROCERIES("Groceries", blue600, blue500, Res.drawable.ic_groceries),
TRAVEL("Travel", indigo500, indigo600, Res.drawable.ic_travel),
TRANSPORT("Transport", purple600, purple500, Res.drawable.ic_transport),
GIFTS_DONATIONS("Gifts & Donations", pink600, pink500, Res.drawable.ic_gifts),
MISCELLANEOUS("Miscellaneous", rose600, rose500, Res.drawable.ic_miscellaneous);

companion object {
fun all(): Array<Category> = enumValues<Category>()
}
}
3 changes: 1 addition & 2 deletions composeApp/src/commonMain/kotlin/domain/model/Operation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package domain.model

import kotlinx.datetime.LocalDateTime


data class Operation(
val id: Long,
val amount: Double,
val description: String,
val type: OperationType,
val type: OperationType,
val category: Category,
val date: LocalDateTime,
val isPeriodic: Boolean,
Expand Down
16 changes: 14 additions & 2 deletions composeApp/src/commonMain/kotlin/domain/model/OperationType.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
package domain.model

// TODO: implement properly
typealias OperationType = String // "expense" || "income"
import androidx.compose.ui.graphics.Color
import presentation.theme.expense
import presentation.theme.income

enum class OperationType(val operation: String, val color: Color) {
EXPENSE("Expense", expense),
INCOME("Income", income);

companion object {
private fun all(): Array<OperationType> = enumValues<OperationType>()

fun operationNames(): List<String> = all().map { it.operation }
}
}
Loading

0 comments on commit f459237

Please sign in to comment.