Skip to content

Commit 348b5ee

Browse files
committed
Implement backend API migration for public and only-me modes
- Update API endpoints to match new unified backend structure - Add relay owner management API endpoints for only-me mode - Implement nip19 encoding/decoding for proper NPUB format handling - Update types to support new mode structure and permissions - Replace old read/write NPUB management with unified user system - Add proper validation and error handling for mode transitions
1 parent 605d358 commit 348b5ee

14 files changed

Lines changed: 1000 additions & 991 deletions

File tree

src/api/allowedUsers.api.ts

Lines changed: 162 additions & 118 deletions
Large diffs are not rendered by default.

src/components/allowed-users/components/ModeSelector/ModeSelector.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ interface ModeSelectorProps {
1010
}
1111

1212
const MODE_INFO = {
13-
personal: {
13+
'only-me': {
1414
label: 'Only Me',
1515
subtitle: '[Free]',
1616
description: 'Personal relay for single user with unlimited access',
1717
color: '#fa541c'
1818
},
19-
exclusive: {
19+
'invite-only': {
2020
label: 'Invite Only',
2121
subtitle: '[Free]',
2222
description: 'Invite-only access with manual NPUB management',
2323
color: '#722ed1'
2424
},
25-
free: {
25+
'public': {
2626
label: 'Public Relay',
2727
subtitle: '[Free]',
2828
description: 'Open access with optional free tiers',
2929
color: '#1890ff'
3030
},
31-
paid: {
31+
'subscription': {
3232
label: 'Subscription',
3333
subtitle: '[Paid]',
3434
description: 'Subscription-based access control',
@@ -44,7 +44,7 @@ export const ModeSelector: React.FC<ModeSelectorProps> = ({
4444
return (
4545
<S.Container>
4646
<S.ModeGrid>
47-
{(['personal', 'exclusive', 'free', 'paid'] as AllowedUsersMode[]).map((mode) => {
47+
{(['only-me', 'invite-only', 'public', 'subscription'] as AllowedUsersMode[]).map((mode) => {
4848
const info = MODE_INFO[mode];
4949
const isActive = currentMode === mode;
5050

@@ -76,9 +76,9 @@ export const ModeSelector: React.FC<ModeSelectorProps> = ({
7676

7777
<S.ModeDescription>
7878
<S.DescriptionText>
79-
<strong>{MODE_INFO[currentMode].label}:</strong> {MODE_INFO[currentMode].description}
79+
<strong>{MODE_INFO[currentMode]?.label || 'Unknown Mode'}:</strong> {MODE_INFO[currentMode]?.description || 'No description available'}
8080
</S.DescriptionText>
8181
</S.ModeDescription>
8282
</S.Container>
8383
);
84-
};
84+
};

0 commit comments

Comments
 (0)