Merge pull request #8910 from backstage/erikengervall/improve-patch-cta
[Plugin] git-release-manager: Improve patch CTA copy
This commit is contained in:
@@ -296,6 +296,11 @@ const mockBumpedTag = 'rc-2020.01.01_1337';
|
||||
// @public (undocumented)
|
||||
const mockCalverProject: Project;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "mockCtaMessage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
const mockCtaMessage = 'Patch Release Candidate';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "mockDefaultBranch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -601,6 +606,7 @@ declare namespace testHelpers_2 {
|
||||
mockNextGitInfoSemver,
|
||||
mockNextGitInfoCalver,
|
||||
mockTagParts,
|
||||
mockCtaMessage,
|
||||
mockBumpedTag,
|
||||
createMockRelease,
|
||||
mockReleaseCandidateCalver,
|
||||
|
||||
@@ -40,24 +40,32 @@ export const Patch = ({
|
||||
releaseBranch,
|
||||
onSuccess,
|
||||
}: PatchProps) => {
|
||||
const ctaMessage = `Patch Release ${
|
||||
latestRelease?.prerelease ? 'Candidate' : 'Version'
|
||||
}`;
|
||||
|
||||
return (
|
||||
<InfoCardPlus>
|
||||
<Box marginBottom={2}>
|
||||
<Typography variant="h4">
|
||||
Patch Release {latestRelease?.prerelease ? 'Candidate' : 'Version'}
|
||||
</Typography>
|
||||
<Typography variant="h4">{ctaMessage}</Typography>
|
||||
</Box>
|
||||
|
||||
<BodyWrapper
|
||||
latestRelease={latestRelease}
|
||||
releaseBranch={releaseBranch}
|
||||
onSuccess={onSuccess}
|
||||
ctaMessage={ctaMessage}
|
||||
/>
|
||||
</InfoCardPlus>
|
||||
);
|
||||
};
|
||||
|
||||
function BodyWrapper({ latestRelease, releaseBranch, onSuccess }: PatchProps) {
|
||||
function BodyWrapper({
|
||||
latestRelease,
|
||||
releaseBranch,
|
||||
onSuccess,
|
||||
ctaMessage,
|
||||
}: PatchProps & { ctaMessage: string }) {
|
||||
const { project } = useProjectContext();
|
||||
|
||||
if (latestRelease === null) {
|
||||
@@ -93,6 +101,7 @@ function BodyWrapper({ latestRelease, releaseBranch, onSuccess }: PatchProps) {
|
||||
releaseBranch={releaseBranch}
|
||||
onSuccess={onSuccess}
|
||||
tagParts={bumpedTag.tagParts}
|
||||
ctaMessage={ctaMessage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
mockReleaseCandidateCalver,
|
||||
mockReleaseVersionCalver,
|
||||
mockTagParts,
|
||||
mockCtaMessage,
|
||||
} from '../../test-helpers/test-helpers';
|
||||
import { mockApiClient } from '../../test-helpers/mock-api-client';
|
||||
import { PatchBody } from './PatchBody';
|
||||
@@ -60,6 +61,7 @@ describe('PatchBody', () => {
|
||||
latestRelease={mockReleaseCandidateCalver}
|
||||
releaseBranch={mockReleaseBranch}
|
||||
tagParts={mockTagParts}
|
||||
ctaMessage={mockCtaMessage}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -77,6 +79,7 @@ describe('PatchBody', () => {
|
||||
releaseBranch={mockReleaseBranch}
|
||||
bumpedTag={mockBumpedTag}
|
||||
tagParts={mockTagParts}
|
||||
ctaMessage={mockCtaMessage}
|
||||
/>,
|
||||
);
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ interface PatchBodyProps {
|
||||
releaseBranch: GetBranchResult['branch'];
|
||||
onSuccess?: ComponentConfig<PatchOnSuccessArgs>['onSuccess'];
|
||||
tagParts: NonNullable<CalverTagParts | SemverTagParts>;
|
||||
ctaMessage: string;
|
||||
}
|
||||
|
||||
export const PatchBody = ({
|
||||
@@ -66,6 +67,7 @@ export const PatchBody = ({
|
||||
releaseBranch,
|
||||
onSuccess,
|
||||
tagParts,
|
||||
ctaMessage,
|
||||
}: PatchBodyProps) => {
|
||||
const pluginApiClient = useApi(gitReleaseManagerApiRef);
|
||||
const { project } = useProjectContext();
|
||||
@@ -106,7 +108,7 @@ export const PatchBody = ({
|
||||
<ResponseStepDialog
|
||||
progress={progress}
|
||||
responseSteps={responseSteps}
|
||||
title="Patch Release Candidate"
|
||||
title={ctaMessage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -320,7 +322,7 @@ export const PatchBody = ({
|
||||
run(selectedPatchCommit);
|
||||
}}
|
||||
>
|
||||
Patch Release Candidate
|
||||
{ctaMessage}
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -115,6 +115,8 @@ export const mockTagParts = {
|
||||
patch: 1,
|
||||
} as CalverTagParts;
|
||||
|
||||
export const mockCtaMessage = 'Patch Release Candidate';
|
||||
|
||||
export const mockBumpedTag = 'rc-2020.01.01_1337';
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user