mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-19 12:59:36 +02:00
Fix general category handling
This commit is contained in:
parent
ce0b82acb7
commit
adf45ff557
16 changed files with 192 additions and 126 deletions
|
@ -111,7 +111,16 @@ class Adventure(models.Model):
|
||||||
if force_insert and force_update:
|
if force_insert and force_update:
|
||||||
raise ValueError("Cannot force both insert and updating in model saving.")
|
raise ValueError("Cannot force both insert and updating in model saving.")
|
||||||
if not self.category:
|
if not self.category:
|
||||||
self.category = Category.objects.get_or_create(user_id=self.user_id, name='general', display_name='General', icon='🌍')[0]
|
category, created = Category.objects.get_or_create(
|
||||||
|
user_id=self.user_id,
|
||||||
|
name='general',
|
||||||
|
defaults={
|
||||||
|
'display_name': 'General',
|
||||||
|
'icon': '🌍'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.category = category
|
||||||
|
|
||||||
return super().save(force_insert, force_update, using, update_fields)
|
return super().save(force_insert, force_update, using, update_fields)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -273,4 +282,4 @@ class Category(models.Model):
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name + ' - ' + self.display_name + ' - ' + self.icon
|
|
@ -118,6 +118,7 @@ class AdventureSerializer(CustomModelSerializer):
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
visits_data = validated_data.pop('visits', [])
|
visits_data = validated_data.pop('visits', [])
|
||||||
category_data = validated_data.pop('category', None)
|
category_data = validated_data.pop('category', None)
|
||||||
|
print(category_data)
|
||||||
adventure = Adventure.objects.create(**validated_data)
|
adventure = Adventure.objects.create(**validated_data)
|
||||||
for visit_data in visits_data:
|
for visit_data in visits_data:
|
||||||
Visit.objects.create(adventure=adventure, **visit_data)
|
Visit.objects.create(adventure=adventure, **visit_data)
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="badge badge-primary">
|
<div class="badge badge-primary">
|
||||||
{`${adventure.category.display_name} ${adventure.category.icon}`}
|
{adventure.category?.display_name + ' ' + adventure.category?.icon}
|
||||||
</div>
|
</div>
|
||||||
<div class="badge badge-success">
|
<div class="badge badge-success">
|
||||||
{adventure.is_visited ? $t('adventures.visited') : $t('adventures.planned')}
|
{adventure.is_visited ? $t('adventures.visited') : $t('adventures.planned')}
|
||||||
|
|
|
@ -31,13 +31,6 @@
|
||||||
selectCategory(new_category);
|
selectCategory(new_category);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function removeCategory(categoryName: string) {
|
|
||||||
// categories = categories.filter((category) => category.name !== categoryName);
|
|
||||||
// if (selected_category && selected_category.name === categoryName) {
|
|
||||||
// selected_category = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown when clicking outside
|
||||||
let dropdownRef: HTMLDivElement;
|
let dropdownRef: HTMLDivElement;
|
||||||
|
|
||||||
|
@ -59,7 +52,7 @@
|
||||||
<button type="button" class="btn btn-outline w-full text-left" on:click={toggleDropdown}>
|
<button type="button" class="btn btn-outline w-full text-left" on:click={toggleDropdown}>
|
||||||
{selected_category && selected_category.name
|
{selected_category && selected_category.name
|
||||||
? selected_category.display_name + ' ' + selected_category.icon
|
? selected_category.display_name + ' ' + selected_category.icon
|
||||||
: 'Select Category'}
|
: $t('categories.select_category')}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if isOpen}
|
{#if isOpen}
|
||||||
|
@ -69,13 +62,13 @@
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Category Name"
|
placeholder={$t('categories.category_name')}
|
||||||
class="input input-bordered w-full max-w-xs"
|
class="input input-bordered w-full max-w-xs"
|
||||||
bind:value={new_category.display_name}
|
bind:value={new_category.display_name}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Icon"
|
placeholder={$t('categories.icon')}
|
||||||
class="input input-bordered w-full max-w-xs"
|
class="input input-bordered w-full max-w-xs"
|
||||||
bind:value={new_category.icon}
|
bind:value={new_category.icon}
|
||||||
/>
|
/>
|
||||||
|
@ -93,13 +86,6 @@
|
||||||
on:click={() => selectCategory(category)}
|
on:click={() => selectCategory(category)}
|
||||||
>
|
>
|
||||||
<span>{category.display_name} {category.icon} ({category.num_adventures})</span>
|
<span>{category.display_name} {category.icon} ({category.num_adventures})</span>
|
||||||
<!-- <button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-xs btn-error"
|
|
||||||
on:click|stopPropagation={() => removeCategory(category.name)}
|
|
||||||
>
|
|
||||||
{$t('adventures.remove')}
|
|
||||||
</button> -->
|
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
let category_fetch = await fetch('/api/categories/categories');
|
let category_fetch = await fetch('/api/categories/categories');
|
||||||
categories = await category_fetch.json();
|
categories = await category_fetch.json();
|
||||||
// remove the general category if it exists
|
// remove the general category if it exists
|
||||||
categories = categories.filter((c) => c.name !== 'general');
|
// categories = categories.filter((c) => c.name !== 'general');
|
||||||
});
|
});
|
||||||
|
|
||||||
async function saveCategory() {
|
async function saveCategory() {
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||||
<div class="modal-box" role="dialog" on:keydown={handleKeydown} tabindex="0">
|
<div class="modal-box" role="dialog" on:keydown={handleKeydown} tabindex="0">
|
||||||
<h3 class="font-bold text-lg">Manage Categories</h3>
|
<h3 class="font-bold text-lg">{$t('categories.manage_categories')}</h3>
|
||||||
|
|
||||||
{#each categories as category}
|
{#each categories as category}
|
||||||
<div class="flex justify-between items-center mt-2">
|
<div class="flex justify-between items-center mt-2">
|
||||||
|
@ -82,32 +82,36 @@
|
||||||
<button on:click={() => (category_to_edit = category)} class="btn btn-primary btn-sm"
|
<button on:click={() => (category_to_edit = category)} class="btn btn-primary btn-sm"
|
||||||
>Edit</button
|
>Edit</button
|
||||||
>
|
>
|
||||||
<button on:click={removeCategory(category)} class="btn btn-warning btn-sm">Remove</button>
|
{#if category.name != 'general'}
|
||||||
|
<button on:click={removeCategory(category)} class="btn btn-warning btn-sm"
|
||||||
|
>{$t('adventures.remove')}</button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
{#if categories.length === 0}
|
{#if categories.length === 0}
|
||||||
<p>No categories found.</p>
|
<p>{$t('categories.no_categories_found')}</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if category_to_edit}
|
{#if category_to_edit}
|
||||||
<h2 class="text-center text-xl font-semibold mt-2 mb-2">Edit Category</h2>
|
<h2 class="text-center text-xl font-semibold mt-2 mb-2">{$t('categories.edit_category')}</h2>
|
||||||
<div class="flex flex-row space-x-2 form-control">
|
<div class="flex flex-row space-x-2 form-control">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Name"
|
placeholder={$t('adventures.name')}
|
||||||
bind:value={category_to_edit.display_name}
|
bind:value={category_to_edit.display_name}
|
||||||
class="input input-bordered w-full max-w-xs"
|
class="input input-bordered w-full max-w-xs"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Icon"
|
placeholder={$t('categories.icon')}
|
||||||
bind:value={category_to_edit.icon}
|
bind:value={category_to_edit.icon}
|
||||||
class="input input-bordered w-full max-w-xs"
|
class="input input-bordered w-full max-w-xs"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary" on:click={saveCategory}>Save</button>
|
<button class="btn btn-primary" on:click={saveCategory}>{$t('notes.save')}</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<button class="btn btn-primary mt-4" on:click={close}>{$t('about.close')}</button>
|
<button class="btn btn-primary mt-4" on:click={close}>{$t('about.close')}</button>
|
||||||
|
@ -127,7 +131,7 @@
|
||||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||||
></path>
|
></path>
|
||||||
</svg>
|
</svg>
|
||||||
<span>The adventure cards will be updated once you refresh the page.</span>
|
<span>{$t('categories.update_after_refresh')}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
import PaletteOutline from '~icons/mdi/palette-outline';
|
import PaletteOutline from '~icons/mdi/palette-outline';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { t, locale, locales } from 'svelte-i18n';
|
import { t, locale, locales } from 'svelte-i18n';
|
||||||
|
import { themes } from '$lib';
|
||||||
|
|
||||||
let query: string = '';
|
let query: string = '';
|
||||||
|
|
||||||
|
@ -214,44 +215,18 @@
|
||||||
<button class="btn" on:click={() => (isAboutModalOpen = true)}>{$t('navbar.about')}</button>
|
<button class="btn" on:click={() => (isAboutModalOpen = true)}>{$t('navbar.about')}</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm mt-2"
|
class="btn btn-sm mt-2"
|
||||||
on:click={() => (window.location.href = 'https://docs.adventurelog.app/')}
|
on:click={() => (window.location.href = 'https://adventurelog.app')}
|
||||||
>{$t('navbar.documentation')}</button
|
>{$t('navbar.documentation')}</button
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm mt-2"
|
class="btn btn-sm mt-2"
|
||||||
on:click={() => (window.location.href = 'https://discord.gg/wRbQ9Egr8C')}>Discord</button
|
on:click={() => (window.location.href = 'https://discord.gg/wRbQ9Egr8C')}>Discord</button
|
||||||
>
|
>
|
||||||
<p class="font-bold m-4 text-lg text-center">{$t('navbar.theme_selection')}</p>
|
<button
|
||||||
<form method="POST" use:enhance={submitUpdateTheme}>
|
class="btn btn-sm mt-2"
|
||||||
<li>
|
on:click={() => (window.location.href = 'https://buymeacoffee.com/seanmorley15')}
|
||||||
<button formaction="/?/setTheme&theme=light"
|
>{$t('navbar.support')} 💖</button
|
||||||
>{$t('navbar.themes.light')}<WeatherSunny class="w-6 h-6" />
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<button formaction="/?/setTheme&theme=dark"
|
|
||||||
>{$t('navbar.themes.dark')}<WeatherNight class="w-6 h-6" /></button
|
|
||||||
>
|
>
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<button formaction="/?/setTheme&theme=night"
|
|
||||||
>{$t('navbar.themes.night')}<WeatherNight class="w-6 h-6" /></button
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<button formaction="/?/setTheme&theme=forest"
|
|
||||||
>{$t('navbar.themes.forest')}<Forest class="w-6 h-6" /></button
|
|
||||||
>
|
|
||||||
<button formaction="/?/setTheme&theme=aestheticLight"
|
|
||||||
>{$t('navbar.themes.aestetic-light')}<PaletteOutline class="w-6 h-6" /></button
|
|
||||||
>
|
|
||||||
<button formaction="/?/setTheme&theme=aestheticDark"
|
|
||||||
>{$t('navbar.themes.aestetic-dark')}<PaletteOutline class="w-6 h-6" /></button
|
|
||||||
>
|
|
||||||
<button formaction="/?/setTheme&theme=aqua"
|
|
||||||
>{$t('navbar.themes.aqua')}<Water class="w-6 h-6" /></button
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<p class="font-bold m-4 text-lg text-center">{$t('navbar.language_selection')}</p>
|
<p class="font-bold m-4 text-lg text-center">{$t('navbar.language_selection')}</p>
|
||||||
<form method="POST" use:enhance>
|
<form method="POST" use:enhance>
|
||||||
<select
|
<select
|
||||||
|
@ -265,6 +240,15 @@
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" name="locale" value={$locale} />
|
<input type="hidden" name="locale" value={$locale} />
|
||||||
</form>
|
</form>
|
||||||
|
<p class="font-bold m-4 text-lg text-center">{$t('navbar.theme_selection')}</p>
|
||||||
|
<form method="POST" use:enhance={submitUpdateTheme}>
|
||||||
|
{#each themes as theme}
|
||||||
|
<li>
|
||||||
|
<button formaction="/?/setTheme&theme={theme.name}"
|
||||||
|
>{$t(`navbar.themes.${theme.name}`)}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
</form>
|
</form>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -305,3 +305,13 @@ export function findFirstValue(obj: any): any {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export let themes = [
|
||||||
|
{ name: 'light', label: 'Light' },
|
||||||
|
{ name: 'dark', label: 'Dark' },
|
||||||
|
{ name: 'night', label: 'Night' },
|
||||||
|
{ name: 'forest', label: 'Forest' },
|
||||||
|
{ name: 'aqua', label: 'Aqua' },
|
||||||
|
{ name: 'aestheticLight', label: 'Aesthetic Light' },
|
||||||
|
{ name: 'aestheticDark', label: 'Aesthetic Dark' }
|
||||||
|
];
|
||||||
|
|
|
@ -187,7 +187,8 @@
|
||||||
"day": "Tag",
|
"day": "Tag",
|
||||||
"add_a_tag": "Fügen Sie ein Tag hinzu",
|
"add_a_tag": "Fügen Sie ein Tag hinzu",
|
||||||
"tags": "Schlagworte",
|
"tags": "Schlagworte",
|
||||||
"set_to_pin": "Auf „Anpinnen“ setzen"
|
"set_to_pin": "Auf „Anpinnen“ setzen",
|
||||||
|
"category_fetch_error": "Fehler beim Abrufen der Kategorien"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Entdecken, planen und erkunden Sie mit Leichtigkeit",
|
"desc_1": "Entdecken, planen und erkunden Sie mit Leichtigkeit",
|
||||||
|
@ -219,19 +220,20 @@
|
||||||
"shared_with_me": "Mit mir geteilt",
|
"shared_with_me": "Mit mir geteilt",
|
||||||
"theme_selection": "Themenauswahl",
|
"theme_selection": "Themenauswahl",
|
||||||
"themes": {
|
"themes": {
|
||||||
"aestetic-dark": "Ästhetisches Dunkel",
|
|
||||||
"aestetic-light": "Ästhetisches Licht",
|
|
||||||
"aqua": "Aqua",
|
"aqua": "Aqua",
|
||||||
"dark": "Dunkel",
|
"dark": "Dunkel",
|
||||||
"forest": "Wald",
|
"forest": "Wald",
|
||||||
"light": "Licht",
|
"light": "Licht",
|
||||||
"night": "Nacht"
|
"night": "Nacht",
|
||||||
|
"aestheticDark": "Ästhetisches Dunkel",
|
||||||
|
"aestheticLight": "Ästhetisches Licht"
|
||||||
},
|
},
|
||||||
"users": "Benutzer",
|
"users": "Benutzer",
|
||||||
"worldtravel": "Weltreisen",
|
"worldtravel": "Weltreisen",
|
||||||
"my_tags": "Meine Tags",
|
"my_tags": "Meine Tags",
|
||||||
"tag": "Etikett",
|
"tag": "Etikett",
|
||||||
"language_selection": "Sprache"
|
"language_selection": "Sprache",
|
||||||
|
"support": "Unterstützung"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"confirm_password": "Passwort bestätigen",
|
"confirm_password": "Passwort bestätigen",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "Benutzerstatistiken",
|
"user_stats": "Benutzerstatistiken",
|
||||||
"visited_countries": "Besuchte Länder",
|
"visited_countries": "Besuchte Länder",
|
||||||
"visited_regions": "Besuchte Regionen"
|
"visited_regions": "Besuchte Regionen"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "Kategoriename",
|
||||||
|
"edit_category": "Kategorie bearbeiten",
|
||||||
|
"icon": "Symbol",
|
||||||
|
"manage_categories": "Kategorien verwalten",
|
||||||
|
"no_categories_found": "Keine Kategorien gefunden.",
|
||||||
|
"select_category": "Kategorie auswählen",
|
||||||
|
"update_after_refresh": "Die Abenteuerkarten werden aktualisiert, sobald Sie die Seite aktualisieren."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,15 @@
|
||||||
"documentation": "Documentation",
|
"documentation": "Documentation",
|
||||||
"discord": "Discord",
|
"discord": "Discord",
|
||||||
"language_selection": "Language",
|
"language_selection": "Language",
|
||||||
|
"support": "Support",
|
||||||
"theme_selection": "Theme Selection",
|
"theme_selection": "Theme Selection",
|
||||||
"themes": {
|
"themes": {
|
||||||
"light": "Light",
|
"light": "Light",
|
||||||
"dark": "Dark",
|
"dark": "Dark",
|
||||||
"night": "Night",
|
"night": "Night",
|
||||||
"forest": "Forest",
|
"forest": "Forest",
|
||||||
"aestetic-dark": "Aestetic Dark",
|
"aestheticLight": "Aesthetic Light",
|
||||||
"aestetic-light": "Aestetic Light",
|
"aestheticDark": "Aesthetic Dark",
|
||||||
"aqua": "Aqua"
|
"aqua": "Aqua"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -400,5 +401,14 @@
|
||||||
"user_stats": "User Stats",
|
"user_stats": "User Stats",
|
||||||
"visited_countries": "Visited Countries",
|
"visited_countries": "Visited Countries",
|
||||||
"visited_regions": "Visited Regions"
|
"visited_regions": "Visited Regions"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"manage_categories": "Manage Categories",
|
||||||
|
"no_categories_found": "No categories found.",
|
||||||
|
"edit_category": "Edit Category",
|
||||||
|
"icon": "Icon",
|
||||||
|
"update_after_refresh": "The adventure cards will be updated once you refresh the page.",
|
||||||
|
"select_category": "Select Category",
|
||||||
|
"category_name": "Category Name"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
"dark": "Oscuro",
|
"dark": "Oscuro",
|
||||||
"night": "Noche",
|
"night": "Noche",
|
||||||
"forest": "Bosque",
|
"forest": "Bosque",
|
||||||
"aestetic-dark": "Estético Oscuro",
|
"aqua": "Aqua",
|
||||||
"aestetic-light": "Estético Claro",
|
"aestheticDark": "Estética Oscura",
|
||||||
"aqua": "Aqua"
|
"aestheticLight": "Luz estetica"
|
||||||
},
|
},
|
||||||
"my_tags": "Mis etiquetas",
|
"my_tags": "Mis etiquetas",
|
||||||
"tag": "Etiqueta",
|
"tag": "Etiqueta",
|
||||||
"language_selection": "Idioma"
|
"language_selection": "Idioma",
|
||||||
|
"support": "Apoyo"
|
||||||
},
|
},
|
||||||
"about": {
|
"about": {
|
||||||
"about": "Acerca de",
|
"about": "Acerca de",
|
||||||
|
@ -231,7 +232,8 @@
|
||||||
"day": "Día",
|
"day": "Día",
|
||||||
"add_a_tag": "Agregar una etiqueta",
|
"add_a_tag": "Agregar una etiqueta",
|
||||||
"tags": "Etiquetas",
|
"tags": "Etiquetas",
|
||||||
"set_to_pin": "Establecer en Fijar"
|
"set_to_pin": "Establecer en Fijar",
|
||||||
|
"category_fetch_error": "Error al buscar categorías"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"all": "Todo",
|
"all": "Todo",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "Estadísticas de usuario",
|
"user_stats": "Estadísticas de usuario",
|
||||||
"visited_countries": "Países visitados",
|
"visited_countries": "Países visitados",
|
||||||
"visited_regions": "Regiones visitadas"
|
"visited_regions": "Regiones visitadas"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "Nombre de categoría",
|
||||||
|
"edit_category": "Editar categoría",
|
||||||
|
"icon": "Icono",
|
||||||
|
"manage_categories": "Administrar categorías",
|
||||||
|
"no_categories_found": "No se encontraron categorías.",
|
||||||
|
"select_category": "Seleccionar categoría",
|
||||||
|
"update_after_refresh": "Las tarjetas de aventuras se actualizarán una vez que actualices la página."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@
|
||||||
"day": "Jour",
|
"day": "Jour",
|
||||||
"add_a_tag": "Ajouter une balise",
|
"add_a_tag": "Ajouter une balise",
|
||||||
"tags": "Balises",
|
"tags": "Balises",
|
||||||
"set_to_pin": "Définir sur Épingler"
|
"set_to_pin": "Définir sur Épingler",
|
||||||
|
"category_fetch_error": "Erreur lors de la récupération des catégories"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",
|
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",
|
||||||
|
@ -222,16 +223,17 @@
|
||||||
"forest": "Forêt",
|
"forest": "Forêt",
|
||||||
"light": "Lumière",
|
"light": "Lumière",
|
||||||
"night": "Nuit",
|
"night": "Nuit",
|
||||||
"aestetic-dark": "Esthétique sombre",
|
|
||||||
"aestetic-light": "Lumière esthétique",
|
|
||||||
"aqua": "Aqua",
|
"aqua": "Aqua",
|
||||||
"dark": "Sombre"
|
"dark": "Sombre",
|
||||||
|
"aestheticDark": "Esthétique sombre",
|
||||||
|
"aestheticLight": "Lumière esthétique"
|
||||||
},
|
},
|
||||||
"users": "Utilisateurs",
|
"users": "Utilisateurs",
|
||||||
"worldtravel": "Voyage dans le monde",
|
"worldtravel": "Voyage dans le monde",
|
||||||
"my_tags": "Mes balises",
|
"my_tags": "Mes balises",
|
||||||
"tag": "Étiqueter",
|
"tag": "Étiqueter",
|
||||||
"language_selection": "Langue"
|
"language_selection": "Langue",
|
||||||
|
"support": "Soutien"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"confirm_password": "Confirmez le mot de passe",
|
"confirm_password": "Confirmez le mot de passe",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "Statistiques des utilisateurs",
|
"user_stats": "Statistiques des utilisateurs",
|
||||||
"visited_countries": "Pays visités",
|
"visited_countries": "Pays visités",
|
||||||
"visited_regions": "Régions visitées"
|
"visited_regions": "Régions visitées"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "Nom de la catégorie",
|
||||||
|
"edit_category": "Modifier la catégorie",
|
||||||
|
"icon": "Icône",
|
||||||
|
"manage_categories": "Gérer les catégories",
|
||||||
|
"no_categories_found": "Aucune catégorie trouvée.",
|
||||||
|
"select_category": "Sélectionnez une catégorie",
|
||||||
|
"update_after_refresh": "Les cartes d'aventure seront mises à jour une fois que vous aurez actualisé la page."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@
|
||||||
"day": "Giorno",
|
"day": "Giorno",
|
||||||
"add_a_tag": "Aggiungi un'etichetta",
|
"add_a_tag": "Aggiungi un'etichetta",
|
||||||
"tags": "Tag",
|
"tags": "Tag",
|
||||||
"set_to_pin": "Imposta su Blocca"
|
"set_to_pin": "Imposta su Blocca",
|
||||||
|
"category_fetch_error": "Errore durante il recupero delle categorie"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Scopri, pianifica ed esplora con facilità",
|
"desc_1": "Scopri, pianifica ed esplora con facilità",
|
||||||
|
@ -219,19 +220,20 @@
|
||||||
"shared_with_me": "Condiviso con me",
|
"shared_with_me": "Condiviso con me",
|
||||||
"theme_selection": "Selezione del tema",
|
"theme_selection": "Selezione del tema",
|
||||||
"themes": {
|
"themes": {
|
||||||
"aestetic-dark": "Oscuro estetico",
|
|
||||||
"aestetic-light": "Luce estetica",
|
|
||||||
"aqua": "Acqua",
|
"aqua": "Acqua",
|
||||||
"dark": "Buio",
|
"dark": "Buio",
|
||||||
"forest": "Foresta",
|
"forest": "Foresta",
|
||||||
"light": "Leggero",
|
"light": "Leggero",
|
||||||
"night": "Notte"
|
"night": "Notte",
|
||||||
|
"aestheticDark": "Estetico scuro",
|
||||||
|
"aestheticLight": "Luce estetica"
|
||||||
},
|
},
|
||||||
"users": "Utenti",
|
"users": "Utenti",
|
||||||
"worldtravel": "Viaggio nel mondo",
|
"worldtravel": "Viaggio nel mondo",
|
||||||
"my_tags": "I miei tag",
|
"my_tags": "I miei tag",
|
||||||
"tag": "Etichetta",
|
"tag": "Etichetta",
|
||||||
"language_selection": "Lingua"
|
"language_selection": "Lingua",
|
||||||
|
"support": "Supporto"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"confirm_password": "Conferma password",
|
"confirm_password": "Conferma password",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "Statistiche utente",
|
"user_stats": "Statistiche utente",
|
||||||
"visited_countries": "Paesi visitati",
|
"visited_countries": "Paesi visitati",
|
||||||
"visited_regions": "Regioni visitate"
|
"visited_regions": "Regioni visitate"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "Nome della categoria",
|
||||||
|
"edit_category": "Modifica categoria",
|
||||||
|
"icon": "Icona",
|
||||||
|
"manage_categories": "Gestisci categorie",
|
||||||
|
"no_categories_found": "Nessuna categoria trovata.",
|
||||||
|
"select_category": "Seleziona Categoria",
|
||||||
|
"update_after_refresh": "Le carte avventura verranno aggiornate una volta aggiornata la pagina."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@
|
||||||
"day": "Dag",
|
"day": "Dag",
|
||||||
"add_a_tag": "Voeg een label toe",
|
"add_a_tag": "Voeg een label toe",
|
||||||
"tags": "Labels",
|
"tags": "Labels",
|
||||||
"set_to_pin": "Stel in op Vastzetten"
|
"set_to_pin": "Stel in op Vastzetten",
|
||||||
|
"category_fetch_error": "Fout bij ophalen van categorieën"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Ontdek, plan en verken met gemak",
|
"desc_1": "Ontdek, plan en verken met gemak",
|
||||||
|
@ -219,19 +220,20 @@
|
||||||
"shared_with_me": "Gedeeld met mij",
|
"shared_with_me": "Gedeeld met mij",
|
||||||
"theme_selection": "Thema Selectie",
|
"theme_selection": "Thema Selectie",
|
||||||
"themes": {
|
"themes": {
|
||||||
"aestetic-dark": "Esthetisch donker",
|
|
||||||
"aestetic-light": "Esthetisch licht",
|
|
||||||
"aqua": "Aqua",
|
"aqua": "Aqua",
|
||||||
"dark": "Donker",
|
"dark": "Donker",
|
||||||
"forest": "Woud",
|
"forest": "Woud",
|
||||||
"light": "Licht",
|
"light": "Licht",
|
||||||
"night": "Nacht"
|
"night": "Nacht",
|
||||||
|
"aestheticDark": "Esthetisch donker",
|
||||||
|
"aestheticLight": "Esthetisch licht"
|
||||||
},
|
},
|
||||||
"users": "Gebruikers",
|
"users": "Gebruikers",
|
||||||
"worldtravel": "Wereldreizen",
|
"worldtravel": "Wereldreizen",
|
||||||
"my_tags": "Mijn tags",
|
"my_tags": "Mijn tags",
|
||||||
"tag": "Label",
|
"tag": "Label",
|
||||||
"language_selection": "Taal"
|
"language_selection": "Taal",
|
||||||
|
"support": "Steun"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"confirm_password": "Bevestig wachtwoord",
|
"confirm_password": "Bevestig wachtwoord",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "Gebruikersstatistieken",
|
"user_stats": "Gebruikersstatistieken",
|
||||||
"visited_countries": "Bezochte landen",
|
"visited_countries": "Bezochte landen",
|
||||||
"visited_regions": "Bezochte regio's"
|
"visited_regions": "Bezochte regio's"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "Categorienaam",
|
||||||
|
"edit_category": "Categorie bewerken",
|
||||||
|
"icon": "Icon",
|
||||||
|
"manage_categories": "Beheer categorieën",
|
||||||
|
"no_categories_found": "Geen categorieën gevonden.",
|
||||||
|
"select_category": "Selecteer Categorie",
|
||||||
|
"update_after_refresh": "De avonturenkaarten worden bijgewerkt zodra u de pagina vernieuwt."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@
|
||||||
"day": "Dag",
|
"day": "Dag",
|
||||||
"add_a_tag": "Lägg till en tagg",
|
"add_a_tag": "Lägg till en tagg",
|
||||||
"tags": "Taggar",
|
"tags": "Taggar",
|
||||||
"set_to_pin": "Ställ in på Pin"
|
"set_to_pin": "Ställ in på Pin",
|
||||||
|
"category_fetch_error": "Det gick inte att hämta kategorier"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Upptäck, planera och utforska med lätthet",
|
"desc_1": "Upptäck, planera och utforska med lätthet",
|
||||||
|
@ -219,19 +220,20 @@
|
||||||
"shared_with_me": "Delade med mig",
|
"shared_with_me": "Delade med mig",
|
||||||
"theme_selection": "Temaval",
|
"theme_selection": "Temaval",
|
||||||
"themes": {
|
"themes": {
|
||||||
"aestetic-dark": "Estetisk mörk",
|
|
||||||
"aestetic-light": "Estetiskt ljus",
|
|
||||||
"aqua": "Aqua",
|
"aqua": "Aqua",
|
||||||
"dark": "Mörk",
|
"dark": "Mörk",
|
||||||
"forest": "Skog",
|
"forest": "Skog",
|
||||||
"light": "Ljus",
|
"light": "Ljus",
|
||||||
"night": "Natt"
|
"night": "Natt",
|
||||||
|
"aestheticDark": "Estetisk mörk",
|
||||||
|
"aestheticLight": "Estetiskt ljus"
|
||||||
},
|
},
|
||||||
"users": "Användare",
|
"users": "Användare",
|
||||||
"worldtravel": "Världsresor",
|
"worldtravel": "Världsresor",
|
||||||
"my_tags": "Mina taggar",
|
"my_tags": "Mina taggar",
|
||||||
"tag": "Märka",
|
"tag": "Märka",
|
||||||
"language_selection": "Språk"
|
"language_selection": "Språk",
|
||||||
|
"support": "Stöd"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"all": "Alla",
|
"all": "Alla",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "Användarstatistik",
|
"user_stats": "Användarstatistik",
|
||||||
"visited_countries": "Besökta länder",
|
"visited_countries": "Besökta länder",
|
||||||
"visited_regions": "Besökte regioner"
|
"visited_regions": "Besökte regioner"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "Kategorinamn",
|
||||||
|
"edit_category": "Redigera kategori",
|
||||||
|
"icon": "Ikon",
|
||||||
|
"manage_categories": "Hantera kategorier",
|
||||||
|
"no_categories_found": "Inga kategorier hittades.",
|
||||||
|
"select_category": "Välj Kategori",
|
||||||
|
"update_after_refresh": "Äventyrskorten kommer att uppdateras när du uppdaterar sidan."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@
|
||||||
"day": "天",
|
"day": "天",
|
||||||
"add_a_tag": "添加标签",
|
"add_a_tag": "添加标签",
|
||||||
"tags": "标签",
|
"tags": "标签",
|
||||||
"set_to_pin": "设置为固定"
|
"set_to_pin": "设置为固定",
|
||||||
|
"category_fetch_error": "获取类别时出错"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "轻松发现、规划和探索",
|
"desc_1": "轻松发现、规划和探索",
|
||||||
|
@ -219,19 +220,20 @@
|
||||||
"shared_with_me": "与我分享",
|
"shared_with_me": "与我分享",
|
||||||
"theme_selection": "主题选择",
|
"theme_selection": "主题选择",
|
||||||
"themes": {
|
"themes": {
|
||||||
"aestetic-dark": "审美黑暗",
|
|
||||||
"aestetic-light": "审美之光",
|
|
||||||
"aqua": "阿夸",
|
"aqua": "阿夸",
|
||||||
"dark": "黑暗的",
|
"dark": "黑暗的",
|
||||||
"forest": "森林",
|
"forest": "森林",
|
||||||
"light": "光",
|
"light": "光",
|
||||||
"night": "夜晚"
|
"night": "夜晚",
|
||||||
|
"aestheticDark": "审美黑暗",
|
||||||
|
"aestheticLight": "美学之光"
|
||||||
},
|
},
|
||||||
"users": "用户",
|
"users": "用户",
|
||||||
"worldtravel": "环球旅行",
|
"worldtravel": "环球旅行",
|
||||||
"my_tags": "我的标签",
|
"my_tags": "我的标签",
|
||||||
"tag": "标签",
|
"tag": "标签",
|
||||||
"language_selection": "语言"
|
"language_selection": "语言",
|
||||||
|
"support": "支持"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"forgot_password": "忘记密码?",
|
"forgot_password": "忘记密码?",
|
||||||
|
@ -399,5 +401,14 @@
|
||||||
"user_stats": "用户统计",
|
"user_stats": "用户统计",
|
||||||
"visited_countries": "访问过的国家",
|
"visited_countries": "访问过的国家",
|
||||||
"visited_regions": "访问地区"
|
"visited_regions": "访问地区"
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"category_name": "类别名称",
|
||||||
|
"edit_category": "编辑类别",
|
||||||
|
"icon": "图标",
|
||||||
|
"manage_categories": "管理类别",
|
||||||
|
"no_categories_found": "未找到类别。",
|
||||||
|
"select_category": "选择类别",
|
||||||
|
"update_after_refresh": "刷新页面后,冒险卡将更新。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
|
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
|
||||||
import { redirect, type Actions } from '@sveltejs/kit';
|
import { redirect, type Actions } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad } from './$types';
|
import { themes } from '$lib';
|
||||||
import { getRandomBackground } from '$lib';
|
|
||||||
|
|
||||||
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
|
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
|
||||||
|
|
||||||
|
@ -9,21 +8,7 @@ export const actions: Actions = {
|
||||||
setTheme: async ({ url, cookies }) => {
|
setTheme: async ({ url, cookies }) => {
|
||||||
const theme = url.searchParams.get('theme');
|
const theme = url.searchParams.get('theme');
|
||||||
// change the theme only if it is one of the allowed themes
|
// change the theme only if it is one of the allowed themes
|
||||||
if (
|
if (theme && themes.find((t) => t.name === theme)) {
|
||||||
theme &&
|
|
||||||
[
|
|
||||||
'light',
|
|
||||||
'dark',
|
|
||||||
'night',
|
|
||||||
'retro',
|
|
||||||
'forest',
|
|
||||||
'aqua',
|
|
||||||
'forest',
|
|
||||||
'aestheticLight',
|
|
||||||
'aestheticDark',
|
|
||||||
'emerald'
|
|
||||||
].includes(theme)
|
|
||||||
) {
|
|
||||||
cookies.set('colortheme', theme, {
|
cookies.set('colortheme', theme, {
|
||||||
path: '/',
|
path: '/',
|
||||||
maxAge: 60 * 60 * 24 * 365
|
maxAge: 60 * 60 * 24 * 365
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue