All files / publisher/release/components TrackInfo.tsx

100% Statements 4/4
100% Branches 13/13
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                      5x   4x       4x                                  
import { Tooltip } from "@canonical/react-components";
 
type TrackInfoProps = {
  versionPattern: string | null;
  automaticPhasingPercentage: string | null;
};
 
export default function TrackInfo({
  versionPattern,
  automaticPhasingPercentage,
}: TrackInfoProps) {
  if (!versionPattern && !automaticPhasingPercentage) return null;
 
  const progressiveReleases = automaticPhasingPercentage
    ? `Releases will be done progressively on the track and ${automaticPhasingPercentage}% will be incremented automatically.`
    : "";
 
  return (
    <p>
      {versionPattern && `Version pattern: ${versionPattern}`}
      {versionPattern && automaticPhasingPercentage && " / "}
      {automaticPhasingPercentage &&
        `Auto. phasing %: ${automaticPhasingPercentage}`}{" "}
      <Tooltip
        autoAdjust
        message={`The version pattern and the automatic phasing percentage are additional
properties available as options when creating a new track.
${progressiveReleases}`}
      >
        <i className="p-icon--information" />
      </Tooltip>
    </p>
  );
}