-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #338 from seanmorley15/development
Development
- Loading branch information
Showing
24 changed files
with
206 additions
and
127 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
backend/server/adventures/migrations/0010_collection_link.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.8 on 2024-10-08 03:05 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('adventures', '0009_alter_adventure_type'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='collection', | ||
name='link', | ||
field=models.URLField(blank=True, max_length=2083, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<script lang="ts"> | ||
import type { Adventure } from '$lib/types'; | ||
import ImageDisplayModal from './ImageDisplayModal.svelte'; | ||
export let adventures: Adventure[] = []; | ||
let currentSlide = 0; | ||
let image_url: string | null = null; | ||
$: adventure_images = adventures.flatMap((adventure) => | ||
adventure.images.map((image) => ({ image: image.image, adventure: adventure })) | ||
); | ||
$: { | ||
if (adventure_images.length > 0) { | ||
currentSlide = 0; | ||
} | ||
} | ||
function changeSlide(direction: string) { | ||
if (direction === 'next' && currentSlide < adventure_images.length - 1) { | ||
currentSlide = currentSlide + 1; | ||
} else if (direction === 'prev' && currentSlide > 0) { | ||
currentSlide = currentSlide - 1; | ||
} | ||
} | ||
</script> | ||
|
||
{#if image_url} | ||
<ImageDisplayModal | ||
adventure={adventure_images[currentSlide].adventure} | ||
image={image_url} | ||
on:close={() => (image_url = null)} | ||
/> | ||
{/if} | ||
|
||
<figure> | ||
{#if adventure_images && adventure_images.length > 0} | ||
<div class="carousel w-full relative"> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<div class="carousel-item w-full block"> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<!-- svelte-ignore a11y-no-static-element-interactions --> | ||
<!-- svelte-ignore a11y-missing-attribute --> | ||
<a | ||
on:click|stopPropagation={() => (image_url = adventure_images[currentSlide].image)} | ||
class="cursor-pointer" | ||
> | ||
<img | ||
src={adventure_images[currentSlide].image} | ||
class="w-full h-48 object-cover" | ||
alt={adventure_images[currentSlide].adventure.name} | ||
/> | ||
</a> | ||
|
||
{#if adventure_images.length > 1} | ||
<div class="absolute inset-0 flex items-center justify-between pointer-events-none"> | ||
{#if currentSlide > 0} | ||
<button | ||
on:click|stopPropagation={() => changeSlide('prev')} | ||
class="btn btn-circle btn-sm ml-2 pointer-events-auto">❮</button | ||
> | ||
{:else} | ||
<div class="w-12"></div> | ||
{/if} | ||
|
||
{#if currentSlide < adventure_images.length - 1} | ||
<button | ||
on:click|stopPropagation={() => changeSlide('next')} | ||
class="btn btn-circle mr-2 btn-sm pointer-events-auto">❯</button | ||
> | ||
{:else} | ||
<div class="w-12"></div> | ||
{/if} | ||
</div> | ||
{/if} | ||
</div> | ||
</div> | ||
{:else} | ||
<!-- svelte-ignore a11y-img-redundant-alt --> | ||
<img | ||
src={'https://placehold.co/300?text=No%20Image%20Found&font=roboto'} | ||
alt="No image available" | ||
class="w-full h-48 object-cover" | ||
/> | ||
{/if} | ||
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.