From 5303d3bf6f59667e25d60ce21c9af133363f1503 Mon Sep 17 00:00:00 2001 From: Brutal Strike Date: Tue, 25 Jun 2024 10:50:29 +0300 Subject: [PATCH] Refactor code to split logic into multiple components --- README.md | 14 ++++++- components/AttractionList.vue | 40 ++++++++++++++++++++ components/Filters.vue | 18 +++++++++ components/MapView.vue | 53 ++++++++++++++++++++++++++ pages/index.vue | 71 +++-------------------------------- 5 files changed, 129 insertions(+), 67 deletions(-) create mode 100644 components/AttractionList.vue create mode 100644 components/Filters.vue create mode 100644 components/MapView.vue diff --git a/README.md b/README.md index 8c5c534..54caf89 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ - - https://github.com/friuns2/travelmaps/assets/16543239/3fc07810-ec7a-4c82-93c5-e9d5e8550002 @@ -62,6 +60,18 @@ Created with [GPTCall App Creator](https://app.gptcall.net/) 5. Toggle between list and map views on mobile devices. 6. Use the "Show Itinerary" button to view your planned route. +## Component Structure and Usage + +The application's logic has been refactored to split into multiple Vue components for better maintainability and scalability. Here's an overview of the new components and how they are used: + +- `AttractionList.vue`: This component is responsible for rendering the list of attractions. It receives the list of attractions as a prop and handles user interactions such as focusing on an attraction or toggling it in the itinerary. + +- `MapView.vue`: This component handles the display of the interactive map. It receives the home location and the list of attractions as props, and it is responsible for initializing the map, creating markers, and displaying directions. + +- `Filters.vue`: This component provides the UI for filtering attractions based on the minimum rating count. It receives the minimum rating count as a prop and emits an event when the value changes. + +These components are imported and used in the `pages/index.vue` file, which acts as the main entry point for the application's UI. + ## Future Plans - Implement AI support to generate travel recommendations and itineraries based on user preferences and travel style. diff --git a/components/AttractionList.vue b/components/AttractionList.vue new file mode 100644 index 0000000..e81ad3e --- /dev/null +++ b/components/AttractionList.vue @@ -0,0 +1,40 @@ + + + diff --git a/components/Filters.vue b/components/Filters.vue new file mode 100644 index 0000000..6aee42a --- /dev/null +++ b/components/Filters.vue @@ -0,0 +1,18 @@ + + + diff --git a/components/MapView.vue b/components/MapView.vue new file mode 100644 index 0000000..8d5af5b --- /dev/null +++ b/components/MapView.vue @@ -0,0 +1,53 @@ + + + diff --git a/pages/index.vue b/pages/index.vue index 1e5fdcd..6ef0fc7 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,5 +1,4 @@ -