@rpg-engine/long-bow 0.6.19 → 0.6.21
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/PartySystem/PartyManager/PartyManager.d.ts +1 -1
- package/dist/components/PartySystem/PartyManager/PartyManagerRows.d.ts +1 -0
- package/dist/components/Text/HighlightedText.d.ts +6 -0
- package/dist/long-bow.cjs.development.js +70 -25
- 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 +70 -25
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/PartySystem/PartyManager/PartyManager.tsx +21 -25
- package/src/components/PartySystem/PartyManager/PartyManagerRows.tsx +54 -21
- package/src/components/PartySystem/mockedConstantes/mockedValues.tsx +7 -0
- package/src/components/Text/HighlightedText.tsx +25 -0
package/package.json
CHANGED
|
@@ -2,14 +2,12 @@ import { ICharacterPartyShared, isMobileOrTablet } from '@rpg-engine/shared';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { uiColors } from '../../../constants/uiColors';
|
|
5
|
-
import { DraggableContainer } from '../../DraggableContainer';
|
|
6
|
-
import { RPGUIContainerTypes } from '../../RPGUI/RPGUIContainer';
|
|
7
5
|
import { PartyManagerRow } from './PartyManagerRows';
|
|
8
6
|
|
|
9
7
|
export interface IPartyManagerProps {
|
|
10
8
|
partyRows: ICharacterPartyShared | null;
|
|
11
9
|
isLeader: boolean;
|
|
12
|
-
|
|
10
|
+
userId: string;
|
|
13
11
|
onRemovePlayer: (id: string) => void;
|
|
14
12
|
onChangeLeader: (id: string) => void;
|
|
15
13
|
}
|
|
@@ -17,20 +15,14 @@ export interface IPartyManagerProps {
|
|
|
17
15
|
export const PartyManager: React.FC<IPartyManagerProps> = ({
|
|
18
16
|
partyRows,
|
|
19
17
|
isLeader,
|
|
20
|
-
|
|
18
|
+
userId,
|
|
21
19
|
onRemovePlayer,
|
|
22
20
|
onChangeLeader,
|
|
23
21
|
}) => {
|
|
24
22
|
const invitationActionText = isMobileOrTablet() ? 'Tap' : 'Right click';
|
|
25
23
|
|
|
26
24
|
return (
|
|
27
|
-
|
|
28
|
-
type={RPGUIContainerTypes.Framed}
|
|
29
|
-
onCloseButton={onClose}
|
|
30
|
-
width="800px"
|
|
31
|
-
height="400px"
|
|
32
|
-
cancelDrag=".partyRows"
|
|
33
|
-
>
|
|
25
|
+
<>
|
|
34
26
|
<Wrapper>
|
|
35
27
|
<div style={{ width: '100%' }}>
|
|
36
28
|
<Title>Party Dashboard</Title>
|
|
@@ -41,6 +33,7 @@ export const PartyManager: React.FC<IPartyManagerProps> = ({
|
|
|
41
33
|
{partyRows && partyRows.members ? (
|
|
42
34
|
<>
|
|
43
35
|
<PartyManagerRow
|
|
36
|
+
userId={userId}
|
|
44
37
|
key={partyRows.leader._id}
|
|
45
38
|
id={partyRows.leader._id}
|
|
46
39
|
leaderId={partyRows.leader._id}
|
|
@@ -52,6 +45,7 @@ export const PartyManager: React.FC<IPartyManagerProps> = ({
|
|
|
52
45
|
/>
|
|
53
46
|
{partyRows.members.map(partyRow => (
|
|
54
47
|
<PartyManagerRow
|
|
48
|
+
userId={userId}
|
|
55
49
|
key={partyRow._id}
|
|
56
50
|
charName={partyRow.name}
|
|
57
51
|
charClass={partyRow.class}
|
|
@@ -64,20 +58,26 @@ export const PartyManager: React.FC<IPartyManagerProps> = ({
|
|
|
64
58
|
))}
|
|
65
59
|
</>
|
|
66
60
|
) : (
|
|
67
|
-
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</NotInParty>
|
|
75
|
-
</>
|
|
61
|
+
<NotInParty>
|
|
62
|
+
<p>You're not in a party.</p>
|
|
63
|
+
<p>
|
|
64
|
+
Tip: <YellowText>{invitationActionText}</YellowText> on a player
|
|
65
|
+
to invite them.
|
|
66
|
+
</p>
|
|
67
|
+
</NotInParty>
|
|
76
68
|
)}
|
|
77
69
|
</RowsWrapper>
|
|
78
|
-
|
|
70
|
+
</>
|
|
79
71
|
);
|
|
80
72
|
};
|
|
73
|
+
|
|
74
|
+
const RowsWrapper = styled.div`
|
|
75
|
+
width: 100%;
|
|
76
|
+
max-height: 300px;
|
|
77
|
+
overflow-y: auto;
|
|
78
|
+
overflow-x: hidden;
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
81
|
const YellowText = styled.span`
|
|
82
82
|
color: ${uiColors.yellow} !important;
|
|
83
83
|
`;
|
|
@@ -88,10 +88,6 @@ const Wrapper = styled.div`
|
|
|
88
88
|
width: 100%;
|
|
89
89
|
`;
|
|
90
90
|
|
|
91
|
-
const RowsWrapper = styled.div`
|
|
92
|
-
width: 100%;
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
91
|
const Title = styled.h1`
|
|
96
92
|
font-size: 0.6rem;
|
|
97
93
|
color: ${uiColors.yellow} !important;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { uiColors } from '../../../constants/uiColors';
|
|
4
|
-
import {
|
|
4
|
+
import { HighlightedText } from '../../Text/HighlightedText';
|
|
5
|
+
import { Ellipsis } from '../../shared/Ellipsis';
|
|
5
6
|
|
|
6
7
|
export interface IPartyManagerRowProps {
|
|
7
8
|
id: string;
|
|
@@ -9,6 +10,7 @@ export interface IPartyManagerRowProps {
|
|
|
9
10
|
charClass: string;
|
|
10
11
|
isLeader: boolean;
|
|
11
12
|
leaderId: string;
|
|
13
|
+
userId: string;
|
|
12
14
|
onRemovePlayer: (id: string) => void;
|
|
13
15
|
onChangeLeader: (id: string) => void;
|
|
14
16
|
}
|
|
@@ -19,28 +21,38 @@ export const PartyManagerRow: React.FC<IPartyManagerRowProps> = ({
|
|
|
19
21
|
isLeader,
|
|
20
22
|
id,
|
|
21
23
|
leaderId,
|
|
24
|
+
userId,
|
|
22
25
|
onRemovePlayer,
|
|
23
26
|
onChangeLeader,
|
|
24
27
|
}) => {
|
|
28
|
+
const isCurrentUser = id === userId;
|
|
29
|
+
const canRemove = isLeader || isCurrentUser; // Only leaders or the current user can remove
|
|
30
|
+
|
|
25
31
|
return (
|
|
26
32
|
<PartyWrapper>
|
|
27
|
-
<TextContainer>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
>
|
|
34
|
-
|
|
35
|
-
</
|
|
36
|
-
</
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
<TextContainer>
|
|
34
|
+
<Ellipsis maxLines={1} maxWidth="200px" fontSize="0.8rem">
|
|
35
|
+
{charName}
|
|
36
|
+
</Ellipsis>
|
|
37
|
+
</TextContainer>
|
|
38
|
+
<TextContainer>
|
|
39
|
+
<Ellipsis maxLines={1} maxWidth="200px" fontSize="0.8rem">
|
|
40
|
+
{charClass}
|
|
41
|
+
</Ellipsis>
|
|
42
|
+
</TextContainer>
|
|
43
|
+
<ButtonContainer>
|
|
44
|
+
{canRemove && (
|
|
45
|
+
<HighlightedText onPointerDown={() => onRemovePlayer(id)}>
|
|
46
|
+
{isCurrentUser ? 'Leave' : 'Remove'}
|
|
47
|
+
</HighlightedText>
|
|
48
|
+
)}
|
|
49
|
+
{/* Render the "New Leader" button only if the user is the leader and not the current user */}
|
|
50
|
+
{isLeader && leaderId !== id && (
|
|
51
|
+
<HighlightedText onPointerDown={() => onChangeLeader(id)}>
|
|
52
|
+
New Leader
|
|
53
|
+
</HighlightedText>
|
|
54
|
+
)}
|
|
55
|
+
</ButtonContainer>
|
|
44
56
|
</PartyWrapper>
|
|
45
57
|
);
|
|
46
58
|
};
|
|
@@ -49,12 +61,33 @@ const PartyWrapper = styled.div`
|
|
|
49
61
|
width: 100%;
|
|
50
62
|
display: flex;
|
|
51
63
|
align-items: center;
|
|
52
|
-
justify-content: space-
|
|
53
|
-
.
|
|
54
|
-
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
padding: 0.5rem;
|
|
66
|
+
min-height: 50px;
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
gap: 1rem;
|
|
69
|
+
transition: background-color 0.3s ease; // Smooth transition for background color
|
|
70
|
+
|
|
71
|
+
overflow-x: auto;
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
background-color: ${uiColors.darkGray}; // Darker overlay color on hover
|
|
75
|
+
cursor: pointer; // Change cursor to pointer for better UX feedback
|
|
55
76
|
}
|
|
56
77
|
`;
|
|
57
78
|
|
|
58
79
|
const TextContainer = styled.div`
|
|
80
|
+
flex: 1;
|
|
59
81
|
color: ${uiColors.white};
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
text-overflow: ellipsis;
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
const ButtonContainer = styled.div`
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
min-width: 150px;
|
|
92
|
+
gap: 0.5rem;
|
|
60
93
|
`;
|
|
@@ -90,6 +90,13 @@ export const mockedPlayersRows2: ICharacterPartyShared = {
|
|
|
90
90
|
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
91
91
|
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
92
92
|
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
93
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
94
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
95
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
96
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
97
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
98
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
99
|
+
{ _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
|
|
93
100
|
],
|
|
94
101
|
maxSize: 5,
|
|
95
102
|
size: 4,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { uiColors } from '../../constants/uiColors';
|
|
4
|
+
|
|
5
|
+
interface IProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
6
|
+
children: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const HighlightedText = ({ children, ...rest }: IProps) => {
|
|
10
|
+
return <Text {...rest}>{children}</Text>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Text = styled.p`
|
|
14
|
+
color: ${uiColors.yellow} !important;
|
|
15
|
+
|
|
16
|
+
font-weight: bold;
|
|
17
|
+
font-size: 1.2rem;
|
|
18
|
+
|
|
19
|
+
// show the cursor as a pointer when hovering over the text
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
text-decoration: underline;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
`;
|