Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.db import migrations, models
from users.models import BASEMAP_CHOICES


class Migration(migrations.Migration):

dependencies = [
('adventures', '0076_normalize_all_day_visit_end_dates'),
]

operations = [
migrations.AddField(
model_name='collection',
name='map_style',
field=models.CharField(choices=BASEMAP_CHOICES, default='default', max_length=32),
),
]
5 changes: 5 additions & 0 deletions backend/server/adventures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import threading
from django.contrib.auth import get_user_model
from django.contrib.postgres.fields import ArrayField
# For map style choice
from users.models import BASEMAP_CHOICES
from django_resized import ResizedImageField
from djmoney.models.fields import MoneyField
from worldtravel.models import City, Country, Region, VisitedCity, VisitedRegion
Expand Down Expand Up @@ -298,6 +300,9 @@ class Collection(models.Model):
blank=True,
)

# Optional collection-level default map style.
map_style = models.CharField(max_length=32, choices=BASEMAP_CHOICES, default='default')

# if connected locations are private and collection is public, raise an error
def clean(self):
if self.is_public and self.pk: # Only check if the instance has a primary key
Expand Down
3 changes: 2 additions & 1 deletion backend/server/adventures/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ class Meta:
'days_until_start',
'primary_image',
'primary_image_id',
'map_style',
]
read_only_fields = ['id', 'created_at', 'updated_at', 'user', 'shared_with', 'status', 'days_until_start', 'primary_image']

Expand Down Expand Up @@ -1197,7 +1198,7 @@ class Meta:
fields = [
'id', 'user', 'name', 'description', 'is_public', 'start_date', 'end_date',
'is_archived', 'link', 'created_at', 'updated_at', 'location_images',
'location_count', 'shared_with', 'collaborators', 'status', 'days_until_start', 'primary_image'
'location_count', 'shared_with', 'collaborators', 'status', 'days_until_start', 'primary_image', 'map_style'
]
read_only_fields = fields # All fields are read-only for listing

Expand Down
25 changes: 24 additions & 1 deletion frontend/src/lib/components/CollectionModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { addToast } from '$lib/toasts';
import { copyToClipboard } from '$lib/index';
import type { Collection, ContentImage, SlimCollection } from '$lib/types';
import { basemapOptions } from '$lib';

// Icons
import CollectionIcon from '~icons/mdi/folder-multiple';
Expand Down Expand Up @@ -37,6 +38,7 @@
days_until_start: collectionToEdit?.days_until_start ?? null,
primary_image: collectionToEdit?.primary_image ?? null,
primary_image_id: collectionToEdit?.primary_image_id ?? null,
map_style: collectionToEdit?.map_style ?? 'default',
itinerary_days: []
};

Expand Down Expand Up @@ -166,7 +168,8 @@
end_date: collection.end_date,
is_public: collection.is_public,
link: collection.link,
primary_image_id: coverImageId
primary_image_id: coverImageId,
map_style: collection.map_style
};

// Clean up link: empty/whitespace → null, invalid URL → null
Expand Down Expand Up @@ -331,6 +334,26 @@
placeholder="https://example.com"
/>
</div>

<!-- Collection default map style -->
<div class="form-control">
<label class="label" for="map_style">
<span class="label-text font-medium">Default map style</span>
</label>
<select
id="map_style"
name="map_style"
bind:value={collection.map_style}
class="select select-bordered w-full"
>
{#each basemapOptions as option}
<option value={option.value}>{option.label}</option>
{/each}
</select>
<p class="text-sm text-base-content/60 mt-2">
{$t('collection.map_style_desc')}
</p>
</div>
</div>

<!-- Right Column -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
export let clusterOptions: any = { radius: 300, maxZoom: 8, minPoints: 2 };

let basemapType = 'default';
$: if (user && basemapType === 'default' && user.map_style) {
basemapType = normalizeBasemapType(user.map_style);
$: if (basemapType === 'default') {
const userStyle = user?.map_style ? normalizeBasemapType(user.map_style) : 'default';
const collectionStyle = collection?.map_style
? normalizeBasemapType(collection.map_style)
: 'default';
if (userStyle !== 'default') basemapType = userStyle;
else if (collectionStyle !== 'default') basemapType = collectionStyle;
}

type MarkerType = 'location' | 'lodging' | 'transportation';
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export type Collection = {
itinerary_days: CollectionItineraryDay[]; // Day metadata (names/descriptions)
status: 'folder' | 'upcoming' | 'in_progress' | 'completed';
days_until_start: number | null;
map_style?: string | null;
};

export type SlimCollection = {
Expand All @@ -207,6 +208,7 @@ export type SlimCollection = {
primary_image?: ContentImage | null;
status: 'folder' | 'upcoming' | 'in_progress' | 'completed';
days_until_start: number | null;
map_style?: string | null;
};

export type GeocodeSearchResult = {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@
"location_primary": "Location cover",
"set_cover": "Set cover",
"clear_cover": "Clear cover",
"collaborators": "Collaborators"
"collaborators": "Collaborators",
"map_style_desc": "Used as the default basemap for this collection."
},
"notes": {
"note_deleted": "Note deleted successfully!",
Expand Down
Loading