diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b51de2cc5675..cc3cf44705b7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: isort name: isort (python) - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 diff --git a/frontend/api/class-interfaces/group-seeder.ts b/frontend/api/class-interfaces/group-seeder.ts new file mode 100644 index 000000000000..fd5257adca7f --- /dev/null +++ b/frontend/api/class-interfaces/group-seeder.ts @@ -0,0 +1,26 @@ +import { BaseAPI } from "../_base"; +import { SuccessResponse } from "~/types/api-types/response"; +import { SeederConfig } from "~/types/api-types/group"; + +const prefix = "/api"; + +const routes = { + base: `${prefix}/groups/seeders`, + foods: `${prefix}/groups/seeders/foods`, + units: `${prefix}/groups/seeders/units`, + labels: `${prefix}/groups/seeders/labels`, +}; + +export class GroupDataSeederApi extends BaseAPI { + foods(payload: SeederConfig) { + return this.requests.post(routes.foods, payload); + } + + units(payload: SeederConfig) { + return this.requests.post(routes.units, payload); + } + + labels(payload: SeederConfig) { + return this.requests.post(routes.labels, payload); + } +} diff --git a/frontend/api/index.ts b/frontend/api/index.ts index f691224793a5..d434b5b74038 100644 --- a/frontend/api/index.ts +++ b/frontend/api/index.ts @@ -23,6 +23,7 @@ import { ShoppingApi } from "./class-interfaces/group-shopping-lists"; import { MultiPurposeLabelsApi } from "./class-interfaces/group-multiple-purpose-labels"; import { GroupEventNotifierApi } from "./class-interfaces/group-event-notifier"; import { MealPlanRulesApi } from "./class-interfaces/group-mealplan-rules"; +import { GroupDataSeederApi } from "./class-interfaces/group-seeder"; import { ApiRequestInstance } from "~/types/api"; class Api { @@ -50,6 +51,7 @@ class Api { public multiPurposeLabels: MultiPurposeLabelsApi; public groupEventNotifier: GroupEventNotifierApi; public upload: UploadFile; + public seeders: GroupDataSeederApi; constructor(requests: ApiRequestInstance) { // Recipes @@ -75,6 +77,7 @@ class Api { this.groupReports = new GroupReportsApi(requests); this.shopping = new ShoppingApi(requests); this.multiPurposeLabels = new MultiPurposeLabelsApi(requests); + this.seeders = new GroupDataSeederApi(requests); // Admin this.backups = new BackupAPI(requests); diff --git a/frontend/components/global/BaseDialog.vue b/frontend/components/global/BaseDialog.vue index 79934fac339d..982efc48b73d 100644 --- a/frontend/components/global/BaseDialog.vue +++ b/frontend/components/global/BaseDialog.vue @@ -9,7 +9,7 @@ :fullscreen="$vuetify.breakpoint.xsOnly" > - + {{ icon }} diff --git a/frontend/components/global/LanguageDialog.vue b/frontend/components/global/LanguageDialog.vue index c1f11e392f3e..79d6bc626857 100644 --- a/frontend/components/global/LanguageDialog.vue +++ b/frontend/components/global/LanguageDialog.vue @@ -6,7 +6,6 @@ v-model="locale" :items="locales" item-text="name" - menu-props="auto" class="my-3" hide-details outlined diff --git a/frontend/composables/use-locales/available-locales.ts b/frontend/composables/use-locales/available-locales.ts index ac50130c4d8c..7162dafb7031 100644 --- a/frontend/composables/use-locales/available-locales.ts +++ b/frontend/composables/use-locales/available-locales.ts @@ -3,12 +3,12 @@ export const LOCALES = [ { name: "繁體中文 (Chinese traditional)", value: "zh-TW", - progress: 100, + progress: 90, }, { name: "简体中文 (Chinese simplified)", value: "zh-CN", - progress: 100, + progress: 74, }, { name: "Tiếng Việt (Vietnamese)", @@ -18,17 +18,17 @@ export const LOCALES = [ { name: "Українська (Ukrainian)", value: "uk-UA", - progress: 100, + progress: 99, }, { name: "Türkçe (Turkish)", value: "tr-TR", - progress: 7, + progress: 5, }, { name: "Svenska (Swedish)", value: "sv-SE", - progress: 100, + progress: 92, }, { name: "српски (Serbian)", @@ -38,12 +38,12 @@ export const LOCALES = [ { name: "Slovak", value: "sk-SK", - progress: 100, + progress: 74, }, { name: "Pусский (Russian)", value: "ru-RU", - progress: 100, + progress: 74, }, { name: "Română (Romanian)", @@ -53,12 +53,12 @@ export const LOCALES = [ { name: "Português (Portugese)", value: "pt-PT", - progress: 15, + progress: 11, }, { name: "Português do Brasil (Brazilian Portuguese)", value: "pt-BR", - progress: 64, + progress: 47, }, { name: "Polski (Polish)", @@ -68,12 +68,12 @@ export const LOCALES = [ { name: "Norsk (Norwegian)", value: "no-NO", - progress: 100, + progress: 74, }, { name: "Nederlands (Dutch)", value: "nl-NL", - progress: 100, + progress: 98, }, { name: "한국어 (Korean)", @@ -88,7 +88,7 @@ export const LOCALES = [ { name: "Italiano (Italian)", value: "it-IT", - progress: 99, + progress: 96, }, { name: "Magyar (Hungarian)", @@ -103,12 +103,12 @@ export const LOCALES = [ { name: "Français (French)", value: "fr-FR", - progress: 100, + progress: 99, }, { name: "French, Canada", value: "fr-CA", - progress: 100, + progress: 88, }, { name: "Suomi (Finnish)", @@ -118,7 +118,7 @@ export const LOCALES = [ { name: "Español (Spanish)", value: "es-ES", - progress: 100, + progress: 74, }, { name: "American English", @@ -128,22 +128,22 @@ export const LOCALES = [ { name: "British English", value: "en-GB", - progress: 100, + progress: 74, }, { name: "Ελληνικά (Greek)", value: "el-GR", - progress: 100, + progress: 86, }, { name: "Deutsch (German)", value: "de-DE", - progress: 100, + progress: 99, }, { name: "Dansk (Danish)", value: "da-DK", - progress: 100, + progress: 83, }, { name: "Čeština (Czech)", @@ -153,7 +153,7 @@ export const LOCALES = [ { name: "Català (Catalan)", value: "ca-ES", - progress: 100, + progress: 74, }, { name: "العربية (Arabic)", @@ -165,4 +165,4 @@ export const LOCALES = [ value: "af-ZA", progress: 0, }, -]; +] diff --git a/frontend/lang/messages/en-US.json b/frontend/lang/messages/en-US.json index 2869e484a399..03644c5db131 100644 --- a/frontend/lang/messages/en-US.json +++ b/frontend/lang/messages/en-US.json @@ -130,7 +130,9 @@ "url": "URL", "view": "View", "wednesday": "Wednesday", - "yes": "Yes" + "yes": "Yes", + "foods": "Foods", + "units": "Units" }, "group": { "are-you-sure-you-want-to-delete-the-group": "Are you sure you want to delete {groupName}?", @@ -502,5 +504,14 @@ "select-description": "Choose the language for the Mealie UI. The setting only applies to you, not other users.", "how-to-contribute-description": "Is something not translated yet, mistranslated, or your language missing from the list? {read-the-docs-link} on how to contribute!", "read-the-docs": "Read the docs" + }, + "data-pages": { + "seed-data": "Seed Data", + "foods": { + "merge-dialog-text": "Combining the selected foods will merge the source food and target food into a single food. The source food will be deleted and all of the references to the source food will be updated to point to the target food.", + "merge-food-example": "Merging {food1} into {food2}", + "seed-dialog-text": "Seed the database with foods based on your local language. This will create 200+ common foods that can be used to organize your database. Foods are translated via a community effort.", + "seed-dialog-warning": "You have already have some items in your database. This action will not reconcile duplicates, you will have to manage them manually." + } } } diff --git a/frontend/pages/group/data/foods.vue b/frontend/pages/group/data/foods.vue index b7fb8588e1fc..fe6caed394a2 100644 --- a/frontend/pages/group/data/foods.vue +++ b/frontend/pages/group/data/foods.vue @@ -3,18 +3,57 @@ - Combining the selected foods will merge the Source Food and Target Food into a single food. The - Source Food will be deleted and all of the references to the Source Food will be updated to - point to the Target Food. +
+ {{ $t("data-pages.foods.merge-dialog-text") }} +
+ + + +
+ {{ $t("data-pages.foods.seed-dialog-text") }} +
+ + + + + + {{ $t("data-pages.foods.seed-dialog-warning") }} + +
+
+ + @@ -80,11 +125,13 @@