@rpg-engine/long-bow 0.3.44 → 0.3.46
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/Abstractions/SlotsContainer.d.ts +1 -0
- package/dist/components/Button.d.ts +3 -2
- package/dist/components/Chat/Chat.d.ts +12 -2
- package/dist/components/Chatdeprecated/ChatDeprecated.d.ts +13 -0
- package/dist/components/CheckButton.d.ts +1 -2
- package/dist/components/CircularController/CircularController.d.ts +10 -0
- package/dist/components/CraftBook/CraftBook.d.ts +15 -0
- package/dist/components/CraftBook/MockItems.d.ts +2 -0
- package/dist/components/DraggableContainer.d.ts +1 -0
- package/dist/components/DropdownSelectorContainer.d.ts +13 -0
- package/dist/components/Equipment/EquipmentSet.d.ts +8 -0
- package/dist/components/Input.d.ts +1 -0
- package/dist/components/Item/Inventory/ItemContainer.d.ts +12 -0
- package/dist/components/Item/Inventory/ItemQuantitySelector.d.ts +7 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +9 -0
- package/dist/components/NPCDialog/NPCDialogText.d.ts +4 -2
- package/dist/components/RadioInput/RadioButton.d.ts +8 -0
- package/dist/components/RadioInput/RadioInput.d.ts +13 -0
- package/dist/components/RadioInput/instruments.d.ts +4 -0
- package/dist/components/RangeSlider.d.ts +1 -0
- package/dist/components/Spellbook/QuickSpells.d.ts +10 -0
- package/dist/components/Spellbook/Spell.d.ts +11 -0
- package/dist/components/Spellbook/Spellbook.d.ts +15 -0
- package/dist/components/Spellbook/SpellbookShortcuts.d.ts +10 -0
- package/dist/components/Spellbook/constants.d.ts +3 -0
- package/dist/components/Spellbook/mockSpells.d.ts +2 -0
- package/dist/components/itemSelector/ItemSelector.d.ts +14 -0
- package/dist/constants/uiDevices.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/long-bow.cjs.development.js +7464 -515
- 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 +7458 -518
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/equipmentSet.mocks.d.ts +15 -2
- package/dist/mocks/skills.mocks.d.ts +2 -121
- package/dist/stories/ChatDeprecated.stories.d.ts +5 -0
- package/dist/stories/CircullarController.stories.d.ts +5 -0
- package/dist/stories/CraftBook.stories.d.ts +4 -0
- package/dist/stories/DropdownSelectorContainer.stories.d.ts +5 -0
- package/dist/stories/ItemQuantitySelector.stories.d.ts +5 -0
- package/dist/stories/ItemSelector.stories.d.ts +4 -0
- package/dist/stories/QuickSpells.stories.d.ts +5 -0
- package/dist/stories/RadioInput.stories.d.ts +5 -0
- package/dist/stories/Spellbook.stories.d.ts +5 -0
- package/package.json +5 -2
- package/src/components/Abstractions/SlotsContainer.tsx +3 -0
- package/src/components/Button.tsx +18 -8
- package/src/components/Chat/Chat.tsx +105 -105
- package/src/components/Chatdeprecated/ChatDeprecated.tsx +200 -0
- package/src/components/CheckButton.tsx +1 -1
- package/src/components/CircularController/CircularController.tsx +162 -0
- package/src/components/CraftBook/CraftBook.tsx +230 -0
- package/src/components/CraftBook/MockItems.ts +46 -0
- package/src/components/DraggableContainer.tsx +4 -1
- package/src/components/Dropdown.tsx +7 -1
- package/src/components/DropdownSelectorContainer.tsx +42 -0
- package/src/components/Equipment/EquipmentSet.tsx +46 -0
- package/src/components/Input.tsx +6 -2
- package/src/components/Item/Inventory/ItemContainer.tsx +104 -6
- package/src/components/Item/Inventory/ItemQuantitySelector.tsx +142 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +234 -34
- package/src/components/NPCDialog/NPCDialog.tsx +4 -28
- package/src/components/NPCDialog/NPCDialogText.tsx +75 -15
- package/src/components/NPCDialog/img/press-button.gif +0 -0
- package/src/components/RadioInput/RadioButton.tsx +98 -0
- package/src/components/RadioInput/RadioInput.tsx +99 -0
- package/src/components/RadioInput/instruments.ts +16 -0
- package/src/components/RangeSlider.tsx +37 -14
- package/src/components/SkillsContainer.tsx +1 -1
- package/src/components/Spellbook/QuickSpells.tsx +120 -0
- package/src/components/Spellbook/Spell.tsx +201 -0
- package/src/components/Spellbook/Spellbook.tsx +144 -0
- package/src/components/Spellbook/SpellbookShortcuts.tsx +77 -0
- package/src/components/Spellbook/constants.ts +12 -0
- package/src/components/Spellbook/mockSpells.ts +60 -0
- package/src/components/TimeWidget/TimeWidget.tsx +1 -0
- package/src/components/TradingMenu/TradingItemRow.tsx +43 -6
- package/src/components/TradingMenu/TradingMenu.tsx +1 -1
- package/src/components/itemSelector/ItemSelector.tsx +136 -0
- package/src/components/shared/SpriteFromAtlas.tsx +4 -1
- package/src/constants/uiDevices.ts +5 -0
- package/src/hooks/useOutsideAlerter.ts +2 -2
- package/src/index.tsx +8 -0
- package/src/mocks/atlas/items/items.json +6086 -314
- package/src/mocks/atlas/items/items.png +0 -0
- package/src/mocks/equipmentSet.mocks.ts +49 -4
- package/src/mocks/itemContainer.mocks.ts +54 -6
- package/src/mocks/skills.mocks.ts +8 -2
- package/src/stories/Chat.stories.tsx +20 -3
- package/src/stories/ChatDeprecated.stories.tsx +170 -0
- package/src/stories/CircullarController.stories.tsx +33 -0
- package/src/stories/CraftBook.stories.tsx +40 -0
- package/src/stories/DropdownSelectorContainer.stories.tsx +41 -0
- package/src/stories/EquipmentSet.stories.tsx +10 -0
- package/src/stories/ItemContainer.stories.tsx +84 -15
- package/src/stories/ItemQuantitySelector.stories.tsx +26 -0
- package/src/stories/ItemSelector.stories.tsx +77 -0
- package/src/stories/QuickSpells.stories.tsx +38 -0
- package/src/stories/RadioInput.stories.tsx +35 -0
- package/src/stories/RangeSlider.stories.tsx +10 -9
- package/src/stories/Spellbook.stories.tsx +107 -0
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import { IEquipmentSet } from '@rpg-engine/shared';
|
|
2
|
-
|
|
1
|
+
import { IEquipmentSet, IItem } from '@rpg-engine/shared';
|
|
2
|
+
interface IEquipmentSetItems {
|
|
3
|
+
leftHand: IItem;
|
|
4
|
+
head: IItem;
|
|
5
|
+
armor: IItem;
|
|
6
|
+
legs: IItem;
|
|
7
|
+
boot: IItem;
|
|
8
|
+
neck: IItem;
|
|
9
|
+
ring: IItem;
|
|
10
|
+
accessory: IItem;
|
|
11
|
+
inventory: IItem;
|
|
12
|
+
rightHand: IItem;
|
|
13
|
+
}
|
|
14
|
+
export declare const items: IEquipmentSetItems;
|
|
3
15
|
export declare const equipmentSetMock: IEquipmentSet;
|
|
16
|
+
export {};
|
|
@@ -1,121 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const skillMock:
|
|
3
|
-
_id: string;
|
|
4
|
-
stamina: {
|
|
5
|
-
type: SkillType;
|
|
6
|
-
level: number;
|
|
7
|
-
skillPoints: number;
|
|
8
|
-
skillPointsToNextLevel: number;
|
|
9
|
-
};
|
|
10
|
-
magic: {
|
|
11
|
-
type: SkillType;
|
|
12
|
-
level: number;
|
|
13
|
-
skillPoints: number;
|
|
14
|
-
skillPointsToNextLevel: number;
|
|
15
|
-
};
|
|
16
|
-
magicResistance: {
|
|
17
|
-
type: SkillType;
|
|
18
|
-
level: number;
|
|
19
|
-
skillPoints: number;
|
|
20
|
-
skillPointsToNextLevel: number;
|
|
21
|
-
};
|
|
22
|
-
strength: {
|
|
23
|
-
type: SkillType;
|
|
24
|
-
level: number;
|
|
25
|
-
skillPoints: number;
|
|
26
|
-
skillPointsToNextLevel: number;
|
|
27
|
-
};
|
|
28
|
-
resistance: {
|
|
29
|
-
type: SkillType;
|
|
30
|
-
level: number;
|
|
31
|
-
skillPoints: number;
|
|
32
|
-
skillPointsToNextLevel: number;
|
|
33
|
-
};
|
|
34
|
-
dexterity: {
|
|
35
|
-
type: SkillType;
|
|
36
|
-
level: number;
|
|
37
|
-
skillPoints: number;
|
|
38
|
-
skillPointsToNextLevel: number;
|
|
39
|
-
};
|
|
40
|
-
first: {
|
|
41
|
-
type: SkillType;
|
|
42
|
-
level: number;
|
|
43
|
-
skillPoints: number;
|
|
44
|
-
skillPointsToNextLevel: number;
|
|
45
|
-
};
|
|
46
|
-
club: {
|
|
47
|
-
type: SkillType;
|
|
48
|
-
level: number;
|
|
49
|
-
skillPoints: number;
|
|
50
|
-
skillPointsToNextLevel: number;
|
|
51
|
-
};
|
|
52
|
-
sword: {
|
|
53
|
-
type: SkillType;
|
|
54
|
-
level: number;
|
|
55
|
-
skillPoints: number;
|
|
56
|
-
skillPointsToNextLevel: number;
|
|
57
|
-
};
|
|
58
|
-
dagger: {
|
|
59
|
-
type: SkillType;
|
|
60
|
-
level: number;
|
|
61
|
-
skillPoints: number;
|
|
62
|
-
skillPointsToNextLevel: number;
|
|
63
|
-
};
|
|
64
|
-
axe: {
|
|
65
|
-
type: SkillType;
|
|
66
|
-
level: number;
|
|
67
|
-
skillPoints: number;
|
|
68
|
-
skillPointsToNextLevel: number;
|
|
69
|
-
};
|
|
70
|
-
distance: {
|
|
71
|
-
type: SkillType;
|
|
72
|
-
level: number;
|
|
73
|
-
skillPoints: number;
|
|
74
|
-
skillPointsToNextLevel: number;
|
|
75
|
-
};
|
|
76
|
-
shielding: {
|
|
77
|
-
type: SkillType;
|
|
78
|
-
level: number;
|
|
79
|
-
skillPoints: number;
|
|
80
|
-
skillPointsToNextLevel: number;
|
|
81
|
-
};
|
|
82
|
-
fishing: {
|
|
83
|
-
type: SkillType;
|
|
84
|
-
level: number;
|
|
85
|
-
skillPoints: number;
|
|
86
|
-
skillPointsToNextLevel: number;
|
|
87
|
-
};
|
|
88
|
-
mining: {
|
|
89
|
-
type: SkillType;
|
|
90
|
-
level: number;
|
|
91
|
-
skillPoints: number;
|
|
92
|
-
skillPointsToNextLevel: number;
|
|
93
|
-
};
|
|
94
|
-
lumberjacking: {
|
|
95
|
-
type: SkillType;
|
|
96
|
-
level: number;
|
|
97
|
-
skillPoints: number;
|
|
98
|
-
skillPointsToNextLevel: number;
|
|
99
|
-
};
|
|
100
|
-
cooking: {
|
|
101
|
-
type: SkillType;
|
|
102
|
-
level: number;
|
|
103
|
-
skillPoints: number;
|
|
104
|
-
skillPointsToNextLevel: number;
|
|
105
|
-
};
|
|
106
|
-
alchemy: {
|
|
107
|
-
type: SkillType;
|
|
108
|
-
level: number;
|
|
109
|
-
skillPoints: number;
|
|
110
|
-
skillPointsToNextLevel: number;
|
|
111
|
-
};
|
|
112
|
-
level: number;
|
|
113
|
-
xpGainRate: number;
|
|
114
|
-
experience: number;
|
|
115
|
-
xpToNextLevel: number;
|
|
116
|
-
ownerType: string;
|
|
117
|
-
owner: string;
|
|
118
|
-
createdAt: string;
|
|
119
|
-
updatedAt: string;
|
|
120
|
-
__v: number;
|
|
121
|
-
};
|
|
1
|
+
import { ISkill } from '@rpg-engine/shared';
|
|
2
|
+
export declare const skillMock: ISkill;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IChatMessage } from '@rpg-engine/shared';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IChatMessage>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { CircularControllerProps } from '../components/CircularController/CircularController';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, CircularControllerProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IDropdownSelectorContainer } from '../components/DropdownSelectorContainer';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IDropdownSelectorContainer>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IItemQuantitySelectorProps } from '../components/Item/Inventory/ItemQuantitySelector';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IItemQuantitySelectorProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { QuickSpellsProps } from '../components/Spellbook/QuickSpells';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, QuickSpellsProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IRadioInput } from '../components/RadioInput/RadioInput';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const RadioInputElement: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IRadioInput>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ISpellbookProps } from '../components/Spellbook/Spellbook';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ISpellbookProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,15 +83,18 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.6.
|
|
86
|
+
"@rpg-engine/shared": "^0.6.80",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
|
+
"font-awesome": "^4.7.0",
|
|
88
89
|
"fs-extra": "^10.1.0",
|
|
90
|
+
"is-mobile": "^3.1.1",
|
|
89
91
|
"lodash": "^4.17.21",
|
|
90
92
|
"lodash-es": "^4.17.21",
|
|
91
93
|
"mobx": "^6.6.0",
|
|
92
94
|
"mobx-react": "^7.5.0",
|
|
93
95
|
"react-draggable": "^4.4.5",
|
|
94
96
|
"react-error-boundary": "^3.1.4",
|
|
97
|
+
"react-icons": "^4.7.1",
|
|
95
98
|
"rollup-plugin-image-files": "^1.4.2",
|
|
96
99
|
"rpgui": "^1.0.3"
|
|
97
100
|
}
|
|
@@ -9,6 +9,7 @@ interface IProps {
|
|
|
9
9
|
onClose?: () => void;
|
|
10
10
|
onPositionChange?: (position: IPosition) => void;
|
|
11
11
|
onOutsideClick?: () => void;
|
|
12
|
+
initialPosition?: IPosition;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export const SlotsContainer: React.FC<IProps> = ({
|
|
@@ -17,6 +18,7 @@ export const SlotsContainer: React.FC<IProps> = ({
|
|
|
17
18
|
onClose,
|
|
18
19
|
onPositionChange,
|
|
19
20
|
onOutsideClick,
|
|
21
|
+
initialPosition,
|
|
20
22
|
}) => {
|
|
21
23
|
return (
|
|
22
24
|
<DraggableContainer
|
|
@@ -35,6 +37,7 @@ export const SlotsContainer: React.FC<IProps> = ({
|
|
|
35
37
|
}
|
|
36
38
|
}}
|
|
37
39
|
onOutsideClick={onOutsideClick}
|
|
40
|
+
initialPosition={initialPosition}
|
|
38
41
|
>
|
|
39
42
|
{children}
|
|
40
43
|
</DraggableContainer>
|
|
@@ -7,25 +7,35 @@ export enum ButtonTypes {
|
|
|
7
7
|
RPGUIGoldButton = 'rpgui-button golden',
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export interface IButtonProps
|
|
10
|
+
export interface IButtonProps
|
|
11
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
children: React.ReactNode;
|
|
13
14
|
buttonType: ButtonTypes;
|
|
15
|
+
onClick?: (e: any) => void;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
export const Button
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export const Button = ({
|
|
19
|
+
disabled = false,
|
|
20
|
+
children,
|
|
21
|
+
buttonType,
|
|
22
|
+
onClick,
|
|
23
|
+
...props
|
|
24
|
+
}: IButtonProps) => {
|
|
21
25
|
return (
|
|
22
|
-
<ButtonContainer
|
|
26
|
+
<ButtonContainer
|
|
27
|
+
className={`${buttonType}`}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
{...props}
|
|
30
|
+
onTouchStart={onClick}
|
|
31
|
+
onClick={onClick}
|
|
32
|
+
>
|
|
23
33
|
<p>{children}</p>
|
|
24
34
|
</ButtonContainer>
|
|
25
35
|
);
|
|
26
36
|
};
|
|
27
37
|
|
|
28
|
-
const ButtonContainer = styled.button
|
|
38
|
+
const ButtonContainer = styled.button`
|
|
29
39
|
height: 45px;
|
|
30
40
|
font-size: ${uiFonts.size.small};
|
|
31
41
|
`;
|
|
@@ -2,34 +2,46 @@ import { IChatMessage } from '@rpg-engine/shared';
|
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
5
|
+
import { RxPaperPlane } from 'react-icons/rx';
|
|
5
6
|
import styled from 'styled-components';
|
|
6
|
-
import { uiColors } from '../../constants/uiColors';
|
|
7
|
-
import { uiFonts } from '../../constants/uiFonts';
|
|
8
|
-
import { Button, ButtonTypes } from '../Button';
|
|
9
|
-
import { Input } from '../Input';
|
|
10
|
-
import { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';
|
|
11
7
|
import { Column } from '../shared/Column';
|
|
12
8
|
|
|
13
9
|
interface IEmitter {
|
|
14
10
|
_id: string;
|
|
15
11
|
name: string;
|
|
16
12
|
}
|
|
13
|
+
|
|
14
|
+
interface IStyles {
|
|
15
|
+
textColor?: string;
|
|
16
|
+
buttonColor?: string;
|
|
17
|
+
buttonBackgroundColor?: string;
|
|
18
|
+
width?: string;
|
|
19
|
+
height?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
export interface IChatProps {
|
|
18
23
|
chatMessages: IChatMessage[];
|
|
19
24
|
onSendChatMessage: (message: string) => void;
|
|
20
25
|
onCloseButton: () => void;
|
|
26
|
+
onFocus?: () => void;
|
|
27
|
+
onBlur?: () => void;
|
|
21
28
|
opacity?: number;
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
sendMessage: boolean;
|
|
30
|
+
styles?: IStyles;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
export const Chat: React.FC<IChatProps> = ({
|
|
27
34
|
chatMessages,
|
|
28
35
|
onSendChatMessage,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
onFocus,
|
|
37
|
+
onBlur,
|
|
38
|
+
styles = {
|
|
39
|
+
textColor: '#c65102',
|
|
40
|
+
buttonColor: '#005b96',
|
|
41
|
+
buttonBackgroundColor: 'rgba(0,0,0,.2)',
|
|
42
|
+
width: '80%',
|
|
43
|
+
height: 'auto',
|
|
44
|
+
},
|
|
33
45
|
}) => {
|
|
34
46
|
const [message, setMessage] = useState('');
|
|
35
47
|
|
|
@@ -70,114 +82,102 @@ export const Chat: React.FC<IChatProps> = ({
|
|
|
70
82
|
const onRenderChatMessages = (chatMessages: IChatMessage[]) => {
|
|
71
83
|
return chatMessages?.length ? (
|
|
72
84
|
chatMessages?.map(({ _id, createdAt, emitter, message }, index) => (
|
|
73
|
-
<
|
|
74
|
-
{onRenderMessageLines(emitter, createdAt, message)}
|
|
75
|
-
</
|
|
85
|
+
<Message color={styles?.textColor || '#c65102'} key={`${_id}_${index}`}>
|
|
86
|
+
{onRenderMessageLines(emitter, createdAt as string, message)}
|
|
87
|
+
</Message>
|
|
76
88
|
))
|
|
77
89
|
) : (
|
|
78
|
-
<
|
|
90
|
+
<Message color={styles?.textColor || '#c65102'}>
|
|
91
|
+
No messages available.
|
|
92
|
+
</Message>
|
|
79
93
|
);
|
|
80
94
|
};
|
|
81
95
|
|
|
82
96
|
return (
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
className="chat-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
id="chat-send-button"
|
|
122
|
-
>
|
|
123
|
-
Send
|
|
124
|
-
</Button>
|
|
125
|
-
</Column>
|
|
126
|
-
</Form>
|
|
127
|
-
</ErrorBoundary>
|
|
128
|
-
</CustomContainer>
|
|
129
|
-
</Container>
|
|
97
|
+
<ChatContainer
|
|
98
|
+
width={styles?.width || '80%'}
|
|
99
|
+
height={styles?.height || 'auto'}
|
|
100
|
+
>
|
|
101
|
+
<ErrorBoundary fallback={<p>Oops! Your chat has crashed.</p>}>
|
|
102
|
+
<MessagesContainer className="chat-body">
|
|
103
|
+
{onRenderChatMessages(chatMessages)}
|
|
104
|
+
</MessagesContainer>
|
|
105
|
+
|
|
106
|
+
<Form onSubmit={handleSubmit}>
|
|
107
|
+
<Column flex={70}>
|
|
108
|
+
<TextField
|
|
109
|
+
value={message}
|
|
110
|
+
id="inputMessage"
|
|
111
|
+
onChange={e => getInputValue(e.target.value)}
|
|
112
|
+
height={20}
|
|
113
|
+
type="text"
|
|
114
|
+
autoComplete="off"
|
|
115
|
+
onFocus={onFocus}
|
|
116
|
+
onBlur={onBlur}
|
|
117
|
+
onTouchStart={onFocus}
|
|
118
|
+
/>
|
|
119
|
+
</Column>
|
|
120
|
+
<Column justifyContent="flex-end">
|
|
121
|
+
<Button
|
|
122
|
+
buttonColor={styles?.buttonColor || '#005b96'}
|
|
123
|
+
buttonBackgroundColor={
|
|
124
|
+
styles?.buttonBackgroundColor || 'rgba(0,0,0,.5)'
|
|
125
|
+
}
|
|
126
|
+
id="chat-send-button"
|
|
127
|
+
style={{ borderRadius: '20%' }}
|
|
128
|
+
>
|
|
129
|
+
<RxPaperPlane size={15} />
|
|
130
|
+
</Button>
|
|
131
|
+
</Column>
|
|
132
|
+
</Form>
|
|
133
|
+
</ErrorBoundary>
|
|
134
|
+
</ChatContainer>
|
|
130
135
|
);
|
|
131
136
|
};
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const CloseButton = styled.div`
|
|
138
|
-
position: absolute;
|
|
139
|
-
top: 2px;
|
|
140
|
-
right: 0px;
|
|
141
|
-
color: white;
|
|
142
|
-
z-index: 22;
|
|
143
|
-
font-size: 0.7rem;
|
|
144
|
-
`;
|
|
145
|
-
|
|
146
|
-
const CustomInput = styled(Input)`
|
|
147
|
-
height: 30px;
|
|
148
|
-
width: 100%;
|
|
149
|
-
|
|
150
|
-
.rpgui-content .input {
|
|
151
|
-
min-height: 39px;
|
|
152
|
-
}
|
|
153
|
-
`;
|
|
154
|
-
|
|
155
|
-
interface ICustomContainerProps {
|
|
156
|
-
opacity: number;
|
|
138
|
+
interface IContainerProps {
|
|
139
|
+
width: string;
|
|
140
|
+
height: string;
|
|
157
141
|
}
|
|
158
142
|
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
interface IMessageProps {
|
|
144
|
+
color: string;
|
|
145
|
+
}
|
|
161
146
|
|
|
162
|
-
|
|
147
|
+
interface IButtonProps {
|
|
148
|
+
buttonColor: string;
|
|
149
|
+
buttonBackgroundColor: string;
|
|
150
|
+
}
|
|
163
151
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
152
|
+
const ChatContainer = styled.div<IContainerProps>`
|
|
153
|
+
height: ${props => props.height};
|
|
154
|
+
width: ${({ width }) => width};
|
|
155
|
+
padding: 10px;
|
|
156
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
157
|
+
height: auto;
|
|
158
|
+
`;
|
|
167
159
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
160
|
+
const TextField = styled.input`
|
|
161
|
+
width: 100%;
|
|
162
|
+
background-color: rgba(0, 0, 0, 0.25) !important;
|
|
163
|
+
border: none !important;
|
|
164
|
+
max-height: 28px !important;
|
|
165
|
+
`;
|
|
171
166
|
|
|
167
|
+
const MessagesContainer = styled.div`
|
|
168
|
+
height: 70%;
|
|
169
|
+
margin-bottom: 10px;
|
|
172
170
|
.chat-body {
|
|
173
|
-
|
|
174
|
-
background: unset;
|
|
175
|
-
}
|
|
176
|
-
max-height: 170px;
|
|
171
|
+
max-height: auto;
|
|
177
172
|
overflow-y: auto;
|
|
178
173
|
}
|
|
179
174
|
`;
|
|
180
175
|
|
|
176
|
+
const Message = styled.div<IMessageProps>`
|
|
177
|
+
margin-bottom: 8px;
|
|
178
|
+
color: ${({ color }) => color};
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
181
|
const Form = styled.form`
|
|
182
182
|
display: flex;
|
|
183
183
|
width: 100%;
|
|
@@ -185,10 +185,10 @@ const Form = styled.form`
|
|
|
185
185
|
align-items: center;
|
|
186
186
|
`;
|
|
187
187
|
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
const Button = styled.button<IButtonProps>`
|
|
189
|
+
color: ${({ buttonColor }) => buttonColor};
|
|
190
|
+
background-color: ${({ buttonBackgroundColor }) => buttonBackgroundColor};
|
|
191
|
+
width: 28px;
|
|
192
|
+
height: 28px;
|
|
193
|
+
border: none !important;
|
|
194
194
|
`;
|