mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Claude <[email protected]>
102 lines
2.8 KiB
TypeScript
102 lines
2.8 KiB
TypeScript
import React from 'react';
|
|
import { Stack, Text, Code, Group, Badge, Alert, Loader } from '@mantine/core';
|
|
import { useAppConfig } from '../../../../hooks/useAppConfig';
|
|
|
|
const Overview: React.FC = () => {
|
|
const { config, loading, error } = useAppConfig();
|
|
|
|
const renderConfigSection = (title: string, data: any) => {
|
|
if (!data || typeof data !== 'object') return null;
|
|
|
|
return (
|
|
<Stack gap="xs" mb="md">
|
|
<Text fw={600} size="md" c="blue">{title}</Text>
|
|
<Stack gap="xs" pl="md">
|
|
{Object.entries(data).map(([key, value]) => (
|
|
<Group key={key} wrap="nowrap" align="flex-start">
|
|
<Text size="sm" w={150} style={{ flexShrink: 0 }} c="dimmed">
|
|
{key}:
|
|
</Text>
|
|
{typeof value === 'boolean' ? (
|
|
<Badge color={value ? 'green' : 'red'} size="sm">
|
|
{value ? 'true' : 'false'}
|
|
</Badge>
|
|
) : typeof value === 'object' ? (
|
|
<Code block>{JSON.stringify(value, null, 2)}</Code>
|
|
) : (
|
|
String(value) || 'null'
|
|
)}
|
|
</Group>
|
|
))}
|
|
</Stack>
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
const basicConfig = config ? {
|
|
appName: config.appName,
|
|
appNameNavbar: config.appNameNavbar,
|
|
baseUrl: config.baseUrl,
|
|
contextPath: config.contextPath,
|
|
serverPort: config.serverPort,
|
|
} : null;
|
|
|
|
const securityConfig = config ? {
|
|
enableLogin: config.enableLogin,
|
|
} : null;
|
|
|
|
const systemConfig = config ? {
|
|
enableAlphaFunctionality: config.enableAlphaFunctionality,
|
|
enableAnalytics: config.enableAnalytics,
|
|
} : null;
|
|
|
|
const integrationConfig = config ? {
|
|
GoogleDriveEnabled: config.GoogleDriveEnabled,
|
|
SSOAutoLogin: config.SSOAutoLogin,
|
|
} : null;
|
|
|
|
if (loading) {
|
|
return (
|
|
<Stack align="center" py="md">
|
|
<Loader size="sm" />
|
|
<Text size="sm" c="dimmed">Loading configuration...</Text>
|
|
</Stack>
|
|
);
|
|
}
|
|
|
|
if (error) {
|
|
return (
|
|
<Alert color="red" title="Error">
|
|
{error}
|
|
</Alert>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Stack gap="lg">
|
|
<div>
|
|
<Text fw={600} size="lg">Application Configuration</Text>
|
|
<Text size="sm" c="dimmed">
|
|
Current application settings and configuration details.
|
|
</Text>
|
|
</div>
|
|
|
|
{config && (
|
|
<>
|
|
{renderConfigSection('Basic Configuration', basicConfig)}
|
|
{renderConfigSection('Security Configuration', securityConfig)}
|
|
{renderConfigSection('System Configuration', systemConfig)}
|
|
{renderConfigSection('Integration Configuration', integrationConfig)}
|
|
|
|
{config.error && (
|
|
<Alert color="yellow" title="Configuration Warning">
|
|
{config.error}
|
|
</Alert>
|
|
)}
|
|
</>
|
|
)}
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
export default Overview; |