Skip to content

Commit

Permalink
[gn] sub-recipes!
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed Jan 23, 2025
1 parent 4f197d1 commit dfc3332
Show file tree
Hide file tree
Showing 60 changed files with 2,320 additions and 690 deletions.
28 changes: 27 additions & 1 deletion apps/gnocchi/conversion/src/lib/sanitize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,30 @@ export function sanitize(text: string) {
}

const removeLeadingChars = ['-', '*'];
const removeCharsAnywhere = ['•', '□', '▪', '▫', '▢', '\n', '\r', '\t'];
const removeCharsAnywhere = [
'•',
'□',
'▪',
'▫',
'▢',
'\n',
'\r',
'\t',
'▢',
'▣',
'▪',
'▫',
'◉',
'○',
'◌',
'●',
'◦',
'◯',
'◻',
'◼',
'◽',
'◾',
'☐',
'☑',
'☒',
];
9 changes: 8 additions & 1 deletion apps/gnocchi/conversion/src/lib/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ export function lookupUnit(unitName: string | null): UnitDescription | null {
return (
unitName.toLowerCase() === abbr ||
unitName.toLowerCase() === singular.toLowerCase() ||
unitName.toLowerCase() === plural.toLowerCase()
unitName.toLowerCase() === plural.toLowerCase() ||
unitName.toLowerCase() === translateBritish(singular.toLowerCase())
);
});
return match || null;
}

function translateBritish(word: string) {
if (word.endsWith('re')) {
return word.slice(0, -2) + 'er';
}
}
18 changes: 18 additions & 0 deletions apps/gnocchi/verdant/src/client/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,12 @@ export type RecipeLastCookedAt = number;
export type RecipeLastAddedAt = number;
export type RecipeAddIntervalGuess = number;
export type RecipePinnedAt = number;
export type RecipeSubRecipeMultipliers = ObjectEntity<
RecipeSubRecipeMultipliersInit,
RecipeSubRecipeMultipliersDestructured,
RecipeSubRecipeMultipliersSnapshot
>;
export type RecipeSubRecipeMultipliersValue = number;
export type RecipeInit = {
id?: string;
slug?: string;
Expand All @@ -906,6 +912,7 @@ export type RecipeInit = {
lastAddedAt?: number | null;
addIntervalGuess?: number | null;
pinnedAt?: number | null;
subRecipeMultipliers?: RecipeSubRecipeMultipliersInit;
};

export type RecipeIngredientsItemCommentsInit = string[];
Expand Down Expand Up @@ -936,6 +943,9 @@ export type RecipeSessionInit = {
ingredientAssignments?: RecipeSessionIngredientAssignmentsInit;
} | null;
export type RecipeTagsInit = string[];
export type RecipeSubRecipeMultipliersInit = {
[key: string]: RecipeSubRecipeMultipliersValueInit;
};
export type RecipeDestructured = {
id: string;
slug: string;
Expand All @@ -960,6 +970,7 @@ export type RecipeDestructured = {
lastAddedAt: number | null;
addIntervalGuess: number | null;
pinnedAt: number | null;
subRecipeMultipliers: RecipeSubRecipeMultipliers;
};

export type RecipeIngredientsItemCommentsDestructured = string[];
Expand Down Expand Up @@ -990,6 +1001,9 @@ export type RecipeSessionDestructured = {
ingredientAssignments: RecipeSessionIngredientAssignments;
};
export type RecipeTagsDestructured = string[];
export type RecipeSubRecipeMultipliersDestructured = {
[key: string]: RecipeSubRecipeMultipliersValue | undefined;
};
export type RecipeSnapshot = {
id: string;
slug: string;
Expand All @@ -1014,6 +1028,7 @@ export type RecipeSnapshot = {
lastAddedAt: number | null;
addIntervalGuess: number | null;
pinnedAt: number | null;
subRecipeMultipliers: RecipeSubRecipeMultipliersSnapshot;
};

export type RecipeIngredientsItemCommentsSnapshot = string[];
Expand Down Expand Up @@ -1044,6 +1059,9 @@ export type RecipeSessionSnapshot = {
ingredientAssignments: RecipeSessionIngredientAssignmentsSnapshot;
} | null;
export type RecipeTagsSnapshot = string[];
export type RecipeSubRecipeMultipliersSnapshot = {
[key: string]: RecipeSubRecipeMultipliersValueSnapshot;
};

/** Index filters for Recipe **/

Expand Down
4 changes: 2 additions & 2 deletions apps/gnocchi/verdant/src/client/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./schemaVersions/v44.js";
export { default } from "./schemaVersions/v44.js";
export * from "./schemaVersions/v45.js";
export { default } from "./schemaVersions/v45.js";
2 changes: 1 addition & 1 deletion apps/gnocchi/verdant/src/client/schema.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import schema from './schemaVersions/v44.js';
import schema from './schemaVersions/v45.js';
const finalSchema = { wip: false, ...schema };
export default finalSchema;
3 changes: 2 additions & 1 deletion apps/gnocchi/verdant/src/client/schemaVersions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import v41 from './v41.js';
import v42 from './v42.js';
import v43 from './v43.js';
import v44 from './v44.js';
import v45 from './v45.js';

export default [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44]
export default [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45]

Loading

0 comments on commit dfc3332

Please sign in to comment.