-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Sections to Meds Page + Change Medication Status Colors + add …
…a key (#120) # *Adding Sections to Meds Page + Change Medication Status Colors + add a key* ## ♻️ Current situation & Problem 1. Patients wanted a different color scheme for their medication treatment progress 2. Patients wanted a more clear picture of what medications they are currently taking versus the ones they are not. ## ⚙️ Release Notes - Changed the colors of the different medications based on patient treatment status and added a key for those colors either to the top or bottom of the medications page. - Separated the page into two sections: medications the patient is taking vs the medications they are not taking ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md). --------- Signed-off-by: Basler182 <[email protected]>
- Loading branch information
Showing
15 changed files
with
516 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
app/src/main/kotlin/edu/stanford/bdh/engagehf/medication/components/ColorKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package edu.stanford.bdh.engagehf.medication.components | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import edu.stanford.bdh.engagehf.R | ||
import edu.stanford.bdh.engagehf.medication.ui.MedicationColor | ||
import edu.stanford.spezi.core.design.component.DefaultElevatedCard | ||
import edu.stanford.spezi.core.design.theme.Sizes | ||
import edu.stanford.spezi.core.design.theme.Spacings | ||
import edu.stanford.spezi.core.design.theme.SpeziTheme | ||
import edu.stanford.spezi.core.design.theme.ThemePreviews | ||
|
||
@Composable | ||
fun ColorKey( | ||
modifier: Modifier = Modifier, | ||
) { | ||
DefaultElevatedCard( | ||
modifier = modifier | ||
.padding(bottom = Spacings.medium), | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(Spacings.medium), | ||
verticalArrangement = Arrangement.spacedBy(Spacings.small), | ||
) { | ||
MedicationColor.entries.forEach { | ||
ColorKeyRow(color = it) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun ColorKeyRow(color: MedicationColor) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.size(Sizes.Icon.medium) | ||
.background( | ||
color.value.copy(alpha = MEDICATION_ICON_ALPHA_COLOR_FACTOR), | ||
shape = CircleShape | ||
) | ||
.padding(Spacings.small), | ||
) | ||
Spacer(modifier = Modifier.width(Spacings.small)) | ||
Text( | ||
text = when (color) { | ||
MedicationColor.GREEN_SUCCESS -> stringResource(R.string.on_target_dose_that_best_helps_your_heart) | ||
MedicationColor.YELLOW -> stringResource(R.string.on_medication_but_may_benefit_from_a_higher_dose) | ||
MedicationColor.BLUE -> stringResource(R.string.not_on_this_medication_that_may_help_your_heart) | ||
}, | ||
overflow = TextOverflow.Clip, | ||
) | ||
} | ||
} | ||
|
||
@ThemePreviews | ||
@Composable | ||
private fun ColorKeyPreview() { | ||
SpeziTheme(isPreview = true) { | ||
ColorKey() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.