SwEnt-Group13 / Unio

The world’s largest campus life platform.
3 stars 1 forks source link

Feature/event listing - Implement Event List Overview with Mock Data, UI Enhancements, and Unit Tests #29

Closed Aurelien9Code closed 1 week ago

Aurelien9Code commented 2 weeks ago

This pull request introduces the foundational structure for the "Events" feature, including a mock implementation of event data handling, UI enhancements, and essential unit tests. The focus is to provide a functional event list view for testing and development purposes until the final event data source is implemented.

Key Features ->

Event Data Handling: -Created Event.kt data class to represent event entities. -Implemented EventRepositoryMock for testing, providing sample events as the real event repository is yet to be finalized.

ViewModel and State Management: -Introduced EventListViewModel with StateFlow to manage event data. -Mock data is loaded into the ViewModel for use during testing and development.

UI Enhancements: -Developed a responsive Event List Overview with a tab selection animation (switching between "All" and "Following"). -Created a dynamic layout that adjusts the tab size based on text width and tracks the X coordinates for smooth transitions. -Designed EventItem UI with gradient colors, background images, and dynamic styling for better user experience. -Added handling for empty event lists, showing a user-friendly message when no events are available. -Implemented utility functions for event type color mapping and contrast adjustments. -Introduced new properties to Event (like catchy_description, main_type, and picture) to enrich the event details.

UI Testing and Preview: -Added a composable function, EventListOverviewPreview, for easier UI previews in development. -Enhanced UI components with test tags to support automated UI testing.

Unit Testing: -Added comprehensive tests for the Event List Overview component, covering tab switching, empty list handling, and rendering of event items. -Verified UI animations and behavior, including the functionality of the "Map" button.

Let me know if you'd like any modification ! ; )

Aurelien9Code commented 2 weeks ago

There is a lot of duplicated code, but it's only for the EventListRepositoryMock for test reasons so it will be destroyed when I will delete my mock

Romainhir commented 1 week ago

The image in "model/events/events_picture" is already in "resources". The "event_picture" package should not exist in "model/events". However, it can be a sub package of "resources"

Aurelien9Code commented 1 week ago

If that is okay for all of my reviewers, I will change EnventListViewModel.kt to use a callback function, restructure the EventType.kt file and add some consistency in the names. For the rest, as it was only a blind implementation of EventRepository structure in order to wait for the real one (which is now pushed to main), I will just push to the main and then destroy my structure and connect the real one to the rest of my code. Thanks !

oskar-codes commented 1 week ago

If that is okay for all of my reviewers, I will change EnventListViewModel.kt to use a callback function, restructure the EventType.kt file and add some consistency in the names. For the rest, as it was only a blind implementation of EventRepository structure in order to wait for the real one (which is now pushed to main), I will just push to the main and then destroy my structure and connect the real one to the rest of my code. Thanks !

@Aurelien9Code I believe you can pull the changes from main directly to this branch, without having to merge beforehand. See this.

Aurelien9Code commented 1 week ago

If that is okay for all of my reviewers, I will change EnventListViewModel.kt to use a callback function, restructure the EventType.kt file and add some consistency in the names. For the rest, as it was only a blind implementation of EventRepository structure in order to wait for the real one (which is now pushed to main), I will just push to the main and then destroy my structure and connect the real one to the rest of my code. Thanks !

@Aurelien9Code I believe you can pull the changes from main directly to this branch, without having to merge beforehand. See this.

thanks ! I'll check this tomorrow morning

Aurelien9Code commented 1 week ago

All the changements required are now done ! To summary, it was : -> change EnventListViewModel.kt to use a callback function -> structure the EventType.kt file and add some consistency in the names -> add some consistency in the names -> pull main to my branch -> recode my files to link them to the real EventRespository structure -> delete my mock EventRepository structure

Thanks !

Romainhir commented 1 week ago

LGTM

oskar-codes commented 1 week ago

Astronomically low code coverage, but apart from that it looks good to me.

Aurelien9Code commented 1 week ago

71% will be improved soon for sure ! But it's not that bad... Thanks for the review thought !

sonarcloud[bot] commented 1 week ago

Quality Gate Failed Quality Gate failed

Failed conditions
71.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud