Merge branch 'main' into feature/internationalization-support

This commit is contained in:
Mohamad Tarbin
2026-03-10 23:10:48 -04:00
committed by GitHub
26 changed files with 1171 additions and 270 deletions

View File

@@ -324,7 +324,7 @@ export const notInCompletionWindow = chore => {
chore.completionWindow &&
chore.completionWindow > -1 &&
chore.nextDueDate &&
moment().add(chore.completionWindow, 'hours') < moment(chore.nextDueDate)
moment() < moment(chore.nextDueDate).add(-chore.completionWindow, 'seconds')
)
}
export const ChoreFilters = userId => ({

View File

@@ -0,0 +1,18 @@
export const TIME_UNITS = [
{ label: 'Mins', value: 'm', seconds: 60 },
{ label: 'Hours', value: 'h', seconds: 3600 },
{ label: 'Days', value: 'd', seconds: 86400 },
]
export function secondsToValueAndUnit(totalSeconds) {
if (totalSeconds % 86400 === 0)
return { value: totalSeconds / 86400, unit: 'd' }
if (totalSeconds % 3600 === 0)
return { value: totalSeconds / 3600, unit: 'h' }
return { value: Math.round(totalSeconds / 60), unit: 'm' }
}
export function valueAndUnitToSeconds(value, unit) {
const unitInfo = TIME_UNITS.find(u => u.value === unit)
return value * (unitInfo?.seconds ?? 1)
}

View File

@@ -7,13 +7,21 @@ export const DEFAULT_SIDEPANEL_CONFIG = [
enabled: true,
order: 0,
},
{
id: 'smartInsights',
name: 'Smart Insights',
description: 'Quick actions based on your tasks',
iconName: 'TrendingUp',
enabled: false,
order: 1,
},
{
id: 'assignees',
name: 'Tasks by Assignee',
description: 'Groups tasks by who they are assigned to',
iconName: 'Person',
enabled: true,
order: 1,
order: 2,
},
{
id: 'calendar',
@@ -21,7 +29,7 @@ export const DEFAULT_SIDEPANEL_CONFIG = [
description: 'Shows tasks in a calendar format',
iconName: 'CalendarMonth',
enabled: true,
order: 2,
order: 3,
},
{
id: 'activities',
@@ -29,7 +37,7 @@ export const DEFAULT_SIDEPANEL_CONFIG = [
description: 'Shows recent task completions and activities',
iconName: 'History',
enabled: true,
order: 3,
order: 4,
},
{
id: 'weeklyGoals',
@@ -37,21 +45,37 @@ export const DEFAULT_SIDEPANEL_CONFIG = [
description: 'Shows weekly progress and family completion stats',
iconName: 'EmojiEvents',
enabled: true,
order: 4,
order: 5,
},
]
export const getSidepanelConfig = () => {
const saved = localStorage.getItem('sidepanelConfig')
let savedConfig = []
if (saved) {
try {
return JSON.parse(saved)
savedConfig = JSON.parse(saved)
} catch (error) {
console.error('Error parsing sidepanel config:', error)
return DEFAULT_SIDEPANEL_CONFIG
}
}
return DEFAULT_SIDEPANEL_CONFIG
// Merge saved config with default config
// This ensures new items in DEFAULT_SIDEPANEL_CONFIG are added to existing configs
const mergedConfig = DEFAULT_SIDEPANEL_CONFIG.map(defaultItem => {
const savedItem = savedConfig.find(item => item.id === defaultItem.id)
return savedItem || defaultItem
})
// Add any saved items that are no longer in default (for backwards compatibility)
const newSavedItems = savedConfig.filter(
savedItem =>
!DEFAULT_SIDEPANEL_CONFIG.find(item => item.id === savedItem.id),
)
return [...mergedConfig, ...newSavedItems]
}
export const saveSidepanelConfig = config => {