/*
* File: DicomViewerModal.example.tsx
* Description: Example usage of DicomViewerModal component
* Design & Developed by Tech4Biz Solutions
* Copyright (c) Spurrin Innovations. All rights reserved.
*/
import React, { useState } from 'react';
import { View, TouchableOpacity, Text, StyleSheet } from 'react-native';
import { DicomViewerModal } from './index';
import { theme } from '../../theme/theme';
// ============================================================================
// EXAMPLE COMPONENT
// ============================================================================
/**
* DicomViewerModalExample Component
*
* Purpose: Demonstrates how to use the DicomViewerModal component
*
* Features:
* - Shows how to pass dicomUrl to modal
* - Demonstrates modal state management
* - Example with patient information
* - Error handling examples
*/
export const DicomViewerModalExample: React.FC = () => {
// ============================================================================
// STATE MANAGEMENT
// ============================================================================
const [isModalVisible, setIsModalVisible] = useState(false);
// Example DICOM URLs (replace with your actual URLs)
const exampleDicomUrl = 'https://example-dicom-server.com/studies/123/series/456/instances/789';
// Example patient data
const patientData = {
name: 'John Doe',
studyDescription: 'CT Brain with Contrast',
};
// ============================================================================
// EVENT HANDLERS
// ============================================================================
/**
* Open DICOM viewer modal
*/
const openDicomViewer = () => {
setIsModalVisible(true);
};
/**
* Close DICOM viewer modal
*/
const closeDicomViewer = () => {
setIsModalVisible(false);
};
// ============================================================================
// RENDER
// ============================================================================
return (
{/* Trigger Button */}
View DICOM Image
{/* DICOM Viewer Modal */}
);
};
// ============================================================================
// STYLES
// ============================================================================
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: theme.colors.background,
padding: theme.spacing.lg,
},
button: {
backgroundColor: theme.colors.primary,
paddingHorizontal: theme.spacing.xl,
paddingVertical: theme.spacing.md,
borderRadius: theme.borderRadius.medium,
...theme.shadows.primary,
},
buttonText: {
fontSize: theme.typography.fontSize.bodyLarge,
fontFamily: theme.typography.fontFamily.bold,
color: theme.colors.background,
},
});
// ============================================================================
// USAGE EXAMPLES IN OTHER COMPONENTS
// ============================================================================
/*
// Example 1: Basic Usage in Patient Details Screen
import { DicomViewerModal } from '../../../shared/components';
const PatientDetailsExample = () => {
const [showDicom, setShowDicom] = useState(false);
const dicomUrl = patient.scanResults?.dicomUrl;
return (
<>
setShowDicom(true)}>
View Scan Results
setShowDicom(false)}
patientName={patient.name}
studyDescription={patient.scanResults?.description}
/>
>
);
};
// Example 2: Usage with Series Selection
import { DicomViewerModal } from '../../../shared/components';
const SeriesListExample = () => {
const [selectedDicom, setSelectedDicom] = useState(null);
const [modalVisible, setModalVisible] = useState(false);
const openDicom = (dicomUrl: string) => {
setSelectedDicom(dicomUrl);
setModalVisible(true);
};
const closeDicom = () => {
setModalVisible(false);
setSelectedDicom(null);
};
return (
<>
{seriesList.map((series) => (
openDicom(series.dicomUrl)}
>
{series.description}
))}
>
);
};
// Example 3: Usage with Error Handling
import { DicomViewerModal } from '../../../shared/components';
const ErrorHandlingExample = () => {
const [dicomModalState, setDicomModalState] = useState({
visible: false,
url: '',
title: '',
});
const openDicomWithValidation = (url: string, title: string) => {
if (!url) {
Alert.alert('Error', 'No DICOM URL available');
return;
}
setDicomModalState({
visible: true,
url,
title,
});
};
const closeDicomModal = () => {
setDicomModalState({
visible: false,
url: '',
title: '',
});
};
return (
<>
openDicomWithValidation(scan.url, scan.title)}
>
View Scan
>
);
};
*/
/*
* End of File: DicomViewerModal.example.tsx
* Design & Developed by Tech4Biz Solutions
* Copyright (c) Spurrin Innovations. All rights reserved.
*/