Rename to MdelingStatusIndicator and move to a separate file

This commit is contained in:
Robert
2023-07-18 10:59:08 +01:00
parent de7d65fc8b
commit 70e04a1c99
2 changed files with 25 additions and 21 deletions

View File

@@ -19,8 +19,7 @@ import { extensiblePredicateDefinitions } from "../../data-extensions-editor/pre
import { Mode } from "../../data-extensions-editor/shared/mode";
import { Dropdown } from "../common/Dropdown";
import { MethodClassifications } from "./MethodClassifications";
import { Codicon } from "../common/icon";
import { assertNever } from "../../common/helpers-pure";
import { ModelingStatusIndicator } from "./ModelingStatusIndicator";
const ApiOrMethodCell = styled(VSCodeDataGridCell)`
display: flex;
@@ -215,7 +214,7 @@ function ModelableMethodRow(props: Props) {
return (
<VSCodeDataGridRow>
<ApiOrMethodCell gridColumn={1}>
<ModificationIndicator state={modificationState} />
<ModelingStatusIndicator status={modificationState} />
<ExternalApiUsageName {...props} />
{mode === Mode.Application && (
<UsagesButton onClick={jumpToUsage}>
@@ -271,7 +270,7 @@ function UnmodelableMethodRow(props: Props) {
return (
<VSCodeDataGridRow>
<ApiOrMethodCell gridColumn={1}>
<ModificationIndicator state="saved" />
<ModelingStatusIndicator status="saved" />
<ExternalApiUsageName {...props} />
{mode === Mode.Application && (
<UsagesButton onClick={jumpToUsage}>
@@ -307,20 +306,3 @@ function sendJumpToUsageMessage(externalApiUsage: ExternalApiUsage) {
location: externalApiUsage.usages[0].url,
});
}
function ModificationIndicator({
state,
}: {
state: "unmodeled" | "unsaved" | "saved";
}) {
switch (state) {
case "unmodeled":
return <Codicon name="circle-large-outline" label="Method not modeled" />;
case "unsaved":
return <Codicon name="pass" label="Changes have not been saved" />;
case "saved":
return <Codicon name="pass-filled" label="Method modeled" />;
default:
assertNever(state);
}
}

View File

@@ -0,0 +1,22 @@
import * as React from "react";
import { assertNever } from "../../common/helpers-pure";
import { Codicon } from "../common/icon/Codicon";
export type ModelingStatus = "unmodeled" | "unsaved" | "saved";
interface Props {
status: ModelingStatus;
}
export function ModelingStatusIndicator({ status }: Props) {
switch (status) {
case "unmodeled":
return <Codicon name="circle-large-outline" label="Method not modeled" />;
case "unsaved":
return <Codicon name="pass" label="Changes have not been saved" />;
case "saved":
return <Codicon name="pass-filled" label="Method modeled" />;
default:
assertNever(status);
}
}