@rpg-engine/long-bow 0.5.8 → 0.5.9
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/Leaderboard/Leaderboard.d.ts +5 -3
- package/dist/components/Leaderboard/LeaderboardTable.d.ts +2 -2
- package/dist/long-bow.cjs.development.js +19 -17
- 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 +19 -17
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/leaderboard.mocks.d.ts +4 -4
- package/package.json +2 -2
- package/src/components/Leaderboard/Leaderboard.tsx +41 -24
- package/src/components/Leaderboard/LeaderboardTable.tsx +6 -3
- package/src/mocks/leaderboard.mocks.ts +116 -107
- package/src/stories/Leaderboard.stories.tsx +16 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const leaderboardLevelRankingItems: Set<
|
|
3
|
-
export declare const leaderboardClassRankingItems: Set<
|
|
4
|
-
export declare const leaderboardSkillRankingItems: Set<
|
|
1
|
+
import { IRankingTopCharacterEntry, IRankingTopSkillEntry } from '@rpg-engine/shared';
|
|
2
|
+
export declare const leaderboardLevelRankingItems: Set<IRankingTopCharacterEntry>;
|
|
3
|
+
export declare const leaderboardClassRankingItems: Set<IRankingTopCharacterEntry>;
|
|
4
|
+
export declare const leaderboardSkillRankingItems: Set<IRankingTopSkillEntry>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.8.
|
|
86
|
+
"@rpg-engine/shared": "^0.8.74",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"font-awesome": "^4.7.0",
|
|
89
89
|
"fs-extra": "^10.1.0",
|
|
@@ -1,46 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IRankingTopCharacterEntry,
|
|
3
|
+
IRankingTopSkillEntry,
|
|
4
|
+
} from '@rpg-engine/shared';
|
|
2
5
|
import React, { useEffect, useRef } from 'react';
|
|
3
6
|
import styled from 'styled-components';
|
|
4
7
|
import { Dropdown, IOptionsProps } from '../Dropdown';
|
|
5
8
|
import { LeaderboardTable } from './LeaderboardTable';
|
|
6
9
|
|
|
7
|
-
|
|
8
10
|
export interface ILeaderboardProps {
|
|
9
|
-
items: Set<
|
|
11
|
+
items: Set<IRankingTopCharacterEntry> | Set<IRankingTopSkillEntry> | null;
|
|
10
12
|
onChangeClassType: (value: string) => void;
|
|
11
13
|
onChangeRankType: (value: string) => void;
|
|
12
14
|
onChangeSkillType: (value: string) => void;
|
|
13
|
-
|
|
15
|
+
skillOptions: string[];
|
|
16
|
+
rankOptions: string[];
|
|
17
|
+
classOptions: string[];
|
|
14
18
|
rankType: string;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
const rankTypeOptions: IOptionsProps[] = ['Level', 'Class', 'Skill'].map(
|
|
18
|
-
(itemType, index) => ({
|
|
19
|
-
id: index + 1,
|
|
20
|
-
value: itemType,
|
|
21
|
-
option: itemType,
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const classTypeOptions: IOptionsProps[] = Object.keys(CharacterClass).map((itemType, index) => ({
|
|
26
|
-
id: index + 1,
|
|
27
|
-
value: itemType,
|
|
28
|
-
option: itemType,
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
21
|
export const Leaderboard = (props: ILeaderboardProps) => {
|
|
32
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
items,
|
|
24
|
+
onChangeRankType,
|
|
25
|
+
onChangeClassType,
|
|
26
|
+
rankType,
|
|
27
|
+
skillOptions,
|
|
28
|
+
onChangeSkillType,
|
|
29
|
+
classOptions,
|
|
30
|
+
rankOptions,
|
|
31
|
+
} = props;
|
|
33
32
|
const itemsContainer = useRef<HTMLDivElement>(null);
|
|
34
33
|
|
|
35
34
|
useEffect(() => {
|
|
36
35
|
itemsContainer.current?.scrollTo(0, 0);
|
|
37
36
|
}, []);
|
|
38
37
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const rankTypeOptions: IOptionsProps[] = rankOptions.map(
|
|
39
|
+
(itemType, index) => ({
|
|
40
|
+
id: index + 1,
|
|
41
|
+
value: itemType,
|
|
42
|
+
option: itemType,
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const skillTypeOptions: IOptionsProps[] = skillOptions.map(
|
|
47
|
+
(itemType, index) => ({
|
|
48
|
+
id: index + 1,
|
|
49
|
+
value: itemType,
|
|
50
|
+
option: itemType,
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const classTypeOptions: IOptionsProps[] = classOptions.map(
|
|
55
|
+
(itemType, index) => ({
|
|
56
|
+
id: index + 1,
|
|
57
|
+
value: itemType,
|
|
58
|
+
option: itemType,
|
|
59
|
+
})
|
|
60
|
+
);
|
|
44
61
|
|
|
45
62
|
return (
|
|
46
63
|
<>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IRankingTopCharacterEntry,
|
|
3
|
+
IRankingTopSkillEntry,
|
|
4
|
+
} from '@rpg-engine/shared';
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import styled from 'styled-components';
|
|
4
7
|
import { uiColors } from '../../constants/uiColors';
|
|
5
8
|
import { Ellipsis } from '../shared/Ellipsis';
|
|
6
9
|
|
|
7
10
|
export interface ILeaderboardLevelProps {
|
|
8
|
-
items: Set<
|
|
11
|
+
items: Set<IRankingTopCharacterEntry> | Set<IRankingTopSkillEntry> | null;
|
|
9
12
|
rankType: string;
|
|
10
13
|
}
|
|
11
14
|
|
|
@@ -13,7 +16,7 @@ export const LeaderboardTable: React.FC<ILeaderboardLevelProps> = props => {
|
|
|
13
16
|
const { items, rankType } = props;
|
|
14
17
|
if (!items) return null;
|
|
15
18
|
|
|
16
|
-
function isTopSkillEntry(entry: any): entry is
|
|
19
|
+
function isTopSkillEntry(entry: any): entry is IRankingTopSkillEntry {
|
|
17
20
|
return 'skill' in entry;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -1,110 +1,119 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IRankingTopCharacterEntry,
|
|
3
|
+
IRankingTopSkillEntry,
|
|
4
|
+
} from '@rpg-engine/shared';
|
|
2
5
|
|
|
3
|
-
export const leaderboardLevelRankingItems: Set<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
6
|
+
export const leaderboardLevelRankingItems: Set<IRankingTopCharacterEntry> = new Set(
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
name: 'Player 1',
|
|
10
|
+
level: 1,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'Player 2',
|
|
14
|
+
level: 2,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Player 3',
|
|
18
|
+
level: 3,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'Player 4',
|
|
22
|
+
level: 4,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Player 5',
|
|
26
|
+
level: 5,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Player 6',
|
|
30
|
+
level: 6,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Player 7',
|
|
34
|
+
level: 7,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Player 8',
|
|
38
|
+
level: 8,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Player 9',
|
|
42
|
+
level: 9,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Player 10',
|
|
46
|
+
level: 10,
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
);
|
|
45
50
|
|
|
46
|
-
export const leaderboardClassRankingItems: Set<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
51
|
+
export const leaderboardClassRankingItems: Set<IRankingTopCharacterEntry> = new Set(
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
name: 'Player 1',
|
|
55
|
+
level: 1,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Player 2',
|
|
59
|
+
level: 2,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Player 3',
|
|
63
|
+
level: 3,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Player 4',
|
|
67
|
+
level: 4,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Player 5',
|
|
71
|
+
level: 5,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Player 6',
|
|
75
|
+
level: 6,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Player 7',
|
|
79
|
+
level: 7,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Player 8',
|
|
83
|
+
level: 8,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'Player 9',
|
|
87
|
+
level: 9,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'Player 10',
|
|
91
|
+
level: 10,
|
|
92
|
+
},
|
|
93
|
+
]
|
|
94
|
+
);
|
|
88
95
|
|
|
89
|
-
export const leaderboardSkillRankingItems: Set<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
export const leaderboardSkillRankingItems: Set<IRankingTopSkillEntry> = new Set(
|
|
97
|
+
[
|
|
98
|
+
{
|
|
99
|
+
name: 'Player 1',
|
|
100
|
+
level: 1,
|
|
101
|
+
skill: 'skill 1',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Player 2',
|
|
105
|
+
level: 2,
|
|
106
|
+
skill: 'skill 2',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Player 3',
|
|
110
|
+
level: 3,
|
|
111
|
+
skill: 'skill 3',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'Player 4',
|
|
115
|
+
level: 4,
|
|
116
|
+
skill: 'skill 4',
|
|
117
|
+
},
|
|
118
|
+
]
|
|
119
|
+
);
|
|
@@ -31,9 +31,11 @@ export const Default = Template.bind({});
|
|
|
31
31
|
Default.args = {
|
|
32
32
|
items: leaderboardLevelRankingItems,
|
|
33
33
|
rankType: 'Level',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
skillOptions: ['Lumbarjacking'],
|
|
35
|
+
classOptions: ['Warrior'],
|
|
36
|
+
rankOptions: ['Level', 'Class', 'Skill'],
|
|
37
|
+
onChangeRankType: () => {},
|
|
38
|
+
onChangeClassType: () => {},
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
export const ClassRanking = Template.bind({});
|
|
@@ -41,9 +43,11 @@ export const ClassRanking = Template.bind({});
|
|
|
41
43
|
ClassRanking.args = {
|
|
42
44
|
items: leaderboardClassRankingItems,
|
|
43
45
|
rankType: 'Class',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
skillOptions: ['Lumbarjacking'],
|
|
47
|
+
classOptions: ['Warrior'],
|
|
48
|
+
rankOptions: ['Level', 'Class', 'Skill'],
|
|
49
|
+
onChangeRankType: () => {},
|
|
50
|
+
onChangeClassType: () => {},
|
|
47
51
|
};
|
|
48
52
|
|
|
49
53
|
export const SkillRanking = Template.bind({});
|
|
@@ -51,7 +55,9 @@ export const SkillRanking = Template.bind({});
|
|
|
51
55
|
SkillRanking.args = {
|
|
52
56
|
items: leaderboardSkillRankingItems,
|
|
53
57
|
rankType: 'Skill',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
+
skillOptions: ['Lumbarjacking'],
|
|
59
|
+
classOptions: ['Warrior'],
|
|
60
|
+
rankOptions: ['Level', 'Class', 'Skill'],
|
|
61
|
+
onChangeRankType: () => {},
|
|
62
|
+
onChangeClassType: () => {},
|
|
63
|
+
};
|