|
|
@ -1,12 +1,7 @@
|
|
|
|
import { faTrash, faWrench } from "@fortawesome/free-solid-svg-icons";
|
|
|
|
import { faTrash, faWrench } from "@fortawesome/free-solid-svg-icons";
|
|
|
|
import { ActionButton, SimpleTable, useShowModal } from "components";
|
|
|
|
import { ActionButton, SimpleTable, useShowModal } from "components";
|
|
|
|
import { cloneDeep } from "lodash";
|
|
|
|
import { cloneDeep } from "lodash";
|
|
|
|
import React, {
|
|
|
|
import React, { FunctionComponent, useCallback, useMemo } from "react";
|
|
|
|
FunctionComponent,
|
|
|
|
|
|
|
|
useCallback,
|
|
|
|
|
|
|
|
useMemo,
|
|
|
|
|
|
|
|
useState,
|
|
|
|
|
|
|
|
} from "react";
|
|
|
|
|
|
|
|
import { Badge, Button, ButtonGroup } from "react-bootstrap";
|
|
|
|
import { Badge, Button, ButtonGroup } from "react-bootstrap";
|
|
|
|
import { Column, TableUpdater } from "react-table";
|
|
|
|
import { Column, TableUpdater } from "react-table";
|
|
|
|
import { useEnabledLanguagesContext, useProfilesContext } from ".";
|
|
|
|
import { useEnabledLanguagesContext, useProfilesContext } from ".";
|
|
|
@ -16,12 +11,10 @@ import Modal from "./modal";
|
|
|
|
import { anyCutoff } from "./options";
|
|
|
|
import { anyCutoff } from "./options";
|
|
|
|
|
|
|
|
|
|
|
|
const Table: FunctionComponent = () => {
|
|
|
|
const Table: FunctionComponent = () => {
|
|
|
|
const originalProfiles = useProfilesContext();
|
|
|
|
const profiles = useProfilesContext();
|
|
|
|
|
|
|
|
|
|
|
|
const languages = useEnabledLanguagesContext();
|
|
|
|
const languages = useEnabledLanguagesContext();
|
|
|
|
|
|
|
|
|
|
|
|
const [profiles, setProfiles] = useState(() => cloneDeep(originalProfiles));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const nextProfileId = useMemo(
|
|
|
|
const nextProfileId = useMemo(
|
|
|
|
() =>
|
|
|
|
() =>
|
|
|
|
1 +
|
|
|
|
1 +
|
|
|
@ -36,7 +29,6 @@ const Table: FunctionComponent = () => {
|
|
|
|
const submitProfiles = useCallback(
|
|
|
|
const submitProfiles = useCallback(
|
|
|
|
(list: Language.Profile[]) => {
|
|
|
|
(list: Language.Profile[]) => {
|
|
|
|
update(list, languageProfileKey);
|
|
|
|
update(list, languageProfileKey);
|
|
|
|
setProfiles(list);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[update]
|
|
|
|
[update]
|
|
|
|
);
|
|
|
|
);
|
|
|
|