snowballtools-base/packages/frontend/src/components/projects/project/settings/DisplayEnvironmentVariables.tsx
Eric Lewis 042aff2f87 temp (?) fix build
revert this if needed
2024-02-26 11:56:51 -05:00

57 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useState } from 'react';
import { Card, Collapse, Typography } from '@material-tailwind/react';
import EditEnvironmentVariableRow from './EditEnvironmentVariableRow';
import { Environment, EnvironmentVariable } from 'gql-client';
interface DisplayEnvironmentVariablesProps {
environment: Environment;
variables: EnvironmentVariable[];
onUpdate: () => Promise<void>;
}
const DisplayEnvironmentVariables = ({
environment,
variables,
onUpdate,
}: DisplayEnvironmentVariablesProps) => {
const [openCollapse, setOpenCollapse] = useState(false);
return (
<>
<div
className="flex gap-4 p-2 "
onClick={() => setOpenCollapse((cur) => !cur)}
>
<div>^</div>
<div className="grow capitalize">{environment}</div>
<div>{variables.length} variables</div>
</div>
<Collapse open={openCollapse}>
{variables.length === 0 ? (
<Card className="bg-gray-300 flex items-center p-4" placeholder={''}>
<Typography variant="small" className="text-black" placeholder={''}>
No environment variables added yet.
</Typography>
<Typography variant="small" placeholder={''}>
Once you add them, theyll show up here.
</Typography>
</Card>
) : (
variables.map((variable: EnvironmentVariable) => {
return (
<EditEnvironmentVariableRow
onUpdate={onUpdate}
key={variable.id}
variable={variable}
/>
);
})
)}
</Collapse>
</>
);
};
export default DisplayEnvironmentVariables;