Skip to content

Commit

Permalink
[Issue-164] [Mythical telegram app] refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
dungnguyen-art committed Nov 15, 2024
1 parent 713be58 commit b5770fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Component (props: Props): React.ReactElement<Props> {
const { activeModal, inactiveModal } = useContext(ModalContext);
const [dailyRewards, setDailyRewards] = useState(apiSdk.getDailyRewardAchievements());

const remainingDailyRewards = useCallback(() => {
const claimableDailyRewards = useCallback(() => {
return dailyRewards.filter((item) => item.status === 'claimable');
}, [dailyRewards]);
const openDailyRewardsModal = useCallback(() => {
Expand Down Expand Up @@ -66,7 +66,7 @@ function Component (props: Props): React.ReactElement<Props> {
{t('Daily rewards')}
</MythButton>

{remainingDailyRewards.length > 0 && <div className={'__notice-icon'}></div>}
{claimableDailyRewards.length > 0 && <div className={'__notice-icon'}></div>}
</div>
</div>

Expand Down
14 changes: 9 additions & 5 deletions packages/extension-koni-ui/src/components/Layout/base/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Component = ({ backgroundStyle = 'style-1', children, className, headerIco
const { pathname } = useLocation();
const { t } = useTranslation();
const { language } = useSelector((state) => state.settings);
const [claimAbleAchievements, setClaimAbleAchievements] = useState(apiSdk.getClaimAbleAchievements());
const [claimableAchievements, setClaimableAchievements] = useState(apiSdk.getClaimableAchievements());

const tabBarItems = useMemo((): Array<Omit<SwTabBarItem, 'onClick'> & { url: string }> => ([
{
Expand Down Expand Up @@ -77,7 +77,7 @@ const Component = ({ backgroundStyle = 'style-1', children, className, headerIco
fill='currentColor'
/>
</svg>
{ claimAbleAchievements.length > 0 && <div className={'__notice-icon-tabbar'}></div>}
{ claimableAchievements.length > 0 && <div className={'__notice-icon-tabbar'}></div>}
</>
)
},
Expand Down Expand Up @@ -153,7 +153,7 @@ const Component = ({ backgroundStyle = 'style-1', children, className, headerIco
key: 'my-profile',
url: '/home/my-profile'
}
]), [claimAbleAchievements.length, t]);
]), [claimableAchievements.length, t]);

const selectedTab = useMemo((): string => {
const isHomePath = pathname.includes('/home');
Expand Down Expand Up @@ -185,7 +185,7 @@ const Component = ({ backgroundStyle = 'style-1', children, className, headerIco

useEffect(() => {
const sub1 = apiSdk.subscribeClaimableAchievements().subscribe((achievements: Achievement[]) => {
setClaimAbleAchievements(achievements);
setClaimableAchievements(achievements);
});

return () => {
Expand Down Expand Up @@ -266,8 +266,12 @@ const Base = styled(Component)<LayoutBaseProps>(({ theme: { extendToken, token }
backgroundColor: 'transparent'
},

'&.-show-tab-bar > .ant-sw-screen-layout-body > .ant-sw-screen-layout-body-inner': {
paddingBottom: 90
},

'.ant-sw-tab-bar-container': {
position: 'relative',
position: 'fixed',
bottom: 0,
left: 0,
right: 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-koni-ui/src/connector/booka/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export class BookaSdk {
return this.inviteAchievementsSubject;
}

getClaimAbleAchievements () {
getClaimableAchievements () {
return this.claimAbleAchievementsSubject.value;
}

Expand Down

0 comments on commit b5770fa

Please sign in to comment.