All files / publisher-admin/pages/Settings Settings.tsx

100% Statements 5/5
50% Branches 3/6
100% Functions 1/1
100% Lines 5/5

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                  2x 2x 2x 2x   2x                              
import { useAtomValue } from "jotai";
import { Row, Col } from "@canonical/react-components";
 
import { packageDataState } from "../../state/atoms";
import { capitalize } from "../../utils";
 
import type { Package } from "../../types";
 
function Settings() {
  const packageData = useAtomValue<Package | undefined>(packageDataState);
  const status = packageData ? capitalize(packageData.status) : "";
  const listingStatus = packageData?.unlisted ? "Unlisted" : "Listed";
  const statusLabel = packageData ? `${status} (${listingStatus})` : "";
 
  return (
    <section className="p-strip u-no-padding--top">
      <Row>
        <Col size={2}>
          <p>Status:</p>
        </Col>
        <Col size={8}>
          <p>{statusLabel}</p>
        </Col>
      </Row>
    </section>
  );
}
 
export default Settings;