@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/dist/components/Friends/FriendList.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +87 -85
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +83 -86
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Friends/FriendList.tsx +86 -94
- package/src/components/PartySystem/PartyManager/PartyManager.tsx +0 -17
- package/src/components/Table/Table.tsx +33 -0
- package/src/index.tsx +2 -0
package/package.json
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
<
|
|
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
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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(
|
|
105
|
+
onClick={() => setIsAddFriendUI(prev => !prev)}
|
|
100
106
|
>
|
|
101
107
|
{isAddFriendUI ? 'Back' : 'Add New Friend'}
|
|
102
108
|
</Button>
|
|
103
109
|
</ButtonContainer>
|
|
104
|
-
</
|
|
110
|
+
</ListWrapper>
|
|
105
111
|
);
|
|
106
112
|
};
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
margin:
|
|
111
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
border-radius: 4px;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
`;
|
|
136
121
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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';
|