import { StatusBar } from 'expo-status-bar';
import { Platform, StyleSheet, useWindowDimensions } from 'react-native';

import EditScreenInfo from '@/components/EditScreenInfo';
import { Text, View } from '@/components/Themed';
import { clampContentWidth, isIPadLike } from '@/src/utils/device';

export default function ModalScreen() {
  const { width, height } = useWindowDimensions();
  const isTablet = isIPadLike(width, height);
  const contentWidth = isTablet ? clampContentWidth(width, 700, 24) : undefined;

  return (
    <View style={styles.container}>
      <View style={[styles.contentWrap, contentWidth ? { width: contentWidth } : null]}>
        <Text style={styles.title}>Modal</Text>
        <View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
        <EditScreenInfo path="app/modal.tsx" />
      </View>

      {/* Use a light status bar on iOS to account for the black space above the modal */}
      <StatusBar style={Platform.OS === 'ios' ? 'light' : 'auto'} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    width: '100%',
    alignSelf: 'stretch',
  },
  contentWrap: {
    width: '100%',
    alignItems: 'center',
  },
  title: {
    fontSize: 20,
    fontWeight: 'bold',
  },
  separator: {
    marginVertical: 30,
    height: 1,
    width: '80%',
  },
});
