-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/app/pages/common/Modals/PreferencesModal/Badges/index.js 🔨 Refactor 🧠 Overmind Hacktoberfest #2760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,12 +1,20 @@ | ||||||
| import React from 'react'; | ||||||
| import { inject, observer } from 'app/componentConnectors'; | ||||||
| import React, {FunctionComponent} from 'react'; | ||||||
| import { useOvermind } from 'app/overmind'; | ||||||
|
|
||||||
| import Margin from '@codesandbox/common/lib/components/spacing/Margin'; | ||||||
| import Badge from '@codesandbox/common/lib/utils/badges/Badge'; | ||||||
| import { Title } from '../elements'; | ||||||
|
|
||||||
| function BadgesComponent({ store, signals }) { | ||||||
| const badgesCount = store.user.badges.length; | ||||||
| export const Badges: FunctionComponent = () => { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| const { | ||||||
| state: { | ||||||
| user: {badges}, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
eslint --fix should have caught this, not sure why it didn't. Adding spaces for consistency |
||||||
| }, | ||||||
| actions: { | ||||||
| preferences: {setBadgeVisibility}, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }, | ||||||
| } = useOvermind(); | ||||||
| const badgesCount = badges.length; | ||||||
|
|
||||||
| return ( | ||||||
| <div> | ||||||
|
|
@@ -17,12 +25,12 @@ function BadgesComponent({ store, signals }) { | |||||
| visibility. | ||||||
| </strong> | ||||||
| <Margin top={2}> | ||||||
| {store.user.badges.map(badge => ( | ||||||
| {badges.map(badge => ( | ||||||
| <Badge | ||||||
| key={badge.id} | ||||||
| tooltip={false} | ||||||
| onClick={b => | ||||||
| signals.preferences.setBadgeVisibility({ | ||||||
| setBadgeVisibility({ | ||||||
| ...b, | ||||||
| visible: !b.visible, | ||||||
| }) | ||||||
|
|
@@ -37,4 +45,3 @@ function BadgesComponent({ store, signals }) { | |||||
| ); | ||||||
| } | ||||||
|
|
||||||
| export const Badges = inject('store', 'signals')(observer(BadgesComponent)); | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For types we don't need to use named imports, we can just pull it off React