+
+ {/* Render the body without double hyphens */}
{body && (
)}
+
+ {/* Render the footer if it exists */}
{footer && (
{footer}
@@ -50,7 +47,7 @@ const DiffCommit = ({commitMessage}) => {
DiffCommit.propTypes = {
commitMessage: PropTypes.shape({
- type: PropTypes.string.isRequired,
+ type: PropTypes.string,
scope: PropTypes.string,
subject: PropTypes.string.isRequired,
body: PropTypes.string,
diff --git a/frontend/src/components/settings/git/modal/ViewDiff.jsx b/frontend/src/components/settings/git/modal/ViewDiff.jsx
index 175099d..57872c0 100644
--- a/frontend/src/components/settings/git/modal/ViewDiff.jsx
+++ b/frontend/src/components/settings/git/modal/ViewDiff.jsx
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import Modal from '../../../ui/Modal';
-import {Code, FileText, Settings, File} from 'lucide-react';
import DiffCommit from './DiffCommit';
const ViewDiff = ({
@@ -40,25 +39,45 @@ const ViewDiff = ({
});
};
- const getTypeIcon = () => {
- switch (type) {
- case 'Regex Pattern':
- return
;
- case 'Custom Format':
- return
;
- case 'Quality Profile':
- return
;
- default:
- return
;
- }
+ // Tag background colors based on the type and scope
+ const typeColors = {
+ 'New Feature':
+ 'bg-green-100 text-white-800 dark:bg-green-900 dark:text-white-200',
+ 'Bug Fix':
+ 'bg-red-100 text-white-800 dark:bg-red-900 dark:text-white-200',
+ Documentation:
+ 'bg-yellow-100 text-white-800 dark:bg-yellow-900 dark:text-white-200',
+ 'Style Change':
+ 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200',
+ Refactoring:
+ 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200',
+ 'Performance Improvement':
+ 'bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200',
+ 'Test Addition/Modification':
+ 'bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200',
+ 'Chore/Maintenance':
+ 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200'
};
- const formattedContent = formatDiffContent(diffContent);
+ const scopeColors = {
+ 'Regex Pattern':
+ 'bg-blue-100 text-white-800 dark:bg-blue-900 dark:text-white-200',
+ 'Custom Format':
+ 'bg-green-100 text-white-800 dark:bg-green-900 dark:text-white-200',
+ 'Quality Profile':
+ 'bg-yellow-100 text-white-800 dark:bg-yellow-900 dark:text-white-200'
+ };
+
+ const renderTag = (label, colorClass) => (
+
+ {label}
+
+ );
const titleContent = (
-
- {getTypeIcon()}
-
{`${type}: ${name}`}
+
+ {name}
{isIncoming ? 'Incoming' : 'Outgoing'}
+ {commitMessage &&
+ commitMessage.type &&
+ renderTag(
+ commitMessage.type,
+ typeColors[commitMessage.type] ||
+ 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200'
+ )}
+ {commitMessage &&
+ commitMessage.scope &&
+ renderTag(
+ commitMessage.scope,
+ scopeColors[commitMessage.scope] ||
+ 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200'
+ )}
);
+ const formattedContent = formatDiffContent(diffContent);
+
return (
+ width='3xl'>
-
{' '}
- {/* Passing the commitMessage object */}
+