-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
249 lines (236 loc) · 6.88 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<script setup lang="ts">
import '~/assets/flag.css';
import '~/assets/style.css';
useSeoMeta({
title: 'OnlyMaya - Food 🍕',
ogTitle: 'OnlyMaya - Food 🍕',
description: 'Food and Friends is the best combo, don\'t waste time!',
ogDescription: 'Food and Friends is the best combo, don\'t waste time!',
ogImage: 'https://www.onlymaya.it/open.jpg',
twitterCard: 'summary_large_image',
})
interface Places {
id: number;
name: string;
city: string;
flag: string;
total: number;
photo: string;
photoBlack?: boolean;
votes: {
price: number;
location: number;
service: number;
food: number;
};
link: string;
when: string;
}
const places = ref<Places[]>([]);
const search = ref('');
const dinner = ref(true);
const lunch = ref(true);
const filteredContacts = computed(() => {
let res = places.value;
if (!lunch.value) {
res = res.filter((item) => {
return item.when !== 'lunch';
});
}
if (!dinner.value) {
res = res.filter((item) => {
return item.when !== 'dinner';
});
}
if (!search.value) {
return res;
}
const filterRe = new RegExp(search.value, 'i');
return res.filter((item) => {
return [item.name, item.city].some(item =>
item.match(filterRe),
);
});
});
places.value = usePlaces().value;
</script>
<template>
<div class="min-h-screen">
<div class="text-center">
<h1 class="mt-0 pt-4 mb-2 text-4xl font-bold text-primary">
OnlyMaya - Food 🍕
</h1>
<p class="font-sans text-lg text-slate-500">
List of place where I eat with my friends 🐼
</p>
</div>
<div class="flex justify-content-center mb-4 align-items-center">
<IconField>
<InputIcon class="pi pi-search" />
<InputText
v-model="search"
placeholder="Search"
autocomplete="off"
/>
</IconField>
</div>
<div class="flex justify-content-center mb-6 align-items-center">
<InputSwitch
v-model="dinner"
input-id="dinner"
class="ml-4 mr-2"
/>
<label for="dinner">Dinner </label><i class="pi pi-moon" />
<InputSwitch
v-model="lunch"
input-id="lunch"
class="ml-4 mr-2"
/>
<label for="lunch">Lunch </label><i class="pi pi-sun" />
</div>
<div>
<div
v-if="filteredContacts.length === 0"
class="flex justify-content-center"
>
<Message
:closable="false"
severity="secondary"
icon="pi pi-wave-pulse"
>
Sorry, no places matching your search criteria.
</Message>
</div>
<div
v-else
class="flex flex-wrap justify-content-center gap-6 mb-6"
>
<TransitionGroup
enter-active-class="transform-gpu"
enter-from-class="opacity-0 -translate-x-full"
enter-to-class="opacity-100 translate-x-0"
leave-active-class="absolute transform-gpu"
leave-from-class="opacity-100 translate-x-0"
leave-to-class="opacity-0 -translate-x-full"
>
<div
v-for="contact in filteredContacts"
:key="contact.id"
class="border-primary border-3 border-round p-3 transition-all duration-300 w-10 md:w-3"
>
<!-- Photo -->
<div
style="height: 80px;"
class="align-content-center"
>
<div class="flex justify-content-center">
<img
v-if="contact.photoBlack"
class=" bg-black-alpha-50"
style="max-height: 80px; max-width: 200px"
:src="contact.photo"
:alt="contact.name"
>
<img
v-else
style="max-height: 80px;max-width: 200px"
:src="contact.photo"
:alt="contact.name"
>
</div>
</div>
<!-- Name -->
<div class="text-center mt-4">
<a
:href="`${contact.link}`"
target="_blank"
class="no-underline text-primary"
>
<h4 class="text-lg font-medium text-slate-700 mb-2">
{{ contact.name }}
</h4>
</a>
<p class="text-sm text-slate-400">
{{ contact.city }} <img
:alt="contact.city"
src="https://primefaces.org/cdn/primevue/images/flag/flag_placeholder.png"
:class="`mr-2 flag flag-${contact.flag.toLowerCase()}`"
style="width: 18px"
>
</p>
</div>
<!-- Points -->
<div class="flex justify-content-evenly align-items-center">
<div class="w-full">
<div class="m-0 flex ">
<p class="my-2 font-semibold">
Location:
</p><p class="my-2">
{{ contact.votes.location }}/10
</p>
</div>
<div class="m-0 flex ">
<p class="my-2 font-semibold">
Service:
</p><p class="my-2">
{{ contact.votes.service }}/10
</p>
</div>
<div class="m-0 flex ">
<p class="my-2 font-semibold">
Food:
</p><p class="my-2">
{{ contact.votes.food }}/10
</p>
</div>
<div class="m-0 flex">
<p class="my-2 font-semibold">
Price:
</p><p class="my-2">
{{ contact.votes.price }}/10
</p>
</div>
</div>
<div class="w-full text-center">
<Knob
v-model="contact.total"
readonly
/>
</div>
</div>
<!-- Chip -->
<div class="mt-2">
<Chip
v-if="contact.when === 'lunch'"
label="Lunch"
icon="pi pi-clock"
class="bg-orange-500 text-white"
/>
<Chip
v-if="contact.when === 'dinner'"
label="Dinner"
icon="pi pi-moon"
class="bg-blue-800 text-white"
/>
</div>
</div>
</TransitionGroup>
<Message
:closable="false"
severity="secondary"
icon="pi pi-wave-pulse"
class="w-full mx-4"
>
Total records {{ filteredContacts.length }}
</Message>
<ScrollTop />
</div>
<FooterUnicorne/>
</div>
</div>
</template>
<style>
html, body {
margin: 0;
}
</style>