This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { Activity, ArchiveRestore, Check, Download, FileJson, LogOut, RefreshCw, Trash2, Upload, X } from 'lucide-vue-next'
|
||||
import { dateKey, isHabitComplete, isHabitScheduledToday, mergePage, nextHabitSwipeValue, previousHabitSwipeValue, shouldToggleRowSwipe } from './lib/mvp-utils'
|
||||
import { dateKey, habitButtonValue, isHabitComplete, isHabitScheduledToday, mergePage, nextHabitSwipeValue, previousHabitSwipeValue, shouldToggleRowSwipe } from './lib/mvp-utils'
|
||||
import { csrfHeader } from './lib/csrf'
|
||||
|
||||
type View = 'habits' | 'today-habits' | 'settings'
|
||||
@@ -187,9 +187,7 @@ function cancelHabitSwipe(h?: Habit) {
|
||||
async function toggleHabitFromButton(h: Habit) {
|
||||
const current = logFor(h, todayKey.value)?.value
|
||||
const previous = current ?? 0
|
||||
const next = isDone(h, todayKey.value)
|
||||
? previousHabitSwipeValue(h.kind, current)
|
||||
: nextHabitSwipeValue(h.kind, current, h.target ?? 1)
|
||||
const next = habitButtonValue(h.kind, current, h.target ?? 1)
|
||||
setLocalHabitValue(h, next)
|
||||
try {
|
||||
await request(`/habits/${h.id}/logs/${todayKey.value}`, { method: 'PUT', body: JSON.stringify({ value: next }) })
|
||||
|
||||
Reference in New Issue
Block a user