Remove stray console.log and better variable naming

This commit is contained in:
Vishnu Nithin Reddy
2023-09-21 21:09:26 +05:30
parent 540373dbfd
commit 03bbce2b97
5 changed files with 20 additions and 21 deletions

View File

@@ -33,7 +33,6 @@ export const themeOverriddenAtom = atomWithStorage(
/** User's default table settings (affecting saving and popup behavior) */
export const defaultTableSettingsAtom = atom((get) => {
const userSettings = get(userSettingsAtom);
console.log("defaultTableSettings", userSettings.defaultTableSettings);
return userSettings.defaultTableSettings;
});

View File

@@ -20,12 +20,12 @@ export default function TableSettings({
control={
<Checkbox
checked={Boolean(
settings.defaultTableSettings?.saveSortingPopupDisabled
settings.defaultTableSettings?.saveSortsPopupDisabled
)}
onChange={(e) => {
updateSettings({
defaultTableSettings: merge(settings.defaultTableSettings, {
saveSortingPopupDisabled: e.target.checked,
saveSortsPopupDisabled: e.target.checked,
}),
});
}}
@@ -34,17 +34,17 @@ export default function TableSettings({
label="Disable popup - to save sorting changes to the team"
style={{ marginLeft: -11, marginBottom: 13 }}
/>
<Collapse in={settings.defaultTableSettings?.saveSortingPopupDisabled}>
<Collapse in={settings.defaultTableSettings?.saveSortsPopupDisabled}>
<FormControlLabel
control={
<Checkbox
checked={Boolean(
settings.defaultTableSettings?.automaticallyApplySorting
settings.defaultTableSettings?.automaticallyApplySorts
)}
onChange={(e) => {
updateSettings({
defaultTableSettings: merge(settings.defaultTableSettings, {
automaticallyApplySorting: e.target.checked,
automaticallyApplySorts: e.target.checked,
}),
});
}}
@@ -61,12 +61,12 @@ export default function TableSettings({
control={
<Checkbox
checked={Boolean(
settings.defaultTableSettings?.saveColumnWidthPopupDisabled
settings.defaultTableSettings?.saveColumnSizingPopupDisabled
)}
onChange={(e) => {
updateSettings({
defaultTableSettings: merge(settings.defaultTableSettings, {
saveColumnWidthPopupDisabled: e.target.checked,
saveColumnSizingPopupDisabled: e.target.checked,
}),
});
}}
@@ -76,18 +76,18 @@ export default function TableSettings({
style={{ marginLeft: -11, marginTop: 13 }}
/>
<Collapse
in={settings.defaultTableSettings?.saveColumnWidthPopupDisabled}
in={settings.defaultTableSettings?.saveColumnSizingPopupDisabled}
>
<FormControlLabel
control={
<Checkbox
checked={Boolean(
settings.defaultTableSettings?.automaticallyApplyColumnWidth
settings.defaultTableSettings?.automaticallyApplyColumnSizing
)}
onChange={(e) => {
updateSettings({
defaultTableSettings: merge(settings.defaultTableSettings, {
automaticallyApplyColumnWidth: e.target.checked,
automaticallyApplyColumnSizing: e.target.checked,
}),
});
}}

View File

@@ -42,9 +42,9 @@ function useSaveTableSorts(canEditColumns: boolean) {
}
if (!canEditColumns) return;
// If the user has disabled the popup, return early
if (defaultTableSettings?.saveSortingPopupDisabled) {
// If the user has `automaticallyApplySorting` set to true, apply the sorting before returning
if (defaultTableSettings?.automaticallyApplySorting) {
if (defaultTableSettings?.saveSortsPopupDisabled) {
// If the user has `automaticallyApplySorts` set to true, apply the sorting before returning
if (defaultTableSettings?.automaticallyApplySorts) {
const updateTable = async () => await updateTableSchema({ sorts });
updateTable();
}

View File

@@ -43,9 +43,9 @@ export function useSaveColumnSizing(
useEffect(() => {
if (!canEditColumns || isEmpty(debouncedColumnSizing)) return;
// If the user has disabled the popup, return early
if (defaultTableSettings?.saveColumnWidthPopupDisabled) {
// If the user has `automaticallyApplyColumnWidth` set to true, apply the column width before returning
if (defaultTableSettings?.automaticallyApplyColumnWidth) {
if (defaultTableSettings?.saveColumnSizingPopupDisabled) {
// If the user has `automaticallyApplyColumnSizing` set to true, apply the column width before returning
if (defaultTableSettings?.automaticallyApplyColumnSizing) {
const updateTable = async () => {
for (const [key, value] of Object.entries(debouncedColumnSizing)) {
await updateColumn({ key, config: { width: value } });

View File

@@ -52,10 +52,10 @@ export type UserSettings = Partial<{
favoriteTables: string[];
/** Stores default user settings for all tables */
defaultTableSettings: Partial<{
saveSortingPopupDisabled: boolean;
automaticallyApplySorting: boolean;
saveColumnWidthPopupDisabled: boolean;
automaticallyApplyColumnWidth: boolean;
saveSortsPopupDisabled: boolean;
automaticallyApplySorts: boolean;
saveColumnSizingPopupDisabled: boolean;
automaticallyApplyColumnSizing: boolean;
}>;
/** Stores table-specific user overrides */
tables: Record<