Skip to content

Commit

Permalink
autofill team from parent when creating function (#90)
Browse files Browse the repository at this point in the history
Co-authored-by: Mailn Nifeli Snieske <[email protected]>
  • Loading branch information
malinnsnieske and Mailn Nifeli Snieske authored Nov 5, 2024
1 parent ad64ef3 commit 6aa073d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/function-column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function FunctionColumn({ functionId }: FunctionFolderProps) {
mb="20px"
autoFocus
/>
<TeamSelect functionId={functionId} edit />
<TeamSelect functionId={functionId} />
<Flex gap="10px">
<Button
aria-label="delete"
Expand Down
7 changes: 3 additions & 4 deletions src/components/team-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Text, Skeleton, Select } from "@kvib/react";

export function TeamSelect({
functionId,
edit,
}: { functionId: number; edit?: boolean }) {
const { metadata } = useFunction(functionId);
const { teams } = useUser();
Expand All @@ -25,12 +24,12 @@ export function TeamSelect({
size="sm"
borderRadius="5px"
required
placeholder={edit ? "Velg team" : undefined}
defaultValue={edit ? undefined : currentTeam.data?.id}
placeholder={currentTeam.data?.id ? undefined : "Velg team"}
defaultValue={currentTeam.data?.id}
>
{teams.data?.map((team) => (
<option key={team.id} value={team.id}>
{team.displayName}
{team.displayName.replace(/.* - /, "")}
</option>
))}
</Select>
Expand Down

0 comments on commit 6aa073d

Please sign in to comment.