@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.
@@ -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.77",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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 {