diff --git a/package.json b/package.json index 8c4a1f7..f032e89 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,10 @@ { "type": "docs", "release": "patch" + }, + { + "type": "style", + "release": "patch" } ] } diff --git a/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx b/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx index 9888cbb..a476f79 100644 --- a/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx +++ b/plugins/awards/src/components/AwardEditComponent/AwardEditComponent.tsx @@ -30,7 +30,7 @@ import Autocomplete from '@mui/material/Autocomplete'; import Stack from '@mui/material/Stack'; import { Award } from '@seatgeek/backstage-plugin-awards-common'; import { isEmpty, random } from 'lodash'; -import React, { useState } from 'react'; +import React, { useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import useAsync from 'react-use/lib/useAsync'; import { awardsApiRef } from '../../api'; @@ -38,8 +38,8 @@ import { editRouteRef } from '../../routes'; const emptyAward: Award = { uid: '', - name: 'Award Name', - description: 'Award description', + name: '', + description: '', image: '', owners: [], recipients: [], @@ -87,6 +87,10 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => { }; }), ); + const hasRequiredFields = useMemo(() => { + return awardName !== '' && awardDescription !== '' && awardImage !== ''; + }, [awardName, awardDescription, awardImage]); + const [allUsers, setAllUsers] = useState(new Array()); useAsync(async () => { @@ -287,6 +291,7 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => { color="primary" variant="contained" startIcon={} + disabled={!hasRequiredFields} onClick={saveAward} > Save