Skip to content

Commit

Permalink
feat: inform user that they can deploy (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
annesylvie committed Oct 27, 2023
1 parent 1136249 commit 38377e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qvet-web/src/components/DeploymentHeadline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
embargoListFromStatusList,
} from "src/hooks/useCommitStatus";
import useConfig from "src/hooks/useConfig";
import useLogin from "src/hooks/useLogin";
import useOctokit from "src/hooks/useOctokit";
import useOwnerRepo from "src/hooks/useOwnerRepo";
import useSetCommitState from "src/hooks/useSetCommitState";
Expand Down Expand Up @@ -108,6 +109,7 @@ interface DeploymentUsersProps {

const DeploymentUsers = memo(function ({ commits }: DeploymentUsersProps) {
const allUsers = useTeamMembers();
const loginData = useLogin();
if (allUsers.isLoading || allUsers.isError || allUsers.data === null)
return null;

Expand All @@ -126,6 +128,9 @@ const DeploymentUsers = memo(function ({ commits }: DeploymentUsersProps) {
</Typography>
);

if (loginData.data && loginData.data.id in usersWithoutCommits)
return <Typography>You can deploy!</Typography>;

const luckyUsers = selectUsers(usersWithoutCommits);
const userSingularOrPlural = luckyUsers.length > 1 ? "users" : "user";
return (
Expand Down

0 comments on commit 38377e2

Please sign in to comment.