1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fixing extension name sorting

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-05-18 11:07:48 +03:00
parent 63730358b6
commit aa6a074bd6
5 changed files with 19 additions and 14 deletions

View File

@ -8,6 +8,7 @@ import { Spinner } from "../spinner";
import { ExtensionInstallationStateStore } from "./extension-install.store";
import { cssNames } from "../../utils";
import { observer } from "mobx-react";
import type { Column, Row } from "react-table";
import type { LensExtensionId } from "../../../extensions/lens-extension";
interface Props {
@ -44,12 +45,21 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
(extension: InstalledExtension) => extension.manifest.version,
];
const columns = useMemo(
const columns: Column<any>[] = useMemo(
() => [
{
Header: "Name",
accessor: "extension",
width: 200
width: 200,
sortType: (rowA: Row, rowB: Row) => { // Custom sorting for extension name
const nameA = extensions[rowA.index].manifest.name;
const nameB = extensions[rowB.index].manifest.name;
if (nameA > nameB) return -1;
if (nameB > nameA) return 1;
return 0;
},
},
{
Header: "Version",

View File

@ -21,7 +21,7 @@
.notice {
@apply p-8 flex flex-col gap-2 mb-14 mt-3 rounded-lg;
background-color: var(--noticeBackground);
background-color: var(--inputControlBackground);
border: 1px solid var(--boxShadow);
color: var(--textColorTertiary);
}

View File

@ -32,6 +32,7 @@ import { ConfirmDialog } from "../confirm-dialog";
import { Icon } from "../icon";
import { Menu, MenuItem } from "../menu";
import { MaterialTooltip } from "../+catalog/material-tooltip/material-tooltip";
import { observer } from "mobx-react";
interface Props extends DOMAttributes<HTMLElement> {
uid: string;
@ -84,8 +85,8 @@ function getNameParts(name: string): string[] {
return name.split(/@+/);
}
export function HotbarIcon(props: Props) {
const { uid, title, className, source, active, remove, disabled, menuItems, onMenuOpen, children, ...rest } = props;
export const HotbarIcon = observer(({ menuItems = [], ...props }: Props) => {
const { uid, title, className, source, active, remove, disabled, onMenuOpen, children, ...rest } = props;
const id = `hotbarIcon-${uid}`;
const [menuOpen, setMenuOpen] = useState(false);
@ -150,8 +151,4 @@ export function HotbarIcon(props: Props) {
</Menu>
</div>
);
}
HotbarIcon.defaultProps = {
menuItems: []
};
});

View File

@ -129,7 +129,6 @@
"navSelectedBackground": "#262b2e",
"navHoverColor": "#dcddde",
"hrColor": "#ffffff0f",
"tooltipBackground": "#18191c",
"noticeBackground": "#00000045"
"tooltipBackground": "#18191c"
}
}

View File

@ -131,7 +131,6 @@
"navSelectedBackground": "#ffffff",
"navHoverColor": "#2e3135",
"hrColor": "#06060714",
"tooltipBackground": "#ffffff",
"noticeBackground": "#e3e5e8"
"tooltipBackground": "#ffffff"
}
}