import React from 'react';
import { useSelector, useDispatch, batch } from 'react-redux';
import { Tooltip as ReactTooltip } from 'react-tooltip';
import { update } from '../store/settings/settings';
import LabeledCheckbox from '../components/common/LabeledCheckbox';
import TabbedCard from '../components/common/TabbedCard';
import PageWrapper from '../components/PageWrapper';
import images from '../assets/images';
export default function Settings() {
const settingsState = useSelector(state => state.settings);
const dispatch = useDispatch();
return (
General{' '}
info
On large screens, site content will be limited to a maximum of 1500px.
Uncheck if you wish to use the full width of your browser window.
dispatch(update({ field: 'limitContentWidth', value: e.target.checked }))}
/>
Task tracker{' '}
info
Choose which columns to show on the task tracker.
Note that on small screens, some columns may be hidden regardless of this setting.
dispatch(update({ field: 'taskColumns', subfield: 'priority', value: e.target.checked }))
}
/>
dispatch(update({ field: 'taskColumns', subfield: 'category', value: e.target.checked }))
}
/>
dispatch(update({ field: 'taskColumns', subfield: 'completedAt', value: e.target.checked }))
}
/>
dispatch(update({ field: 'taskColumns', subfield: 'regions', value: e.target.checked }))
}
/>
);
}
function ModeSelectCard({ label, mode }) {
const activeTheme = useSelector(state => state.settings.theme);
const activeMode = useSelector(state => state.settings.mode);
const dispatch = useDispatch();
const themeMode = `${activeTheme.split('-')[0]}-${mode}`;
const selected = activeMode === mode;
const selectedStyle = selected ? 'border-x-2 border-accent bg-secondary-alt' : 'cursor-pointer bg-hover';
return (
batch(() => {
dispatch(update({ field: 'theme', value: themeMode }));
dispatch(update({ field: 'mode', value: mode }));
})
}
>
{label}
);
}
function ThemeSelectCard({ label, theme }) {
const activeTheme = useSelector(state => state.settings.theme);
const activeMode = useSelector(state => state.settings.mode);
const dispatch = useDispatch();
const themeMode = `${theme}-${activeMode}`;
const selected = activeTheme === themeMode;
const selectedStyle = selected ? 'border-x-2 border-accent bg-secondary-alt' : 'cursor-pointer bg-hover';
return (
batch(() => {
dispatch(update({ field: 'theme', value: themeMode }));
})
}
>
{label}
);
}