Skip to content

Commit e6df7f3

Browse files
author
colinmcneil
committed
Strip old context hooks
1 parent aedd478 commit e6df7f3

File tree

11 files changed

+2
-981
lines changed

11 files changed

+2
-981
lines changed

src/extension/ui/src/components/tabs/ToolCatalog.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import AddIcon from '@mui/icons-material/Add';
55
import { v1 } from "@docker/extension-api-client-types";
66
import { CatalogItemWithName } from '../../types/catalog';
77
import { Secret } from '../../types/secrets';
8-
import { useCatalogContext } from '../../context/CatalogContext';
98
import { CATALOG_LAYOUT_SX } from '../../Constants';
109

1110
interface ToolCatalogProps {
@@ -26,9 +25,7 @@ interface ToolCatalogProps {
2625

2726
const ToolCatalog: React.FC<ToolCatalogProps> = ({ config, search, catalogItems, client, onSecretChange, secrets, registryItems, showMine }) => {
2827

29-
const { getCanRegisterCatalogItem } = useCatalogContext();
30-
31-
const tileIsRegistered = (item: CatalogItemWithName) => registryItems[item.name]?.ref !== undefined && getCanRegisterCatalogItem(item);
28+
const tileIsRegistered = (item: CatalogItemWithName) => registryItems[item.name]?.ref !== undefined;
3229

3330
const filteredCatalogItems = catalogItems.filter(item => {
3431
const isRegistered = tileIsRegistered(item);

src/extension/ui/src/components/tile/Index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ import { CatalogItemWithName } from "../../types/catalog";
55
import { Save, LockReset } from "@mui/icons-material";
66
import Secrets from "../../Secrets";
77
import ConfigurationModal from "./Modal";
8-
import { useCatalogContext } from "../../context/CatalogContext";
98
import Top from "./Top";
109
import Center from "./Center";
1110
import Bottom from "./Bottom";
1211
import { Secret } from "../../types";
1312
import { v1 } from "@docker/extension-api-client-types";
14-
import { useConfigContext } from "../../context/ConfigContext";
15-
1613

1714
type TileProps = {
1815
item: CatalogItemWithName;

src/extension/ui/src/components/tile/Modal.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { useEffect, useMemo, useState } from "react";
44
import { CatalogItemWithName } from "../../types/catalog";
55
import Secrets from "../../Secrets";
66
import { v1 } from "@docker/extension-api-client-types";
7-
import { useCatalogContext } from "../../context/CatalogContext";
8-
import { useConfigContext } from "../../context/ConfigContext";
97
import { ASSIGNED_SECRET_PLACEHOLDER, CATALOG_LAYOUT_SX, UNASSIGNED_SECRET_PLACEHOLDER } from "../../Constants";
108
import ConfigEditor from "./ConfigEditor";
119

@@ -57,9 +55,6 @@ const ConfigurationModal = ({
5755
registered,
5856
onSecretChange,
5957
}: ConfigurationModalProps) => {
60-
61-
const { registryItems, secrets, getCanRegisterCatalogItem } = useCatalogContext();
62-
const { configLoading, config } = useConfigContext();
6358
const [localSecrets, setLocalSecrets] = useState<{ [key: string]: string | undefined }>({});
6459
const theme = useTheme();
6560

src/extension/ui/src/components/tile/Top.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Settings } from "@mui/icons-material";
2-
import { Badge, CardMedia, IconButton, Stack, Switch, Tooltip, Typography } from "@mui/material";
2+
import { CardMedia, Stack, Switch, Tooltip, Typography } from "@mui/material";
33
import { CatalogItemWithName } from "../../types/catalog";
4-
import { useCatalogContext } from "../../context/CatalogContext";
54

65
type TopProps = {
76
unAssignedConfig: { name: string, assigned: boolean }[],
@@ -12,9 +11,6 @@ type TopProps = {
1211
}
1312

1413
export default function Top({ item, onToggleRegister, registered }: TopProps) {
15-
const { getCanRegisterCatalogItem } = useCatalogContext();
16-
17-
const canRegister = getCanRegisterCatalogItem(item);
1814

1915
const getActionButton = () => {
2016
if (!canRegister) {

0 commit comments

Comments
 (0)