|
1 | 1 | <script lang="ts"> |
2 | 2 | import type { Collection, User, ContentImage } from '$lib/types'; |
3 | 3 | import { onMount } from 'svelte'; |
| 4 | + import { t } from 'svelte-i18n'; |
4 | 5 | import { DefaultMarker, MapLibre, Popup } from 'svelte-maplibre'; |
5 | 6 | import { getBasemapUrl } from '$lib'; |
6 | 7 | import MagnifyIcon from '~icons/mdi/magnify'; |
|
22 | 23 | export let collection: Collection; |
23 | 24 | export let user: User | null; |
24 | 25 | // Whether the current user can modify this collection (owner or shared user) |
25 | | - export let canModify: boolean = false; |
26 | 26 |
|
27 | 27 | type RecommendationResult = { |
28 | 28 | name: string; |
|
269 | 269 | <div class="card-body"> |
270 | 270 | <h2 class="card-title text-2xl mb-4"> |
271 | 271 | <Compass class="w-8 h-8" /> |
272 | | - Discover Places |
| 272 | + {$t('recomendations.discover_places')} |
273 | 273 | </h2> |
274 | 274 |
|
275 | 275 | <!-- Search Options --> |
|
278 | 278 | {#if locationsWithCoords.length > 0} |
279 | 279 | <div class="form-control"> |
280 | 280 | <label class="label"> |
281 | | - <span class="label-text font-semibold">Search Around Location</span> |
| 281 | + <span class="label-text font-semibold" |
| 282 | + >{$t('recomendations.search_around_location')}</span |
| 283 | + > |
282 | 284 | </label> |
283 | 285 | <select class="select select-bordered w-full" bind:value={selectedLocationId}> |
284 | | - <option value={null}>Use search instead...</option> |
| 286 | + <option value={null}>{$t('recomendations.use_search_instead')}...</option> |
285 | 287 | {#each locationsWithCoords as location} |
286 | 288 | <option value={location.id}>{location.name}</option> |
287 | 289 | {/each} |
|
292 | 294 | <!-- Search Input --> |
293 | 295 | <div class="form-control"> |
294 | 296 | <label class="label"> |
295 | | - <span class="label-text font-semibold"> |
296 | | - {locationsWithCoords.length > 0 ? 'Or Search by Address' : 'Search by Address'} |
297 | | - </span> |
| 297 | + <span class="label-text font-semibold">{$t('recomendations.search_by_address')}</span> |
298 | 298 | </label> |
299 | 299 | <input |
300 | 300 | type="text" |
301 | | - placeholder="Enter city, address, or place..." |
| 301 | + placeholder={$t('adventures.search_placeholder')} |
302 | 302 | class="input input-bordered w-full" |
303 | 303 | bind:value={searchQuery} |
304 | 304 | disabled={selectedLocationId !== null} |
|
309 | 309 | <!-- Category Selector --> |
310 | 310 | <div class="form-control"> |
311 | 311 | <label class="label"> |
312 | | - <span class="label-text font-semibold">Category</span> |
| 312 | + <span class="label-text font-semibold">{$t('adventures.category')}</span> |
313 | 313 | </label> |
314 | 314 | <select class="select select-bordered w-full" bind:value={selectedCategory}> |
315 | | - <option value="tourism">🏛️ Tourist Attractions</option> |
316 | | - <option value="lodging">🏨 Hotels & Lodging</option> |
317 | | - <option value="food">🍴 Restaurants & Food</option> |
| 315 | + <option value="tourism">🏛️ {$t('recomendations.tourism')}</option> |
| 316 | + <option value="lodging">🏨 {$t('recomendations.lodging')}</option> |
| 317 | + <option value="food">🍴 {$t('recomendations.food')}</option> |
318 | 318 | </select> |
319 | 319 | </div> |
320 | 320 |
|
321 | 321 | <!-- Radius Selector --> |
322 | 322 | <div class="form-control"> |
323 | 323 | <label class="label"> |
324 | | - <span class="label-text font-semibold">Search Radius: {radiusDisplay}</span> |
| 324 | + <span class="label-text font-semibold" |
| 325 | + >{$t('recomendations.search_radius_label')} {radiusDisplay}</span |
| 326 | + > |
325 | 327 | </label> |
326 | 328 | <select class="select select-bordered w-full" bind:value={radiusValue}> |
327 | 329 | {#each radiusOptions as option} |
|
336 | 338 | <button class="btn btn-primary flex-1" on:click={searchRecommendations} disabled={loading}> |
337 | 339 | {#if loading} |
338 | 340 | <span class="loading loading-spinner loading-sm"></span> |
339 | | - Searching... |
| 341 | + {$t('recomendations.searching')} |
340 | 342 | {:else} |
341 | 343 | <MagnifyIcon class="w-5 h-5" /> |
342 | | - Search |
| 344 | + {$t('navbar.search')} |
343 | 345 | {/if} |
344 | 346 | </button> |
345 | 347 | <button class="btn btn-ghost" on:click={() => (showFilters = !showFilters)}> |
346 | 348 | <TuneVariant class="w-5 h-5" /> |
347 | | - Filters |
| 349 | + {$t('adventures.filter')} |
348 | 350 | </button> |
349 | 351 | </div> |
350 | 352 |
|
351 | 353 | <!-- Advanced Filters --> |
352 | 354 | {#if showFilters} |
353 | | - <div class="divider">Filters</div> |
| 355 | + <div class="divider">{$t('adventures.filter')}</div> |
354 | 356 | <div class="grid grid-cols-1 md:grid-cols-3 gap-4"> |
355 | 357 | <div class="form-control"> |
356 | 358 | <label class="label"> |
357 | | - <span class="label-text">Minimum Rating</span> |
| 359 | + <span class="label-text">{$t('recomendations.minimum_rating')}</span> |
358 | 360 | </label> |
359 | 361 | <select class="select select-bordered select-sm" bind:value={minRating}> |
360 | | - <option value={0}>Any</option> |
| 362 | + <option value={0}>{$t('recomendations.any')}</option> |
361 | 363 | <option value={3}>3+ ⭐</option> |
362 | 364 | <option value={3.5}>3.5+ ⭐</option> |
363 | 365 | <option value={4}>4+ ⭐</option> |
|
366 | 368 | </div> |
367 | 369 |
|
368 | 370 | <div class="form-control"> |
| 371 | + <!-- svelte-ignore a11y-label-has-associated-control --> |
369 | 372 | <label class="label"> |
370 | | - <span class="label-text">Minimum Reviews</span> |
| 373 | + <span class="label-text">{$t('recomendations.minimum_reviews')}</span> |
371 | 374 | </label> |
372 | 375 | <select class="select select-bordered select-sm" bind:value={minReviews}> |
373 | | - <option value={0}>Any</option> |
| 376 | + <option value={0}>{$t('recomendations.any')}</option> |
374 | 377 | <option value={10}>10+</option> |
375 | 378 | <option value={50}>50+</option> |
376 | 379 | <option value={100}>100+</option> |
|
380 | 383 |
|
381 | 384 | <div class="form-control"> |
382 | 385 | <label class="label cursor-pointer"> |
383 | | - <span class="label-text">Open Now Only</span> |
| 386 | + <span class="label-text">{$t('recomendations.open_now_only')}</span> |
384 | 387 | <input type="checkbox" class="toggle toggle-primary" bind:checked={showOpenOnly} /> |
385 | 388 | </label> |
386 | 389 | </div> |
|
406 | 409 | <!-- Results Stats --> |
407 | 410 | <div class="stats shadow w-full"> |
408 | 411 | <div class="stat"> |
409 | | - <div class="stat-title">Total Results</div> |
| 412 | + <div class="stat-title">{$t('recomendations.total_results')}</div> |
410 | 413 | <div class="stat-value text-primary">{filteredResults.length}</div> |
411 | 414 | </div> |
412 | 415 | <div class="stat"> |
413 | | - <div class="stat-title">Average Rating</div> |
| 416 | + <div class="stat-title">{$t('recomendations.average_rating')}</div> |
414 | 417 | <div class="stat-value text-secondary"> |
415 | 418 | {( |
416 | 419 | filteredResults.filter((r) => r.rating).reduce((sum, r) => sum + (r.rating || 0), 0) / |
|
420 | 423 | </div> |
421 | 424 | </div> |
422 | 425 | <div class="stat"> |
423 | | - <div class="stat-title">Search Radius</div> |
| 426 | + <div class="stat-title">{$t('recomendations.search_radius_label')}</div> |
424 | 427 | <div class="stat-value text-accent">{radiusDisplay}</div> |
425 | 428 | </div> |
426 | 429 | </div> |
427 | 430 |
|
428 | 431 | <!-- Map View --> |
429 | 432 | <div class="card bg-base-200 shadow-xl"> |
430 | 433 | <div class="card-body"> |
431 | | - <h3 class="card-title text-xl mb-4">📍 Map View</h3> |
| 434 | + <h3 class="card-title text-xl mb-4">📍 {$t('recomendations.map_view')}</h3> |
432 | 435 | <div class="rounded-lg overflow-hidden shadow-lg"> |
433 | 436 | <MapLibre |
434 | 437 | style={getBasemapUrl()} |
|
650 | 653 | <div class="card bg-base-200 shadow-xl"> |
651 | 654 | <div class="card-body text-center py-12"> |
652 | 655 | <MagnifyIcon class="w-24 h-24 mx-auto opacity-30 mb-4" /> |
653 | | - <h3 class="text-2xl font-bold mb-2">No Results Yet</h3> |
654 | | - <p class="opacity-70"> |
655 | | - Select a location or enter a search query to discover amazing places nearby! |
656 | | - </p> |
| 656 | + <h3 class="text-2xl font-bold mb-2">{$t('recomendations.no_results_yet')}</h3> |
| 657 | + <p class="opacity-70">{$t('recomendations.select_location_or_query')}</p> |
657 | 658 | </div> |
658 | 659 | </div> |
659 | 660 | {/if} |
|
0 commit comments