Skip to content

Commit 97fea62

Browse files
committed
Fix padding inconsistency in Push Notifications settings section - removed duplicate containers and applied consistent glass-morphism styling
1 parent bc508e7 commit 97fea62

2 files changed

Lines changed: 161 additions & 180 deletions

File tree

src/components/settings/PushNotificationSettings.tsx

Lines changed: 78 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import React, { useEffect, useState } from 'react';
2-
import { Form, Input, InputNumber, Tooltip, Card } from 'antd';
2+
import { Form, Input, InputNumber, Tooltip, Alert, Spin, Divider, Card } from 'antd';
33
import {
44
QuestionCircleOutlined,
5-
BellOutlined,
6-
AppleOutlined,
7-
AndroidOutlined,
8-
SettingOutlined,
95
KeyOutlined,
106
FileTextOutlined
117
} from '@ant-design/icons';
128
import { LiquidToggle } from '@app/components/common/LiquidToggle';
139
import useGenericSettings from '@app/hooks/useGenericSettings';
1410
import { SettingsGroupType } from '@app/types/settings.types';
15-
import BaseSettingsForm from './BaseSettingsForm';
16-
import * as S from './Settings.styles';
11+
import styled from 'styled-components';
12+
13+
const Container = styled.div`
14+
background: rgba(0, 255, 255, 0.03);
15+
backdrop-filter: blur(10px);
16+
-webkit-backdrop-filter: blur(10px);
17+
border: 1px solid rgba(0, 255, 255, 0.1);
18+
border-radius: 8px;
19+
padding: 1.5rem;
20+
margin-bottom: 1rem;
21+
`;
1722

1823
const PushNotificationSettings: React.FC = () => {
1924
const {
@@ -50,43 +55,46 @@ const PushNotificationSettings: React.FC = () => {
5055
updateSettings(changedValues);
5156
};
5257

53-
// Modified save function to reset the editing flag
54-
const handleSave = async () => {
55-
await saveSettings();
56-
setIsUserEditing(false); // Reset after saving
57-
};
5858

5959
return (
60-
<BaseSettingsForm
61-
title="Push Notification Settings"
62-
loading={loading}
63-
error={error}
64-
onSave={handleSave}
65-
onReset={() => {
66-
fetchSettings();
67-
setIsUserEditing(false);
68-
}}
69-
>
70-
<Form
71-
form={form}
72-
layout="vertical"
73-
onValuesChange={handleValuesChange}
74-
initialValues={settings || {}}
75-
onFinish={(values) => {
76-
console.log('Form submitted with values:', values);
77-
setIsUserEditing(false);
78-
}}
79-
>
80-
{/* Main Configuration */}
81-
<Card
82-
title={
83-
<span>
84-
<BellOutlined style={{ marginRight: 8 }} />
85-
General Configuration
86-
</span>
87-
}
88-
style={{ marginBottom: 16 }}
60+
<Container>
61+
{error && (
62+
<Alert
63+
message="Error"
64+
description={error.message}
65+
type="error"
66+
showIcon
67+
style={{ marginBottom: '1rem' }}
68+
/>
69+
)}
70+
71+
<Spin spinning={loading}>
72+
<Form
73+
form={form}
74+
layout="vertical"
75+
onValuesChange={handleValuesChange}
76+
initialValues={settings || {}}
77+
onFinish={(values) => {
78+
console.log('Form submitted with values:', values);
79+
setIsUserEditing(false);
80+
}}
81+
style={{
82+
padding: 0,
83+
margin: 0,
84+
background: 'transparent',
85+
border: 'none'
86+
}}
87+
colon={false}
8988
>
89+
{/* Main Configuration */}
90+
<Divider orientation="left" style={{
91+
borderColor: 'rgba(82, 196, 255, 0.3)',
92+
fontSize: '0.95em',
93+
marginTop: 0
94+
}}>
95+
General Configuration
96+
</Divider>
97+
9098
<Form.Item
9199
name="enabled"
92100
label={
@@ -101,18 +109,14 @@ const PushNotificationSettings: React.FC = () => {
101109
>
102110
<LiquidToggle />
103111
</Form.Item>
104-
</Card>
105-
106112
{/* Service Configuration */}
107-
<Card
108-
title={
109-
<span>
110-
<SettingOutlined style={{ marginRight: 8 }} />
111-
Service Configuration
112-
</span>
113-
}
114-
style={{ marginBottom: 16 }}
115-
>
113+
<Divider orientation="left" style={{
114+
borderColor: 'rgba(82, 196, 255, 0.3)',
115+
fontSize: '0.95em'
116+
}}>
117+
Service Configuration
118+
</Divider>
119+
116120
<Form.Item
117121
name="service_worker_count"
118122
label={
@@ -202,7 +206,6 @@ const PushNotificationSettings: React.FC = () => {
202206
>
203207
<Input
204208
placeholder="e.g., 1s, 500ms, 2m"
205-
prefix={<SettingOutlined />}
206209
/>
207210
</Form.Item>
208211

@@ -228,18 +231,14 @@ const PushNotificationSettings: React.FC = () => {
228231
max={1000}
229232
/>
230233
</Form.Item>
231-
</Card>
232-
233234
{/* APNs Configuration */}
234-
<Card
235-
title={
236-
<span>
237-
<AppleOutlined style={{ marginRight: 8 }} />
238-
Apple Push Notification Service (APNs)
239-
</span>
240-
}
241-
style={{ marginBottom: 16 }}
242-
>
235+
<Divider orientation="left" style={{
236+
borderColor: 'rgba(82, 196, 255, 0.3)',
237+
fontSize: '0.95em'
238+
}}>
239+
Apple Push Notification Service (APNs)
240+
</Divider>
241+
243242
<Form.Item
244243
name="apns_enabled"
245244
label={
@@ -347,7 +346,6 @@ const PushNotificationSettings: React.FC = () => {
347346
>
348347
<Input
349348
placeholder="com.your.app"
350-
prefix={<AppleOutlined />}
351349
/>
352350
</Form.Item>
353351

@@ -365,18 +363,14 @@ const PushNotificationSettings: React.FC = () => {
365363
>
366364
<LiquidToggle />
367365
</Form.Item>
368-
</Card>
369-
370366
{/* FCM Configuration */}
371-
<Card
372-
title={
373-
<span>
374-
<AndroidOutlined style={{ marginRight: 8 }} />
375-
Firebase Cloud Messaging (FCM)
376-
</span>
377-
}
378-
style={{ marginBottom: 16 }}
379-
>
367+
<Divider orientation="left" style={{
368+
borderColor: 'rgba(82, 196, 255, 0.3)',
369+
fontSize: '0.95em'
370+
}}>
371+
Firebase Cloud Messaging (FCM)
372+
</Divider>
373+
380374
<Form.Item
381375
name="fcm_enabled"
382376
label={
@@ -414,24 +408,21 @@ const PushNotificationSettings: React.FC = () => {
414408
prefix={<FileTextOutlined />}
415409
/>
416410
</Form.Item>
417-
</Card>
418-
419411
<Form.Item>
420-
<p style={{
412+
<p style={{
421413
color: 'rgba(255, 255, 255, 0.8)',
422414
fontSize: '0.9em',
423-
padding: '0.75rem',
424-
backgroundColor: 'rgba(0, 0, 0, 0.1)',
425-
borderLeft: '3px solid rgba(82, 196, 255, 0.8)',
426-
borderRadius: '0 4px 4px 0'
415+
padding: '0.75rem 0 0.75rem 0.75rem',
416+
borderLeft: '3px solid rgba(82, 196, 255, 0.8)'
427417
}}>
428-
<span style={{ color: 'rgba(82, 196, 255, 1)' }}>Note:</span> Push notification settings are saved to the configuration file
429-
and the push notification service automatically reloads with the new configuration.
418+
<span style={{ color: 'rgba(82, 196, 255, 1)' }}>Note:</span> Push notification settings are saved to the configuration file
419+
and the push notification service automatically reloads with the new configuration.
430420
At least one service (APNs or FCM) should be enabled if push notifications are enabled.
431421
</p>
432422
</Form.Item>
433-
</Form>
434-
</BaseSettingsForm>
423+
</Form>
424+
</Spin>
425+
</Container>
435426
);
436427
};
437428

0 commit comments

Comments
 (0)