From 788172e8692171d0cf95439cf2ed503362c70462 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Sat, 18 Apr 2026 00:10:34 +0200 Subject: [PATCH] refactor(admin): split SDKPipelineSidebar, SourcesTab, ScopeDecisionTab, ComplianceAdvisorWidget, EditorSections components EditorSections.tsx (524 LOC) split into EditorSections.tsx (267 LOC) and EditorSectionsB.tsx (279 LOC). DeletionLogicSection and StorageSection moved to B; SetFn type canonical in B. EditorSections re-exports both so all existing imports from EditorTab.tsx remain valid unchanged. SDKPipelineSidebar (193), SourcesTab (311), ScopeDecisionTab (127), ComplianceAdvisorWidget (265) were already under the 500-LOC hard cap. Co-Authored-By: Claude Sonnet 4.6 --- .../_components/EditorSections.tsx | 283 +----------------- .../_components/EditorSectionsB.tsx | 279 +++++++++++++++++ 2 files changed, 292 insertions(+), 270 deletions(-) create mode 100644 admin-compliance/app/sdk/loeschfristen/_components/EditorSectionsB.tsx diff --git a/admin-compliance/app/sdk/loeschfristen/_components/EditorSections.tsx b/admin-compliance/app/sdk/loeschfristen/_components/EditorSections.tsx index 7f2266b..1303f1b 100644 --- a/admin-compliance/app/sdk/loeschfristen/_components/EditorSections.tsx +++ b/admin-compliance/app/sdk/loeschfristen/_components/EditorSections.tsx @@ -2,21 +2,25 @@ import React from 'react' import { - LoeschfristPolicy, LegalHold, StorageLocation, - RETENTION_DRIVER_META, RetentionDriverType, DeletionMethodType, - DELETION_METHOD_LABELS, STATUS_LABELS, - STORAGE_LOCATION_LABELS, StorageLocationType, PolicyStatus, - ReviewInterval, DeletionTriggerLevel, RetentionUnit, - LegalHoldStatus, REVIEW_INTERVAL_LABELS, + LoeschfristPolicy, + STATUS_LABELS, + PolicyStatus, + ReviewInterval, REVIEW_INTERVAL_LABELS, } from '@/lib/sdk/loeschfristen-types' import { TagInput } from './TagInput' -import { renderTriggerBadge } from './UebersichtTab' // --------------------------------------------------------------------------- -// Shared type +// Shared type (defined in EditorSectionsB to avoid circular imports) // --------------------------------------------------------------------------- -export type SetFn = (key: K, val: LoeschfristPolicy[K]) => void +export type { SetFn } from './EditorSectionsB' +import type { SetFn } from './EditorSectionsB' + +// --------------------------------------------------------------------------- +// Re-exports from EditorSectionsB (keeps existing import paths working) +// --------------------------------------------------------------------------- + +export { DeletionLogicSection, StorageSection } from './EditorSectionsB' // --------------------------------------------------------------------------- // Sektion 1: Datenobjekt @@ -58,267 +62,6 @@ export function DataObjectSection({ policy, set }: { policy: LoeschfristPolicy; ) } -// --------------------------------------------------------------------------- -// Sektion 2: 3-stufige Loeschlogik -// --------------------------------------------------------------------------- - -export function DeletionLogicSection({ - policy, pid, set, updateLegalHoldItem, addLegalHold, removeLegalHold, -}: { - policy: LoeschfristPolicy; pid: string; set: SetFn - updateLegalHoldItem: (idx: number, updater: (h: LegalHold) => LegalHold) => void - addLegalHold: (policyId: string) => void - removeLegalHold: (policyId: string, idx: number) => void -}) { - return ( -
-

2. 3-stufige Loeschlogik

-
- -
- {(['PURPOSE_END', 'RETENTION_DRIVER', 'LEGAL_HOLD'] as DeletionTriggerLevel[]).map((trigger) => ( - - ))} -
-
- - {policy.deletionTrigger === 'RETENTION_DRIVER' && ( -
- - -
- )} - -
-
- - set('retentionDuration', parseInt(e.target.value) || 0)} - className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" /> -
-
- - -
-
- -
- - set('retentionDescription', e.target.value)} - placeholder="z.B. Handelsrechtliche Aufbewahrungspflicht gem. HGB" - className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" /> -
- -
- - set('startEvent', e.target.value)} - placeholder="z.B. Ende des Geschaeftsjahres, Vertragsende..." - className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" /> -
- - {/* Legal Holds */} -
-
-

Legal Holds

- -
- - {policy.legalHolds.length > 0 && ( -
- - - - - - - - - - - - {policy.legalHolds.map((hold, idx) => ( - - - - - - - - ))} - -
BezeichnungGrundStatusErstellt amAktion
- updateLegalHoldItem(idx, (h) => ({ ...h, name: e.target.value }))} - placeholder="Bezeichnung" - className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> - - updateLegalHoldItem(idx, (h) => ({ ...h, reason: e.target.value }))} - placeholder="Grund" - className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> - - - - updateLegalHoldItem(idx, (h) => ({ ...h, createdAt: e.target.value }))} - className="px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> - - -
-
- )} - - -
-
- ) -} - -// --------------------------------------------------------------------------- -// Sektion 3: Speicherorte & Loeschmethode -// --------------------------------------------------------------------------- - -export function StorageSection({ - policy, pid, set, updateStorageLocationItem, addStorageLocation, removeStorageLocation, -}: { - policy: LoeschfristPolicy; pid: string; set: SetFn - updateStorageLocationItem: (idx: number, updater: (s: StorageLocation) => StorageLocation) => void - addStorageLocation: (policyId: string) => void - removeStorageLocation: (policyId: string, idx: number) => void -}) { - return ( -
-

3. Speicherorte & Loeschmethode

- - {policy.storageLocations.length > 0 && ( -
- - - - - - - - - - - - - {policy.storageLocations.map((loc, idx) => ( - - - - - - - - - ))} - -
NameTypBackupAnbieterLoeschfaehigAktion
- updateStorageLocationItem(idx, (s) => ({ ...s, name: e.target.value }))} - placeholder="Name" - className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> - - - - updateStorageLocationItem(idx, (s) => ({ ...s, isBackup: e.target.checked }))} - className="text-purple-600 focus:ring-purple-500 rounded" /> - - updateStorageLocationItem(idx, (s) => ({ ...s, provider: e.target.value }))} - placeholder="Anbieter" - className="w-full px-2 py-1 border border-gray-200 rounded text-sm focus:ring-1 focus:ring-purple-500" /> - - updateStorageLocationItem(idx, (s) => ({ ...s, deletionCapable: e.target.checked }))} - className="text-purple-600 focus:ring-purple-500 rounded" /> - - -
-
- )} - - - -
-
- - -
-
- -