import React from 'react'
import { Grid, Card, Text, Title, Group, Box, Button, Stack, Progress } from '@mantine/core'
import { IconSearch, IconCube, IconGridPattern } from '@tabler/icons-react'
import { useXRD } from '../context/XRDContext'
const ResultsHero = () => {
const { modelResults, setIsLogitDrawerOpen } = useXRD()
// Animation styles
const cardAnimation = {
animation: 'slideIn 0.5s ease-out forwards',
opacity: 0,
}
const keyframes = `
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
`
if (!modelResults || !modelResults.predictions?.phase_predictions) {
return null
}
const predictions = modelResults.predictions.phase_predictions
// Extract predictions by type
const crystalSystem = predictions.find(p => p.phase === 'Crystal System')
const spaceGroup = predictions.find(p => p.phase === 'Space Group')
const latticeParams = predictions.find(p => p.is_lattice)
const getConfidenceColor = (confidence) => {
if (confidence >= 0.8) return 'green'
if (confidence >= 0.5) return 'yellow'
return 'orange'
}
return (
<>
{/* Card 1: Crystal System */}
Crystal System
{crystalSystem?.predicted_class || 'N/A'}
{/* Card 2: Space Group */}
Space Group
{spaceGroup?.predicted_class || 'N/A'}
{spaceGroup?.space_group_symbol && (
{spaceGroup.space_group_symbol}
)}
{/* Card 3: Lattice Parameters */}
Lattice Parameters
{latticeParams?.lattice_params ? (
a = {latticeParams.lattice_params.a?.toFixed(3)} Å
b = {latticeParams.lattice_params.b?.toFixed(3)} Å
c = {latticeParams.lattice_params.c?.toFixed(3)} Å
α = {latticeParams.lattice_params['α']?.toFixed(2)}°
β = {latticeParams.lattice_params['β']?.toFixed(2)}°
γ = {latticeParams.lattice_params['γ']?.toFixed(2)}°
) : (
N/A
)}
{/* Card 4: Confidence & Inspection */}
Confidence
{/* CS and SG Confidences - Compact */}
{/* Crystal System Confidence */}
{crystalSystem?.confidence && (
CS
{(crystalSystem.confidence * 100).toFixed(0)}%
)}
{/* Space Group Confidence */}
{spaceGroup?.confidence && (
SG
{(spaceGroup.confidence * 100).toFixed(0)}%
)}
}
size="sm"
onClick={() => setIsLogitDrawerOpen(true)}
mt="xs"
style={{
border: '1px solid #1e88e5'
}}
>
Inspect Logits
>
)
}
export default ResultsHero