Skip to content

Commit 66172a2

Browse files
Sowmiya07SaraVieira
andcommitted
/app/pages/common/Modals/PreferencesModal/Badges/index.js 🔨 Re… (#2760)
* refactored badges to use overmind refactored the badges index.js file to use overmind and added named export instead of default export * Update index.js * Rename index.js to index.tsx * Update index.tsx * Update index.tsx Co-authored-by: Sara Vieira <[email protected]>
1 parent 0e9c0cf commit 66172a2

File tree

1 file changed

+14
-7
lines changed
  • packages/app/src/app/pages/common/Modals/PreferencesModal/Badges

1 file changed

+14
-7
lines changed
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
import React from 'react';
2-
import { inject, observer } from 'app/componentConnectors';
1+
import React, {FunctionComponent} from 'react';
2+
import { useOvermind } from 'app/overmind';
33

44
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
55
import Badge from '@codesandbox/common/lib/utils/badges/Badge';
66
import { Title } from '../elements';
77

8-
function BadgesComponent({ store, signals }) {
9-
const badgesCount = store.user.badges.length;
8+
export const Badges: FunctionComponent = () => {
9+
const {
10+
state: {
11+
user: {badges},
12+
},
13+
actions: {
14+
preferences: {setBadgeVisibility},
15+
},
16+
} = useOvermind();
17+
const badgesCount = badges.length;
1018

1119
return (
1220
<div>
@@ -17,12 +25,12 @@ function BadgesComponent({ store, signals }) {
1725
visibility.
1826
</strong>
1927
<Margin top={2}>
20-
{store.user.badges.map(badge => (
28+
{badges.map(badge => (
2129
<Badge
2230
key={badge.id}
2331
tooltip={false}
2432
onClick={b =>
25-
signals.preferences.setBadgeVisibility({
33+
setBadgeVisibility({
2634
...b,
2735
visible: !b.visible,
2836
})
@@ -37,4 +45,3 @@ function BadgesComponent({ store, signals }) {
3745
);
3846
}
3947

40-
export const Badges = inject('store', 'signals')(observer(BadgesComponent));

0 commit comments

Comments
 (0)