happy-plants
happy-plants copied to clipboard
Integration with Trefle
Hi, what do you think about the Idea to add integration to https://trefle.io? This way plant information could automatically be added.
Interesting, thanks for sharing @phiwut! I was looking for something like this when I started this project but didn't find anything useful back then. This could potentially enable some really cool features, like you suggested automated plant information. :)
I will fiddle around with that API and see what possibilities this brings for HappyPlants!
Hi Moriz, I tried to implement treffle but I sadly couldn't figure out where you locate the API logic (in the API folder?) and the business logic for loading the data in the Overview component. However, I'm interested to see how you'll implement this feature :)
Hey @phiwut,
thanks for giving it a shot! I'm following the development around Trefle and up until today they didn't have any client-side API tokens. With that addition it should be possible to work on some experimental features, e.g. autocompleting data or having an entirely separate plant module. Alternatively, Netlify's Lambda functions could be used to fetch the data. However, the project is still in very early stages and the API might break/change quickly. I am very interested in this API, just not sure about its maturity at this stage.
I don't want to discourage you contributing to this project though, just sharing my thoughts on it. :)
couldn't figure out where you locate the API logic (in the API folder?) and the business logic for loading the data in the Overview component.
Everything in the src/api
directory is meant to be a light wrapper around any API used in the application. In this case Firebase, localForage
, and sessionStorage
. I realise the naming is a bit ambiguous.
The actual business logic of the application can always be found in the store
directory of any feature. In your example it would be src/app/overview/store
. The actions
dispatch and fetch data, while mutations
take the input and mutate the state. Since the overview screen doesn't do anything with data, except displaying it, there isn't anything business logic. Take a look into src/app/plant/store/actions
to get a better understanding of it.
I should probably write a little bit of documentation on the overall application architecture so it's easier to contribute :)
Thanks!