diff --git a/src/components/admin/ConfigurationManager.tsx b/src/components/admin/ConfigurationManager.tsx index ae3d4bc..0fdb74a 100644 --- a/src/components/admin/ConfigurationManager.tsx +++ b/src/components/admin/ConfigurationManager.tsx @@ -158,9 +158,12 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro if (!config.isEditable) { return ( -
-

{config.configValue}

-

This setting cannot be modified

+
+

{config.configValue}

+

+ + This setting cannot be modified +

); } @@ -168,10 +171,13 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro switch (config.uiComponent || config.valueType.toLowerCase()) { case 'toggle': return ( -
- - {currentValue === 'true' ? 'Enabled' : 'Disabled'} - +
+
+
+ + {currentValue === 'true' ? 'Enabled' : 'Disabled'} + +
@@ -187,10 +193,10 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro const min = config.validationRules?.min || 0; const max = config.validationRules?.max || 100; return ( -
+
- {numValue}% - Range: {min}-{max} + {numValue}% + Range: {min}-{max}
); @@ -226,7 +232,7 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro value={currentValue} onChange={(e) => handleValueChange(config.configKey, e.target.value)} disabled={isSaving} - className="font-mono" + className="font-mono border-slate-300 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 rounded-md transition-all shadow-sm" /> ); } @@ -289,11 +295,13 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro if (configurations.length === 0) { return ( - + - -

No configurations found

-

+

+ +
+

No configurations found

+

System configurations will appear here once they are initialized

@@ -307,22 +315,26 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro
{/* Success Message */} {successMessage && ( -
- -

{successMessage}

+
+
+ +
+

{successMessage}

)} {/* Error Message */} {error && ( -
- -

{error}

+
+
+ +
+

{error}

@@ -331,58 +343,64 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro {/* Configurations by Category */} - + {categories.map(category => ( - - {category.replace(/_/g, ' ')} + + + {category.replace(/_/g, ' ')} + ))} {categories.map(category => ( - - + +
-
+
{getCategoryIcon(category)}
- + {category.replace(/_/g, ' ')} - - {groupedConfigs[category].length} setting{groupedConfigs[category].length !== 1 ? 's' : ''} + + {groupedConfigs[category].length} setting{groupedConfigs[category].length !== 1 ? 's' : ''} available
{groupedConfigs[category].map(config => ( -
+
-
-
@@ -391,12 +409,12 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro {renderConfigInput(config)} {config.isEditable && ( -
+
@@ -416,7 +434,7 @@ export function ConfigurationManager({ onConfigUpdate }: ConfigurationManagerPro variant="outline" onClick={() => handleReset(config)} disabled={saving === config.configKey} - className="gap-2" + className="gap-2 border-slate-300 hover:bg-slate-50 hover:border-slate-400 shadow-sm" > Reset to Default diff --git a/src/components/admin/HolidayManager.tsx b/src/components/admin/HolidayManager.tsx index 45246d5..8e3ef0d 100644 --- a/src/components/admin/HolidayManager.tsx +++ b/src/components/admin/HolidayManager.tsx @@ -135,13 +135,13 @@ export function HolidayManager() { const getTypeColor = (type: Holiday['holidayType']) => { switch (type) { case 'NATIONAL': - return 'bg-red-100 text-red-800 border-red-200'; + return 'bg-gradient-to-r from-red-50 to-rose-50 text-red-800 border-red-300'; case 'REGIONAL': - return 'bg-blue-100 text-blue-800 border-blue-200'; + return 'bg-gradient-to-r from-blue-50 to-cyan-50 text-blue-800 border-blue-300'; case 'ORGANIZATIONAL': - return 'bg-purple-100 text-purple-800 border-purple-200'; + return 'bg-gradient-to-r from-purple-50 to-violet-50 text-purple-800 border-purple-300'; case 'OPTIONAL': - return 'bg-gray-100 text-gray-800 border-gray-200'; + return 'bg-gradient-to-r from-slate-50 to-gray-50 text-slate-700 border-slate-300'; } }; @@ -168,22 +168,26 @@ export function HolidayManager() {
{/* Success Message */} {successMessage && ( -
- -

{successMessage}

+
+
+ +
+

{successMessage}

)} {/* Error Message */} {error && ( -
- -

{error}

+
+
+ +
+

{error}

@@ -191,26 +195,26 @@ export function HolidayManager() { )} {/* Header */} - - -
+ + +
-
- +
+
- Holiday Calendar - + Holiday Calendar + Manage organization holidays for TAT calculations
-
+
-
@@ -233,69 +241,83 @@ export function HolidayManager() {
) : holidays.length === 0 ? ( - + - -

No holidays found for {selectedYear}

-
) : ( -
+
{sortedMonths.map(month => ( - - - {month} {selectedYear} - - {holidaysByMonth[month].length} holiday{holidaysByMonth[month].length !== 1 ? 's' : ''} - + + +
+
+ {month} {selectedYear} + + {holidaysByMonth[month].length} holiday{holidaysByMonth[month].length !== 1 ? 's' : ''} + +
+
+ +
+
- + {holidaysByMonth[month].map(holiday => (
-
-
-

{holiday.holidayName}

- +
+
+

{holiday.holidayName}

+ {holiday.holidayType} {holiday.isRecurring && ( - + Recurring )}
-

+

{formatDateShort(holiday.holidayDate)}

{holiday.description && ( -

{holiday.description}

+

{holiday.description}

)}
-
+
@@ -308,59 +330,62 @@ export function HolidayManager() { {/* Add/Edit Dialog */} - + - + {editingHoliday ? 'Edit Holiday' : 'Add New Holiday'} - + {editingHoliday ? 'Update holiday information' : 'Add a new holiday to the calendar'}
- + setFormData({ ...formData, holidayDate: e.target.value })} + className="border-slate-300 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 rounded-md transition-all shadow-sm" />
- + setFormData({ ...formData, holidayName: e.target.value })} + className="border-slate-300 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 rounded-md transition-all shadow-sm" />
- + setFormData({ ...formData, description: e.target.value })} + className="border-slate-300 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 rounded-md transition-all shadow-sm" />
- +
-
+
setFormData({ ...formData, isRecurring: e.target.checked })} - className="rounded border-gray-300" + className="rounded border-slate-300 text-blue-600 focus:ring-2 focus:ring-blue-500/20 focus:ring-offset-0 w-4 h-4 cursor-pointer" /> -
- - - diff --git a/src/pages/Settings/Settings.tsx b/src/pages/Settings/Settings.tsx index 01087e3..f580f94 100644 --- a/src/pages/Settings/Settings.tsx +++ b/src/pages/Settings/Settings.tsx @@ -18,73 +18,207 @@ import { HolidayManager } from '@/components/admin/HolidayManager'; export function Settings() { const { user } = useAuth(); + const isAdmin = (user as any)?.isAdmin; + return ( -
- {/* Header Card */} - -
- - -
-
-
-
- -
-
-

Settings

-

Manage your account settings and preferences

-
+
+
+ {/* Header Card */} + +
+
+ + +
+
+ +
+
+

Settings

+

Manage your account and preferences

-
- - + + - {/* Check if user is admin */} - {(user as any)?.isAdmin ? ( - - - - - User Settings - - - - System Configuration - - - - Holiday Calendar - - + {/* Tabs for Admin, Cards for Non-Admin */} + {isAdmin ? ( + + + + + User Settings + User + + + + Configuration + Config + + + + Holidays + Holidays + + - {/* User Settings Tab */} - -
+ {/* Fixed width container to prevent layout shifts */} +
+ {/* User Settings Tab */} + +
+ {/* Notification Settings */} + + +
+
+ +
+
+ Notifications + Manage notification preferences +
+
+
+ +
+ +
+
+
+ + {/* Security Settings */} + + +
+
+ +
+
+ Security + Password and security settings +
+
+
+ +
+
+

Security settings will be available soon

+
+
+
+
+ + {/* Appearance Settings */} + + +
+
+ +
+
+ Appearance + Theme and display preferences +
+
+
+ +
+
+

Appearance settings will be available soon

+
+
+
+
+ + {/* Preferences */} + + +
+
+ +
+
+ Preferences + Application preferences +
+
+
+ +
+
+

User preferences will be available soon

+
+
+
+
+
+
+ + {/* System Configuration Tab (Admin Only) */} + + + + + {/* Holiday Calendar Tab (Admin Only) */} + + + +
+ + ) : ( + <> + {/* Non-Admin User Settings Only */} +
{/* Notification Settings */} - +
-
- +
+
- Notifications - Manage notification preferences + Notifications + Manage notification preferences
-
@@ -92,197 +226,89 @@ export function Settings() { {/* Security Settings */} - +
-
- +
+
- Security - Password and security settings + Security + Password and security settings
-
-

Security settings will be available soon

+
+

Security settings will be available soon

{/* Appearance Settings */} - +
-
- +
+
- Appearance - Theme and display preferences + Appearance + Theme and display preferences
-
-

Appearance settings will be available soon

+
+

Appearance settings will be available soon

{/* Preferences */} - +
-
- +
+
- Preferences - Application preferences + Preferences + Application preferences
-
-

User preferences will be available soon

+
+

User preferences will be available soon

- - {/* System Configuration Tab (Admin Only) */} - - - - - {/* Holiday Calendar Tab (Admin Only) */} - - - - - ) : ( - <> - {/* Non-Admin User Settings Only */} -
- {/* Notification Settings */} - - -
-
- + {/* Info: Admin features not available */} + + +
+
+
-
- Notifications - Manage notification preferences -
-
- - -
- -
-
-
- - {/* Security Settings */} - - -
-
- -
-
- Security - Password and security settings -
-
-
- -
-
-

Security settings will be available soon

+
+

Admin Features Not Accessible

+

System configuration and holiday management require admin privileges. Contact your administrator for access.

- - {/* Appearance Settings */} - - -
-
- -
-
- Appearance - Theme and display preferences -
-
-
- -
-
-

Appearance settings will be available soon

-
-
-
-
- - {/* Preferences */} - - -
-
- -
-
- Preferences - Application preferences -
-
-
- -
-
-

User preferences will be available soon

-
-
-
-
-
- - {/* Info: Admin features not available */} - - -
- -
-

Admin features not accessible

-

System configuration and holiday management require admin privileges.

-
-
-
-
- - )} + + )} +
); }