mirror of
https://github.com/ManInDark/HabitTrove.git
synced 2026-03-11 04:49:49 +01:00
fix(#3): only show complete button if interval matches today
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
|||||||
import { useHabits } from '@/hooks/useHabits'
|
import { useHabits } from '@/hooks/useHabits'
|
||||||
import { currentUserAtom, settingsAtom, usersAtom } from '@/lib/atoms'
|
import { currentUserAtom, settingsAtom, usersAtom } from '@/lib/atoms'
|
||||||
import { Habit, User } from '@/lib/types'
|
import { Habit, User } from '@/lib/types'
|
||||||
import { convertMachineReadableFrequencyToHumanReadable, getCompletionsForToday, hasPermission, isTaskOverdue } from '@/lib/utils'
|
import { convertMachineReadableFrequencyToHumanReadable, getCompletionsForToday, hasPermission, isHabitDueToday, isTaskOverdue } from '@/lib/utils'
|
||||||
import { useAtom } from 'jotai'
|
import { useAtom } from 'jotai'
|
||||||
import { Check, Coins, Edit, MoreVertical, Pin, Undo2 } from 'lucide-react'
|
import { Check, Coins, Edit, MoreVertical, Pin, Undo2 } from 'lucide-react'
|
||||||
import { useTranslations } from 'next-intl'
|
import { useTranslations } from 'next-intl'
|
||||||
@@ -140,7 +140,7 @@ export default function HabitItem({ habit, onEdit, onDelete }: HabitItemProps) {
|
|||||||
<CardFooter className="flex-shrink-0 flex justify-between gap-2">
|
<CardFooter className="flex-shrink-0 flex justify-between gap-2">
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Button
|
{(habit.isTask || isHabitDueToday({ habit, timezone: settings.system.timezone })) && <Button
|
||||||
variant={isCompletedToday ? "secondary" : "default"}
|
variant={isCompletedToday ? "secondary" : "default"}
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={async () => await completeHabit(habit)}
|
onClick={async () => await completeHabit(habit)}
|
||||||
@@ -175,7 +175,7 @@ export default function HabitItem({ habit, onEdit, onDelete }: HabitItemProps) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>}
|
||||||
</div>
|
</div>
|
||||||
{completionsToday > 0 && !habit.archived && (
|
{completionsToday > 0 && !habit.archived && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user