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

Store locations of expenses #172

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Teilkasko
Copy link

@Teilkasko Teilkasko commented Jun 19, 2024

To close #18 I implemented a first iteration for storing locations of expenses. It adds a new card to the expense form where users can see and change the location of where an expense was made.

Users can choose between having their current location determined (by accessing navigator.geolocation) and manually setting/correcting it by dragging the position marker on the map; alternatively they can also place it somewhere by clicking/tapping on the map.

Locations are stored in a separate table Point, which has a 1:1 relationship to Expense, this way it is ensured that a position always consists of both latitude and longitude (or otherwise it just does not exist). Initially my plan was to use the point datatype of Postgres for storage, but unfortunately at this point the Prisma ORM does not support the PG geometric data types (and apparently it will not any time soon).

Screencast

simplescreenrecorder-2024-06-23_19.36.10.mp4

@dcbr
Copy link
Contributor

dcbr commented Jun 24, 2024

Awesome feature, great job!
Extra suggestion: Could you maybe add a textfield (e.g. under the expense date) that allows you to freely describe a location without having to put a marker on a map? Then you could add a button right next to that textfield that links towards the Location card to further specify it/put an exact marker.

@Teilkasko
Copy link
Author

Thank you for the feedback! @dcbr

Could you maybe add a textfield (e.g. under the expense date) that allows you to freely describe a location without having to put a marker on a map? Then you could add a button right next to that textfield that links towards the Location card to further specify it/put an exact marker.

Intuitively it feels a bit like creating a redundancy, as such a free-text description/mentioning of a location can already be done as part of the existing input fields (title or notes). I find myself usually writing the name of a place, where an expense was made, into the title, i. e. "Dinner at 4 seasons". Also I can imagine that for users it might be a bit confusing to have two different points in the app page where to store location-related details (the input field in the top card and then further down the location card with the map view). From your perspective, what would be the benefit to add another input field to the already existing ones?

@dcbr
Copy link
Contributor

dcbr commented Jun 25, 2024

My idea was that this free text location description could be used in the expense overview list (which doesn't make sense for coordinates only). I quickly drew an example on the figure below (extracted from your video).
image
That's a bit cleaner than putting the location information in the title (or notes), in my opinion. It might also make location based filtering easier if that would be added in the future.
Regarding the UI inside the expense form, we might have to fine tune that a bit. But I guess if both the text input and map view are close together, it shouldn't be too confusing.
Now that I think about it, it might be possible to extract the city name automatically from the marker location? That would also "suit my needs", although others might want to specify alternative descriptions (including street names for example, or only the country), hence why I would make it free-text. Or maybe we could make this a group setting (e.g. show country only, country + city, city only, city + street)?

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.

REQUEST: Add Location of Transaction
2 participants