@rpg-engine/long-bow 0.6.76 → 0.6.77
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/index.d.ts +2 -2
- package/dist/long-bow.cjs.development.js +69 -211
- 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 +69 -211
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/QuestInfo.stories.d.ts +1 -1
- package/dist/stories/QuestList.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/{QuestInfo → Quests/QuestInfo}/QuestInfo.tsx +8 -8
- package/src/components/{QuestList.tsx → Quests/QuestList.tsx} +89 -89
- package/src/index.tsx +2 -2
- package/src/stories/QuestInfo.stories.tsx +1 -1
- package/src/stories/QuestList.stories.tsx +1 -1
- /package/dist/components/{QuestInfo → Quests/QuestInfo}/QuestInfo.d.ts +0 -0
- /package/dist/components/{QuestList.d.ts → Quests/QuestList.d.ts} +0 -0
- /package/src/components/{QuestInfo → Quests/QuestInfo}/img/default.png +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react';
|
|
2
|
-
import { IQuestInfoProps } from '
|
|
2
|
+
import { IQuestInfoProps } from '../components/Quests/QuestInfo/QuestInfo';
|
|
3
3
|
declare const meta: Meta;
|
|
4
4
|
export default meta;
|
|
5
5
|
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IQuestInfoProps>;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { IQuest } from '@rpg-engine/shared';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { uiColors } from '
|
|
5
|
-
import { uiFonts } from '
|
|
6
|
-
import SelectArrow from '
|
|
7
|
-
import { Button, ButtonTypes } from '
|
|
8
|
-
import { DraggableContainer } from '
|
|
9
|
-
|
|
10
|
-
import { RPGUIContainerTypes } from '
|
|
11
|
-
import { Column } from '
|
|
4
|
+
import { uiColors } from '../../../constants/uiColors';
|
|
5
|
+
import { uiFonts } from '../../../constants/uiFonts';
|
|
6
|
+
import SelectArrow from '../../Arrow/SelectArrow';
|
|
7
|
+
import { Button, ButtonTypes } from '../../Button';
|
|
8
|
+
import { DraggableContainer } from '../../DraggableContainer';
|
|
9
|
+
|
|
10
|
+
import { RPGUIContainerTypes } from '../../RPGUI/RPGUIContainer';
|
|
11
|
+
import { Column } from '../../shared/Column';
|
|
12
12
|
import thumbnailDefault from './img/default.png';
|
|
13
13
|
|
|
14
14
|
export interface IQuestsButtonProps {
|
|
@@ -6,10 +6,7 @@ import {
|
|
|
6
6
|
} from '@rpg-engine/shared';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
import { uiColors } from '
|
|
10
|
-
import { Table, TableCell, TableHeader, TableRow } from './Table/Table';
|
|
11
|
-
import { Ellipsis } from './shared/Ellipsis';
|
|
12
|
-
import { SimpleTooltip } from './shared/SimpleTooltip';
|
|
9
|
+
import { uiColors } from '../../constants/uiColors';
|
|
13
10
|
|
|
14
11
|
export interface IQuestListProps {
|
|
15
12
|
quests?: IQuest[];
|
|
@@ -19,66 +16,32 @@ export const QuestList: React.FC<IQuestListProps> = ({ quests }) => {
|
|
|
19
16
|
return (
|
|
20
17
|
<QuestListContainer>
|
|
21
18
|
{quests && quests.length > 0 ? (
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</TableCell>
|
|
49
|
-
<TableCell>
|
|
50
|
-
<SimpleTooltip
|
|
51
|
-
content={quest.description}
|
|
52
|
-
direction="bottom"
|
|
53
|
-
>
|
|
54
|
-
<Ellipsis maxWidth="300px">{quest.description}</Ellipsis>
|
|
55
|
-
</SimpleTooltip>
|
|
56
|
-
</TableCell>
|
|
57
|
-
<TableCell>
|
|
58
|
-
<SimpleTooltip
|
|
59
|
-
content={formatObjectives(quest.objectives)}
|
|
60
|
-
direction="bottom"
|
|
61
|
-
>
|
|
62
|
-
<Ellipsis maxWidth="300px">
|
|
63
|
-
{formatObjectives(quest.objectives)}
|
|
64
|
-
</Ellipsis>
|
|
65
|
-
</SimpleTooltip>
|
|
66
|
-
</TableCell>
|
|
67
|
-
<TableCell>
|
|
68
|
-
<SimpleTooltip
|
|
69
|
-
content={formatRewards(quest.rewards)}
|
|
70
|
-
direction="bottom"
|
|
71
|
-
>
|
|
72
|
-
<Ellipsis maxWidth="200px">
|
|
73
|
-
{formatRewards(quest.rewards)}
|
|
74
|
-
</Ellipsis>
|
|
75
|
-
</SimpleTooltip>
|
|
76
|
-
</TableCell>
|
|
77
|
-
</TableRow>
|
|
78
|
-
))}
|
|
79
|
-
</tbody>
|
|
80
|
-
</Table>
|
|
81
|
-
</>
|
|
19
|
+
quests.map((quest, i) => (
|
|
20
|
+
<QuestCard key={i}>
|
|
21
|
+
<QuestItem>
|
|
22
|
+
<Label>Title:</Label>
|
|
23
|
+
<Value>{formatText(quest.title)}</Value>
|
|
24
|
+
</QuestItem>
|
|
25
|
+
<QuestItem>
|
|
26
|
+
<Label>Status:</Label>
|
|
27
|
+
<Value style={{ color: getStatusColor(quest.status) }}>
|
|
28
|
+
{formatStatus(quest.status) ?? 'Unknown'}
|
|
29
|
+
</Value>
|
|
30
|
+
</QuestItem>
|
|
31
|
+
<QuestItem>
|
|
32
|
+
<Label>Description:</Label>
|
|
33
|
+
<Value>{quest.description}</Value>
|
|
34
|
+
</QuestItem>
|
|
35
|
+
<QuestItem>
|
|
36
|
+
<Label>Objectives:</Label>
|
|
37
|
+
<Value>{formatObjectives(quest.objectives)}</Value>
|
|
38
|
+
</QuestItem>
|
|
39
|
+
<QuestItem>
|
|
40
|
+
<Label>Rewards:</Label>
|
|
41
|
+
<Value>{formatRewards(quest.rewards)}</Value>
|
|
42
|
+
</QuestItem>
|
|
43
|
+
</QuestCard>
|
|
44
|
+
))
|
|
82
45
|
) : (
|
|
83
46
|
<NoQuestContainer>
|
|
84
47
|
<p>There are no ongoing quests</p>
|
|
@@ -88,7 +51,56 @@ export const QuestList: React.FC<IQuestListProps> = ({ quests }) => {
|
|
|
88
51
|
);
|
|
89
52
|
};
|
|
90
53
|
|
|
91
|
-
|
|
54
|
+
const QuestListContainer = styled.div`
|
|
55
|
+
margin-top: 20px;
|
|
56
|
+
margin-bottom: 40px;
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
max-height: 400px;
|
|
59
|
+
padding: 10px;
|
|
60
|
+
border-radius: 10px;
|
|
61
|
+
font-size: 0.7rem;
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
const QuestCard = styled.div`
|
|
65
|
+
background-color: ${uiColors.darkGray};
|
|
66
|
+
padding: 15px;
|
|
67
|
+
margin-bottom: 10px;
|
|
68
|
+
border-radius: 10px;
|
|
69
|
+
border: 1px solid ${uiColors.gray};
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const QuestItem = styled.div`
|
|
75
|
+
display: flex;
|
|
76
|
+
margin-bottom: 5px;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
|
|
79
|
+
&:last-child {
|
|
80
|
+
margin-bottom: 0;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
const Label = styled.span`
|
|
85
|
+
font-weight: bold;
|
|
86
|
+
color: ${uiColors.yellow} !important;
|
|
87
|
+
margin-right: 10px;
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const Value = styled.span`
|
|
91
|
+
flex-grow: 1;
|
|
92
|
+
color: ${uiColors.white};
|
|
93
|
+
word-wrap: break-word;
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
const NoQuestContainer = styled.div`
|
|
97
|
+
text-align: center;
|
|
98
|
+
p {
|
|
99
|
+
margin-top: 5px;
|
|
100
|
+
color: ${uiColors.lightGray};
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
|
|
92
104
|
const formatObjectives = (
|
|
93
105
|
objectives: (IQuestObjectiveKill | IQuestObjectiveInteraction)[]
|
|
94
106
|
) => {
|
|
@@ -118,7 +130,6 @@ const formatObjectives = (
|
|
|
118
130
|
}
|
|
119
131
|
};
|
|
120
132
|
|
|
121
|
-
// Updated helper function to format rewards
|
|
122
133
|
const formatRewards = (rewards: IQuest['rewards']) => {
|
|
123
134
|
try {
|
|
124
135
|
if (!rewards || !Array.isArray(rewards)) return 'No rewards';
|
|
@@ -162,6 +173,7 @@ const formatRewards = (rewards: IQuest['rewards']) => {
|
|
|
162
173
|
};
|
|
163
174
|
|
|
164
175
|
const formatText = (text: string) => {
|
|
176
|
+
if (!text) return 'Unknown';
|
|
165
177
|
return text
|
|
166
178
|
.split('-')
|
|
167
179
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
@@ -171,32 +183,20 @@ const formatText = (text: string) => {
|
|
|
171
183
|
const getStatusColor = (status?: QuestStatus) => {
|
|
172
184
|
switch (status) {
|
|
173
185
|
case QuestStatus.Pending:
|
|
174
|
-
return uiColors.orange;
|
|
186
|
+
return uiColors.orange;
|
|
175
187
|
case QuestStatus.InProgress:
|
|
176
|
-
return uiColors.blue;
|
|
188
|
+
return uiColors.blue;
|
|
177
189
|
case QuestStatus.Completed:
|
|
178
|
-
return uiColors.lightGreen;
|
|
190
|
+
return uiColors.lightGreen;
|
|
179
191
|
default:
|
|
180
|
-
return uiColors.white;
|
|
192
|
+
return uiColors.white;
|
|
181
193
|
}
|
|
182
194
|
};
|
|
183
195
|
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
border-radius: 10px;
|
|
192
|
-
border: 1px solid ${uiColors.gray};
|
|
193
|
-
font-size: 0.7rem;
|
|
194
|
-
`;
|
|
195
|
-
|
|
196
|
-
const NoQuestContainer = styled.div`
|
|
197
|
-
text-align: center;
|
|
198
|
-
p {
|
|
199
|
-
margin-top: 5px;
|
|
200
|
-
color: ${uiColors.lightGray};
|
|
201
|
-
}
|
|
202
|
-
`;
|
|
196
|
+
const formatStatus = (status?: QuestStatus) => {
|
|
197
|
+
if (!status) return 'Unknown';
|
|
198
|
+
return status
|
|
199
|
+
.split(/(?=[A-Z])/)
|
|
200
|
+
.join(' ')
|
|
201
|
+
.replace(/^\w/, c => c.toUpperCase());
|
|
202
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -33,8 +33,8 @@ export * from './components/NPCDialog/QuestionDialog/QuestionDialog';
|
|
|
33
33
|
export * from './components/PartySystem';
|
|
34
34
|
export * from './components/ProgressBar';
|
|
35
35
|
export * from './components/PropertySelect/PropertySelect';
|
|
36
|
-
export * from './components/QuestInfo/QuestInfo';
|
|
37
|
-
export * from './components/QuestList';
|
|
36
|
+
export * from './components/Quests/QuestInfo/QuestInfo';
|
|
37
|
+
export * from './components/Quests/QuestList';
|
|
38
38
|
export * from './components/RadioButton';
|
|
39
39
|
export * from './components/RangeSlider';
|
|
40
40
|
export * from './components/RPGUI/RPGUIContainer';
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import {
|
|
5
5
|
IQuestInfoProps,
|
|
6
6
|
QuestInfo,
|
|
7
|
-
} from '
|
|
7
|
+
} from '../components/Quests/QuestInfo/QuestInfo';
|
|
8
8
|
import { RPGUIRoot } from '../components/RPGUI/RPGUIRoot';
|
|
9
9
|
const meta: Meta = {
|
|
10
10
|
title: 'Quest Info',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QuestStatus, QuestType } from '@rpg-engine/shared';
|
|
2
2
|
import { Story } from '@storybook/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { IQuestListProps, QuestList } from '../components/QuestList';
|
|
4
|
+
import { IQuestListProps, QuestList } from '../components/Quests/QuestList';
|
|
5
5
|
import { RPGUIRoot } from '../components/RPGUI/RPGUIRoot';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|