import { Dimensions } from 'react-native';
import { API_HOST } from 'src/constants';

const windowWidth = Dimensions.get('window').width;
const pageMargin = windowWidth * 0.05;
const usableWidth = windowWidth - pageMargin * 2;
const photoMargin = 8;
const twoPhotos = (usableWidth - photoMargin) / 2;
const bigPhotoWidth = ((usableWidth - photoMargin) * 2) / 3;

export const smallPhotoWidth = (usableWidth - photoMargin) / 3;
export const smallPhotoHeight = (bigPhotoWidth - photoMargin) / 2;
export const itemWidth = (usableWidth - 16) / 2;

export const photoStyles = {
  onePhoto: {
    width: usableWidth,
    height: usableWidth,
    borderRadius: 8
  },
  twoPhotos: {
    width: twoPhotos,
    height: twoPhotos,
    borderRadius: 8
  },
  bigPhoto: {
    width: bigPhotoWidth,
    height: bigPhotoWidth,
    borderRadius: 8
  },
  smallPhoto: {
    width: smallPhotoWidth,
    height: smallPhotoHeight,
    borderRadius: 8
  }
};

export const getImageUri = (path: string) => `${API_HOST}${path}`;
