All files / src/components WhatsNewModal.tsx

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 4/4

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                        1x           6x   5x                   3x                                                                                  
// src/components/WhatsNewModal.tsx
import React from 'react';
import { XCircleIcon } from './icons/XCircleIcon';
import { GiftIcon } from './icons/GiftIcon';
 
export interface WhatsNewModalProps {
  isOpen: boolean;
  onClose: () => void;
  version: string;
  commitMessage: string;
}
 
export const WhatsNewModal: React.FC<WhatsNewModalProps> = ({
  isOpen,
  onClose,
  version,
  commitMessage,
}) => {
  if (!isOpen) return null;
 
  return (
    <div
      className="fixed inset-0 bg-black bg-opacity-60 z-50 flex justify-center items-center p-4"
      onClick={onClose}
    >
      <div
        role="dialog"
        aria-modal="true"
        aria-labelledby="whats-new-title"
        className="relative bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-md m-4 transform transition-all"
        onClick={(e) => e.stopPropagation()}
      >
        <div className="p-6">
          <div className="flex items-center mb-4">
            <div className="p-2 bg-brand-primary-light dark:bg-brand-primary-dark rounded-full mr-4">
              <GiftIcon className="w-6 h-6 text-brand-primary" />
            </div>
            <div>
              <h2 id="whats-new-title" className="text-xl font-bold text-gray-900 dark:text-white">
                What's New?
              </h2>
              <p className="text-xs text-gray-500 dark:text-gray-400">Version: {version}</p>
            </div>
          </div>
 
          <div className="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg">
            <p className="text-base font-medium text-gray-800 dark:text-gray-200">
              {commitMessage}
            </p>
          </div>
 
          <div className="mt-6 flex justify-end">
            <button
              onClick={onClose}
              className="px-4 py-2 bg-gray-200 dark:bg-gray-600 text-gray-800 dark:text-gray-200 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors"
            >
              Got it!
            </button>
          </div>
        </div>
        <button
          onClick={onClose}
          className="absolute top-3 right-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"
          aria-label="Close"
        >
          <XCircleIcon className="w-6 h-6" />
        </button>
      </div>
    </div>
  );
};