Files
calendar/companion/utils/safeLogger.ts
T
Dhairyashil ShindeandGitHub 49ae10149f feat(companion): iOS native UI components and simplified event type creation (#26240)
ios:


https://github.com/user-attachments/assets/efdfd3e3-239f-4cbf-be1a-7784d1df1851


android:



https://github.com/user-attachments/assets/a8e22a5c-60f3-4fb6-8923-b8a786bceb0c




## Overview

This PR introduces native iOS UI components, refactors the profile menu, and simplifies the event type creation flow for a more native iOS experience.

## Key Changes

### iOS Native UI Components
- **iOS-specific Event Types Page**: Added native Stack.Header, glass UI, and context menus for iOS
- **Platform-specific Profile Sheet**: Created separate implementations for iOS (formSheet) and Android/Web (modal)
- **Bottom Glass UI Navbar**: Updated bottom navigation bar with glass UI styling for iOS
- **Native iOS Alerts**: Replaced custom modals with native `Alert.prompt` for event types and availability pages

### Profile Menu Refactor
- Restructured More page with folder layout and native iOS header support
- Added profile button to More page header on iOS with glass UI
- Added "Copy public page link" and "Roadmap" options to profile sheet
- Refactored Header component: removed inline profile modal, now uses route-based navigation
- Updated Availability page with New menu and profile button in header
- Fixed "My Settings" URL to use `/general` endpoint
- Removed "Profile" item from More section menu
- Updated tab layout to support `(more)` folder structure

### Simplified Event Type Creation
- Reduced event type creation to only require title input
- Auto-generate slug from title using slugify utility
- Set default duration to 15 minutes
- Leave description empty (users can edit later)
- Applied to both iOS and Android/Web platforms

### UI Improvements
- Updated login button styling: changed background color to pure black (#000000) with white text for better contrast
2025-12-28 18:48:48 -03:00

73 lines
2.2 KiB
TypeScript

/**
* Safe Logger Utility
*
* Provides secure logging functions that only output in development mode.
* This prevents sensitive data from being exposed in production logs.
*
* Security: All error objects, stack traces, and potentially sensitive data
* should be logged using these functions to ensure they are not exposed in production.
*/
/**
* Safely log an error message only in development mode.
* Use this instead of console.error when logging error objects that may contain sensitive data.
*
* @param message - The error message prefix
* @param error - Optional error object (will only be logged in __DEV__ mode)
*/
export const safeLogError = (message: string, error?: unknown): void => {
if (__DEV__) {
if (error !== undefined) {
console.error(message, error);
} else {
console.error(message);
}
}
};
/**
* Safely log a warning message only in development mode.
* Use this instead of console.warn when logging potentially sensitive data.
*
* @param message - The warning message prefix
* @param data - Optional additional data (will only be logged in __DEV__ mode)
*/
export const safeLogWarn = (message: string, data?: unknown): void => {
if (__DEV__) {
if (data !== undefined) {
console.warn(message, data);
} else {
console.warn(message);
}
}
};
/**
* Safely log an info message only in development mode.
* Use this instead of console.log when logging potentially sensitive data.
*
* @param message - The info message prefix
* @param data - Optional additional data (will only be logged in __DEV__ mode)
*/
export const safeLogInfo = (message: string, data?: unknown): void => {
if (__DEV__) {
if (data !== undefined) {
console.log(message, data);
} else {
console.log(message);
}
}
};
/**
* Get a safe error message for displaying to users.
* Returns a generic message instead of exposing raw error details.
*
* @param error - The error object
* @param fallbackMessage - The generic message to show to users
* @returns The fallback message (never exposes raw error details to users)
*/
export const getSafeErrorMessage = (_error: unknown, fallbackMessage: string): string => {
return fallbackMessage;
};