From 49c9e0cecf48ad404af2a093e53ca3da6a471d6a Mon Sep 17 00:00:00 2001 From: Andy Charlwood Date: Tue, 17 Feb 2026 02:09:26 +0000 Subject: [PATCH] refactor: centralise detail panel inline styles into detail-styles.ts Extract 5 shared style constants (detailRootStyle, sectionHeadingStyle, bulletListStyle, bodyTextStyle, paragraphStyle) used across 5 of 6 detail components. Replaces ~30 inline style object definitions with imports. Net reduction: 274 lines across detail panel components. --- src/components/detail/ConsultationDetail.tsx | 109 ++----------------- src/components/detail/EducationDetail.tsx | 70 ++---------- src/components/detail/KPIDetail.tsx | 90 ++------------- src/components/detail/ProjectDetail.tsx | 79 ++------------ src/components/detail/SkillDetail.tsx | 49 +-------- src/components/detail/detail-styles.ts | 38 +++++++ 6 files changed, 83 insertions(+), 352 deletions(-) create mode 100644 src/components/detail/detail-styles.ts diff --git a/src/components/detail/ConsultationDetail.tsx b/src/components/detail/ConsultationDetail.tsx index 013e07c..cc1e5b1 100644 --- a/src/components/detail/ConsultationDetail.tsx +++ b/src/components/detail/ConsultationDetail.tsx @@ -1,4 +1,5 @@ import type { Consultation } from '@/types/pmr' +import { detailRootStyle, sectionHeadingStyle, bulletListStyle, bodyTextStyle, paragraphStyle } from './detail-styles' interface ConsultationDetailProps { consultation: Consultation @@ -6,14 +7,7 @@ interface ConsultationDetailProps { export function ConsultationDetail({ consultation }: ConsultationDetailProps) { return ( -
+
{/* Role header */}
-

- History -

-

+

History

+

{consultation.history}

@@ -96,36 +72,10 @@ export function ConsultationDetail({ consultation }: ConsultationDetailProps) { {/* Examination (achievements) */} {consultation.examination && consultation.examination.length > 0 && (
-

- Key Achievements -

-
    +

    Key Achievements

    +
      {consultation.examination.map((item, index) => ( -
    • +
    • {item}
    • ))} @@ -136,36 +86,10 @@ export function ConsultationDetail({ consultation }: ConsultationDetailProps) { {/* Plan (outcomes) */} {consultation.plan && consultation.plan.length > 0 && (
      -

      - Outcomes & Impact -

      -
        +

        Outcomes & Impact

        +
          {consultation.plan.map((item, index) => ( -
        • +
        • {item}
        • ))} @@ -176,18 +100,7 @@ export function ConsultationDetail({ consultation }: ConsultationDetailProps) { {/* Coded entries (technical environment / tags) */} {consultation.codedEntries && consultation.codedEntries.length > 0 && (
          -

          - Coded Entries -

          +

          Coded Entries

          = { Certificate: GraduationCap, Registration: Award, @@ -27,14 +19,7 @@ export function EducationDetail({ document }: EducationDetailProps) { const Icon = typeIconMap[document.type] || GraduationCap return ( -
          +
          {/* Header */}
          -

          Research Project

          -

          +

          Research Project

          +

          {extra.researchDescription}

          @@ -134,7 +112,7 @@ export function EducationDetail({ document }: EducationDetailProps) { {/* OSCE score (MPharm) */} {extra?.osceScore && (
          -

          OSCE Performance

          +

          OSCE Performance

          0 && (
          -

          Extracurricular Activities

          -
            +

            Extracurricular Activities

            +
              {extra.extracurriculars.map((activity, index) => ( -
            • +
            • {activity}
            • ))} @@ -199,15 +162,8 @@ export function EducationDetail({ document }: EducationDetailProps) { {/* Programme detail (Mary Seacole) */} {extra?.programmeDetail && (
              -

              Programme Overview

              -

              +

              Programme Overview

              +

              {extra.programmeDetail}

              @@ -216,13 +172,11 @@ export function EducationDetail({ document }: EducationDetailProps) { {/* Notes */} {document.notes && (
              -

              Notes

              +

              Notes

              diff --git a/src/components/detail/KPIDetail.tsx b/src/components/detail/KPIDetail.tsx index cdfb489..7ee50ad 100644 --- a/src/components/detail/KPIDetail.tsx +++ b/src/components/detail/KPIDetail.tsx @@ -1,5 +1,6 @@ import type { KPI } from '@/types/pmr' import { KPI_COLORS } from '@/lib/theme-colors' +import { detailRootStyle, sectionHeadingStyle, bulletListStyle, bodyTextStyle, paragraphStyle } from './detail-styles' interface KPIDetailProps { kpi: KPI @@ -35,14 +36,7 @@ export function KPIDetail({ kpi }: KPIDetailProps) { const { context, role, outcomes, period } = kpi.story return ( -

              +
              {/* Headline number */}
              -

              - Context -

              -

              - {context} -

              +

              Context

              +

              {context}

              {/* Your role paragraph */}
              -

              - Your Role -

              -

              - {role} -

              +

              Your Role

              +

              {role}

              {/* Outcome bullets */}
              -

              - Key Outcomes -

              -
                +

                Key Outcomes

                +
                  {outcomes.map((outcome, index) => ( -
                • +
                • {outcome}
                • ))} diff --git a/src/components/detail/ProjectDetail.tsx b/src/components/detail/ProjectDetail.tsx index 7178985..53b56b6 100644 --- a/src/components/detail/ProjectDetail.tsx +++ b/src/components/detail/ProjectDetail.tsx @@ -1,6 +1,7 @@ import { ExternalLink } from 'lucide-react' import type { Investigation } from '@/types/pmr' import { PROJECT_STATUS_COLORS } from '@/lib/theme-colors' +import { detailRootStyle, sectionHeadingStyle, bulletListStyle, bodyTextStyle, paragraphStyle } from './detail-styles' interface ProjectDetailProps { investigation: Investigation @@ -17,14 +18,7 @@ export function ProjectDetail({ investigation }: ProjectDetailProps) { const statusBg = statusBgMap[investigation.status] return ( -
                  +
                  {/* Header: name + year + status */}
                  -

                  - Methodology -

                  -

                  - {investigation.methodology} -

                  +

                  Methodology

                  +

                  {investigation.methodology}

                  {/* Tech stack tags */}
                  -

                  - Tech Stack -

                  +

                  Tech Stack

                  {investigation.techStack.map((tech) => ( -

                  - Results -

                  -
                    +

                    Results

                    +
                      {investigation.results.map((result, index) => ( -
                    • +
                    • {result}
                    • ))} diff --git a/src/components/detail/SkillDetail.tsx b/src/components/detail/SkillDetail.tsx index ceb82bc..ef8cd89 100644 --- a/src/components/detail/SkillDetail.tsx +++ b/src/components/detail/SkillDetail.tsx @@ -1,5 +1,6 @@ import type { SkillMedication } from '@/types/pmr' import { roleSkillMappings, constellationNodes } from '@/data/constellation' +import { detailRootStyle, sectionHeadingStyle } from './detail-styles' interface SkillDetailProps { skill: SkillMedication @@ -32,14 +33,7 @@ export function SkillDetail({ skill }: SkillDetailProps) { .sort((a, b) => (a!.startYear ?? 0) - (b!.startYear ?? 0)) return ( -
                      +
                      {/* Skill header */}
                      -

                      - Proficiency -

                      +

                      Proficiency

                      -

                      - Experience -

                      +

                      Experience

                      0 && (
                      -

                      - Used In -

                      +

                      Used In

                      {usedInRoles.map((node) => (