diff --git a/src/components/allowed-users/components/NPubManagement/NPubManagement.tsx b/src/components/allowed-users/components/NPubManagement/NPubManagement.tsx index 950af278..70951da6 100644 --- a/src/components/allowed-users/components/NPubManagement/NPubManagement.tsx +++ b/src/components/allowed-users/components/NPubManagement/NPubManagement.tsx @@ -4,6 +4,7 @@ import { PlusOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons'; import { useAllowedUsersList, useAllowedUsersValidation } from '@app/hooks/useAllowedUsers'; import { AllowedUsersSettings, AllowedUsersMode, AllowedUser } from '@app/types/allowedUsers.types'; import * as S from './NPubManagement.styles'; +import { TableContainer } from '../TiersConfig/TiersConfig.styles'; interface NPubManagementProps { settings: AllowedUsersSettings; @@ -158,19 +159,22 @@ export const NPubManagement: React.FC = ({ - `Total ${total} users` - }} - rowKey="npub" - /> + +
`Total ${total} users` + }} + rowKey="npub" + /> + {/* Add User Modal */} ` .ant-select { width: 100%; - + .ant-select-arrow{ + color: ${(props) => (!props.$isForced ? `var(--text-main-color)` : `var(--text-light-color)`)}; + } .ant-select-selector { - background-color: ${props => props.$isForced ? '#1a1d35' : '#25284B'} !important; - border: ${props => props.$isForced ? '1px solid #434343' : '1px solid #d9d9d9'} !important; - color: ${props => props.$isForced ? '#8c8c8c' : '#d9d9d9'} !important; + background-color: ${(props) => (props.$isForced ? '#1a1d35' : '#25284B')} !important; + border: ${(props) => (props.$isForced ? '1px solid #434343' : '1px solid #d9d9d9')} !important; + color: ${(props) => (props.$isForced ? '#8c8c8c' : '#d9d9d9')} !important; } - + .ant-select-selection-item { - color: ${props => props.$isForced ? '#8c8c8c' : '#d9d9d9'} !important; + color: ${(props) => (props.$isForced ? '#8c8c8c' : '#d9d9d9')} !important; } - + &.ant-select-disabled { .ant-select-selector { - background-color: ${props => props.$isForced ? '#1a1d35' : '#25284B'} !important; - border: ${props => props.$isForced ? '1px solid #434343' : '1px solid #d9d9d9'} !important; + background-color: ${(props) => (props.$isForced ? '#1a1d35' : '#25284B')} !important; + border: ${(props) => (props.$isForced ? '1px solid #434343' : '1px solid #d9d9d9')} !important; } - + .ant-select-selection-item { - color: ${props => props.$isForced ? '#8c8c8c' : '#d9d9d9'} !important; + color: ${(props) => (props.$isForced ? '#8c8c8c' : '#d9d9d9')} !important; } } } diff --git a/src/components/allowed-users/components/TierEditor/TierEditor.tsx b/src/components/allowed-users/components/TierEditor/TierEditor.tsx index 2a8c8789..1c6a7799 100644 --- a/src/components/allowed-users/components/TierEditor/TierEditor.tsx +++ b/src/components/allowed-users/components/TierEditor/TierEditor.tsx @@ -1,14 +1,16 @@ import React, { useState, useEffect } from 'react'; -import { Input, Select, Checkbox, Space, Typography, Alert } from 'antd'; -import { - TierDisplayFormat, - DataUnit, - validateTierFormat, +import { Select, Checkbox, Space, Typography, Alert } from 'antd'; +import { + TierDisplayFormat, + DataUnit, + validateTierFormat, displayToFriendlyString, bytesToDisplayFormat, - TIER_VALIDATION + TIER_VALIDATION, } from '@app/utils/tierConversion.utils'; import { AllowedUsersTier } from '@app/types/allowedUsers.types'; +import { StyledInput } from '@app/styles/themes/reusableComponentStyles'; +import styled from 'styled-components'; const { Text } = Typography; const { Option } = Select; @@ -21,12 +23,25 @@ interface TierEditorProps { showPrice?: boolean; } +const PreviewTextWrapper = styled.div` + display: flex; + flex-direction: column; + gap: 1rem; + .ant-typography { + color: var(--text-main-color); + } +`; +const SelectWrapper = styled.div` +.ant-select-arrow { + color: var(--text-main-color); +} +` export const TierEditor: React.FC = ({ tier, onTierChange, disabled = false, showName = true, - showPrice = true + showPrice = true, }) => { // Convert backend format to display format for editing const [displayFormat, setDisplayFormat] = useState(() => { @@ -49,9 +64,10 @@ export const TierEditor: React.FC = ({ const updatedTier: AllowedUsersTier = { name, price_sats: priceSats, - monthly_limit_bytes: displayFormat.unlimited ? 0 : - Math.round(displayFormat.value * getUnitMultiplier(displayFormat.unit)), - unlimited: displayFormat.unlimited + monthly_limit_bytes: displayFormat.unlimited + ? 0 + : Math.round(displayFormat.value * getUnitMultiplier(displayFormat.unit)), + unlimited: displayFormat.unlimited, }; onTierChange(updatedTier); } @@ -59,24 +75,28 @@ export const TierEditor: React.FC = ({ const getUnitMultiplier = (unit: DataUnit): number => { switch (unit) { - case 'MB': return 1048576; // 1024 * 1024 - case 'GB': return 1073741824; // 1024 * 1024 * 1024 - case 'TB': return 1099511627776; // 1024 * 1024 * 1024 * 1024 - default: return 1048576; + case 'MB': + return 1048576; // 1024 * 1024 + case 'GB': + return 1073741824; // 1024 * 1024 * 1024 + case 'TB': + return 1099511627776; // 1024 * 1024 * 1024 * 1024 + default: + return 1048576; } }; const handleValueChange = (value: string) => { const numericValue = parseFloat(value) || 0; - setDisplayFormat(prev => ({ ...prev, value: numericValue })); + setDisplayFormat((prev) => ({ ...prev, value: numericValue })); }; const handleUnitChange = (unit: DataUnit) => { - setDisplayFormat(prev => ({ ...prev, unit })); + setDisplayFormat((prev) => ({ ...prev, unit })); }; const handleUnlimitedChange = (unlimited: boolean) => { - setDisplayFormat(prev => ({ ...prev, unlimited })); + setDisplayFormat((prev) => ({ ...prev, unlimited })); }; const handleNameChange = (value: string) => { @@ -94,7 +114,7 @@ export const TierEditor: React.FC = ({ {showName && (
Tier Name - handleNameChange(e.target.value)} placeholder="Enter tier name" @@ -108,7 +128,7 @@ export const TierEditor: React.FC = ({ {showPrice && (
Price (sats) - handlePriceChange(e.target.value)} @@ -123,7 +143,7 @@ export const TierEditor: React.FC = ({ {/* Data Limit */}
Monthly Data Limit - + {/* Unlimited Checkbox */}
= ({ {/* Value and Unit Inputs */} {!displayFormat.unlimited && ( - handleValueChange(e.target.value)} @@ -147,43 +167,39 @@ export const TierEditor: React.FC = ({ min={TIER_VALIDATION.MIN_VALUE} style={{ flex: 1 }} /> - + + + )} {/* Preview */} -
- - Preview: {displayToFriendlyString(displayFormat)} - -
+ +
+ + Preview: {displayToFriendlyString(displayFormat)} + +
+
{/* Validation Error */} {!isValid && validation.error && ( - + )}
{/* Helpful Information */} -
- - Valid range: 1 MB to 1 TB - -
+ +
+ + Valid range: 1 MB to 1 TB + +
+
); }; diff --git a/src/components/allowed-users/components/TiersConfig/TiersConfig.styles.ts b/src/components/allowed-users/components/TiersConfig/TiersConfig.styles.ts index a278f933..e8c096cb 100644 --- a/src/components/allowed-users/components/TiersConfig/TiersConfig.styles.ts +++ b/src/components/allowed-users/components/TiersConfig/TiersConfig.styles.ts @@ -18,6 +18,30 @@ export const TiersHeader = styled.div` } `; +export const TableContainer = styled.div` + border-radius: 12px; + margin: 0 2px; + padding-bottom: 1.5rem; + background-color: var(--background-color); + border: 1px solid var(--border-base-color); + .ant-table { + border-radius: 12px; + } + .ant-table-tbody { + background-color: var(--layout-sider-bg-color); + } + .ant-table-placeholder .ant-table-cell { + background-color: var(--layout-sider-bg-color); + transition: none; + } + .ant-table-placeholder .ant-table-cell:hover { + background-color: var(--layout-sider-bg-color); + } + .ant-empty-description { + color: var(--text-light-color); + } +`; + export const TiersTitle = styled.h3` margin: 0; color: var(--text-main-color); @@ -36,5 +60,5 @@ interface PriceProps { export const Price = styled.span` font-weight: 600; - color: ${({ $isFree }) => $isFree ? 'var(--success-color)' : 'var(--primary-color)'}; -`; \ No newline at end of file + color: ${({ $isFree }) => ($isFree ? 'var(--success-color)' : 'var(--primary-color)')}; +`; diff --git a/src/components/allowed-users/components/TiersConfig/TiersConfig.tsx b/src/components/allowed-users/components/TiersConfig/TiersConfig.tsx index c7a27bdf..de7c922a 100644 --- a/src/components/allowed-users/components/TiersConfig/TiersConfig.tsx +++ b/src/components/allowed-users/components/TiersConfig/TiersConfig.tsx @@ -345,13 +345,15 @@ export const TiersConfig: React.FC = ({
) : ( -
({ ...tier, key: index }))} - pagination={false} - size="small" - locale={{ emptyText: 'No tiers configured' }} - /> + +
({ ...tier, key: index }))} + pagination={false} + size="small" + locale={{ emptyText: 'No tiers configured' }} + /> + )} { - + - + - + - + {showRelayOwnerConfig && ( - + - + )} {showTiers && ( - { onSettingsChange={handleSettingsUpdate} disabled={loading || saving} /> - + )} {showNpubManagement && ( - + - + )} diff --git a/src/components/blocked-pubkeys/BlockedPubkeys.styles.ts b/src/components/blocked-pubkeys/BlockedPubkeys.styles.ts index 3a65298b..0bdb5696 100644 --- a/src/components/blocked-pubkeys/BlockedPubkeys.styles.ts +++ b/src/components/blocked-pubkeys/BlockedPubkeys.styles.ts @@ -1,6 +1,5 @@ import styled from 'styled-components'; import Card from 'antd/lib/card/Card'; -import { Table, TableProps } from 'antd'; import { Input } from 'antd'; import { BaseCol } from '../common/BaseCol/BaseCol'; export const InputRoot = styled(Input)` diff --git a/src/styles/themes/reusableComponentStyles.ts b/src/styles/themes/reusableComponentStyles.ts new file mode 100644 index 00000000..3c238fb4 --- /dev/null +++ b/src/styles/themes/reusableComponentStyles.ts @@ -0,0 +1,6 @@ +import styled from "styled-components"; +import { Input } from "antd"; + +export const StyledInput = styled(Input)` + background-color: var(--layout-sider-bg-color) !important; +`; \ No newline at end of file