@rpg-engine/long-bow 0.6.65 → 0.6.68

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.6.65",
3
+ "version": "0.6.68",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,15 +1,18 @@
1
- import { ICharacter } from '@rpg-engine/shared';
2
1
  import React, { useState } from 'react';
3
2
  import styled from 'styled-components';
4
3
  import { uiColors } from '../../constants/uiColors';
5
- import { uiFonts } from '../../constants/uiFonts';
6
4
  import { Button, ButtonTypes } from '../Button';
7
- import { DraggableContainer } from '../DraggableContainer';
8
- import { RPGUIContainerTypes } from '../RPGUI/RPGUIContainer';
9
- import { SearchFriend } from './SearchFriend';
10
5
 
6
+ import { ICharacter } from '@rpg-engine/shared';
7
+ import {
8
+ ActionButtons,
9
+ Table,
10
+ TableCell,
11
+ TableHeader,
12
+ TableRow,
13
+ } from '../Table/Table';
14
+ import { SearchFriend } from './SearchFriend';
11
15
  export type IFriend = Pick<ICharacter, 'name' | '_id' | 'isOnline'>;
12
-
13
16
  interface IFriendListProps {
14
17
  scale?: number;
15
18
  friends: IFriend[];
@@ -26,33 +29,23 @@ interface IFriendListProps {
26
29
  onRejectRequest: (character: IFriend) => void;
27
30
  }
28
31
 
29
- export const FriendList = (props: IFriendListProps) => {
32
+ export const FriendList: React.FC<IFriendListProps> = ({
33
+ friends,
34
+ friendRequests,
35
+ searchedCharacters,
36
+ onFocus,
37
+ onBlur,
38
+ onSearch,
39
+ onAcceptRequest,
40
+ onSendFriendRequest,
41
+ onRemoveFriend,
42
+ onOpenPrivateMessage,
43
+ onRejectRequest,
44
+ }) => {
30
45
  const [isAddFriendUI, setIsAddFriendUI] = useState(false);
31
- const {
32
- scale,
33
- friends,
34
- friendRequests,
35
- searchedCharacters,
36
- onBlur,
37
- onFocus,
38
- onClose,
39
- onSearch,
40
- onAcceptRequest,
41
- onSendFriendRequest,
42
- onRemoveFriend,
43
- onOpenPrivateMessage,
44
- onRejectRequest,
45
- } = props;
46
+
46
47
  return (
47
- <DraggableContainer
48
- type={RPGUIContainerTypes.Framed}
49
- onCloseButton={() => {
50
- if (onClose) onClose();
51
- }}
52
- width="800px"
53
- cancelDrag="#FriendListContainer, .rpgui-dropdown-imp, input, .empty-slot, button"
54
- scale={scale}
55
- >
48
+ <ListWrapper>
56
49
  {isAddFriendUI ? (
57
50
  <SearchFriend
58
51
  searchedCharacters={searchedCharacters}
@@ -65,79 +58,70 @@ export const FriendList = (props: IFriendListProps) => {
65
58
  onFocus={onFocus}
66
59
  />
67
60
  ) : (
68
- <ListContainer>
69
- <FriendsTitle>Friends</FriendsTitle>
70
- {friends.map(friend => (
71
- <ListElement key={friend._id}>
72
- <div>
73
- <IsOnlineBadge $isOnline={friend.isOnline} />
74
- {friend.name}
75
- </div>
76
-
77
- <MessageAndDeleteContainer>
78
- <Button
79
- buttonType={ButtonTypes.RPGUIButton}
80
- onPointerDown={() => onOpenPrivateMessage(friend)}
81
- >
82
- Message
83
- </Button>
84
- <Button
85
- buttonType={ButtonTypes.RPGUIButton}
86
- onPointerDown={() => onRemoveFriend(friend)}
87
- >
88
- Remove
89
- </Button>
90
- </MessageAndDeleteContainer>
91
- </ListElement>
92
- ))}
93
- </ListContainer>
61
+ <>
62
+ <ScrollableArea>
63
+ <Table>
64
+ <thead>
65
+ <TableRow>
66
+ <TableHeader>Online</TableHeader>
67
+ <TableHeader>Name</TableHeader>
68
+ <TableHeader>Actions</TableHeader>
69
+ </TableRow>
70
+ </thead>
71
+ <tbody>
72
+ {friends.map(friend => (
73
+ <TableRow key={friend._id}>
74
+ <TableCell>
75
+ <IsOnlineBadge $isOnline={friend.isOnline} />
76
+ </TableCell>
77
+ <TableCell>{friend.name}</TableCell>
78
+ <TableCell>
79
+ <ActionButtons>
80
+ <UserAction
81
+ color={uiColors.yellow}
82
+ onClick={() => onOpenPrivateMessage(friend)}
83
+ >
84
+ Chat
85
+ </UserAction>
86
+ <UserAction
87
+ color={uiColors.red}
88
+ onClick={() => onRemoveFriend(friend)}
89
+ >
90
+ Remove
91
+ </UserAction>
92
+ </ActionButtons>
93
+ </TableCell>
94
+ </TableRow>
95
+ ))}
96
+ </tbody>
97
+ </Table>
98
+ </ScrollableArea>
99
+ </>
94
100
  )}
95
101
 
96
102
  <ButtonContainer>
97
103
  <Button
98
104
  buttonType={ButtonTypes.RPGUIButton}
99
- onClick={() => setIsAddFriendUI(t => !t)}
105
+ onClick={() => setIsAddFriendUI(prev => !prev)}
100
106
  >
101
107
  {isAddFriendUI ? 'Back' : 'Add New Friend'}
102
108
  </Button>
103
109
  </ButtonContainer>
104
- </DraggableContainer>
110
+ </ListWrapper>
105
111
  );
106
112
  };
107
113
 
108
- const FriendsTitle = styled.h2`
109
- font-size: ${uiFonts.size.medium};
110
- margin: 0;
111
- padding: 0;
112
- text-align: center;
113
- `;
114
-
115
- const ListContainer = styled.ul`
116
- border: none;
117
- overflow-y: scroll;
118
- list-style: none;
119
- padding: 0;
120
- width: 100%;
121
- height: 50vh;
122
-
123
- @media (max-width: 768px) {
124
- max-height: 90wh;
125
- }
126
- `;
127
-
128
- const ListElement = styled.li`
129
- margin: 0.5rem 0 !important;
130
- font-size: ${uiFonts.size.small};
131
- padding: 0.5rem 4px;
114
+ // Styled components for FriendList UI
115
+ const ListWrapper = styled.div`
116
+ margin-top: 1rem;
117
+ max-height: 350px;
132
118
  display: flex;
133
- align-items: center;
134
- justify-content: space-between;
135
- border-radius: 4px;
119
+ flex-direction: column;
120
+ `;
136
121
 
137
- & div {
138
- display: flex;
139
- align-items: center;
140
- }
122
+ const ScrollableArea = styled.div`
123
+ overflow-y: auto;
124
+ max-height: 300px; /* Adjust this value based on your layout */
141
125
  `;
142
126
 
143
127
  const IsOnlineBadge = styled.div<{ $isOnline: boolean }>`
@@ -157,8 +141,16 @@ const ButtonContainer = styled.div`
157
141
  margin-top: 1rem;
158
142
  `;
159
143
 
160
- const MessageAndDeleteContainer = styled.div`
161
- display: flex;
162
- justify-content: space-between;
163
- gap: 0.5rem;
144
+ interface IUserActionProps {
145
+ color: string;
146
+ }
147
+
148
+ const UserAction = styled.span<IUserActionProps>`
149
+ color: ${({ color }) => color} !important;
150
+ cursor: pointer;
151
+ margin-right: 0.5rem;
152
+
153
+ &:hover {
154
+ text-decoration: underline;
155
+ }
164
156
  `;
@@ -33,12 +33,6 @@ export const PartyManager: React.FC<IPartyManagerProps> = ({
33
33
 
34
34
  return (
35
35
  <>
36
- <Wrapper>
37
- <div style={{ width: '100%' }}>
38
- <Title>Party Dashboard</Title>
39
- <hr className="golden" />
40
- </div>
41
- </Wrapper>
42
36
  <RowsWrapper className="partyRows">
43
37
  {partyRows && sortedMembers.length ? (
44
38
  sortedMembers.map(partyRow => (
@@ -79,17 +73,6 @@ const YellowText = styled.span`
79
73
  color: ${uiColors.yellow} !important;
80
74
  `;
81
75
 
82
- const Wrapper = styled.div`
83
- display: flex;
84
- flex-direction: column;
85
- width: 100%;
86
- `;
87
-
88
- const Title = styled.h1`
89
- font-size: 0.6rem;
90
- color: ${uiColors.yellow} !important;
91
- `;
92
-
93
76
  const NotInParty = styled.h1`
94
77
  font-size: 0.6rem;
95
78
  margin: auto;
@@ -0,0 +1,33 @@
1
+ import styled from 'styled-components';
2
+ import { uiColors } from '../../constants/uiColors';
3
+
4
+ export const Table = styled.table`
5
+ width: 100%;
6
+ border-collapse: collapse;
7
+ margin-top: 1rem;
8
+ `;
9
+
10
+ export const TableRow = styled.tr`
11
+ &:nth-child(even) {
12
+ background-color: rgba(255, 255, 255, 0.05) !important;
13
+ }
14
+ `;
15
+
16
+ export const TableHeader = styled.th`
17
+ text-align: left;
18
+ padding: 0.5rem;
19
+ color: ${uiColors.yellow} !important;
20
+ border-bottom: 1px solid ${uiColors.lightGray};
21
+ `;
22
+
23
+ export const TableCell = styled.td`
24
+ padding: 0.5rem;
25
+ color: ${uiColors.white};
26
+ border-bottom: 1px solid ${uiColors.lightGray};
27
+ `;
28
+
29
+ export const ActionButtons = styled.div`
30
+ display: flex;
31
+ gap: 10px;
32
+ align-items: center;
33
+ `;
package/src/index.tsx CHANGED
@@ -53,4 +53,6 @@ export * from './components/Truncate';
53
53
  export * from './components/Tutorial/TutorialStepper';
54
54
  export * from './components/typography/DynamicText';
55
55
 
56
+ export * from './components/Table/Table';
57
+
56
58
  export { useEventListener } from './hooks/useEventListener';