Compare commits
2 Commits
09c6751564
...
397ba1efa4
| Author | SHA1 | Date | |
|---|---|---|---|
|
397ba1efa4
|
|||
|
1a943cebcf
|
@@ -156,6 +156,18 @@
|
||||
}, 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
|
||||
function handleTranslationApproved(event: CustomEvent) {
|
||||
translationData = event.detail.translatedRecipe;
|
||||
@@ -473,6 +485,9 @@ button.action_button{
|
||||
{#if !showTranslationWorkflow}
|
||||
<div class=submit_buttons>
|
||||
<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>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -23,10 +23,10 @@ export const GET: RequestHandler = async ({ locals }) => {
|
||||
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({
|
||||
_id: { $in: userFavorites.favorites },
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
}).lean();
|
||||
|
||||
// Transform to English format
|
||||
|
||||
@@ -7,9 +7,9 @@ import { rand_array } from '$lib/js/randomize';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
await dbConnect();
|
||||
|
||||
// Find all recipes that have English translations
|
||||
// Find all recipes that have approved English translations
|
||||
const recipes = await Recipe.find(
|
||||
{ 'translations.en': { $exists: true } },
|
||||
{ 'translations.en.translationStatus': 'approved' },
|
||||
'_id translations.en short_name season dateModified icon'
|
||||
).lean();
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import { dbConnect } from '../../../../../utils/db';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
await dbConnect();
|
||||
|
||||
// Get distinct categories from English translations
|
||||
// Get distinct categories from approved English translations
|
||||
const categories = await Recipe.distinct('translations.en.category', {
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
}).lean();
|
||||
|
||||
return json(JSON.parse(JSON.stringify(categories)));
|
||||
|
||||
@@ -7,11 +7,11 @@ import { rand_array } from '$lib/js/randomize';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
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(
|
||||
{
|
||||
'translations.en.category': params.category,
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
},
|
||||
'_id translations.en short_name images season dateModified icon'
|
||||
).lean();
|
||||
|
||||
@@ -7,11 +7,11 @@ import { rand_array } from '$lib/js/randomize';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
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(
|
||||
{
|
||||
icon: params.icon,
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
},
|
||||
'_id translations.en short_name images season dateModified icon'
|
||||
).lean();
|
||||
|
||||
@@ -6,12 +6,12 @@ import { rand_array } from '$lib/js/randomize';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
await dbConnect();
|
||||
|
||||
// Find recipes in season that have English translations
|
||||
// Find recipes in season that have approved English translations
|
||||
const recipes = await Recipe.find(
|
||||
{
|
||||
season: params.month,
|
||||
icon: {$ne: "🍽️"},
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
},
|
||||
'_id translations.en short_name images season dateModified icon'
|
||||
).lean();
|
||||
|
||||
@@ -5,9 +5,9 @@ import { dbConnect } from '../../../../../utils/db';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
await dbConnect();
|
||||
|
||||
// Get all recipes with English translations
|
||||
// Get all recipes with approved English translations
|
||||
const recipes = await Recipe.find({
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
}, 'translations.en.tags').lean();
|
||||
|
||||
// Extract and flatten all unique tags
|
||||
|
||||
@@ -7,11 +7,11 @@ import { rand_array } from '$lib/js/randomize';
|
||||
export const GET: RequestHandler = async ({params}) => {
|
||||
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(
|
||||
{
|
||||
'translations.en.tags': params.tag,
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
},
|
||||
'_id translations.en short_name images season dateModified icon'
|
||||
).lean();
|
||||
|
||||
@@ -14,9 +14,9 @@ export const GET: RequestHandler = async ({ url, locals }) => {
|
||||
const favoritesOnly = url.searchParams.get('favorites') === 'true';
|
||||
|
||||
try {
|
||||
// Build base query - only recipes with English translations
|
||||
// Build base query - only recipes with approved English translations
|
||||
let dbQuery: any = {
|
||||
'translations.en': { $exists: true }
|
||||
'translations.en.translationStatus': 'approved'
|
||||
};
|
||||
|
||||
// Apply filters based on context
|
||||
|
||||
Reference in New Issue
Block a user