mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
HouseholdPreferenceEditor
This commit is contained in:
parent
5afa928f58
commit
1d20b1455c
1 changed files with 71 additions and 96 deletions
|
@ -41,106 +41,81 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ReadHouseholdPreferences } from "~/lib/api/types/household";
|
import type { ReadHouseholdPreferences } from "~/lib/api/types/household";
|
||||||
|
|
||||||
export default defineNuxtComponent({
|
const preferences = defineModel<ReadHouseholdPreferences>({ required: true });
|
||||||
props: {
|
const i18n = useI18n();
|
||||||
modelValue: {
|
|
||||||
type: Object,
|
type Preference = {
|
||||||
required: true,
|
key: keyof ReadHouseholdPreferences;
|
||||||
},
|
label: string;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const recipePreferences: Preference[] = [
|
||||||
|
{
|
||||||
|
key: "recipePublic",
|
||||||
|
label: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes"),
|
||||||
|
description: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes-description"),
|
||||||
},
|
},
|
||||||
emits: ["update:modelValue"],
|
{
|
||||||
setup(props, context) {
|
key: "recipeShowNutrition",
|
||||||
const i18n = useI18n();
|
label: i18n.t("group.show-nutrition-information"),
|
||||||
|
description: i18n.t("group.show-nutrition-information-description"),
|
||||||
type Preference = {
|
|
||||||
key: keyof ReadHouseholdPreferences;
|
|
||||||
label: string;
|
|
||||||
description: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const recipePreferences: Preference[] = [
|
|
||||||
{
|
|
||||||
key: "recipePublic",
|
|
||||||
label: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes"),
|
|
||||||
description: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes-description"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "recipeShowNutrition",
|
|
||||||
label: i18n.t("group.show-nutrition-information"),
|
|
||||||
description: i18n.t("group.show-nutrition-information-description"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "recipeShowAssets",
|
|
||||||
label: i18n.t("group.show-recipe-assets"),
|
|
||||||
description: i18n.t("group.show-recipe-assets-description"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "recipeLandscapeView",
|
|
||||||
label: i18n.t("group.default-to-landscape-view"),
|
|
||||||
description: i18n.t("group.default-to-landscape-view-description"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "recipeDisableComments",
|
|
||||||
label: i18n.t("group.disable-users-from-commenting-on-recipes"),
|
|
||||||
description: i18n.t("group.disable-users-from-commenting-on-recipes-description"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "recipeDisableAmount",
|
|
||||||
label: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food"),
|
|
||||||
description: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food-description"),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const allDays = [
|
|
||||||
{
|
|
||||||
name: i18n.t("general.sunday"),
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: i18n.t("general.monday"),
|
|
||||||
value: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: i18n.t("general.tuesday"),
|
|
||||||
value: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: i18n.t("general.wednesday"),
|
|
||||||
value: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: i18n.t("general.thursday"),
|
|
||||||
value: 4,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: i18n.t("general.friday"),
|
|
||||||
value: 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: i18n.t("general.saturday"),
|
|
||||||
value: 6,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const preferences = computed({
|
|
||||||
get() {
|
|
||||||
return props.modelValue;
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
context.emit("update:modelValue", val);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
allDays,
|
|
||||||
preferences,
|
|
||||||
recipePreferences,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
});
|
{
|
||||||
|
key: "recipeShowAssets",
|
||||||
|
label: i18n.t("group.show-recipe-assets"),
|
||||||
|
description: i18n.t("group.show-recipe-assets-description"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "recipeLandscapeView",
|
||||||
|
label: i18n.t("group.default-to-landscape-view"),
|
||||||
|
description: i18n.t("group.default-to-landscape-view-description"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "recipeDisableComments",
|
||||||
|
label: i18n.t("group.disable-users-from-commenting-on-recipes"),
|
||||||
|
description: i18n.t("group.disable-users-from-commenting-on-recipes-description"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "recipeDisableAmount",
|
||||||
|
label: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food"),
|
||||||
|
description: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food-description"),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const allDays = [
|
||||||
|
{
|
||||||
|
name: i18n.t("general.sunday"),
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t("general.monday"),
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t("general.tuesday"),
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t("general.wednesday"),
|
||||||
|
value: 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t("general.thursday"),
|
||||||
|
value: 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t("general.friday"),
|
||||||
|
value: 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: i18n.t("general.saturday"),
|
||||||
|
value: 6,
|
||||||
|
},
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue