-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subscriptions): change texts (#372)
* fix(ScreenTitles): change values * fix(NotificationSubscriptionScreen): changed text * feat(contributors): send, receive and show nb of contributors in content
- Loading branch information
1 parent
c6cf6ed
commit 2d78982
Showing
39 changed files
with
317 additions
and
117 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
src/app/background/sagas/sendInstallationDetailsToOptions.saga.ts
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
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
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
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
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,42 @@ | ||
import { expect } from 'chai'; | ||
import { getOptionsTabs, getReadyTabs, getTabsList } from './tabs'; | ||
import { TabsState } from '../reducers/tabs.reducer'; | ||
|
||
interface StateWithTabs { | ||
tabs: TabsState; | ||
} | ||
|
||
describe('background > selectors > tabs', () => { | ||
const state: StateWithTabs = { | ||
tabs: { | ||
'1': { id: 1, url: 'someUrl', ready: true }, | ||
'2': { id: 2, url: 'someOtherUrl' }, | ||
'3': { id: 3, url: 'optionsUrl', options: true, ready: true } | ||
} | ||
}; | ||
|
||
describe('getTabsList', () => { | ||
it('returns all known tabs an an array', () => { | ||
expect(getTabsList(state)).to.eql([ | ||
{ id: 1, url: 'someUrl', ready: true }, | ||
{ id: 2, url: 'someOtherUrl' }, | ||
{ id: 3, url: 'optionsUrl', options: true, ready: true } | ||
]); | ||
}); | ||
}); | ||
describe('getReadyTabs', () => { | ||
it('returns all tabs that are marked ready', () => { | ||
expect(getReadyTabs(state)).to.eql([ | ||
{ id: 1, url: 'someUrl', ready: true }, | ||
{ id: 3, url: 'optionsUrl', options: true, ready: true } | ||
]); | ||
}); | ||
}); | ||
describe('getOptionsTabs', () => { | ||
it('returns all options tabs', () => { | ||
expect(getOptionsTabs(state)).to.eql([ | ||
{ id: 3, url: 'optionsUrl', options: true, ready: true } | ||
]); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { BackgroundState } from '../reducers'; | ||
import { TabsState } from '../reducers/tabs.reducer'; | ||
import { createSelector } from 'reselect'; | ||
import Tab from '../../lmem/Tab'; | ||
|
||
export const getTabs = (state: BackgroundState): TabsState => state.tabs; | ||
import * as R from 'ramda'; | ||
import { isOptionsTab, isTabReady } from 'app/lmem/tab'; | ||
import { TabsState } from '../reducers/tabs.reducer'; | ||
|
||
export const isOptionsTab = (tab: Tab) => tab.options === true; | ||
export const getTabs = (state: { tabs: TabsState }): TabsState => state.tabs; | ||
|
||
export const getOptionsTab = createSelector( | ||
export const getTabsList = createSelector( | ||
[getTabs], | ||
tabs => | ||
Object.keys(tabs) | ||
.map(tabId => tabs[tabId]) | ||
.find(isOptionsTab) | ||
Object.values | ||
); | ||
|
||
export const getReadyTabs = createSelector( | ||
[getTabsList], | ||
R.filter(isTabReady) | ||
); | ||
|
||
export const getOptionsTabs = createSelector( | ||
[getTabsList], | ||
R.filter(isOptionsTab) | ||
); |
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
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
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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import styled from 'styled-components'; | ||
|
||
export default styled.article` | ||
const Container = styled.article` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
padding: 22px 37px 40px; | ||
padding: 22px 20px 40px; | ||
text-align: center; | ||
& svg { | ||
margin-bottom: 35px; | ||
} | ||
`; | ||
|
||
export default Container; |
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 |
---|---|---|
@@ -1,46 +1,44 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import BorderButton from 'components/atoms/Button/BorderButton/BorderButton'; | ||
import withTitle from 'app/hocs/withTitle'; | ||
import Illustration from './Illustration'; | ||
import Container from './Container'; | ||
import SubscriptionsData from './SubscriptionsData'; | ||
import withConnect from './withConnect'; | ||
import { compose } from 'redux'; | ||
|
||
interface SubscriptionsScreenProps { | ||
optionsRequested: () => void; | ||
nbTotalContributors?: number; | ||
nbSubscribedContributors?: number; | ||
} | ||
|
||
const SubscriptionInfo = styled.div` | ||
margin-bottom: 35px; | ||
font-size: 18px; | ||
`; | ||
|
||
const pluralize = (nb: number | undefined) => (nb && nb > 1 ? 's' : ''); | ||
|
||
export const Subscriptions = ({ | ||
optionsRequested | ||
optionsRequested, | ||
nbSubscribedContributors, | ||
nbTotalContributors | ||
}: SubscriptionsScreenProps) => ( | ||
<Container> | ||
<Illustration /> | ||
|
||
<SubscriptionsData> | ||
<div> | ||
<span>5</span> | ||
<span>Abonnements</span> | ||
</div> | ||
<div> | ||
<span>3</span> | ||
<span> | ||
Notices | ||
<br /> | ||
publiées | ||
</span> | ||
</div> | ||
<div> | ||
<span>155</span> | ||
<span>Vues</span> | ||
</div> | ||
</SubscriptionsData> | ||
<SubscriptionInfo> | ||
Votre extension est abonnée à <strong>{nbSubscribedContributors}</strong>{' '} | ||
contributeur{pluralize(nbSubscribedContributors)} sur{' '} | ||
<strong>{nbTotalContributors}</strong> possibles. | ||
</SubscriptionInfo> | ||
|
||
<BorderButton onClick={optionsRequested}>Gérer</BorderButton> | ||
</Container> | ||
); | ||
|
||
export default compose( | ||
withConnect, | ||
withTitle<SubscriptionsScreenProps>('Abonnement') | ||
withTitle<SubscriptionsScreenProps>('Abonnements') | ||
)(Subscriptions); |
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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import { connect } from 'react-redux'; | ||
import { optionsRequested } from 'app/actions/options'; | ||
import { ContentState } from '../../store'; | ||
import { | ||
getNbSubscribedContributors, | ||
getNbTotalContributors | ||
} from '../../selectors/contributors.selectors'; | ||
|
||
const mapStateToProps = (state: ContentState) => ({ | ||
nbTotalContributors: getNbTotalContributors(state), | ||
nbSubscribedContributors: getNbSubscribedContributors(state) | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
optionsRequested: optionsRequested | ||
}; | ||
|
||
export default connect( | ||
null, | ||
mapStateToProps, | ||
mapDispatchToProps | ||
); |
Oops, something went wrong.