From d73cb4dbb8a70a23828c5878d79f88aeb84f5d2c Mon Sep 17 00:00:00 2001 From: Eloi Zalczer Date: Wed, 19 Jun 2024 17:31:04 +0200 Subject: [PATCH] Added connection error message, added max height for tags field, added optional google maps link, added price options. --- src/components/CreateRestaurantModal.vue | 23 +++++++++++++++++++++-- src/components/RestaurantsTable.vue | 5 +++-- src/components/ReviewsDrawer.vue | 24 ++++++++++++++++++------ src/components/TagsField.vue | 4 +++- src/models/restaurant.ts | 1 + src/views/ListView.vue | 5 +++-- src/views/LoginView.vue | 12 ++++++++++-- 7 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/components/CreateRestaurantModal.vue b/src/components/CreateRestaurantModal.vue index aab53b3..d46f08a 100644 --- a/src/components/CreateRestaurantModal.vue +++ b/src/components/CreateRestaurantModal.vue @@ -18,6 +18,10 @@ const { errors, handleSubmit, defineField, resetForm } = useForm({ name: yup.string().required("This field is required."), tags: yup.array().of(yup.string()), price: yup.string().required("This field is required."), + googleMapsLink: yup + .string() + .trim() + .matches(/^$|https:\/\/maps\.app\.goo\.gl\/[a-zA-Z0-9]+/, "Not a valid Google Maps link."), }) ), }); @@ -39,6 +43,7 @@ const submit = handleSubmit((values) => { tags: tags, latitude: position.value?.lat, longitude: position.value?.lng, + googleMapsLink: values.googleMapsLink, }); emit("succeeded", `Restaurant ${values.name} created successfully!`); @@ -65,6 +70,7 @@ onMounted(async () => { const [name, nameAttrs] = defineField("name"); const [tags, tagsAttrs] = defineField("tags"); const [price, priceAttrs] = defineField("price"); +const [googleMapsLink, googleMapsLinkAttrs] = defineField("googleMapsLink"); const emit = defineEmits({ succeeded: (message: string) => true, @@ -138,12 +144,25 @@ defineExpose({ show, hide, setRestaurantPosition }); v-bind="priceAttrs" > - - + + + +
+
+ + + +
+
diff --git a/src/components/RestaurantsTable.vue b/src/components/RestaurantsTable.vue index 3cb9fc7..659923a 100644 --- a/src/components/RestaurantsTable.vue +++ b/src/components/RestaurantsTable.vue @@ -23,6 +23,7 @@ const columns = [ _: "[, ]", }, }, + { data: "price", title: "Price" }, { data: "average_rating", title: "" }, ]; @@ -39,7 +40,7 @@ function deselectAll() { } const emit = defineEmits({ - restaurantSelected: (restaurant: Object) => true, + restaurantSelected: (restaurant: Restaurant) => true, restaurantHovered: (restaurant: Object | null) => true, }); @@ -92,7 +93,7 @@ defineExpose({ deselectAll }); }" @select="onRowSelected" > -