Skip to content

Commit

Permalink
Merge branch 'main' of github.com:seatgeek/backstage-plugins into zh-s3
Browse files Browse the repository at this point in the history
  • Loading branch information
zhammer committed Feb 26, 2024
2 parents a35d6f3 + 7aec768 commit e89925e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
{
"type": "docs",
"release": "patch"
},
{
"type": "style",
"release": "patch"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ import Autocomplete from '@mui/material/Autocomplete';
import Stack from '@mui/material/Stack';
import { Award } from '@seatgeek/backstage-plugin-awards-common';
import { isEmpty } 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';
import { editRouteRef } from '../../routes';

const emptyAward: Award = {
uid: '',
name: 'Award Name',
description: 'Award description',
name: '',
description: '',
image: '',
owners: [],
recipients: [],
Expand Down Expand Up @@ -87,6 +87,9 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => {
};
}),
);
const hasRequiredFields = useMemo(() => {
return awardName !== '' && awardDescription !== '' && awardImage !== '';
}, [awardName, awardDescription, awardImage]);
const { value: allUsers } = useAsync(async () => {
// Fetching all users in the catalog.
// TODO: memoize this
Expand Down Expand Up @@ -272,6 +275,7 @@ export const AwardEditCard = ({ award = emptyAward }: AwardEditCardProps) => {
color="primary"
variant="contained"
startIcon={<CreateComponentIcon />}
disabled={!hasRequiredFields}
onClick={saveAward}
>
Save
Expand Down

0 comments on commit e89925e

Please sign in to comment.