react-achievements 1.3.3 → 1.3.5
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/README.md +24 -11
- package/demo/package-lock.json +1046 -55
- package/demo/package.json +1 -1
- package/demo/src/AchievementConfig.ts +37 -0
- package/demo/src/App.jsx +65 -11
- package/demo/src/assets/achievements/explorer.webp +0 -0
- package/demo/src/assets/achievements/seaoned_warrior.webp +0 -0
- package/demo/src/assets/achievements/warrior.webp +0 -0
- package/images/delete_local_storage.png +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
A flexible and customizable achievement system for React applications, perfect for adding gamification elements to your projects.
|
|
5
5
|
|
|
6
|
+
[](https://youtu.be/BWdtiE53S-8)
|
|
7
|
+
|
|
8
|
+
If you want to test the package, you can try it out here:
|
|
9
|
+
|
|
10
|
+
https://stackblitz.com/edit/vitejs-vite-sccdux
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
<h2 align="center">🚀 Installation</h2>
|
|
7
14
|
|
|
8
15
|
Install `react-achievements` using npm or yarn:
|
|
@@ -65,42 +72,42 @@ import questMasterIcon from './icons/quest-master.png';
|
|
|
65
72
|
const achievementConfig = {
|
|
66
73
|
level: [
|
|
67
74
|
{
|
|
68
|
-
check: (value) => value >=
|
|
75
|
+
check: (value) => value >= 1,
|
|
69
76
|
data: {
|
|
70
|
-
id: '
|
|
77
|
+
id: 'level_1',
|
|
71
78
|
title: 'Novice Adventurer',
|
|
72
|
-
description: 'Reached level
|
|
79
|
+
description: 'Reached level 1',
|
|
73
80
|
icon: levelUpIcon
|
|
74
81
|
}
|
|
75
82
|
},
|
|
76
83
|
{
|
|
77
|
-
check: (value) => value >=
|
|
84
|
+
check: (value) => value >= 5,
|
|
78
85
|
data: {
|
|
79
|
-
id: '
|
|
86
|
+
id: 'level_5',
|
|
80
87
|
title: 'Seasoned Warrior',
|
|
81
|
-
description: 'Reached level
|
|
88
|
+
description: 'Reached level 5',
|
|
82
89
|
icon: levelUpIcon
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
92
|
],
|
|
86
93
|
monstersDefeated: [
|
|
87
94
|
{
|
|
88
|
-
check: (value) => value >=
|
|
95
|
+
check: (value) => value >= 10,
|
|
89
96
|
data: {
|
|
90
97
|
id: 'monster_slayer',
|
|
91
98
|
title: 'Monster Slayer',
|
|
92
|
-
description: 'Defeated
|
|
99
|
+
description: 'Defeated 10 monsters',
|
|
93
100
|
icon: monsterSlayerIcon
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
],
|
|
97
104
|
questsCompleted: [
|
|
98
105
|
{
|
|
99
|
-
check: (value) => value >=
|
|
106
|
+
check: (value) => value >= 1,
|
|
100
107
|
data: {
|
|
101
108
|
id: 'quest_master',
|
|
102
109
|
title: 'Quest Master',
|
|
103
|
-
description: 'Completed
|
|
110
|
+
description: 'Completed 1 quest',
|
|
104
111
|
icon: questMasterIcon
|
|
105
112
|
}
|
|
106
113
|
}
|
|
@@ -191,6 +198,7 @@ export default Game;
|
|
|
191
198
|
- Persistent Achievements: Unlocked achievements and metrics are stored in local storage, allowing players to keep their progress.
|
|
192
199
|
- Achievement Gallery: Players can view all their unlocked achievements, encouraging completionism.
|
|
193
200
|
- Confetti Effect: A celebratory confetti effect is displayed when an achievement is unlocked, adding to the excitement.
|
|
201
|
+
- Local Storage: Achievements are stored locally on the device
|
|
194
202
|
|
|
195
203
|
<h2 align="center">🔧 API</h2>
|
|
196
204
|
|
|
@@ -362,7 +370,12 @@ badgesButton: {
|
|
|
362
370
|
|
|
363
371
|
```
|
|
364
372
|
|
|
365
|
-
|
|
373
|
+
<h2 align="center">Resetting React Achievements</h2>
|
|
374
|
+
|
|
375
|
+
The achievements are stored in local storage. In order to reset the package in your app, you need to delete the key-value pairs in local storage:
|
|
376
|
+
|
|
377
|
+

|
|
378
|
+
|
|
366
379
|
|
|
367
380
|
<h2 align="center">📄 License</h2>
|
|
368
381
|
MIT
|