@rpg-engine/long-bow 0.6.76 → 0.6.78

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.
@@ -1,5 +1,5 @@
1
1
  import { Meta } from '@storybook/react';
2
- import { IQuestInfoProps } from '../../src/components/QuestInfo/QuestInfo';
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>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IQuestListProps } from '../components/QuestList';
2
+ import { IQuestListProps } from '../components/Quests/QuestList';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: React.FC<IQuestListProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.6.76",
3
+ "version": "0.6.78",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,6 +10,8 @@ export interface IDraggableContainerProps {
10
10
  children: React.ReactNode;
11
11
  width?: string;
12
12
  height?: string;
13
+ minWidth?: string;
14
+ minHeight?: string;
13
15
  className?: string;
14
16
  type?: RPGUIContainerTypes;
15
17
  title?: string;
@@ -32,6 +34,8 @@ export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
32
34
  children,
33
35
  width = '50%',
34
36
  height,
37
+ minHeight,
38
+ minWidth,
35
39
  className,
36
40
  type = RPGUIContainerTypes.FramedGold,
37
41
  onCloseButton,
@@ -109,6 +113,8 @@ export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
109
113
  ref={draggableRef}
110
114
  width={width}
111
115
  height={height || 'auto'}
116
+ minWidth={minWidth}
117
+ minHeight={minHeight}
112
118
  className={`rpgui-container ${type} ${className}`}
113
119
  isFullScreen={isFullScreen}
114
120
  opacity={opacity}
@@ -139,6 +145,8 @@ export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
139
145
  interface IContainerProps {
140
146
  width: string;
141
147
  height: string;
148
+ minWidth?: string;
149
+ minHeight?: string;
142
150
  isFullScreen?: boolean;
143
151
  opacity?: number;
144
152
  }
@@ -146,6 +154,8 @@ interface IContainerProps {
146
154
  const Container = styled.div<IContainerProps>`
147
155
  height: ${props => props.height};
148
156
  width: ${({ width }) => width};
157
+ min-width: ${({ minWidth }) => minWidth || 'auto'};
158
+ min-height: ${({ minHeight }) => minHeight || 'auto'};
149
159
  display: flex;
150
160
  flex-wrap: wrap;
151
161
  image-rendering: pixelated;
@@ -204,10 +214,10 @@ interface ICustomIconProps {
204
214
  width: string;
205
215
  }
206
216
 
207
- const Icon = styled.img`
217
+ const Icon = styled.img<ICustomIconProps>`
208
218
  color: white;
209
219
  z-index: 22;
210
220
  font-size: ${uiFonts.size.xsmall};
211
- width: ${(props: ICustomIconProps) => props.width};
221
+ width: ${({ width }) => width};
212
222
  margin-right: 0.5rem;
213
223
  `;
@@ -21,6 +21,8 @@ export interface ITabsContainer {
21
21
  type: MultitabType;
22
22
  styles?: {
23
23
  width?: string;
24
+ minWidth?: string;
25
+ minHeight?: string;
24
26
  height?: string;
25
27
  className?: string;
26
28
  title?: string;
@@ -67,6 +69,8 @@ export const TabsContainer: React.FC<ITabsContainer> = ({
67
69
  cancelDrag=".tabs-container *" // Disable drag on all elements inside .tabs-container
68
70
  width={styles?.width} // use optional chaining
69
71
  height={styles?.height}
72
+ minWidth={styles?.minWidth}
73
+ minHeight={styles?.minHeight}
70
74
  className={styles?.className}
71
75
  title={styles?.title}
72
76
  imgSrc={styles?.imgSrc}
@@ -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 '../../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';
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 '../constants/uiColors';
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
- <Table>
24
- <thead>
25
- <TableRow>
26
- <TableHeader>Status</TableHeader>
27
- <TableHeader>Title</TableHeader>
28
- <TableHeader>Description</TableHeader>
29
- <TableHeader>Objectives</TableHeader>
30
- <TableHeader>Rewards</TableHeader>
31
- </TableRow>
32
- </thead>
33
- <tbody>
34
- {quests.map((quest, i) => (
35
- <TableRow key={i}>
36
- <TableCell style={{ color: getStatusColor(quest.status) }}>
37
- {quest.status ?? 'Unknown'}
38
- </TableCell>
39
- <TableCell>
40
- <SimpleTooltip
41
- content={formatText(quest.title)}
42
- direction="bottom"
43
- >
44
- <Ellipsis maxWidth="300px">
45
- {formatText(quest.title)}
46
- </Ellipsis>
47
- </SimpleTooltip>
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
- // Updated helper function to format objectives
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; // Orange
186
+ return uiColors.orange;
175
187
  case QuestStatus.InProgress:
176
- return uiColors.blue; // Deep Sky Blue
188
+ return uiColors.blue;
177
189
  case QuestStatus.Completed:
178
- return uiColors.lightGreen; // Lime Green
190
+ return uiColors.lightGreen;
179
191
  default:
180
- return uiColors.white; // Default to white
192
+ return uiColors.white;
181
193
  }
182
194
  };
183
195
 
184
- const QuestListContainer = styled.div`
185
- margin-top: 20px;
186
- margin-bottom: 40px;
187
- overflow-y: auto;
188
- max-height: 400px;
189
- background-color: ${uiColors.darkGray};
190
- padding: 20px;
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 '../../src/components/QuestInfo/QuestInfo';
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 {