-
Notifications
You must be signed in to change notification settings - Fork 2
Feature: Implement the event details UI according to the figma. #111
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
Conversation
Added a savedEvents parameter to keep track of which events the user follows.
Fixed the errors in text files due to the previous refactoring
Added all the composables required by the figma design.
Improved the event details UI to adhere to the figma.
Wrote some UI tests for the Event Screen
Added a test for findEventById method.
oskar-codes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request is an overall good addition to the project, well done!
| class HydrationAndSerializationTest { | ||
| private val user = | ||
|
|
||
| val user = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider leaving these values private.
| fun EventScreen( | ||
| navigationAction: NavigationAction, | ||
| eventId: String, | ||
| eventListViewModel: EventListViewModel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you should only use a single EventViewModel instead of both the eventListViewModel and eventId. This will make the function declaration more succinct. The instanciation of this EventViewModel could then be placed in MainActivity right before passing it as a parameter to the EventDetails.
By the way, the EventViewModel doesn't exist on your branch, you should pull it from main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh the EventViewModel class didn't exist when I frist wrote my code but that's indeed better suited.
| private var scope: CoroutineScope? = null | ||
|
|
||
| @OptIn(ExperimentalMaterial3Api::class) | ||
| @SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove this UnusedMaterial3ScaffoldPaddingParameter suppression, and actually use the padding parameter provided by the Scaffold. This will ensure the content is well within the bounds of the scaffold.
| content = { padding -> | ||
| // Mock image before linking to backend | ||
| Column( | ||
| modifier = Modifier.testTag("eventDetailsPage").verticalScroll(rememberScrollState())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentionned in the previous comment, simply add the .padding(padding) modifier here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right I added the modifier.
| Column( | ||
| modifier = | ||
| Modifier.testTag("eventDetailsInformationCard") | ||
| .background(primaryLight) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MaterialTheme.colorScheme.primary.
Make sure to also add the appropriate changes to lines 182, 211, 219, 223, 231, 251, and 272. Also for some of these, do you need to specify the color ? Often the default color is good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't understood how our theme worked ! Should be good now thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this file existed before this pull request, but we should consider renaming it to EventListViewModelTest, to avoid confusion with the EventViewModel because this file tests an EventListViewModel, not an EventViewModel.
| } | ||
|
|
||
| @Test | ||
| fun testFindAssociationById() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the name of this test has nothing to do with its contents, it might be better to rename it to something else.
| * @param id The ID of the event to find. | ||
| * @return The event with the given ID, or null if no such event exists. | ||
| */ | ||
| fun findEventById(id: String): Event? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good function to have, but as mentionned in a previous comment, consider using the EventViewModel for your pull request. It should contains a single Event, just like the UserViewModel, and should be instanciated when you navigate to an event's details page.
Note that the current EventViewModel is only partially implemented as it is unused, and will require changes before you can use it. Maybe that's something you can do when you link the event details to the backend.
| class EventDetailsTest { | ||
| private lateinit var navHostController: NavHostController | ||
| private lateinit var navigationAction: NavigationAction | ||
| @Mock private lateinit var collectionReference: CollectionReference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that several of these mocked variables such as db or collectionReference are not used in this test. Consider removing them if they are not necessary.
| assertDisplayComponentInScroll(composeTestRule.onNodeWithTag("signUpButton")) | ||
| } | ||
|
|
||
| private fun assertDisplayComponentInScroll(compose: SemanticsNodeInteraction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great use of helper functions 🚀
Change the way I define the element's color so that they support changing themes.
Fix EventCardTest that couldn't find some elements because the elements are in merged tree
oskar-codes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done addressing the changes I requested, this will prove itself considerably useful for the application.
| uid?.let { | ||
| EventScreen( | ||
| navigationAction = navigationActions, | ||
| eventViewModel = EventViewModel(eventRepository, userRepository), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should extract the instanciation of the EventViewModel at the top of the composable, and wrap it in a remember { ... }
In MainActivity, moved EventViewModel out of the composable. In Serialization, simplified a statement
|



Implemented the UI of Event Details screen according to the Figma. Note that it is not linked to Firebase as this will be a separate task.
Also added EventDetailsTest to test said screen's UI and wrote a method to allow us to get an event by its id, as this will be useful when linking the screen to the backend