From 5ba0b949750c427d52c272b8339d230605a4e037 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 30 Apr 2024 16:07:14 -0500 Subject: [PATCH] feat: Sync settings and stock per-project --- web/components/BomTab.vue | 2 +- web/components/PartListItem.vue | 2 +- web/components/ProjectSidebar.vue | 16 ++--- web/components/SettingsTab.vue | 53 +++++++++++---- web/components/StockMatrixInput.vue | 70 ++++++++++---------- web/components/StockTab.vue | 30 ++++++++- web/composables/useBladeWidth.ts | 10 --- web/composables/useBladeWidthSetting.ts | 8 --- web/composables/useBoardLayoutsQuery.ts | 29 ++++++-- web/composables/useCutlistConfig.ts | 14 ---- web/composables/useDeleteSettingsMutation.ts | 17 +++++ web/composables/useDistanceUnit.ts | 3 - web/composables/useExtraSpace.ts | 10 --- web/composables/useExtraSpaceSetting.ts | 8 --- web/composables/useFormatDistance.ts | 8 +-- web/composables/useOptimizeFor.ts | 7 -- web/composables/useOptimizeForSetting.ts | 8 --- web/composables/useParseStock.ts | 9 +++ web/composables/useProjectId.ts | 4 ++ web/composables/useProjectListQuery.ts | 2 +- web/composables/useProjectSettings.ts | 68 +++++++++++++++++++ web/composables/useProjectSettingsStore.ts | 3 + web/composables/useProjectTabMap.ts | 2 +- web/composables/useSaveSettingsMutation.ts | 12 ---- web/composables/useSetSettingsMutation.ts | 25 +++++++ web/composables/useSettingsQuery.ts | 10 +++ web/composables/useShowPartNumbers.ts | 3 - web/composables/useStock.ts | 12 ---- web/layouts/default.vue | 2 +- web/plugins/vue-query.ts | 2 +- web/utils/accounts/AccountService.ts | 29 +++++++- web/utils/accounts/FirebaseAccountService.ts | 16 +++-- web/utils/accounts/LocalAccountService.ts | 44 ++++++++---- web/utils/accounts/index.ts | 2 +- 34 files changed, 347 insertions(+), 193 deletions(-) delete mode 100644 web/composables/useBladeWidth.ts delete mode 100644 web/composables/useBladeWidthSetting.ts delete mode 100644 web/composables/useCutlistConfig.ts create mode 100644 web/composables/useDeleteSettingsMutation.ts delete mode 100644 web/composables/useDistanceUnit.ts delete mode 100644 web/composables/useExtraSpace.ts delete mode 100644 web/composables/useExtraSpaceSetting.ts delete mode 100644 web/composables/useOptimizeFor.ts delete mode 100644 web/composables/useOptimizeForSetting.ts create mode 100644 web/composables/useParseStock.ts create mode 100644 web/composables/useProjectId.ts create mode 100644 web/composables/useProjectSettings.ts create mode 100644 web/composables/useProjectSettingsStore.ts delete mode 100644 web/composables/useSaveSettingsMutation.ts create mode 100644 web/composables/useSetSettingsMutation.ts create mode 100644 web/composables/useSettingsQuery.ts delete mode 100644 web/composables/useShowPartNumbers.ts delete mode 100644 web/composables/useStock.ts diff --git a/web/components/BomTab.vue b/web/components/BomTab.vue index 40d8300..1566b78 100644 --- a/web/components/BomTab.vue +++ b/web/components/BomTab.vue @@ -4,7 +4,7 @@ import type { BoardLayoutLeftover } from '@aklinker1/cutlist'; const url = useAssemblyUrl(); const { data: doc } = useDocumentQuery(url); const { data, isLoading } = useBoardLayoutsQuery(); -const distanceUnit = useDistanceUnit(); +const { distanceUnit } = useProjectSettings(); const formatDistance = useFormatDistance(); const rows = computed(() => { diff --git a/web/components/PartListItem.vue b/web/components/PartListItem.vue index 4b5d1b1..e8180fb 100644 --- a/web/components/PartListItem.vue +++ b/web/components/PartListItem.vue @@ -21,7 +21,7 @@ const fontSize = usePx(() => ), ); -const showPartNumbers = useShowPartNumbers(); +const { showPartNumbers } = useProjectSettings();