Skip to content

Supplies Screen #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 16, 2024
Merged

Supplies Screen #182

merged 11 commits into from
May 16, 2024

Conversation

TheMonkeyPrince
Copy link
Contributor

This PR adds the supplies screen to the detailed event page. From there, if you're a staff, you can add / edit / delte / assign supplies. As a guest, you can only assign / unassign yourself from a supply.

A new route (SUPPLIES_SCREEN) has been added.

Here are some screens:

  • Staff perspective
    image
    image
    image

  • Guest perspective
    image
    image

@Athanaze
Copy link
Contributor

According to the design system that was choosen, different types of text field should not be next to each other:

https://m2.material.io/components/text-fields#usage

2024-05-14-092048_1920x1080_scrot

"Unassigned myself" is a bit weird; here are some alternatives:

  1. I withdrew from the task.
  2. I removed myself from the assignment.
  3. I relinquished my responsibilities for the project.
  4. I stepped back from the role.
  5. I excused myself from the duty.
  6. I opted out of the assignment.
  7. I recused myself from the task.
  8. I disengaged from the responsibility.
  9. I abstained from the project.
  10. I released myself from the obligation.

stringResource(id = R.string.chimpagne_cancel),
onClick = onDismissRequest,
modifier = Modifier.testTag("guest_supply_cancel")),
if (supply.assignedTo.containsKey(loggedUserUID))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if-else statements without brackets should not be used here, according to Kotlin's style guide :

Kotlin/kotlin-style-guide#20

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

stringResource(id = R.string.supplies_supply_assigned_to),
modifier = Modifier.testTag("staff_list"))
}
accounts.entries.forEach { (userUID, userAccount) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A filter would be more approriate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, 🇧🇸 would be proud

if (!tempSupply.assignedTo.keys.containsAll(accounts.keys)) {
item { Text(stringResource(id = R.string.supplies_not_assigned_to)) }
accounts.entries.forEach { (userUID, userAccount) ->
if (tempSupply.assignedTo[userUID] != true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!= true should be changed to !tempSupply.assignedTo[userUID]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tempSupply.assignedTo: Map<ChimpagneAccountUID, Boolean?> thus !tempSupply.assignedTo[userUID] doesn't work as tempSupply.assignedTo[userUID] can be null

title = { Text(stringResource(id = R.string.supplies_screen_title)) },
modifier = Modifier.shadow(4.dp),
navigationIcon = {
IconButton(onClick = { navObject.goBack() }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing component, thx

text = "${supply.quantity} ${supply.unit}",
modifier = Modifier.testTag("supply_quantity_and_unit"))
Text(
text = "${supply.assignedTo.keys.size} assigned",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A resource string should be used here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

headlineContent = {
Text(
text =
"${account?.firstName} ${account?.lastName}" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit hard to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -16,6 +16,7 @@ object Route {
const val MY_EVENTS_SCREEN = "myEvents"
const val VIEW_DETAIL_EVENT_SCREEN = "viewDetailEventScreen"
const val MANAGE_STAFF_SCREEN = "manageStaffScreen"
const val SUPPLIES_SCREEN = "SuppliesScreen"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous values use a lowercase character as the first character

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit anarchic
image
A future PR will solve this issue.

Copy link
Contributor

@Athanaze Athanaze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required changes were made, this is ready to be merged

Copy link
Contributor

@juaniac juaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated by other reviewer this is good PR overall, the UI is great looking and the tests are very robust.

But I have to point out a huge oversight.
When a guest or staff member leaves the event, their assigned supplies are still stored in the database.
This shouldn't happen in my opinion, once a person from the event decides to leave, they should automatically get removed from all supplies they were assigned to.

Thus this change should be addressed before merging.

@TheMonkeyPrince
Copy link
Contributor Author

As stated by other reviewer this is good PR overall, the UI is great looking and the tests are very robust.

But I have to point out a huge oversight. When a guest or staff member leaves the event, their assigned supplies are still stored in the database. This shouldn't happen in my opinion, once a person from the event decides to leave, they should automatically get removed from all supplies they were assigned to.

Thus this change should be addressed before merging.

This is a UI only PR... However I fixed this

Copy link

@Athanaze Athanaze dismissed juaniac’s stale review May 16, 2024 08:35

we need to move forward, your comments are very interesting but not in the scope of this PR

@Athanaze Athanaze merged commit f999fb0 into main May 16, 2024
2 checks passed
@TheMonkeyPrince TheMonkeyPrince deleted the final-supplies-screen branch May 16, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants