removes generalized sortbutton

This commit is contained in:
Contrabang
2022-12-08 16:55:13 -05:00
parent 3aa37fa9b2
commit fceec53dca
4 changed files with 81 additions and 36 deletions
@@ -16,7 +16,6 @@ import { TableCell } from '../components/Table';
import { Window } from '../layouts';
import { LoginInfo } from './common/LoginInfo';
import { LoginScreen } from './common/LoginScreen';
import { SortButton } from './common/SortButton';
export const AccountsUplinkTerminal = (properties, context) => {
const { act, data } = useBackend(context);
@@ -174,6 +173,33 @@ const DepartmentAccountsList = (properties, context) => {
);
};
const SortButton = (properties, context) => {
const [sortId, setSortId] = useLocalState(context, 'sortId', 'name');
const [sortOrder, setSortOrder] = useLocalState(context, 'sortOrder', true);
const { id, children } = properties;
return (
<Table.Cell>
<Button
color={sortId !== id && 'transparent'}
width="100%"
onClick={() => {
if (sortId === id) {
setSortOrder(!sortOrder);
} else {
setSortId(id);
setSortOrder(true);
}
}}
>
{children}
{sortId === id && (
<Icon name={sortOrder ? 'sort-up' : 'sort-down'} ml="0.25rem;" />
)}
</Button>
</Table.Cell>
);
};
const AccountsActions = (properties, context) => {
const { act, data } = useBackend(context);
const { is_printing } = data;
@@ -22,7 +22,6 @@ import { Window } from '../layouts';
import { LoginInfo } from './common/LoginInfo';
import { LoginScreen } from './common/LoginScreen';
import { TemporaryNotice } from './common/TemporaryNotice';
import { SortButton } from './common/SortButton';
const severities = {
'Minor': 'lightgray',
@@ -482,6 +481,33 @@ const MedicalRecordsMedbots = (_properties, context) => {
);
};
const SortButton = (properties, context) => {
const [sortId, setSortId] = useLocalState(context, 'sortId', 'name');
const [sortOrder, setSortOrder] = useLocalState(context, 'sortOrder', true);
const { id, children } = properties;
return (
<Table.Cell>
<Button
color={sortId !== id && 'transparent'}
width="100%"
onClick={() => {
if (sortId === id) {
setSortOrder(!sortOrder);
} else {
setSortId(id);
setSortOrder(true);
}
}}
>
{children}
{sortId === id && (
<Icon name={sortOrder ? 'sort-up' : 'sort-down'} ml="0.25rem;" />
)}
</Button>
</Table.Cell>
);
};
const MedicalRecordsNavigation = (_properties, context) => {
const { act, data } = useBackend(context);
const { screen, general } = data;
@@ -18,7 +18,6 @@ import { ComplexModal, modalOpen } from './common/ComplexModal';
import { LoginInfo } from './common/LoginInfo';
import { LoginScreen } from './common/LoginScreen';
import { TemporaryNotice } from './common/TemporaryNotice';
import { SortButton } from './common/SortButton';
const statusStyles = {
'*Execute*': 'execute',
@@ -162,6 +161,33 @@ const SecurityRecordsPageList = (properties, context) => {
);
};
const SortButton = (properties, context) => {
const [sortId, setSortId] = useLocalState(context, 'sortId', 'name');
const [sortOrder, setSortOrder] = useLocalState(context, 'sortOrder', true);
const { id, children } = properties;
return (
<Table.Cell>
<Button
color={sortId !== id && 'transparent'}
width="100%"
onClick={() => {
if (sortId === id) {
setSortOrder(!sortOrder);
} else {
setSortId(id);
setSortOrder(true);
}
}}
>
{children}
{sortId === id && (
<Icon name={sortOrder ? 'sort-up' : 'sort-down'} ml="0.25rem;" />
)}
</Button>
</Table.Cell>
);
};
const SecurityRecordsActions = (properties, context) => {
const { act, data } = useBackend(context);
const { isPrinting } = data;
@@ -1,33 +0,0 @@
import { useLocalState } from '../../backend';
import {
Button,
Icon,
Table,
} from '../../components';
export const SortButton = (properties, context) => {
const [sortId, setSortId] = useLocalState(context, 'sortId', 'name');
const [sortOrder, setSortOrder] = useLocalState(context, 'sortOrder', true);
const { id, children } = properties;
return (
<Table.Cell>
<Button
color={sortId !== id && 'transparent'}
width="100%"
onClick={() => {
if (sortId === id) {
setSortOrder(!sortOrder);
} else {
setSortId(id);
setSortOrder(true);
}
}}
>
{children}
{sortId === id && (
<Icon name={sortOrder ? 'sort-up' : 'sort-down'} ml="0.25rem;" />
)}
</Button>
</Table.Cell>
);
};