mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 14:31:11 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
121
src-old/lib/moderation/constants.ts
Normal file
121
src-old/lib/moderation/constants.ts
Normal file
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* 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,
|
||||
|
||||
// Role Labels
|
||||
ROLE_LABELS: {
|
||||
admin: 'Administrator',
|
||||
moderator: 'Moderator',
|
||||
user: 'User',
|
||||
superuser: 'Superuser',
|
||||
} as const,
|
||||
|
||||
// Status Labels
|
||||
STATUS_LABELS: {
|
||||
pending: 'Pending Review',
|
||||
approved: 'Approved',
|
||||
rejected: 'Rejected',
|
||||
partially_approved: 'Partially Approved',
|
||||
escalated: 'Escalated',
|
||||
in_review: 'In Review',
|
||||
} as const,
|
||||
|
||||
// Submission Type Labels
|
||||
SUBMISSION_TYPE_LABELS: {
|
||||
park: 'Park',
|
||||
ride: 'Ride',
|
||||
company: 'Company',
|
||||
ride_model: 'Ride Model',
|
||||
photo: 'Photo',
|
||||
} as const,
|
||||
|
||||
// Report Type Labels
|
||||
REPORT_TYPE_LABELS: {
|
||||
spam: 'Spam',
|
||||
inappropriate: 'Inappropriate Content',
|
||||
harassment: 'Harassment',
|
||||
misinformation: 'Misinformation',
|
||||
fake_info: 'Fake Information',
|
||||
offensive: 'Offensive Language',
|
||||
other: 'Other',
|
||||
} as const,
|
||||
|
||||
// Entity Type Labels
|
||||
ENTITY_TYPE_LABELS: {
|
||||
park: 'Park',
|
||||
ride: 'Ride',
|
||||
company: 'Company',
|
||||
ride_model: 'Ride Model',
|
||||
review: 'Review',
|
||||
profile: 'Profile',
|
||||
content_submission: 'Content Submission',
|
||||
} as const,
|
||||
|
||||
// Status Colors (for badges)
|
||||
STATUS_COLORS: {
|
||||
pending: 'secondary',
|
||||
approved: 'default',
|
||||
rejected: 'destructive',
|
||||
partially_approved: 'outline',
|
||||
escalated: 'destructive',
|
||||
in_review: 'secondary',
|
||||
} as const,
|
||||
|
||||
// Report Status Colors
|
||||
REPORT_STATUS_COLORS: {
|
||||
pending: 'secondary',
|
||||
reviewed: 'default',
|
||||
dismissed: 'outline',
|
||||
resolved: 'default',
|
||||
} as const,
|
||||
} as const;
|
||||
|
||||
export type ModerationConstants = typeof MODERATION_CONSTANTS;
|
||||
|
||||
// Helper functions for type-safe label access
|
||||
export function getRoleLabel(role: keyof typeof MODERATION_CONSTANTS.ROLE_LABELS): string {
|
||||
return MODERATION_CONSTANTS.ROLE_LABELS[role] || role;
|
||||
}
|
||||
|
||||
export function getStatusLabel(status: keyof typeof MODERATION_CONSTANTS.STATUS_LABELS): string {
|
||||
return MODERATION_CONSTANTS.STATUS_LABELS[status] || status;
|
||||
}
|
||||
|
||||
export function getSubmissionTypeLabel(type: keyof typeof MODERATION_CONSTANTS.SUBMISSION_TYPE_LABELS): string {
|
||||
return MODERATION_CONSTANTS.SUBMISSION_TYPE_LABELS[type] || type;
|
||||
}
|
||||
|
||||
export function getReportTypeLabel(type: keyof typeof MODERATION_CONSTANTS.REPORT_TYPE_LABELS): string {
|
||||
return MODERATION_CONSTANTS.REPORT_TYPE_LABELS[type] || type;
|
||||
}
|
||||
|
||||
export function getEntityTypeLabel(type: keyof typeof MODERATION_CONSTANTS.ENTITY_TYPE_LABELS): string {
|
||||
return MODERATION_CONSTANTS.ENTITY_TYPE_LABELS[type] || type;
|
||||
}
|
||||
Reference in New Issue
Block a user