All files / src/components/widgets/assessmentcenter SecurityImplementationTab.tsx

100% Statements 2/2
78.57% Branches 11/14
100% Functions 1/1
100% Lines 2/2

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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186                                              3x                     19x                                                                                                                                                                                                                                                                                                              
import React from "react";
import { SECURITY_SUMMARY_WIDGET_IDS } from "../../../constants/testIds";
import { SecurityLevel } from "../../../types/cia";
import { getImplementationDescription } from "../../../utils/implementationUtils";
import { WidgetClasses, cn } from "../../../utils/tailwindClassHelpers";
 
/**
 * Props for SecurityImplementationTab component
 */
export interface SecurityImplementationTabProps {
  availabilityLevel: SecurityLevel;
  integrityLevel: SecurityLevel;
  confidentialityLevel: SecurityLevel;
  implementationComplexity: string;
  testId: string;
  implementationTime: string;
  requiredResources: string;
}
 
/**
 * Implementation tab component for SecuritySummaryWidget
 * Displays implementation requirements, timeline, resources, and considerations
 */
export const SecurityImplementationTab: React.FC<
  SecurityImplementationTabProps
> = ({
  availabilityLevel,
  integrityLevel,
  confidentialityLevel,
  implementationComplexity,
  testId,
  implementationTime,
  requiredResources,
}) => {
  return (
    <div
      data-testid={testId || SECURITY_SUMMARY_WIDGET_IDS.section('content-implementation')}
      className="space-y-md"
    >
      <div className="p-sm bg-blue-50 dark:bg-blue-900/20 rounded-lg mb-sm">
        <p className="text-sm">
          This section summarizes implementation requirements for your selected
          security levels, helping plan resources, timelines, and technical
          approaches.
        </p>
      </div>
 
      <div className={cn(WidgetClasses.cardWhite, "shadow-sm")}>
        <h3 className={WidgetClasses.subheading}>
          Implementation Overview
        </h3>
 
        <div className="mb-sm">
          <div className="flex items-center justify-between mb-sm">
            <div className="text-body-lg font-medium text-gray-800 dark:text-gray-200">Implementation Complexity:</div>
            <div className="font-medium text-gray-800 dark:text-gray-200">{implementationComplexity}</div>
          </div>
          <div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2.5">
            <div
              className={`h-2.5 rounded-full ${
                implementationComplexity === "Low"
                  ? "w-1/4 bg-green-500"
                  : implementationComplexity === "Moderate"
                  ? "w-2/4 bg-yellow-500"
                  : implementationComplexity === "High"
                  ? "w-3/4 bg-orange-500"
                  : "w-full bg-red-500"
              }`}
            ></div>
          </div>
          <p className="text-body text-gray-600 dark:text-gray-400 mt-sm">
            {implementationComplexity === "Low"
              ? "Basic security controls with straightforward implementation"
              : implementationComplexity === "Moderate"
              ? "Standard security measures with moderate implementation effort"
              : implementationComplexity === "High"
              ? "Advanced security controls requiring significant implementation effort"
              : "Comprehensive security framework requiring extensive resources"}
          </p>
        </div>
 
        <div className={WidgetClasses.grid2Cols}>
          <div className="p-sm bg-gray-50 dark:bg-gray-700 rounded-lg">
            <div className="text-body font-medium mb-sm text-gray-700 dark:text-gray-200">
              Estimated Implementation Time
            </div>
            <div className="text-lg font-bold text-gray-900 dark:text-gray-100">{implementationTime}</div>
            <div className="text-xs text-gray-600 dark:text-gray-400">
              Typical project timeline
            </div>
          </div>
 
          <div className="p-sm bg-gray-50 dark:bg-gray-700 rounded-lg">
            <div className="text-body font-medium mb-sm text-gray-700 dark:text-gray-200">Required Resources</div>
            <div className="text-lg font-bold text-gray-900 dark:text-gray-100">{requiredResources}</div>
            <div className="text-xs text-gray-600 dark:text-gray-400">
              Resource allocation recommendation
            </div>
          </div>
        </div>
      </div>
 
      <div className={cn(WidgetClasses.card, "shadow-sm")}>
        <h3 className="text-subheading font-medium mb-sm text-gray-800 dark:text-gray-100">
          Component Implementation Summary
        </h3>
 
        <div className={WidgetClasses.grid3Cols}>
          <div className="p-sm bg-purple-50 dark:bg-purple-900/20 rounded-lg border border-purple-100 dark:border-purple-800">
            <h4 className="font-medium text-purple-700 dark:text-purple-300 mb-sm">
              Confidentiality Implementation
            </h4>
            <p className="text-body text-gray-600 dark:text-gray-400">
              {getImplementationDescription(
                "confidentiality",
                confidentialityLevel
              )}
            </p>
            <div className="mt-sm text-xs font-medium text-purple-700 dark:text-purple-300">
              Level: {confidentialityLevel}
            </div>
          </div>
 
          <div className="p-sm bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-100 dark:border-green-800">
            <h4 className="font-medium text-green-700 dark:text-green-300 mb-sm">
              Integrity Implementation
            </h4>
            <p className="text-body text-gray-600 dark:text-gray-400">
              {getImplementationDescription("integrity", integrityLevel)}
            </p>
            <div className="mt-sm text-xs font-medium text-green-700 dark:text-green-300">
              Level: {integrityLevel}
            </div>
          </div>
 
          <div className="p-sm bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800">
            <h4 className="font-medium text-blue-700 dark:text-blue-300 mb-sm">
              Availability Implementation
            </h4>
            <p className="text-body text-gray-600 dark:text-gray-400">
              {getImplementationDescription("availability", availabilityLevel)}
            </p>
            <div className="mt-sm text-xs font-medium text-blue-700 dark:text-blue-300">
              Level: {availabilityLevel}
            </div>
          </div>
        </div>
      </div>
 
      <div className={cn(WidgetClasses.card, "shadow-sm")}>
        <h3 className="text-subheading font-medium mb-sm text-gray-800 dark:text-gray-100">
          Implementation Considerations
        </h3>
 
        <div className={WidgetClasses.grid2Cols}>
          <div className="p-sm bg-yellow-50 dark:bg-yellow-900/20 rounded-lg">
            <h4 className="font-medium text-yellow-700 dark:text-yellow-300">
              Success Factors
            </h4>
            <ul className="mt-sm space-y-sm list-disc list-inside text-sm">
              <li>Executive sponsorship and support</li>
              <li>Clear security requirements definition</li>
              <li>Adequate resource allocation</li>
              <li>Proper testing and validation</li>
              <li>Staff training and awareness</li>
            </ul>
          </div>
 
          <div className="p-sm bg-blue-50 dark:bg-blue-900/20 rounded-lg">
            <h4 className="font-medium text-blue-700 dark:text-blue-300">
              Key Challenges
            </h4>
            <ul className="mt-sm space-y-sm list-disc list-inside text-sm">
              <li>Balancing security with usability</li>
              <li>Integration with existing systems</li>
              <li>Managing scope and expectations</li>
              <li>Maintaining consistent controls</li>
              <li>Securing necessary expertise</li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  );
};