diff --git a/app/components/Edit/DesktopTodoDataSelect.vue b/app/components/Edit/DesktopTodoDataSelect.vue new file mode 100644 index 0000000..252713d --- /dev/null +++ b/app/components/Edit/DesktopTodoDataSelect.vue @@ -0,0 +1,69 @@ + + + diff --git a/app/components/Edit/MobileTodoDataSelect.vue b/app/components/Edit/MobileTodoDataSelect.vue new file mode 100644 index 0000000..12c8063 --- /dev/null +++ b/app/components/Edit/MobileTodoDataSelect.vue @@ -0,0 +1,22 @@ + + + diff --git a/app/components/Edit/TabedDataSelect.vue b/app/components/Edit/TabedDataSelect.vue index b150896..16cd3c9 100644 --- a/app/components/Edit/TabedDataSelect.vue +++ b/app/components/Edit/TabedDataSelect.vue @@ -25,33 +25,7 @@ }); const note = defineModel("note", { required: true }); - function useTimeComputed( - marker: T, - ): ComputedRef, "type"> | undefined> { - return computed, "type"> | undefined>({ - get(): Omit, "type"> | undefined { - if (time.value?.type !== marker) return undefined; - - const { type, ...rest } = time.value as Extract; - return rest; - }, - set(value) { - if (!value) { - time.value = undefined; - return; - } - - time.value = { - type: marker, - ...value, - } as Extract; - }, - }); - } - - const timeRange = useTimeComputed("range"); - const timeRecurring = useTimeComputed("recurring"); - const timePoint = useTimeComputed("point"); + const { timeRange, timeRecurring, timePoint } = useExtractedTime(time); const activeTab = ref("notes"); const selectedTimeType = ref<"range" | "recurring" | "point">( diff --git a/app/components/Edit/TodoForm.vue b/app/components/Edit/TodoForm.vue index f2dc4d1..4126ea0 100644 --- a/app/components/Edit/TodoForm.vue +++ b/app/components/Edit/TodoForm.vue @@ -1,8 +1,7 @@ diff --git a/app/composables/useExtractedTime.ts b/app/composables/useExtractedTime.ts new file mode 100644 index 0000000..77e2ed9 --- /dev/null +++ b/app/composables/useExtractedTime.ts @@ -0,0 +1,35 @@ +export function useExtractedTime(time: Ref