improve Icon

This commit is contained in:
kv
2024-01-14 14:09:00 -08:00
parent b6ec89e4aa
commit 30b6dac7dd
4 changed files with 10 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/* /*
Generated by typeshare 1.6.0 Generated by typeshare 1.7.0
*/ */
export interface MongoIdObj { export interface MongoIdObj {

View File

@@ -121,7 +121,10 @@ export const BuildComponents: RequiredResourceComponents = {
Page: { Page: {
Config: ({ id }) => <BuildConfig id={id} />, Config: ({ id }) => <BuildConfig id={id} />,
}, },
Icon, Icon: ({ id }) => {
if (id) return <Icon id={id} />;
else return <Hammer className="w-4 h-4" />;
},
Actions: ({ id }) => { Actions: ({ id }) => {
const building = useRead("GetBuildActionState", { id }).data?.building; const building = useRead("GetBuildActionState", { id }).data?.building;
const { mutate, isPending } = useExecute("RunBuild"); const { mutate, isPending } = useExecute("RunBuild");

View File

@@ -34,7 +34,7 @@ const deployment_state_color = (state: Types.DockerContainerState) => {
}; };
const deployment_state_fill_color = (state: Types.DockerContainerState) => { const deployment_state_fill_color = (state: Types.DockerContainerState) => {
return `fill-${deployment_state_color(state)}` return `fill-${deployment_state_color(state)}`;
}; };
const deployment_state_text_color = (state: Types.DockerContainerState) => { const deployment_state_text_color = (state: Types.DockerContainerState) => {
@@ -45,7 +45,9 @@ const Icon = ({ id }: { id?: string }) => {
const state = useDeployment(id)?.info.state; const state = useDeployment(id)?.info.state;
return ( return (
<Rocket className={cn("w-4", state && deployment_state_fill_color(state))} /> <Rocket
className={cn("w-4", state && deployment_state_fill_color(state))}
/>
); );
}; };

View File

@@ -6,7 +6,7 @@ type IdComponent = React.FC<{ id: string }>;
type OptionalIdComponent = React.FC<{ id?: string }>; type OptionalIdComponent = React.FC<{ id?: string }>;
export interface RequiredResourceComponents { export interface RequiredResourceComponents {
Icon: IdComponent; Icon: OptionalIdComponent;
New: React.FC; New: React.FC;