fix: update state initialization and improve Grid component usage in ChoreView

This commit is contained in:
Mo Tarbin
2025-10-05 14:24:26 -04:00
parent d1dcdc2f50
commit 09f89afe2a
3 changed files with 15 additions and 6 deletions

View File

@@ -51,6 +51,7 @@ const PageTransition = ({ children }) => {
const location = useLocation()
const prevLocation = useRef(location)
const isNavigatingBack = useRef(false)
const nodeRef = useRef(null)
useEffect(() => {
const currentLevel = getRouteLevel(location.pathname)
@@ -84,8 +85,10 @@ const PageTransition = ({ children }) => {
enter: 50,
exit: 50,
}}
nodeRef={nodeRef}
>
<div
ref={nodeRef}
className='page-wrapper'
style={{
paddingBottom: `var(--safe-area-inset-bottom, 0px)`,

View File

@@ -10,6 +10,7 @@ function KeyboardShortcutHint({
shortcut,
show = true,
withCmd = true,
withCtrl, // Legacy prop for backward compatibility
withShift = false,
sx = {},
...props
@@ -21,7 +22,9 @@ function KeyboardShortcutHint({
// Build the shortcut display string
let displayShortcut = ''
if (withCmd) {
// Support both withCmd and withCtrl for backward compatibility
const shouldShowModifier = withCmd || withCtrl
if (shouldShowModifier) {
displayShortcut += modifierKey
}
if (withShift) {
@@ -64,6 +67,7 @@ KeyboardShortcutHint.propTypes = {
shortcut: PropTypes.string.isRequired,
show: PropTypes.bool,
withCmd: PropTypes.bool,
withCtrl: PropTypes.bool, // Legacy prop for backward compatibility
withShift: PropTypes.bool,
sx: PropTypes.object,
}

View File

@@ -86,10 +86,12 @@ const ChoreView = () => {
const [timeoutId, setTimeoutId] = useState(null)
const [secondsLeftToCancel, setSecondsLeftToCancel] = useState(null)
const [completedDate, setCompletedDate] = useState(null)
const [confirmModelConfig, setConfirmModelConfig] = useState({})
const [confirmModelConfig, setConfirmModelConfig] = useState({
isOpen: false,
})
const [chorePriority, setChorePriority] = useState(null)
const [isDescriptionOpen, setIsDescriptionOpen] = useState(false)
const [timerActionConfig, setTimerActionConfig] = useState({})
const [timerActionConfig, setTimerActionConfig] = useState({ isOpen: false })
const { data: circleMembersData, isLoading: isCircleMembersLoading } =
useCircleMembers()
const { data: userProfile } = useUserProfile()
@@ -447,7 +449,7 @@ const ChoreView = () => {
}}
>
{[ChoreStatus.ACTIVE, ChoreStatus.PAUSED].includes(chore.status) && (
<Grid item xs={12}>
<Grid xs={12}>
<TimePassedCard
chore={chore}
handleAction={action => {
@@ -462,7 +464,7 @@ const ChoreView = () => {
</Grid>
)}
{infoCards.map((card, index) => (
<Grid item xs={6} sm={6} key={index}>
<Grid xs={6} sm={6} key={index}>
<Card
variant='soft'
sx={{
@@ -541,8 +543,8 @@ const ChoreView = () => {
alignItems: 'center',
justifyContent: 'center',
p: 1,
width: '100%',
}}
fullWidth
variant='plain'
>
{chorePriority ? chorePriority.icon : <LowPriority />}