Skip to content
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

T04 Code Review #1

Open
wants to merge 14 commits into
base: feedback
Choose a base branch
from
Open

T04 Code Review #1

wants to merge 14 commits into from

Conversation

diegotc86
Copy link
Member

No description provided.

HLena and others added 14 commits May 17, 2024 13:13
- Installed json-server as a development dependency.
- Updated package.json and package-lock.json with json-server.
- Added db.json to the data folder with a list of 10 contacts
- Each contact oncludes id, name, lastname, twitter_username, avatar_url, favorite status and a note
- '': main route
- contact/:id : subroute of main route
- 404: error route
- error404Component: show the error page
- homeComponente: show tha main view
-contactComponent: show details of a specific contact
-buttonComponente: basic component
* style: Set global styles

* chore: Update property name from 'contact' to 'contacts'

* feat: Implement method to get all contacts

* feat: Consume contactService and show a list of contacts

* Added getContactById fn in ContactService

* Added html structure in Contact component

* Added styles for Contact component

* Updated styles for Contact component

* Added favorite function

* Feat/search contact (HLena#2)

* feat: Implement searchContactByName method

* refactor: Moved search functionality to a new 'searchContact' component and integrated it into 'home' component

* feat: Add search component to handle contact search functionality

* chore: Change the icon before the heading 'h1' element

* Add angular icon

* feat: Implement search functionality with RxJS Observables and operators
- Add BehaviorSubject to manage search term input.
-Use debounceTime and distincyUntilChanged operators to optimize search input handling.
- Implement switchMap to handle search requests and update the filtered contacts list

* refactor: Replace FormControl with input event binding for search functionality

* styles: update styles

* Contact component with delete function (HLena#3)

* Added updateContact fn in ContactService for update favorites with backend

* Updated Json data

* Added delete contact feature

* feat: Implement update and delete functionalities for contacts (HLena#4)

* Added updateContact fn in ContactService for update favorites with backend

* Updated Json data

* Added delete contact feature

---------

Co-authored-by: Heberth López <[email protected]>

* refactor: Update project structure
This commit updates the project structure to improve organization and maintainability.

**Changes:**
- Moved `data-access` folder to a `home` directory
- Relocated `contact` and `search-contact` components  to a `home/ui`` directory
- Updated import paths in affected files

* component: create edit compoenent

* feat: edit functionality working

* Added default avatar for contacts without imageUrl

* Changes in Contact component

* feat: create user done!

* Updated getContactById fn for error handling

* task: basic validations added

* Updated HomeComponent with welcome message

* Added Error404 page with styles

* Update ContactPage when a contact is not found

* chore: add data folder to gitignore file

* chore: remove share contact service

* chore: remove unnecessary imports

* Updated Home Page

* chore: disabled button when required

* Refactor ContactService, SearchContactComponent, and ContactComponent (HLena#6)

* feat: Add HttpClientModule import to enable HTTP requests in HomeComponent

* feat: Persist selected contact in localStorage across page reloads

* fix: Optimize contact data management with contact$ observable

Refactor the contact management to utilize a contact$ observable in the ContactService. This change allows for more efficient and responsive updates when changes occur in the backend database (db.js)

* fix: Centralize ContactService provider in AppComponent for shared state management
- Removed individual ContactService providers from each component to address an issue where updates to contacts$ observable were not being detected across components.
- Set ContactService as a provider in AppComponent to ensure a single, application-wide instance, allowing all components to share and reflect a consistent state.

* feat: Add tap and map operators to update contacts$ observable with new data
- Implement tap and map operators in ContactService to transform and update the contacts$ observable.
- This change ensures that any updates to the contact data are reflected in the observable, improving data consistency across the application.

* feat: Add tap and filter operators in deleteContact method to update contacts$ observable with new data
- Implement tap and filter operators in deleteContact method to transform and update the contacts$ observable.
- This change ensures that any updates to the contact data are reflected in the observable, improving data consistency across the application.

* fear: Manage selected contact Id using BehaviorSubject instead of localStorage

* refactor: Simplify ContactComponent by removing redundant error handling
- Removed unnecessary catchError in ngOnInit.
- Leveraged error handling from service methods.
- Consolidated subscriptions for easier management and cleanup.

* refactor: Add error handling in ContactService
- Implemented catchError in all HTTP request methods.
- Added handleError method to log errors and provide default values.

* feat: Refactor SearchContactComponent to manage state with BehaviorSubject
- Updated to use BehaviorSubject for managing selected contact ID.
- Added setupSearchSubscription, setupContactsSubscription, and setupSelectedContactSubscription methods for better readability.
- Subscribed to selectedContactId$ observable.
- Removed localStorage usage for storing the selected contact ID.
- Ensured proper cleanup of subscriptions in ngOnDestroy.

* refactor: removed disabled on new button

* chore: increase number of random characters in id generator

* Update contact (HLena#9)

* feat: Add HttpClientModule import to enable HTTP requests in HomeComponent

* feat: Persist selected contact in localStorage across page reloads

* fix: Optimize contact data management with contact$ observable

Refactor the contact management to utilize a contact$ observable in the ContactService. This change allows for more efficient and responsive updates when changes occur in the backend database (db.js)

* fix: Centralize ContactService provider in AppComponent for shared state management
- Removed individual ContactService providers from each component to address an issue where updates to contacts$ observable were not being detected across components.
- Set ContactService as a provider in AppComponent to ensure a single, application-wide instance, allowing all components to share and reflect a consistent state.

* feat: Add tap and map operators to update contacts$ observable with new data
- Implement tap and map operators in ContactService to transform and update the contacts$ observable.
- This change ensures that any updates to the contact data are reflected in the observable, improving data consistency across the application.

* feat: Add tap and filter operators in deleteContact method to update contacts$ observable with new data
- Implement tap and filter operators in deleteContact method to transform and update the contacts$ observable.
- This change ensures that any updates to the contact data are reflected in the observable, improving data consistency across the application.

* fear: Manage selected contact Id using BehaviorSubject instead of localStorage

* refactor: Simplify ContactComponent by removing redundant error handling
- Removed unnecessary catchError in ngOnInit.
- Leveraged error handling from service methods.
- Consolidated subscriptions for easier management and cleanup.

* refactor: Add error handling in ContactService
- Implemented catchError in all HTTP request methods.
- Added handleError method to log errors and provide default values.

* feat: Refactor SearchContactComponent to manage state with BehaviorSubject
- Updated to use BehaviorSubject for managing selected contact ID.
- Added setupSearchSubscription, setupContactsSubscription, and setupSelectedContactSubscription methods for better readability.
- Subscribed to selectedContactId$ observable.
- Removed localStorage usage for storing the selected contact ID.
- Ensured proper cleanup of subscriptions in ngOnDestroy.

* fix: Updates the request url to get contacts sorted alphabetically

* feat: Update contacts$ observable after create, edit or delete a contact

* fix: removes contactService from providers

* feat: implements scrollToContact to show always the selected contact in the list
- Added scrollToContact method in SearchContactComponent to scroll to the selected contact.
- Applied scroll-margin-top to contact items to ensure they are not too close to the top edge when scrolled into view.
- Ensured new contact is visible in the contact list immediately.

* refactor: submit button text depens on action to execute

* Username Validations (HLena#11)

* refactor: deletes consolo.log

* feat: Add username validation using UsernameValidatorDirective in contact edit form
- Implemented validateUsername function to validate usernames.
- Created UsernameValidatorDirective to use custom username validation.

* chore: Adds '@' before username in contact component

---------

Co-authored-by: Heberth López <[email protected]>
Co-authored-by: Heberth López <[email protected]>
Co-authored-by: CrhistianT <[email protected]>
Co-authored-by: Crhistian Turpo <[email protected]>
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.

2 participants