managarten/memoro/apps/mobile/components/atoms/PhotoUploadButton.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

57 lines
No EOL
1.4 KiB
TypeScript

import React from 'react';
import { ImagePickerAsset } from 'expo-image-picker';
import Button from './Button';
import { useTranslation } from 'react-i18next';
import { photoStorageService } from '~/features/storage/photoStorage.service';
interface PhotoUploadButtonProps {
onPhotosSelected: (photos: ImagePickerAsset[]) => void;
loading?: boolean;
disabled?: boolean;
variant?: 'primary' | 'secondary' | 'outline';
title?: string;
iconName?: string;
style?: any;
allowsMultipleSelection?: boolean;
}
export default function PhotoUploadButton({
onPhotosSelected,
loading = false,
disabled = false,
variant = 'secondary',
title,
iconName = 'image-outline',
style,
allowsMultipleSelection = true,
}: PhotoUploadButtonProps) {
const { t } = useTranslation();
const handlePress = async () => {
try {
const photos = await photoStorageService.selectPhotos({
allowsMultipleSelection,
quality: 0.8,
});
if (photos.length > 0) {
onPhotosSelected(photos);
}
} catch (error) {
console.debug('Error selecting photos:', error);
// You might want to show an error toast here
}
};
return (
<Button
variant={variant}
title={title || t('memo.add_photos_button', 'Add Photos')}
iconName={iconName}
onPress={handlePress}
loading={loading}
disabled={disabled || loading}
style={style}
/>
);
}