Compare commits
2 Commits
09c6751564
...
397ba1efa4
| Author | SHA1 | Date | |
|---|---|---|---|
|
397ba1efa4
|
|||
|
1a943cebcf
|
@@ -156,6 +156,18 @@
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force full retranslation of entire recipe
|
||||||
|
function forceFullRetranslation() {
|
||||||
|
// Set changedFields to empty array to trigger full translation
|
||||||
|
changedFields = [];
|
||||||
|
showTranslationWorkflow = true;
|
||||||
|
|
||||||
|
// Scroll to translation section
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById('translation-section')?.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle translation approval
|
// Handle translation approval
|
||||||
function handleTranslationApproved(event: CustomEvent) {
|
function handleTranslationApproved(event: CustomEvent) {
|
||||||
translationData = event.detail.translatedRecipe;
|
translationData = event.detail.translatedRecipe;
|
||||||
@@ -473,6 +485,9 @@ button.action_button{
|
|||||||
{#if !showTranslationWorkflow}
|
{#if !showTranslationWorkflow}
|
||||||
<div class=submit_buttons>
|
<div class=submit_buttons>
|
||||||
<button class=action_button on:click={doDelete}><p>Löschen</p><Cross fill=white width=2rem height=2rem></Cross></button>
|
<button class=action_button on:click={doDelete}><p>Löschen</p><Cross fill=white width=2rem height=2rem></Cross></button>
|
||||||
|
{#if translationData}
|
||||||
|
<button class=action_button style="background-color: var(--nord13);" on:click={forceFullRetranslation}><p>Vollständig neu übersetzen</p><Check fill=white width=2rem height=2rem></Check></button>
|
||||||
|
{/if}
|
||||||
<button class=action_button on:click={prepareSubmit}><p>Weiter zur Übersetzung</p><Check fill=white width=2rem height=2rem></Check></button>
|
<button class=action_button on:click={prepareSubmit}><p>Weiter zur Übersetzung</p><Check fill=white width=2rem height=2rem></Check></button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ export const GET: RequestHandler = async ({ locals }) => {
|
|||||||
return json([]);
|
return json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get recipes that are favorited AND have English translations
|
// Get recipes that are favorited AND have approved English translations
|
||||||
let recipes = await Recipe.find({
|
let recipes = await Recipe.find({
|
||||||
_id: { $in: userFavorites.favorites },
|
_id: { $in: userFavorites.favorites },
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
}).lean();
|
}).lean();
|
||||||
|
|
||||||
// Transform to English format
|
// Transform to English format
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import { rand_array } from '$lib/js/randomize';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Find all recipes that have English translations
|
// Find all recipes that have approved English translations
|
||||||
const recipes = await Recipe.find(
|
const recipes = await Recipe.find(
|
||||||
{ 'translations.en': { $exists: true } },
|
{ 'translations.en.translationStatus': 'approved' },
|
||||||
'_id translations.en short_name season dateModified icon'
|
'_id translations.en short_name season dateModified icon'
|
||||||
).lean();
|
).lean();
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { dbConnect } from '../../../../../utils/db';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Get distinct categories from English translations
|
// Get distinct categories from approved English translations
|
||||||
const categories = await Recipe.distinct('translations.en.category', {
|
const categories = await Recipe.distinct('translations.en.category', {
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
}).lean();
|
}).lean();
|
||||||
|
|
||||||
return json(JSON.parse(JSON.stringify(categories)));
|
return json(JSON.parse(JSON.stringify(categories)));
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import { rand_array } from '$lib/js/randomize';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Find recipes in this category that have English translations
|
// Find recipes in this category that have approved English translations
|
||||||
const recipes = await Recipe.find(
|
const recipes = await Recipe.find(
|
||||||
{
|
{
|
||||||
'translations.en.category': params.category,
|
'translations.en.category': params.category,
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
},
|
},
|
||||||
'_id translations.en short_name images season dateModified icon'
|
'_id translations.en short_name images season dateModified icon'
|
||||||
).lean();
|
).lean();
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import { rand_array } from '$lib/js/randomize';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Find recipes with this icon that have English translations
|
// Find recipes with this icon that have approved English translations
|
||||||
const recipes = await Recipe.find(
|
const recipes = await Recipe.find(
|
||||||
{
|
{
|
||||||
icon: params.icon,
|
icon: params.icon,
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
},
|
},
|
||||||
'_id translations.en short_name images season dateModified icon'
|
'_id translations.en short_name images season dateModified icon'
|
||||||
).lean();
|
).lean();
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import { rand_array } from '$lib/js/randomize';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Find recipes in season that have English translations
|
// Find recipes in season that have approved English translations
|
||||||
const recipes = await Recipe.find(
|
const recipes = await Recipe.find(
|
||||||
{
|
{
|
||||||
season: params.month,
|
season: params.month,
|
||||||
icon: {$ne: "🍽️"},
|
icon: {$ne: "🍽️"},
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
},
|
},
|
||||||
'_id translations.en short_name images season dateModified icon'
|
'_id translations.en short_name images season dateModified icon'
|
||||||
).lean();
|
).lean();
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { dbConnect } from '../../../../../utils/db';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Get all recipes with English translations
|
// Get all recipes with approved English translations
|
||||||
const recipes = await Recipe.find({
|
const recipes = await Recipe.find({
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
}, 'translations.en.tags').lean();
|
}, 'translations.en.tags').lean();
|
||||||
|
|
||||||
// Extract and flatten all unique tags
|
// Extract and flatten all unique tags
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import { rand_array } from '$lib/js/randomize';
|
|||||||
export const GET: RequestHandler = async ({params}) => {
|
export const GET: RequestHandler = async ({params}) => {
|
||||||
await dbConnect();
|
await dbConnect();
|
||||||
|
|
||||||
// Find recipes with this tag that have English translations
|
// Find recipes with this tag that have approved English translations
|
||||||
const recipes = await Recipe.find(
|
const recipes = await Recipe.find(
|
||||||
{
|
{
|
||||||
'translations.en.tags': params.tag,
|
'translations.en.tags': params.tag,
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
},
|
},
|
||||||
'_id translations.en short_name images season dateModified icon'
|
'_id translations.en short_name images season dateModified icon'
|
||||||
).lean();
|
).lean();
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ export const GET: RequestHandler = async ({ url, locals }) => {
|
|||||||
const favoritesOnly = url.searchParams.get('favorites') === 'true';
|
const favoritesOnly = url.searchParams.get('favorites') === 'true';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Build base query - only recipes with English translations
|
// Build base query - only recipes with approved English translations
|
||||||
let dbQuery: any = {
|
let dbQuery: any = {
|
||||||
'translations.en': { $exists: true }
|
'translations.en.translationStatus': 'approved'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Apply filters based on context
|
// Apply filters based on context
|
||||||
|
|||||||
Reference in New Issue
Block a user