@rpg-engine/long-bow 0.8.124 → 0.8.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.124",
3
+ "version": "0.8.126",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -49,7 +49,7 @@ export const FriendList: React.FC<IFriendListProps> = ({
49
49
  onBackFriendList,
50
50
  }) => {
51
51
  const [characterName, setCharacterName] = useState('');
52
- const [activeTab, setActiveTab] = useState('friends');
52
+ const [activeTab, setActiveTab] = useState(friends.length > 0 ? 'friends' : 'search');
53
53
 
54
54
  useEffect(() => {
55
55
  if (activeTab === 'search') {
@@ -79,53 +79,45 @@ export const FriendList: React.FC<IFriendListProps> = ({
79
79
  }
80
80
  };
81
81
 
82
- const friendsTabContent =
83
- friends.length > 0 ? (
84
- <ScrollableArea>
85
- <Table>
86
- <thead>
87
- <TableRow>
88
- <TableHeader>Online</TableHeader>
89
- <TableHeader>Name</TableHeader>
90
- <TableHeader>Actions</TableHeader>
82
+ const friendsTabContent = (
83
+ <ScrollableArea>
84
+ <Table>
85
+ <thead>
86
+ <TableRow>
87
+ <TableHeader>Online</TableHeader>
88
+ <TableHeader>Name</TableHeader>
89
+ <TableHeader>Actions</TableHeader>
90
+ </TableRow>
91
+ </thead>
92
+ <tbody>
93
+ {friends.map(friend => (
94
+ <TableRow key={friend._id}>
95
+ <TableCell>
96
+ <IsOnlineBadge $isOnline={friend.isOnline} />
97
+ </TableCell>
98
+ <TableCell>{friend.name}</TableCell>
99
+ <TableCell>
100
+ <ActionButtons>
101
+ <UserActionLink
102
+ color={uiColors.white}
103
+ onClick={() => onOpenPrivateMessage(friend)}
104
+ >
105
+ Chat
106
+ </UserActionLink>
107
+ <UserActionLink
108
+ color={uiColors.red}
109
+ onClick={() => onRemoveFriend(friend)}
110
+ >
111
+ Remove
112
+ </UserActionLink>
113
+ </ActionButtons>
114
+ </TableCell>
91
115
  </TableRow>
92
- </thead>
93
- <tbody>
94
- {friends.map(friend => (
95
- <TableRow key={friend._id}>
96
- <TableCell>
97
- <IsOnlineBadge $isOnline={friend.isOnline} />
98
- </TableCell>
99
- <TableCell>{friend.name}</TableCell>
100
- <TableCell>
101
- <ActionButtons>
102
- <UserActionLink
103
- color={uiColors.white}
104
- onClick={() => onOpenPrivateMessage(friend)}
105
- >
106
- Chat
107
- </UserActionLink>
108
- <UserActionLink
109
- color={uiColors.red}
110
- onClick={() => onRemoveFriend(friend)}
111
- >
112
- Remove
113
- </UserActionLink>
114
- </ActionButtons>
115
- </TableCell>
116
- </TableRow>
117
- ))}
118
- </tbody>
119
- </Table>
120
- </ScrollableArea>
121
- ) : (
122
- <EmptyStateContainer>
123
- <EmptyStateText>You don't have any friends yet</EmptyStateText>
124
- <AddFriendCTA onClick={() => setActiveTab('search')}>
125
- Add your first friend
126
- </AddFriendCTA>
127
- </EmptyStateContainer>
128
- );
116
+ ))}
117
+ </tbody>
118
+ </Table>
119
+ </ScrollableArea>
120
+ );
129
121
 
130
122
  const searchTabContent = (
131
123
  <ListContainer>
@@ -162,7 +154,9 @@ export const FriendList: React.FC<IFriendListProps> = ({
162
154
  );
163
155
 
164
156
  const tabs = [
165
- { id: 'friends', title: `Friends (${friends.length})`, content: friendsTabContent },
157
+ ...(friends.length > 0
158
+ ? [{ id: 'friends', title: `Friends (${friends.length})`, content: friendsTabContent }]
159
+ : []),
166
160
  { id: 'search', title: 'Search', content: searchTabContent },
167
161
  {
168
162
  id: 'requests',
@@ -313,34 +307,3 @@ const EmptyMessage = styled.p`
313
307
  padding: 1rem;
314
308
  font-size: ${uiFonts.size.small};
315
309
  `;
316
-
317
- const EmptyStateContainer = styled.div`
318
- display: flex;
319
- flex-direction: column;
320
- align-items: center;
321
- justify-content: center;
322
- padding: 2rem;
323
- gap: 1rem;
324
- `;
325
-
326
- const EmptyStateText = styled.p`
327
- text-align: center;
328
- color: #888;
329
- font-size: ${uiFonts.size.small};
330
- margin: 0;
331
- `;
332
-
333
- const AddFriendCTA = styled.button`
334
- background-color: ${uiColors.lightGreen};
335
- color: #000;
336
- border: none;
337
- padding: 0.5rem 1rem;
338
- font-size: ${uiFonts.size.small};
339
- cursor: pointer;
340
- border-radius: 4px;
341
- transition: opacity 0.2s;
342
-
343
- &:hover {
344
- opacity: 0.8;
345
- }
346
- `;