6206 get table page size from local storage

Updates #6206

Squashed commit of the following:

commit 03089136a749fbda7da9be1af5997a24738eabb6
Merge: 7078c449c 3ce3c41b5
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Oct 11 15:25:11 2023 +0300

    Merge branch 'master' into ADG-7558

commit 7078c449cb02039b47bdd085de12145b6982ea2c
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Oct 9 19:47:58 2023 +0300

    fix default page size

commit 64569487a916797bbb42246eb935f1388626590e
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Oct 9 19:47:22 2023 +0300

    remove unused

commit 17614fa76b5aab617b807e226f743b9fd461c247
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Oct 9 19:30:22 2023 +0300

    ADG-7473 get table page size from local storage
This commit is contained in:
Ildar Kamalov
2023-10-11 16:17:33 +03:00
parent 3ce3c41b59
commit 6a36615629
7 changed files with 67 additions and 33 deletions

View File

@@ -26,8 +26,8 @@ import {
STANDARD_WEB_PORT,
SPECIAL_FILTER_ID,
THEMES,
LOCAL_STORAGE_THEME_KEY,
} from './constants';
import { LOCAL_STORAGE_KEYS, LocalStorageHelper } from './localStorageHelper';
/**
* @param time {string} The time to format
@@ -680,37 +680,13 @@ export const setHtmlLangAttr = (language) => {
window.document.documentElement.lang = language;
};
/**
* Set local storage field
*
* @param {string} key
* @param {string} value
*/
export const setStorageItem = (key, value) => {
if (window.localStorage) {
window.localStorage.setItem(key, value);
}
};
/**
* Get local storage field
*
* @param {string} key
*/
export const getStorageItem = (key) => (window.localStorage
? window.localStorage.getItem(key)
: null);
/**
* Set local storage theme field
*
* @param {string} theme
*/
export const setTheme = (theme) => {
setStorageItem(LOCAL_STORAGE_THEME_KEY, theme);
LocalStorageHelper.setItem(LOCAL_STORAGE_KEYS.THEME, theme);
};
/**
@@ -719,7 +695,7 @@ export const setTheme = (theme) => {
* @returns {string}
*/
export const getTheme = () => getStorageItem(LOCAL_STORAGE_THEME_KEY) || THEMES.light;
export const getTheme = () => LocalStorageHelper.getItem(LOCAL_STORAGE_KEYS.THEME) || THEMES.light;
/**
* Sets UI theme.