Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions apps/mobile/app/(auth)/login.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { router } from 'expo-router';
import { useState } from 'react';
import {
StyleSheet,
Expand All @@ -8,11 +9,14 @@ import {
ActivityIndicator,
Image,
Linking,
ImageSourcePropType,
type ImageSourcePropType,
} from 'react-native';
import { router } from 'expo-router';
import { lightTheme, darkTheme, typography, spacing, colors, borderRadius } from '../../theme';

import grueneAtLogo from '../../assets/images/gruene-at-logo.png';
import nbIcon from '../../assets/images/nb-icon.png';
import sonnenblumeLogo from '../../assets/images/sonnenblume.png';
import { login, type AuthSource } from '../../services/auth';
import { lightTheme, darkTheme, typography, spacing, colors, borderRadius } from '../../theme';

interface LoginProvider {
enabled: boolean;
Expand All @@ -28,21 +32,21 @@ const LOGIN_PROVIDERS: Record<string, LoginProvider> = {
source: 'gruenes-netz-login',
title: 'Grünes Netz',
description: 'Für Mitglieder von BÜNDNIS 90/DIE GRÜNEN',
logo: require('../../assets/images/sonnenblume.png'),
logo: sonnenblumeLogo,
},
grueneOesterreich: {
enabled: true,
source: 'gruene-oesterreich-login',
title: 'Die Grünen Österreich',
description: 'Für Mitglieder der Grünen Österreich',
logo: require('../../assets/images/gruene-at-logo.png'),
logo: grueneAtLogo,
},
netzbegruenung: {
enabled: true,
source: 'netzbegruenung-login',
title: 'Netzbegrünung',
description: 'Für Mitglieder der Netzbegrünung',
logo: require('../../assets/images/nb-icon.png'),
logo: nbIcon,
},
gruenerator: {
enabled: false,
Expand Down Expand Up @@ -88,7 +92,7 @@ export default function LoginScreen() {
};

const handlePrivacyPress = () => {
Linking.openURL('https://gruenerator.eu/datenschutz');
void Linking.openURL('https://gruenerator.eu/datenschutz');
};

const renderLoginOption = (provider: LoginProvider) => {
Expand Down
25 changes: 13 additions & 12 deletions apps/mobile/app/(fullscreen)/image-studio-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* This editor subscribes to modifications and auto-regenerates on changes.
*/

import { Ionicons } from '@expo/vector-icons';
import { router } from 'expo-router';
import { useCallback, useRef, useState, useEffect } from 'react';
import {
View,
Expand All @@ -17,9 +19,8 @@ import {
Dimensions,
ActivityIndicator,
} from 'react-native';
import { router } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

import { EditCategoryBar } from '../../components/image-studio/EditCategoryBar';
import {
EditCategoryModal,
Expand All @@ -29,14 +30,14 @@ import {
InlineEditBar,
type InlineEditCategory,
} from '../../components/image-studio/InlineEditBar';
import { useImageStudioStore } from '../../stores/imageStudioStore';
import { useEditRegeneration } from '../../hooks/useEditRegeneration';
import {
supportsEditing,
getAvailableCategories,
type EditCategory,
} from '../../config/editSheetConfig';
import { useEditRegeneration } from '../../hooks/useEditRegeneration';
import { getImageDataUri } from '../../services/imageStudio';
import { useImageStudioStore } from '../../stores/imageStudioStore';
import { lightTheme, darkTheme, colors, spacing, borderRadius } from '../../theme';

const { width: SCREEN_WIDTH } = Dimensions.get('window');
Expand Down Expand Up @@ -91,14 +92,6 @@ export default function FullscreenImageStudioEditor() {
}
}, [modifications, formData, debouncedRegenerate]);

if (!type || !generatedImage || !supportsEditing(type)) {
router.back();
return null;
}

const categories = getAvailableCategories(type);
const imageUri = getImageDataUri(generatedImage);

const handleClose = useCallback(() => {
router.back();
}, []);
Expand All @@ -121,6 +114,14 @@ export default function FullscreenImageStudioEditor() {
setInlineCategory(null);
}, []);

if (!type || !generatedImage || !supportsEditing(type)) {
router.back();
return null;
}

const categories = getAvailableCategories(type);
const imageUri = getImageDataUri(generatedImage);

return (
<View style={[styles.container, { backgroundColor: theme.background }]}>
<View style={styles.imageContainer}>
Expand Down
33 changes: 16 additions & 17 deletions apps/mobile/app/(modals)/edit-chat.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import { Ionicons } from '@expo/vector-icons';
import { getGlobalApiClient } from '@gruenerator/shared/api';
import {
useGeneratedTextStore,
useTextEditActions,
extractEditableText,
type ChatMessage,
type EditChange,
} from '@gruenerator/shared/generators';
import { useLocalSearchParams, useRouter } from 'expo-router';
import { useState, useCallback, useEffect, useMemo } from 'react';
import {
View,
Expand All @@ -10,33 +20,23 @@ import {
LayoutAnimation,
UIManager,
} from 'react-native';
import { GiftedChat, IMessage } from 'react-native-gifted-chat';
import { useLocalSearchParams, useRouter } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
import { GiftedChat, type IMessage } from 'react-native-gifted-chat';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { getGlobalApiClient } from '@gruenerator/shared/api';
import {
useGeneratedTextStore,
useTextEditActions,
extractEditableText,
type ChatMessage,
type EditChange,
} from '@gruenerator/shared/generators';
import { colors, spacing, borderRadius, lightTheme, darkTheme } from '../../theme';

import {
FloatingGlassMenu,
createChatRenderers,
ASSISTANT_USER,
CURRENT_USER,
} from '../../components/chat';
import { API_ENDPOINTS } from '../../services/api';
import { colors, spacing, borderRadius, lightTheme, darkTheme } from '../../theme';
import { getErrorMessage } from '../../utils/errors';

if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}

import { API_ENDPOINTS } from '../../services/api';

interface ExpandableTextPreviewProps {
text: string;
theme: typeof lightTheme | typeof darkTheme;
Expand Down Expand Up @@ -154,7 +154,7 @@ export default function EditChatModal() {
if (!rawData?.raw) return null;

try {
let cleaned = rawData.raw
const cleaned = rawData.raw
.replace(/```json\s*|\s*```/g, '')
.replace(/(\*\*|__|~~)\s*"/g, '"')
.replace(/"\s*(\*\*|__|~~)/g, '"')
Expand Down Expand Up @@ -284,6 +284,7 @@ export default function EditChatModal() {
}, [componentName, canRedo, redo]);

const chatRenderers = useMemo(() => createChatRenderers(theme), [theme]);
const insets = useSafeAreaInsets();

if (!componentName) {
return (
Expand All @@ -293,8 +294,6 @@ export default function EditChatModal() {
);
}

const insets = useSafeAreaInsets();

return (
<View style={[styles.container, { backgroundColor: theme.background, paddingTop: insets.top }]}>
<FloatingGlassMenu>
Expand Down
6 changes: 5 additions & 1 deletion apps/sites/src/components/ActionsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export function ActionsSection({ data }: ActionsSectionProps) {
<div className="section-container">
<div className="image-grid">
{data.actions.map((action, index) => (
<div key={index} className="grid-item">
<div
// eslint-disable-next-line react/no-array-index-key
key={index}
className="grid-item"
>
<a href={action.link} target="_blank" rel="noopener noreferrer">
{action.imageUrl && <img src={action.imageUrl} alt={action.text} loading="lazy" />}
<h2>{action.text}</h2>
Expand Down
1 change: 1 addition & 0 deletions apps/sites/src/components/ContactSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function ContactSection({ data }: ContactSectionProps) {
const IconComponent = platformIconMap[social.platform] || FaEnvelope;
return (
<a
// eslint-disable-next-line react/no-array-index-key
key={index}
href={social.url}
target="_blank"
Expand Down
6 changes: 5 additions & 1 deletion apps/sites/src/components/ThemesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export function ThemesSection({ data }: ThemesSectionProps) {
<div className="themes-carousel-wrapper">
<div className="themes-carousel" ref={carouselRef}>
{data.themes.map((theme, index) => (
<article key={index} className="theme-card">
<article
// eslint-disable-next-line react/no-array-index-key
key={index}
className="theme-card"
>
{theme.imageUrl && (
<div className="theme-image-wrapper">
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ export function InteractivePreview({ candidateData, containerRef }: InteractiveP
<div className="themes-grid">
{candidateData.themes.themes.length > 0 ? (
candidateData.themes.themes.map((theme, index) => (
<div key={index} className="theme-card">
<div
// eslint-disable-next-line react/no-array-index-key
key={index}
className="theme-card"
>
{theme.imageUrl && (
<div
data-section="themes"
Expand Down Expand Up @@ -200,6 +204,7 @@ export function InteractivePreview({ candidateData, containerRef }: InteractiveP
{candidateData.actions.actions.length > 0 ? (
candidateData.actions.actions.map((action, index) => (
<div
// eslint-disable-next-line react/no-array-index-key
key={index}
data-section="actions"
data-field="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function ActionsSectionEditor({ data, onChange }: ActionsSectionEditorPro
<div className="editor-array-items">
{data.actions.map((action, index) => (
<div
// eslint-disable-next-line react/no-array-index-key
key={index}
className={`editor-array-item ${isItemHighlighted(index) ? 'editor-array-item--highlighted' : ''}`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export function ThemesSectionEditor({ data, onChange }: ThemesSectionEditorProps
const contentLength = getTextLength(theme.content || '');
return (
<div
// eslint-disable-next-line react/no-array-index-key
key={index}
className={`editor-array-item ${isItemHighlighted(index) ? 'editor-array-item--highlighted' : ''}`}
>
Expand Down
4 changes: 2 additions & 2 deletions apps/sites/src/lib/errorTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function initErrorTracking(): void {
const projectId = import.meta.env.VITE_HIGHLIGHT_PROJECT_ID;

if (!projectId) {
console.info(
console.warn(
'Highlight.io project ID not configured. Error tracking disabled. ' +
'Set VITE_HIGHLIGHT_PROJECT_ID environment variable to enable error tracking.'
);
Expand All @@ -17,7 +17,7 @@ export function initErrorTracking(): void {
}

try {
console.info('Error tracking initialized successfully');
console.warn('Error tracking initialized successfully');
errorTrackingInitialized = true;
} catch (error) {
console.error('Failed to initialize error tracking:', error);
Expand Down
13 changes: 8 additions & 5 deletions apps/sites/src/utils/errorReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ export function reportMessage(
level: 'info' | 'warning' | 'error' = 'info',
context?: Record<string, unknown>
): void {
const consoleMethod = level === 'warning' ? 'warn' : level;
console[consoleMethod]('Message reported:', message, context);
if (level === 'error') {
console.error('Message reported:', message, context);
} else {
console.warn('Message reported:', message, context);
}
}

export function setUserContext(user: { id: string; email?: string }): void {
if (isErrorTrackingEnabled()) {
console.info('User context set:', user.id);
console.warn('User context set:', user.id);
}
}

export function clearUserContext(): void {
if (isErrorTrackingEnabled()) {
console.info('User context cleared');
console.warn('User context cleared');
}
}

Expand All @@ -31,6 +34,6 @@ export function addBreadcrumb(
data?: Record<string, unknown>
): void {
if (isErrorTrackingEnabled()) {
console.info('Breadcrumb:', { message, category, ...data });
console.warn('Breadcrumb:', { message, category, ...data });
}
}
Loading