-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feature-achievement'
- Loading branch information
Showing
30 changed files
with
1,518 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Submodule common
updated
15 files
+6 −0 | codes/codes.json | |
+7 −0 | codes/index.ts | |
+4 −0 | configs/achievement-categories.csv | |
+436 −0 | configs/achievement-config.json | |
+59 −0 | configs/achievement.config.ts | |
+53 −0 | configs/achievements.csv | |
+14 −0 | contracts/achievement.ts | |
+18 −1 | contracts/user.ts | |
+15 −0 | enums/index.ts | |
+18 −0 | interfaces/achievement.ts | |
+1 −0 | interfaces/competition.ts | |
+6 −2 | package.json | |
+33 −0 | routes/be.route.ts | |
+9 −3 | scripts/codes.gen.js | |
+64 −0 | scripts/conf.gen.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import { toast } from 'react-toastify'; | ||
import classNames from 'classnames'; | ||
import { Icon } from 'antd'; | ||
import { Howl } from 'howler'; | ||
import { IAchievement } from '@/common/interfaces/achievement'; | ||
import { EAchievementKey } from '@/common/configs/achievement.config'; | ||
import { getAchievementByKey } from '@/utils/achievement'; | ||
import AchievementTrophySvg from '@/assets/svg/achievement-trophy.svg'; | ||
import { EAchievementLevel } from '@/common/enums'; | ||
|
||
export interface IAchievementToastProps { | ||
achievement: IAchievement; | ||
} | ||
|
||
class AchievementToast extends React.Component<IAchievementToastProps> { | ||
componentDidMount() { | ||
const sound = new Howl({ | ||
src: [`${process.env.PUBLIC_PATH}assets/audio/achievement-toast.mp3`], | ||
}); | ||
setTimeout(() => sound.play(), 200); | ||
} | ||
|
||
render() { | ||
const { achievement } = this.props; | ||
|
||
return ( | ||
<div className="achievement-toast"> | ||
<div | ||
className={classNames( | ||
'achievement-toast-trophy', | ||
`achievement-toast-trophy-${EAchievementLevel[achievement.level]}`, | ||
)} | ||
> | ||
<Icon theme="outlined" component={AchievementTrophySvg} /> | ||
</div> | ||
<div className="achievement-toast-info"> | ||
<div className="achievement-toast-title text-ellipsis">{achievement.title}</div> | ||
<div className="achievement-toast-description text-ellipsis"> | ||
{achievement.description} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default AchievementToast; | ||
|
||
export function showAchievementToast(achievementKey: EAchievementKey) { | ||
const achievement = getAchievementByKey(achievementKey); | ||
return toast(<AchievementToast achievement={achievement} />, { containerId: 'achievement' }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { ToastContainer, Zoom } from 'react-toastify'; | ||
|
||
class AchievementToastContainer extends React.Component { | ||
render() { | ||
return ( | ||
<ToastContainer | ||
containerId="achievement" | ||
position="bottom-center" | ||
autoClose={8000} | ||
hideProgressBar | ||
newestOnTop={false} | ||
closeOnClick | ||
pauseOnFocusLoss | ||
draggable | ||
pauseOnHover | ||
theme="colored" | ||
className="achievement-toast-container" | ||
bodyClassName="achievement-toast-body" | ||
closeButton={false} | ||
transition={Zoom} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default AchievementToastContainer; |
Oops, something went wrong.