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

100% Statements 2/2
83.33% Branches 10/12
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 187 188 189 190 191 192 193                                              7x                 19x                                                                                                                                                                                                                                                                                                                                
import React from "react";
import { SecurityLevel } from "../../../types/cia";
import { getImplementationDescription } from "../../../utils/implementationUtils";
 
/**
 * 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}-content-implementation`}
      className="space-y-4"
    >
      {/* Implementation introduction */}
      <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg mb-4">
        <p className="text-sm">
          This section summarizes implementation requirements for your selected
          security levels, helping plan resources, timelines, and technical
          approaches.
        </p>
      </div>
 
      {/* Implementation Overview */}
      <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700">
        <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100">
          Implementation Overview
        </h3>
 
        <div className="mb-4">
          <div className="flex items-center justify-between mb-2">
            <div className="text-md font-medium">Implementation Complexity:</div>
            <div className="font-medium">{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-sm text-gray-600 dark:text-gray-400 mt-2">
            {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="grid grid-cols-1 lg:grid-cols-2 gap-4">
          {/* Implementation Timeline */}
          <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg">
            <div className="text-sm font-medium mb-1">
              Estimated Implementation Time
            </div>
            <div className="text-lg font-bold">{implementationTime}</div>
            <div className="text-xs text-gray-600 dark:text-gray-400">
              Typical project timeline
            </div>
          </div>
 
          {/* Required Resources */}
          <div className="p-3 bg-gray-50 dark:bg-gray-700 rounded-lg">
            <div className="text-sm font-medium mb-1">Required Resources</div>
            <div className="text-lg font-bold">{requiredResources}</div>
            <div className="text-xs text-gray-600 dark:text-gray-400">
              Resource allocation recommendation
            </div>
          </div>
        </div>
      </div>
 
      {/* Component Implementation Summary */}
      <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700">
        <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100">
          Component Implementation Summary
        </h3>
 
        <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
          {/* Confidentiality Implementation */}
          <div className="p-3 bg-purple-50 dark:bg-purple-900 dark:bg-opacity-20 rounded-lg border border-purple-100 dark:border-purple-800">
            <h4 className="font-medium text-purple-700 dark:text-purple-300 mb-2">
              Confidentiality Implementation
            </h4>
            <p className="text-sm text-gray-600 dark:text-gray-400">
              {getImplementationDescription(
                "confidentiality",
                confidentialityLevel
              )}
            </p>
            <div className="mt-2 text-xs font-medium text-purple-700 dark:text-purple-300">
              Level: {confidentialityLevel}
            </div>
          </div>
 
          {/* Integrity Implementation */}
          <div className="p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg border border-green-100 dark:border-green-800">
            <h4 className="font-medium text-green-700 dark:text-green-300 mb-2">
              Integrity Implementation
            </h4>
            <p className="text-sm text-gray-600 dark:text-gray-400">
              {getImplementationDescription("integrity", integrityLevel)}
            </p>
            <div className="mt-2 text-xs font-medium text-green-700 dark:text-green-300">
              Level: {integrityLevel}
            </div>
          </div>
 
          {/* Availability Implementation */}
          <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg border border-blue-100 dark:border-blue-800">
            <h4 className="font-medium text-blue-700 dark:text-blue-300 mb-2">
              Availability Implementation
            </h4>
            <p className="text-sm text-gray-600 dark:text-gray-400">
              {getImplementationDescription("availability", availabilityLevel)}
            </p>
            <div className="mt-2 text-xs font-medium text-blue-700 dark:text-blue-300">
              Level: {availabilityLevel}
            </div>
          </div>
        </div>
      </div>
 
      {/* Implementation Considerations */}
      <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 border border-gray-100 dark:border-gray-700">
        <h3 className="text-lg font-medium mb-3 text-gray-800 dark:text-gray-100">
          Implementation Considerations
        </h3>
 
        <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
          <div className="p-3 bg-yellow-50 dark:bg-yellow-900 dark:bg-opacity-20 rounded-lg">
            <h4 className="font-medium text-yellow-700 dark:text-yellow-300">
              Success Factors
            </h4>
            <ul className="mt-2 space-y-1 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-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg">
            <h4 className="font-medium text-blue-700 dark:text-blue-300">
              Key Challenges
            </h4>
            <ul className="mt-2 space-y-1 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>
  );
};