managarten/apps/context/apps/mobile/components/ai/ModelSelector.tsx
Till-JS bb0e0cf5cb 🚚 feat(context): integrate context app into monorepo
Restructure the context app (formerly basetext) to follow the monorepo
pattern with proper workspace configuration.

Changes:
- Move app files to apps/context/apps/mobile/
- Rename package to @context/mobile
- Update bundle ID to com.manacore.context
- Create pnpm-workspace.yaml for project workspace
- Add dev scripts to root package.json
- Update CLAUDE.md with project documentation

The app structure is prepared for future web/backend additions.

Note: Existing TypeScript errors in the original codebase are preserved.
These should be fixed in a follow-up PR.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 15:09:04 +01:00

91 lines
2 KiB
TypeScript

import React from 'react';
import { View, TouchableOpacity, StyleSheet } from 'react-native';
import { Text } from '~/components/ui/Text';
import { AIModelOption } from '~/services/aiService';
import { useTheme } from '~/utils/theme';
type ModelSelectorProps = {
modelOptions: AIModelOption[];
selectedModel: string;
onSelectModel: (modelValue: string) => void;
};
export const ModelSelector: React.FC<ModelSelectorProps> = ({
modelOptions,
selectedModel,
onSelectModel,
}) => {
const { mode } = useTheme();
const isDark = mode === 'dark';
return (
<View style={styles.container}>
<Text style={styles.label}>Modell auswählen:</Text>
<View style={styles.buttonContainer}>
{modelOptions.map((model) => (
<TouchableOpacity
key={model.value}
style={[
styles.modelButton,
selectedModel === model.value ? styles.modelButtonSelected : {},
isDark ? styles.modelButtonDark : {},
]}
onPress={() => onSelectModel(model.value)}
>
<Text
style={[
styles.modelButtonText,
selectedModel === model.value ? styles.modelButtonTextSelected : {},
isDark ? styles.modelButtonTextDark : {},
]}
>
{model.label}
</Text>
</TouchableOpacity>
))}
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
marginBottom: 16,
},
label: {
marginBottom: 8,
fontWeight: '500',
},
buttonContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
},
modelButton: {
backgroundColor: '#f3f4f6',
paddingVertical: 8,
paddingHorizontal: 12,
borderRadius: 4,
marginRight: 8,
marginBottom: 8,
borderWidth: 1,
borderColor: '#e5e7eb',
},
modelButtonDark: {
backgroundColor: '#374151',
borderColor: '#4b5563',
},
modelButtonSelected: {
backgroundColor: '#818cf8',
borderColor: '#6366f1',
},
modelButtonText: {
color: '#4b5563',
fontWeight: '500',
},
modelButtonTextDark: {
color: '#d1d5db',
},
modelButtonTextSelected: {
color: '#ffffff',
},
});