mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 21:11:12 -05:00
feat: Implement Phase 5 optimization and best practices
This commit is contained in:
20
src/lib/logger.ts
Normal file
20
src/lib/logger.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Logger Utility
|
||||
*
|
||||
* Provides conditional logging based on environment.
|
||||
* Prevents console noise in production builds.
|
||||
*/
|
||||
|
||||
const isDev = import.meta.env.DEV;
|
||||
|
||||
export const logger = {
|
||||
log: (...args: any[]) => {
|
||||
if (isDev) console.log(...args);
|
||||
},
|
||||
error: (...args: any[]) => {
|
||||
console.error(...args); // Always log errors
|
||||
},
|
||||
warn: (...args: any[]) => {
|
||||
if (isDev) console.warn(...args);
|
||||
},
|
||||
};
|
||||
33
src/lib/moderation/constants.ts
Normal file
33
src/lib/moderation/constants.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Moderation Queue Constants
|
||||
*
|
||||
* Centralized configuration values for the moderation system.
|
||||
*/
|
||||
|
||||
export const MODERATION_CONSTANTS = {
|
||||
// TanStack Query configuration
|
||||
QUERY_STALE_TIME: 30000, // 30 seconds
|
||||
QUERY_GC_TIME: 5 * 60 * 1000, // 5 minutes
|
||||
QUERY_RETRY_COUNT: 2,
|
||||
|
||||
// Realtime configuration
|
||||
REALTIME_DEBOUNCE_MS: 500, // 500ms
|
||||
REALTIME_OPTIMISTIC_REMOVAL_TIMEOUT: 5000, // 5 seconds
|
||||
|
||||
// Lock configuration
|
||||
LOCK_DURATION_MS: 15 * 60 * 1000, // 15 minutes
|
||||
LOCK_EXTENSION_MS: 10 * 60 * 1000, // 10 minutes
|
||||
|
||||
// Cache configuration
|
||||
MAX_ENTITY_CACHE_SIZE: 500,
|
||||
MAX_PROFILE_CACHE_SIZE: 500,
|
||||
|
||||
// Pagination
|
||||
DEFAULT_PAGE_SIZE: 25,
|
||||
MAX_PAGE_SIZE: 100,
|
||||
|
||||
// Filter debounce
|
||||
FILTER_DEBOUNCE_MS: 300,
|
||||
} as const;
|
||||
|
||||
export type ModerationConstants = typeof MODERATION_CONSTANTS;
|
||||
@@ -64,3 +64,7 @@ export {
|
||||
} from './lockHelpers';
|
||||
|
||||
export type { LockStatus, LockUrgency } from './lockHelpers';
|
||||
|
||||
// Constants
|
||||
export { MODERATION_CONSTANTS } from './constants';
|
||||
export type { ModerationConstants } from './constants';
|
||||
|
||||
Reference in New Issue
Block a user