So I wanted to add a favourites option to the list of repos in the form of “staring” the favourite repositories. The Idea with creating a favourites option is that I’ll show the favourite repositories on the home page so the user can get to them quicker.
The favourites options will need to be stored in some local storage so for this I’ll actually use my favourite local storage library that comes as part of the Ionic libraries. https://github.com/ionic-team/ionic-storage
To install this storage library
npm install @ionic/storage-angular
Once its installed I need to make a new storage service. You can interface to the library directly in each components but I want to make it simple to replace if needed.
The service code is pretty much the given boilerplate in the link above, I have just added a get method to it.

So without thinking to much about it, I have swapped the repositories lists to simply use some mat cards and popped a button up in the top right of the card to show a star or star border depending on if its already a favourite or not.

A bit of testing on both the web app and electron versions of the apps just to make sure the data persists, seems to work ok and doesn’t look to bad.

Next I need to allow the user to drill down into a repo to check if it has any open pull requests.
If this project interests you then please consider joining my newsletter.
Categories: ezConsole
Leave a Reply