Skip to content

Commit 61b6181

Browse files
feat: integrate Segre Chart into Element Data page (#145)
## Summary - Moves the Segre Chart from its own navigation tab into the Element Data page's "Integrated" tab as a collapsible section below the periodic table - Clicking a nuclide in the Segre chart selects the corresponding element/isotope in-page (bound to the same URL state as the periodic table) - Removes the standalone Segre Chart sidebar nav item - Redirects `/segre-chart` → `/element-data` for backwards compatibility - Adds `onNuclideClick` callback prop to `SegreChartDiagram` for flexible embedding - Adds `sectionTitle` i18n key across all 7 locales ## Test plan - [ ] Open Element Data page, verify Segre Chart collapsible section appears below the periodic table - [ ] Expand the Segre Chart section, verify zoom/pan controls work - [ ] Click a nuclide in the Segre chart, verify the corresponding element is selected and details appear below - [ ] Verify the sidebar no longer shows a separate Segre Chart nav item - [ ] Navigate to `/segre-chart` directly, verify it redirects to `/element-data` - [ ] Test in dark mode for proper contrast - [ ] Test in all supported locales for correct section title translation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude (staging merge) <noreply@anthropic.com>
1 parent ea99a01 commit 61b6181

11 files changed

Lines changed: 74 additions & 9 deletions

File tree

src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
1+
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'
22
import * as Sentry from '@sentry/react'
33
import { DatabaseProvider } from './contexts/DatabaseContext'
44
import { ThemeProvider } from './contexts/ThemeContext'
@@ -14,7 +14,6 @@ import ShowElementData from './pages/ShowElementData'
1414
import TablesInDetail from './pages/TablesInDetail'
1515
import AllTables from './pages/AllTables'
1616
import CascadesAll from './pages/CascadesAll'
17-
import SegreChart from './pages/SegreChart'
1817
import PrivacyPreferences from './pages/PrivacyPreferences'
1918
import Help from './pages/Help'
2019
import SentryTest from './pages/SentryTest'
@@ -64,7 +63,7 @@ function App() {
6463
<Route path="/fission" element={<FissionQuery />} />
6564
<Route path="/twotwo" element={<TwoToTwoQuery />} />
6665
<Route path="/element-data" element={<ShowElementData />} />
67-
<Route path="/segre-chart" element={<SegreChart />} />
66+
<Route path="/segre-chart" element={<Navigate to="/element-data" replace />} />
6867
<Route path="/tables" element={<TablesInDetail />} />
6968
<Route path="/all-tables" element={<AllTables />} />
7069
<Route path="/cascades" element={<CascadesAll />} />

src/components/Layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ReactNode, useEffect, useCallback, useState } from 'react'
22
import { Link, useLocation } from 'react-router-dom'
3-
import { Menu, X, Atom, Moon, Sun, ChevronLeft, ChevronRight, Home as HomeIcon, GitMerge, Scissors, ArrowLeftRight, FlaskConical, Table, TableProperties, Shield, Workflow, HelpCircle, Grid3x3 } from 'lucide-react'
3+
import { Menu, X, Atom, Moon, Sun, ChevronLeft, ChevronRight, Home as HomeIcon, GitMerge, Scissors, ArrowLeftRight, FlaskConical, Table, TableProperties, Shield, Workflow, HelpCircle } from 'lucide-react'
44
import { useTranslation } from 'react-i18next'
55
import { useTheme } from '../contexts/ThemeContext'
66
import { useLayout } from '../contexts/LayoutContext'
@@ -27,7 +27,6 @@ interface NavigationItem {
2727
const navigationItems: NavigationItem[] = [
2828
{ nameKey: 'navigation.home', path: '/', icon: HomeIcon },
2929
{ nameKey: 'navigation.showElementData', path: '/element-data', icon: FlaskConical },
30-
{ nameKey: 'navigation.segreChart', path: '/segre-chart', icon: Grid3x3 },
3130
{ nameKey: 'navigation.fusionReactions', path: '/fusion', icon: GitMerge },
3231
{ nameKey: 'navigation.fissionReactions', path: '/fission', icon: Scissors },
3332
{ nameKey: 'navigation.twoToTwoReactions', path: '/twotwo', icon: ArrowLeftRight },

src/components/SegreChartDiagram.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface ChartNuclide {
1818

1919
interface SegreChartDiagramProps {
2020
nuclides: ChartNuclide[]
21+
onNuclideClick?: (nuclide: ChartNuclide) => void
2122
}
2223

2324
const MAGIC_NUMBERS = [2, 8, 20, 28, 50, 82, 126]
@@ -38,7 +39,7 @@ function valleyOfStabilityN(Z: number): number {
3839
return Z + 0.006 * Z * Z
3940
}
4041

41-
export default function SegreChartDiagram({ nuclides }: SegreChartDiagramProps) {
42+
export default function SegreChartDiagram({ nuclides, onNuclideClick }: SegreChartDiagramProps) {
4243
const navigate = useNavigate()
4344
const { t } = useTranslation()
4445
const { theme } = useTheme()
@@ -86,8 +87,12 @@ export default function SegreChartDiagram({ nuclides }: SegreChartDiagramProps)
8687
}, [])
8788

8889
const handleClick = useCallback((nuclide: ChartNuclide) => {
89-
navigate(`/element-data?Z=${nuclide.Z}&A=${nuclide.A}`)
90-
}, [navigate])
90+
if (onNuclideClick) {
91+
onNuclideClick(nuclide)
92+
} else {
93+
navigate(`/element-data?Z=${nuclide.Z}&A=${nuclide.A}`)
94+
}
95+
}, [navigate, onNuclideClick])
9196

9297
const textColor = isDark ? '#9ca3af' : '#6b7280'
9398
const magicLineColor = isDark ? 'rgba(147, 197, 253, 0.3)' : 'rgba(59, 130, 246, 0.25)'

src/i18n/locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@
453453
"segreChart": {
454454
"title": "Segre Chart (N-Z Diagram)",
455455
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
456+
"sectionTitle": "Nuklidkarte (Segrè-Diagramm)",
456457
"stable": "Stable (>10\u2079 years)",
457458
"longHalfLife": "Long half-life (>100 years)",
458459
"shortHalfLife": "Short half-life (<100 years)",

src/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@
480480
"segreChart": {
481481
"title": "Segre Chart (N-Z Diagram)",
482482
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
483+
"sectionTitle": "Nuclide Chart (Segre Chart)",
483484
"stable": "Stable (>10\u2079 years)",
484485
"longHalfLife": "Long half-life (>100 years)",
485486
"shortHalfLife": "Short half-life (<100 years)",

src/i18n/locales/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@
453453
"segreChart": {
454454
"title": "Segre Chart (N-Z Diagram)",
455455
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
456+
"sectionTitle": "Carta de nucleidos (diagrama de Segrè)",
456457
"stable": "Stable (>10\u2079 years)",
457458
"longHalfLife": "Long half-life (>100 years)",
458459
"shortHalfLife": "Short half-life (<100 years)",

src/i18n/locales/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@
453453
"segreChart": {
454454
"title": "Segre Chart (N-Z Diagram)",
455455
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
456+
"sectionTitle": "Carte des nucléides (diagramme de Segrè)",
456457
"stable": "Stable (>10\u2079 years)",
457458
"longHalfLife": "Long half-life (>100 years)",
458459
"shortHalfLife": "Short half-life (<100 years)",

src/i18n/locales/ja.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@
455455
"segreChart": {
456456
"title": "Segre Chart (N-Z Diagram)",
457457
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
458+
"sectionTitle": "核種図(セグレ図)",
458459
"stable": "Stable (>10\u2079 years)",
459460
"longHalfLife": "Long half-life (>100 years)",
460461
"shortHalfLife": "Short half-life (<100 years)",

src/i18n/locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@
453453
"segreChart": {
454454
"title": "Segre Chart (N-Z Diagram)",
455455
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
456+
"sectionTitle": "Карта нуклидов (диаграмма Сегре)",
456457
"stable": "Stable (>10\u2079 years)",
457458
"longHalfLife": "Long half-life (>100 years)",
458459
"shortHalfLife": "Short half-life (<100 years)",

src/i18n/locales/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@
455455
"segreChart": {
456456
"title": "Segre Chart (N-Z Diagram)",
457457
"description": "Interactive chart of nuclides plotted by proton number (Z) vs neutron number (N), color-coded by stability",
458+
"sectionTitle": "核素图(塞格雷图)",
458459
"stable": "Stable (>10\u2079 years)",
459460
"longHalfLife": "Long half-life (>100 years)",
460461
"shortHalfLife": "Short half-life (<100 years)",

0 commit comments

Comments
 (0)