Add home screen state persistence

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2023-07-11 21:29:49 +03:00
parent 99195fe481
commit 5518fba787
11 changed files with 154 additions and 70 deletions

View File

@@ -0,0 +1,8 @@
const packageName = 'com.terminallyonline';
const appName = 'Terminally Online';
const escapedAppName = appName.replaceAll(' ', '%20');
// eslint-disable-next-line @typescript-eslint/no-empty-function
const noOp = () => {};
export { packageName, appName, escapedAppName, noOp };

View File

@@ -1,4 +1,4 @@
import { SORT, SORT_DIRECTION } from '../types';
import { SORT, SORT_DIRECTION, VIEW } from '../types';
const getSortIcon = (sort: SORT, sortDirection: SORT_DIRECTION) => {
let sortIcon = '';
@@ -35,4 +35,18 @@ const getSortIcon = (sort: SORT, sortDirection: SORT_DIRECTION) => {
return sortIcon;
};
export { getSortIcon };
const getViewIcon = (view: VIEW) => {
switch (view) {
case VIEW.MASONRY: {
return 'view-dashboard';
}
case VIEW.GRID: {
return 'view-grid';
}
case VIEW.LIST: {
return 'view-list';
}
}
};
export { getSortIcon, getViewIcon };

View File

@@ -1,3 +1,3 @@
export { packageName, appName, escapedAppName, noOp } from './constants';
export { isPermissionForPath, clearPermissions } from './permissions';
export { getSortIcon } from './sort';
export { getViewIcon, getNextView } from './view';
export { getSortIcon, getViewIcon } from './icon';

View File

@@ -1,31 +0,0 @@
import { VIEW } from '../types';
const getViewIcon = (view: VIEW) => {
switch (view) {
case VIEW.MASONRY: {
return 'view-dashboard';
}
case VIEW.GRID: {
return 'view-grid';
}
case VIEW.LIST: {
return 'view-list';
}
}
};
const getNextView = (view: VIEW) => {
switch (view) {
case VIEW.MASONRY: {
return VIEW.GRID;
}
case VIEW.GRID: {
return VIEW.LIST;
}
case VIEW.LIST: {
return VIEW.MASONRY;
}
}
};
export { getViewIcon, getNextView };