eslint --fix

This commit is contained in:
Alex Gleason 2020-04-14 13:44:40 -05:00
parent 5cf3affcd8
commit fc72e39ff4
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
101 changed files with 1014 additions and 969 deletions

View File

@ -14,7 +14,7 @@ export function createAuthApp() {
// TODO: Add commit hash to client_name // TODO: Add commit hash to client_name
client_name: `SoapboxFE_${(new Date()).toISOString()}`, client_name: `SoapboxFE_${(new Date()).toISOString()}`,
redirect_uris: 'urn:ietf:wg:oauth:2.0:oob', redirect_uris: 'urn:ietf:wg:oauth:2.0:oob',
scopes: 'read write follow push admin' scopes: 'read write follow push admin',
}).then(response => { }).then(response => {
dispatch(authAppCreated(response.data)); dispatch(authAppCreated(response.data));
}).then(() => { }).then(() => {
@ -23,12 +23,12 @@ export function createAuthApp() {
client_id: app.get('client_id'), client_id: app.get('client_id'),
client_secret: app.get('client_secret'), client_secret: app.get('client_secret'),
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
grant_type: 'client_credentials' grant_type: 'client_credentials',
}); });
}).then(response => { }).then(response => {
dispatch(authAppAuthorized(response.data)); dispatch(authAppAuthorized(response.data));
}); });
} };
} }
export function logIn(username, password) { export function logIn(username, password) {
@ -40,14 +40,14 @@ export function logIn(username, password) {
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
grant_type: 'password', grant_type: 'password',
username: username, username: username,
password: password password: password,
}).then(response => { }).then(response => {
dispatch(authLoggedIn(response.data)); dispatch(authLoggedIn(response.data));
}).catch((error) => { }).catch((error) => {
dispatch(showAlert('Login failed.', 'Invalid username or password.')); dispatch(showAlert('Login failed.', 'Invalid username or password.'));
throw error; throw error;
}); });
} };
} }
export function logOut() { export function logOut() {
@ -60,20 +60,20 @@ export function logOut() {
export function authAppCreated(app) { export function authAppCreated(app) {
return { return {
type: AUTH_APP_CREATED, type: AUTH_APP_CREATED,
app app,
}; };
} }
export function authAppAuthorized(app) { export function authAppAuthorized(app) {
return { return {
type: AUTH_APP_AUTHORIZED, type: AUTH_APP_AUTHORIZED,
app app,
}; };
} }
export function authLoggedIn(user) { export function authLoggedIn(user) {
return { return {
type: AUTH_LOGGED_IN, type: AUTH_LOGGED_IN,
user user,
}; };
} }

View File

@ -43,7 +43,7 @@ export const create = (title, description, coverImage, routerHistory) => (dispat
dispatch(createSuccess(data)); dispatch(createSuccess(data));
routerHistory.push(`/groups/${data.id}`); routerHistory.push(`/groups/${data.id}`);
}).catch(err => dispatch(createFail(err))); }).catch(err => dispatch(createFail(err)));
}; };
export const createRequest = id => ({ export const createRequest = id => ({
@ -78,7 +78,7 @@ export const update = (groupId, title, description, coverImage, routerHistory) =
dispatch(updateSuccess(data)); dispatch(updateSuccess(data));
routerHistory.push(`/groups/${data.id}`); routerHistory.push(`/groups/${data.id}`);
}).catch(err => dispatch(updateFail(err))); }).catch(err => dispatch(updateFail(err)));
}; };
export const updateRequest = id => ({ export const updateRequest = id => ({
@ -103,7 +103,7 @@ export const changeValue = (field, value) => ({
}); });
export const reset = () => ({ export const reset = () => ({
type: GROUP_EDITOR_RESET type: GROUP_EDITOR_RESET,
}); });
export const setUp = (group) => ({ export const setUp = (group) => ({

View File

@ -193,7 +193,7 @@ export function joinGroupRequest(id) {
export function joinGroupSuccess(relationship) { export function joinGroupSuccess(relationship) {
return { return {
type: GROUP_JOIN_SUCCESS, type: GROUP_JOIN_SUCCESS,
relationship relationship,
}; };
}; };

View File

@ -5,7 +5,7 @@ export const INSTANCE_FAIL = 'INSTANCE_FAIL';
export function fetchInstance() { export function fetchInstance() {
return (dispatch, getState) => { return (dispatch, getState) => {
api(getState).get(`/api/v1/instance`).then(response => { api(getState).get('/api/v1/instance').then(response => {
dispatch(importInstance(response.data)); dispatch(importInstance(response.data));
}).catch(error => { }).catch(error => {
dispatch(instanceFail(error)); dispatch(instanceFail(error));
@ -16,7 +16,7 @@ export function fetchInstance() {
export function importInstance(instance) { export function importInstance(instance) {
return { return {
type: INSTANCE_IMPORT, type: INSTANCE_IMPORT,
instance instance,
}; };
} }

View File

@ -9,9 +9,9 @@ export const ME_FETCH_SKIP = 'ME_FETCH_SKIP';
export function fetchMe() { export function fetchMe() {
return (dispatch, getState) => { return (dispatch, getState) => {
const accessToken = getState().getIn(['auth', 'user', 'access_token']); const accessToken = getState().getIn(['auth', 'user', 'access_token']);
if (!accessToken) return dispatch({type: ME_FETCH_SKIP}); if (!accessToken) return dispatch({ type: ME_FETCH_SKIP });
dispatch(fetchMeRequest()); dispatch(fetchMeRequest());
api(getState).get(`/api/v1/accounts/verify_credentials`).then(response => { api(getState).get('/api/v1/accounts/verify_credentials').then(response => {
dispatch(fetchMeSuccess(response.data)); dispatch(fetchMeSuccess(response.data));
dispatch(importFetchedAccount(response.data)); dispatch(importFetchedAccount(response.data));
}).catch(error => { }).catch(error => {
@ -29,7 +29,7 @@ export function fetchMeRequest() {
export function fetchMeSuccess(me) { export function fetchMeSuccess(me) {
return { return {
type: ME_FETCH_SUCCESS, type: ME_FETCH_SUCCESS,
me me,
}; };
} }

View File

@ -47,7 +47,7 @@ const fetchRelatedRelationships = (dispatch, notifications) => {
export function initializeNotifications() { export function initializeNotifications() {
return { return {
type: NOTIFICATIONS_INITIALIZE type: NOTIFICATIONS_INITIALIZE,
}; };
} }
@ -115,11 +115,10 @@ export function updateNotificationsQueue(notification, intlMessages, intlLocale,
intlMessages, intlMessages,
intlLocale, intlLocale,
}); });
} } else {
else {
dispatch(updateNotifications(notification, intlMessages, intlLocale)); dispatch(updateNotifications(notification, intlMessages, intlLocale));
} }
} };
}; };
export function dequeueNotifications() { export function dequeueNotifications() {
@ -129,13 +128,11 @@ export function dequeueNotifications() {
if (totalQueuedNotificationsCount == 0) { if (totalQueuedNotificationsCount == 0) {
return; return;
} } else if (totalQueuedNotificationsCount > 0 && totalQueuedNotificationsCount <= MAX_QUEUED_NOTIFICATIONS) {
else if (totalQueuedNotificationsCount > 0 && totalQueuedNotificationsCount <= MAX_QUEUED_NOTIFICATIONS) {
queuedNotifications.forEach(block => { queuedNotifications.forEach(block => {
dispatch(updateNotifications(block.notification, block.intlMessages, block.intlLocale)); dispatch(updateNotifications(block.notification, block.intlMessages, block.intlLocale));
}); });
} } else {
else {
dispatch(expandNotifications()); dispatch(expandNotifications());
} }
@ -143,7 +140,7 @@ export function dequeueNotifications() {
type: NOTIFICATIONS_DEQUEUE, type: NOTIFICATIONS_DEQUEUE,
}); });
dispatch(markReadNotifications()); dispatch(markReadNotifications());
} };
}; };
const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS(); const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
@ -240,7 +237,7 @@ export function scrollTopNotifications(top) {
top, top,
}); });
dispatch(markReadNotifications()); dispatch(markReadNotifications());
} };
} }
export function setFilter (filterType) { export function setFilter (filterType) {
@ -262,12 +259,12 @@ export function markReadNotifications() {
const last_read = getState().getIn(['notifications', 'lastRead']); const last_read = getState().getIn(['notifications', 'lastRead']);
if (top_notification && top_notification > last_read) { if (top_notification && top_notification > last_read) {
api(getState).post('/api/v1/notifications/mark_read', {id: top_notification}).then(response => { api(getState).post('/api/v1/notifications/mark_read', { id: top_notification }).then(response => {
dispatch({ dispatch({
type: NOTIFICATIONS_MARK_READ, type: NOTIFICATIONS_MARK_READ,
notification: top_notification, notification: top_notification,
}); });
}); });
} }
} };
} }

View File

@ -5,7 +5,7 @@ export const PATRON_FUNDING_FETCH_FAIL = 'PATRON_FUNDING_FETCH_FAIL';
export function fetchFunding() { export function fetchFunding() {
return (dispatch, getState) => { return (dispatch, getState) => {
api(getState).get(`/patron/v1/funding`).then(response => { api(getState).get('/patron/v1/funding').then(response => {
dispatch(importFetchedFunding(response.data)); dispatch(importFetchedFunding(response.data));
}).then(() => { }).then(() => {
dispatch(fetchFundingSuccess()); dispatch(fetchFundingSuccess());
@ -18,7 +18,7 @@ export function fetchFunding() {
export function importFetchedFunding(funding) { export function importFetchedFunding(funding) {
return { return {
type: PATRON_FUNDING_IMPORT, type: PATRON_FUNDING_IMPORT,
funding funding,
}; };
} }

View File

@ -5,7 +5,7 @@ export const SOAPBOX_CONFIG_FAIL = 'SOAPBOX_CONFIG_FAIL';
export function fetchSoapboxConfig() { export function fetchSoapboxConfig() {
return (dispatch, getState) => { return (dispatch, getState) => {
api(getState).get(`/soapbox/soapbox.json`).then(response => { api(getState).get('/soapbox/soapbox.json').then(response => {
dispatch(importSoapboxConfig(response.data)); dispatch(importSoapboxConfig(response.data));
}).catch(error => { }).catch(error => {
dispatch(soapboxConfigFail(error)); dispatch(soapboxConfigFail(error));
@ -16,7 +16,7 @@ export function fetchSoapboxConfig() {
export function importSoapboxConfig(soapboxConfig) { export function importSoapboxConfig(soapboxConfig) {
return { return {
type: SOAPBOX_CONFIG_IMPORT, type: SOAPBOX_CONFIG_IMPORT,
soapboxConfig soapboxConfig,
}; };
} }

View File

@ -45,7 +45,7 @@ export function updateTimelineQueue(timeline, status, accept) {
timeline, timeline,
status, status,
}); });
} };
}; };
export function dequeueTimeline(timeline, expandFunc, optionalExpandArgs) { export function dequeueTimeline(timeline, expandFunc, optionalExpandArgs) {
@ -57,27 +57,22 @@ export function dequeueTimeline(timeline, expandFunc, optionalExpandArgs) {
if (totalQueuedItemsCount == 0) { if (totalQueuedItemsCount == 0) {
return; return;
} } else if (totalQueuedItemsCount > 0 && totalQueuedItemsCount <= MAX_QUEUED_ITEMS) {
else if (totalQueuedItemsCount > 0 && totalQueuedItemsCount <= MAX_QUEUED_ITEMS) {
queuedItems.forEach(status => { queuedItems.forEach(status => {
dispatch(updateTimeline(timeline, status.toJS(), null)); dispatch(updateTimeline(timeline, status.toJS(), null));
}); });
} } else {
else {
if (typeof expandFunc === 'function') { if (typeof expandFunc === 'function') {
dispatch(clearTimeline(timeline)); dispatch(clearTimeline(timeline));
expandFunc(); expandFunc();
} } else {
else {
if (timeline === 'home') { if (timeline === 'home') {
dispatch(clearTimeline(timeline)); dispatch(clearTimeline(timeline));
dispatch(expandHomeTimeline(optionalExpandArgs)); dispatch(expandHomeTimeline(optionalExpandArgs));
} } else if (timeline === 'community') {
else if (timeline === 'community') {
dispatch(clearTimeline(timeline)); dispatch(clearTimeline(timeline));
dispatch(expandCommunityTimeline(optionalExpandArgs)); dispatch(expandCommunityTimeline(optionalExpandArgs));
} } else {
else {
shouldDispatchDequeue = false; shouldDispatchDequeue = false;
} }
} }
@ -89,7 +84,7 @@ export function dequeueTimeline(timeline, expandFunc, optionalExpandArgs) {
type: TIMELINE_DEQUEUE, type: TIMELINE_DEQUEUE,
timeline, timeline,
}); });
} };
}; };
export function deleteFromTimelines(id) { export function deleteFromTimelines(id) {

View File

@ -22,7 +22,7 @@ export default class DisplayName extends React.PureComponent {
<bdi key={a.get('id')}> <bdi key={a.get('id')}>
<strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} /> <strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} />
</bdi>, </bdi>,
a.get('is_verified') && <VerificationBadge /> a.get('is_verified') && <VerificationBadge />,
]).reduce((prev, cur) => [prev, ', ', cur]); ]).reduce((prev, cur) => [prev, ', ', cur]);
if (others.size - 2 > 0) { if (others.size - 2 > 0) {

View File

@ -135,7 +135,8 @@ class DropdownMenu extends React.PureComponent {
onKeyDown={this.handleItemKeyDown} onKeyDown={this.handleItemKeyDown}
data-index={i} data-index={i}
target={newTab ? '_blank' : null} target={newTab ? '_blank' : null}
data-method={isLogout ? 'delete' : null}> data-method={isLogout ? 'delete' : null}
>
{text} {text}
</a> </a>
</li> </li>

View File

@ -41,9 +41,9 @@ export default class ExtendedVideoPlayer extends React.PureComponent {
render () { render () {
const { src, muted, controls, alt } = this.props; const { src, muted, controls, alt } = this.props;
let conditionalAttributes = {} let conditionalAttributes = {};
if (isIOS()) { if (isIOS()) {
conditionalAttributes.playsInline = '1' conditionalAttributes.playsInline = '1';
} }
return ( return (

View File

@ -119,34 +119,34 @@ class ColumnHeader extends React.PureComponent {
let expandedContent = null; let expandedContent = null;
if ((expandedFor === 'lists' || activeItem === 'lists') && lists) { if ((expandedFor === 'lists' || activeItem === 'lists') && lists) {
expandedContent = lists.map(list => expandedContent = lists.map(list =>
<Link (<Link
key={list.get('id')} key={list.get('id')}
to={`/list/${list.get('id')}`} to={`/list/${list.get('id')}`}
className={ className={
classNames('btn btn--sub grouped', { classNames('btn btn--sub grouped', {
'active': list.get('id') === activeSubItem 'active': list.get('id') === activeSubItem,
}) })
} }
> >
{list.get('title')} {list.get('title')}
</Link> </Link>)
) );
} }
return ( return (
<div className={wrapperClassName}> <div className={wrapperClassName}>
<h1 className={buttonClassName}> <h1 className={buttonClassName}>
<Link to='/' className={classNames('btn grouped', {'active': 'home' === activeItem})}> <Link to='/' className={classNames('btn grouped', { 'active': 'home' === activeItem })}>
<Icon id='home' fixedWidth className='column-header__icon' /> <Icon id='home' fixedWidth className='column-header__icon' />
{formatMessage(messages.homeTitle)} {formatMessage(messages.homeTitle)}
</Link> </Link>
<Link to='/timeline/local' className={classNames('btn grouped', {'active': 'local' === activeItem})}> <Link to='/timeline/local' className={classNames('btn grouped', { 'active': 'local' === activeItem })}>
<Icon id='site-icon' fixedWidth className='column-header__icon' /> <Icon id='site-icon' fixedWidth className='column-header__icon' />
{siteTitle} {siteTitle}
</Link> </Link>
<Link to='/timeline/fediverse' className={classNames('btn grouped', {'active': 'fediverse' === activeItem})}> <Link to='/timeline/fediverse' className={classNames('btn grouped', { 'active': 'fediverse' === activeItem })}>
<Icon id='fediverse' fixedWidth className='column-header__icon' /> <Icon id='fediverse' fixedWidth className='column-header__icon' />
{formatMessage(messages.fediverseTitle)} {formatMessage(messages.fediverseTitle)}
</Link> </Link>
@ -171,6 +171,7 @@ class ColumnHeader extends React.PureComponent {
</div> </div>
); );
} }
} }
export default injectIntl(connect(mapStateToProps)(ColumnHeader)); export default injectIntl(connect(mapStateToProps)(ColumnHeader));

View File

@ -16,7 +16,7 @@ export default class Icon extends React.PureComponent {
// tag. There is a common adblocker rule which hides elements with // tag. There is a common adblocker rule which hides elements with
// alt='retweet' unless the domain is twitter.com. This should // alt='retweet' unless the domain is twitter.com. This should
// change what screenreaders call it as well. // change what screenreaders call it as well.
var alt_id = (id == "retweet") ? "repost" : id; var alt_id = (id == 'retweet') ? 'repost' : id;
return ( return (
<i role='img' alt={alt_id} className={classNames('fa', `fa-${id}`, className, { 'fa-fw': fixedWidth })} {...other} /> <i role='img' alt={alt_id} className={classNames('fa', `fa-${id}`, className, { 'fa-fw': fixedWidth })} {...other} />
); );

View File

@ -10,7 +10,7 @@ const IconWithBadge = ({ id, count, className }) => {
<i className='icon-with-badge'> <i className='icon-with-badge'>
{count > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(count)}</i>} {count > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(count)}</i>}
</i> </i>
) );
}; };
IconWithBadge.propTypes = { IconWithBadge.propTypes = {

View File

@ -178,12 +178,12 @@ class Item extends React.PureComponent {
</a> </a>
); );
} else if (attachment.get('type') === 'gifv') { } else if (attachment.get('type') === 'gifv') {
let conditionalAttributes = {} let conditionalAttributes = {};
if (isIOS()) { if (isIOS()) {
conditionalAttributes.playsInline = '1' conditionalAttributes.playsInline = '1';
} }
if (autoPlayGif) { if (autoPlayGif) {
conditionalAttributes.autoPlay = '1' conditionalAttributes.autoPlay = '1';
} }
thumbnail = ( thumbnail = (
@ -329,12 +329,12 @@ class MediaGallery extends React.PureComponent {
if (isPortrait(ar1) && isPortrait(ar2)) { if (isPortrait(ar1) && isPortrait(ar2)) {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: '100%', r: '2px' }, { w: 50, h: '100%', r: '2px' },
{ w: 50, h: '100%', l: '2px' } { w: 50, h: '100%', l: '2px' },
]; ];
} else if (isPanoramic(ar1) && isPanoramic(ar2)) { } else if (isPanoramic(ar1) && isPanoramic(ar2)) {
itemsDimensions = [ itemsDimensions = [
{ w: 100, h: panoSize_px, b: '2px' }, { w: 100, h: panoSize_px, b: '2px' },
{ w: 100, h: panoSize_px, t: '2px' } { w: 100, h: panoSize_px, t: '2px' },
]; ];
} else if ( } else if (
(isPanoramic(ar1) && isPortrait(ar2)) || (isPanoramic(ar1) && isPortrait(ar2)) ||
@ -355,7 +355,7 @@ class MediaGallery extends React.PureComponent {
} else { } else {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: '100%', r: '2px' }, { w: 50, h: '100%', r: '2px' },
{ w: 50, h: '100%', l: '2px' } { w: 50, h: '100%', l: '2px' },
]; ];
} }
} else if (size == 3) { } else if (size == 3) {
@ -371,19 +371,19 @@ class MediaGallery extends React.PureComponent {
if (isPanoramic(ar1) && isNonConformingRatio(ar2) && isNonConformingRatio(ar3)) { if (isPanoramic(ar1) && isNonConformingRatio(ar2) && isNonConformingRatio(ar3)) {
itemsDimensions = [ itemsDimensions = [
{ w: 100, h: `50%`, b: '2px' }, { w: 100, h: '50%', b: '2px' },
{ w: 50, h: '50%', t: '2px', r: '2px' }, { w: 50, h: '50%', t: '2px', r: '2px' },
{ w: 50, h: '50%', t: '2px', l: '2px' } { w: 50, h: '50%', t: '2px', l: '2px' },
]; ];
} else if (isPanoramic(ar1) && isPanoramic(ar2) && isPanoramic(ar3)) { } else if (isPanoramic(ar1) && isPanoramic(ar2) && isPanoramic(ar3)) {
itemsDimensions = [ itemsDimensions = [
{ w: 100, h: panoSize_px, b: '4px' }, { w: 100, h: panoSize_px, b: '4px' },
{ w: 100, h: panoSize_px }, { w: 100, h: panoSize_px },
{ w: 100, h: panoSize_px, t: '4px' } { w: 100, h: panoSize_px, t: '4px' },
]; ];
} else if (isPortrait(ar1) && isNonConformingRatio(ar2) && isNonConformingRatio(ar3)) { } else if (isPortrait(ar1) && isNonConformingRatio(ar2) && isNonConformingRatio(ar3)) {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: `100%`, r: '2px' }, { w: 50, h: '100%', r: '2px' },
{ w: 50, h: '50%', b: '2px', l: '2px' }, { w: 50, h: '50%', b: '2px', l: '2px' },
{ w: 50, h: '50%', t: '2px', l: '2px' }, { w: 50, h: '50%', t: '2px', l: '2px' },
]; ];
@ -391,7 +391,7 @@ class MediaGallery extends React.PureComponent {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: '50%', b: '2px', r: '2px' }, { w: 50, h: '50%', b: '2px', r: '2px' },
{ w: 50, h: '50%', l: '-2px', b: '-2px', pos: 'absolute', float: 'none' }, { w: 50, h: '50%', l: '-2px', b: '-2px', pos: 'absolute', float: 'none' },
{ w: 50, h: `100%`, r: '-2px', t: '0px', b: '0px', pos: 'absolute', float: 'none' } { w: 50, h: '100%', r: '-2px', t: '0px', b: '0px', pos: 'absolute', float: 'none' },
]; ];
} else if ( } else if (
(isNonConformingRatio(ar1) && isPortrait(ar2) && isNonConformingRatio(ar3)) || (isNonConformingRatio(ar1) && isPortrait(ar2) && isNonConformingRatio(ar3)) ||
@ -399,8 +399,8 @@ class MediaGallery extends React.PureComponent {
) { ) {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: '50%', b: '2px', r: '2px' }, { w: 50, h: '50%', b: '2px', r: '2px' },
{ w: 50, h: `100%`, l: '2px', float: 'right' }, { w: 50, h: '100%', l: '2px', float: 'right' },
{ w: 50, h: '50%', t: '2px', r: '2px' } { w: 50, h: '50%', t: '2px', r: '2px' },
]; ];
} else if ( } else if (
(isPanoramic(ar1) && isPanoramic(ar2) && isNonConformingRatio(ar3)) || (isPanoramic(ar1) && isPanoramic(ar2) && isNonConformingRatio(ar3)) ||
@ -409,7 +409,7 @@ class MediaGallery extends React.PureComponent {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: panoSize_px, b: '2px', r: '2px' }, { w: 50, h: panoSize_px, b: '2px', r: '2px' },
{ w: 50, h: panoSize_px, b: '2px', l: '2px' }, { w: 50, h: panoSize_px, b: '2px', l: '2px' },
{ w: 100, h: `${width - panoSize}px`, t: '2px' } { w: 100, h: `${width - panoSize}px`, t: '2px' },
]; ];
} else if ( } else if (
(isNonConformingRatio(ar1) && isPanoramic(ar2) && isPanoramic(ar3)) || (isNonConformingRatio(ar1) && isPanoramic(ar2) && isPanoramic(ar3)) ||
@ -424,7 +424,7 @@ class MediaGallery extends React.PureComponent {
itemsDimensions = [ itemsDimensions = [
{ w: 50, h: '50%', b: '2px', r: '2px' }, { w: 50, h: '50%', b: '2px', r: '2px' },
{ w: 50, h: '50%', b: '2px', l: '2px' }, { w: 50, h: '50%', b: '2px', l: '2px' },
{ w: 100, h: `50%`, t: '2px' } { w: 100, h: '50%', t: '2px' },
]; ];
} }
} else if (size == 4) { } else if (size == 4) {
@ -471,7 +471,7 @@ class MediaGallery extends React.PureComponent {
{ w: 67, h: '100%', r: '2px' }, { w: 67, h: '100%', r: '2px' },
{ w: 33, h: '33%', b: '4px', l: '2px' }, { w: 33, h: '33%', b: '4px', l: '2px' },
{ w: 33, h: '33%', l: '2px' }, { w: 33, h: '33%', l: '2px' },
{ w: 33, h: '33%', t: '4px', l: '2px' } { w: 33, h: '33%', t: '4px', l: '2px' },
]; ];
} else { } else {
itemsDimensions = [ itemsDimensions = [

View File

@ -19,7 +19,7 @@ const mapDispatchToProps = (dispatch) => ({
}, },
onCancelReplyCompose() { onCancelReplyCompose() {
dispatch(cancelReplyCompose()); dispatch(cancelReplyCompose());
} },
}); });
class ModalRoot extends React.PureComponent { class ModalRoot extends React.PureComponent {
@ -57,8 +57,7 @@ class ModalRoot extends React.PureComponent {
onConfirm: () => onCancelReplyCompose(), onConfirm: () => onCancelReplyCompose(),
onCancel: () => onOpenModal('COMPOSE'), onCancel: () => onOpenModal('COMPOSE'),
}); });
} } else {
else {
this.props.onClose(); this.props.onClose();
} }
}; };
@ -124,6 +123,7 @@ class ModalRoot extends React.PureComponent {
</div> </div>
); );
} }
} }
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ModalRoot)); export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ModalRoot));

View File

@ -3,13 +3,15 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
export default class ProgressBar extends ImmutablePureComponent { export default class ProgressBar extends ImmutablePureComponent {
render() { render() {
const { progress } = this.props; const { progress } = this.props;
return ( return (
<div className='progress-bar'> <div className='progress-bar'>
<div className='progress-bar__progress' style={{width: `${Math.floor(progress*100)}%`}}></div> <div className='progress-bar__progress' style={{ width: `${Math.floor(progress*100)}%` }} />
</div> </div>
) );
} }
}; };

View File

@ -27,11 +27,11 @@ const messages = defineMessages({
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' }, filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
lists: { id: 'column.lists', defaultMessage: 'Lists', }, lists: { id: 'column.lists', defaultMessage: 'Lists' },
apps: { id: 'tabs_bar.apps', defaultMessage: 'Apps' }, apps: { id: 'tabs_bar.apps', defaultMessage: 'Apps' },
news: { id: 'tabs_bar.news', defaultMessage: 'News' }, news: { id: 'tabs_bar.news', defaultMessage: 'News' },
donate: { id: 'donate', defaultMessage: 'Donate' }, donate: { id: 'donate', defaultMessage: 'Donate' },
}) });
const mapStateToProps = state => { const mapStateToProps = state => {
const me = state.get('me'); const me = state.get('me');
@ -92,7 +92,7 @@ class SidebarMenu extends ImmutablePureComponent {
</Link> </Link>
</div> </div>
<div className='sidebar-menu-profile__name'> <div className='sidebar-menu-profile__name'>
<DisplayName account={account}/> <DisplayName account={account} />
</div> </div>
<div className='sidebar-menu-profile__stats'> <div className='sidebar-menu-profile__stats'>
@ -113,7 +113,7 @@ class SidebarMenu extends ImmutablePureComponent {
<Icon id='user' /> <Icon id='user' />
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.profile)}</span> <span className='sidebar-menu-item__title'>{intl.formatMessage(messages.profile)}</span>
</NavLink> </NavLink>
<NavLink className='sidebar-menu-item' to={`/messages`} onClick={onClose}> <NavLink className='sidebar-menu-item' to={'/messages'} onClick={onClose}>
<Icon id='envelope' /> <Icon id='envelope' />
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.messages)}</span> <span className='sidebar-menu-item__title'>{intl.formatMessage(messages.messages)}</span>
</NavLink> </NavLink>

View File

@ -303,20 +303,22 @@ class Status extends ImmutablePureComponent {
prepend = ( prepend = (
<div className='status__prepend'> <div className='status__prepend'>
<div className='status__prepend-icon-wrapper'><Icon id='retweet' className='status__prepend-icon' fixedWidth /></div> <div className='status__prepend-icon-wrapper'><Icon id='retweet' className='status__prepend-icon' fixedWidth /></div>
<FormattedMessage id='status.reblogged_by' defaultMessage='{name} reposted' values={{ <FormattedMessage
id='status.reblogged_by' defaultMessage='{name} reposted' values={{
name: <NavLink to={`/@${status.getIn(['account', 'acct'])}`} className='status__display-name muted'> name: <NavLink to={`/@${status.getIn(['account', 'acct'])}`} className='status__display-name muted'>
<bdi> <bdi>
<strong dangerouslySetInnerHTML={display_name_html} /> <strong dangerouslySetInnerHTML={display_name_html} />
</bdi> </bdi>
</NavLink> </NavLink>,
}} /> }}
/>
</div> </div>
); );
rebloggedByText = intl.formatMessage({ id: 'status.reblogged_by', defaultMessage: '{name} reposted' }, { name: status.getIn(['account', 'acct']) }); rebloggedByText = intl.formatMessage({ id: 'status.reblogged_by', defaultMessage: '{name} reposted' }, { name: status.getIn(['account', 'acct']) });
account = status.get('account'); account = status.get('account');
reblogContent = status.get('contentHtml') reblogContent = status.get('contentHtml');
status = status.get('reblog'); status = status.get('reblog');
} }

View File

@ -298,6 +298,7 @@ class StatusActionBar extends ImmutablePureComponent {
</div> </div>
); );
} }
} }
const mapStateToProps = state => { const mapStateToProps = state => {
@ -314,4 +315,4 @@ const mapDispatchToProps = (dispatch) => ({
export default injectIntl( export default injectIntl(
connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true } connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true }
)(StatusActionBar)) )(StatusActionBar));

View File

@ -141,7 +141,7 @@ export default class StatusList extends ImmutablePureComponent {
<TimelineQueueButtonHeader key='timeline-queue-button-header' onClick={this.handleDequeueTimeline} count={totalQueuedItemsCount} itemType='post' />, <TimelineQueueButtonHeader key='timeline-queue-button-header' onClick={this.handleDequeueTimeline} count={totalQueuedItemsCount} itemType='post' />,
<ScrollableList key='scrollable-list' {...other} isLoading={isLoading} showLoading={isLoading && statusIds.size === 0} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}> <ScrollableList key='scrollable-list' {...other} isLoading={isLoading} showLoading={isLoading && statusIds.size === 0} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}>
{scrollableContent} {scrollableContent}
</ScrollableList> </ScrollableList>,
]; ];
} }

View File

@ -5,6 +5,7 @@ import { shortNumberFormat } from '../utils/numbers';
import classNames from 'classnames'; import classNames from 'classnames';
export default class TimelineQueueButtonHeader extends React.PureComponent { export default class TimelineQueueButtonHeader extends React.PureComponent {
static propTypes = { static propTypes = {
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
count: PropTypes.number, count: PropTypes.number,
@ -20,7 +21,7 @@ export default class TimelineQueueButtonHeader extends React.PureComponent {
const { count, itemType, onClick } = this.props; const { count, itemType, onClick } = this.props;
const classes = classNames('timeline-queue-header', { const classes = classNames('timeline-queue-header', {
'hidden': (count <= 0) 'hidden': (count <= 0),
}); });
return ( return (
@ -38,4 +39,5 @@ export default class TimelineQueueButtonHeader extends React.PureComponent {
</div> </div>
); );
} }
} }

View File

@ -2,8 +2,8 @@ import React from 'react';
import Icon from './icon'; import Icon from './icon';
const VerificationBadge = () => ( const VerificationBadge = () => (
<span className="verified-icon"> <span className='verified-icon'>
<span className="visuallyhidden">Verified Account</span> <span className='visuallyhidden'>Verified Account</span>
</span> </span>
); );

View File

@ -40,8 +40,8 @@ const mapStateToProps = (state) => {
return { return {
showIntroduction, showIntroduction,
me, me,
} };
} };
@connect(mapStateToProps) @connect(mapStateToProps)
class GabSocialMount extends React.PureComponent { class GabSocialMount extends React.PureComponent {

View File

@ -31,7 +31,7 @@ import { boostModal, deleteModal } from '../initial_state';
import { showAlertForError } from '../actions/alerts'; import { showAlertForError } from '../actions/alerts';
import { import {
createRemovedAccount, createRemovedAccount,
groupRemoveStatus groupRemoveStatus,
} from '../actions/groups'; } from '../actions/groups';
const messages = defineMessages({ const messages = defineMessages({

View File

@ -230,10 +230,10 @@ class Header extends ImmutablePureComponent {
if (!account) { if (!account) {
return ( return (
<div className='account__header'> <div className='account__header'>
<div className='account__header__image account__header__image--none'></div> <div className='account__header__image account__header__image--none' />
<div className='account__header__bar'> <div className='account__header__bar'>
<div className='account__header__extra'> <div className='account__header__extra'>
<div className='account__header__avatar'></div> <div className='account__header__avatar' />
</div> </div>
{ {
isSmallScreen && isSmallScreen &&
@ -296,15 +296,15 @@ class Header extends ImmutablePureComponent {
{ {
account.get('id') === me && account.get('id') === me &&
<div> <div>
<NavLink exact activeClassName='active' to={`/@${account.get('acct')}/favorites`} <NavLink
/* : TODO : title={intl.formatNumber(account.get('favourite_count'))} */ exact activeClassName='active' to={`/@${account.get('acct')}/favorites`}
> >
{ /* : TODO : shortNumberFormat(account.get('favourite_count')) */ } { /* : TODO : shortNumberFormat(account.get('favourite_count')) */ }
<span></span> <span></span>
<FormattedMessage id='navigation_bar.favourites' defaultMessage='Favorites' /> <FormattedMessage id='navigation_bar.favourites' defaultMessage='Favorites' />
</NavLink> </NavLink>
<NavLink exact activeClassName='active' to={`/@${account.get('acct')}/pins`} <NavLink
/* : TODO : title={intl.formatNumber(account.get('pinned_count'))} */ exact activeClassName='active' to={`/@${account.get('acct')}/pins`}
> >
{ /* : TODO : shortNumberFormat(account.get('pinned_count')) */ } { /* : TODO : shortNumberFormat(account.get('pinned_count')) */ }
<span></span> <span></span>
@ -327,9 +327,11 @@ class Header extends ImmutablePureComponent {
{actionBtn} {actionBtn}
{account.get('id') !== me && {account.get('id') !== me &&
<Button className='button button-alternative-2' onClick={this.props.onDirect}> <Button className='button button-alternative-2' onClick={this.props.onDirect}>
<FormattedMessage id='account.message' defaultMessage='Message' values={{ <FormattedMessage
name: account.get('acct') id='account.message' defaultMessage='Message' values={{
}} /> name: account.get('acct'),
}}
/>
</Button> </Button>
} }
<DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' /> <DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />

View File

@ -112,12 +112,12 @@ export default class MediaItem extends ImmutablePureComponent {
/> />
); );
} else if (['gifv', 'video'].indexOf(attachment.get('type')) !== -1) { } else if (['gifv', 'video'].indexOf(attachment.get('type')) !== -1) {
let conditionalAttributes = {} let conditionalAttributes = {};
if (isIOS()) { if (isIOS()) {
conditionalAttributes.playsInline = '1' conditionalAttributes.playsInline = '1';
} }
if (autoPlayGif) { if (autoPlayGif) {
conditionalAttributes.autoPlay = '1' conditionalAttributes.autoPlay = '1';
} }
thumbnail = ( thumbnail = (
<div className={classNames('media-gallery__gifv', { autoplay: autoPlayGif })}> <div className={classNames('media-gallery__gifv', { autoplay: autoPlayGif })}>

View File

@ -27,8 +27,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
let accountUsername = username; let accountUsername = username;
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} } else {
else {
let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
accountUsername = account ? account.getIn(['acct'], '') : ''; accountUsername = account ? account.getIn(['acct'], '') : '';
@ -69,6 +68,7 @@ class LoadMoreMedia extends ImmutablePureComponent {
/> />
); );
} }
} }
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@ -94,8 +94,7 @@ class AccountGallery extends ImmutablePureComponent {
if (accountId && accountId !== -1) { if (accountId && accountId !== -1) {
this.props.dispatch(fetchAccount(accountId)); this.props.dispatch(fetchAccount(accountId));
this.props.dispatch(expandAccountMediaTimeline(accountId)); this.props.dispatch(expandAccountMediaTimeline(accountId));
} } else {
else {
this.props.dispatch(fetchAccountByUsername(username)); this.props.dispatch(fetchAccountByUsername(username));
} }
} }
@ -190,7 +189,7 @@ class AccountGallery extends ImmutablePureComponent {
<Column> <Column>
<div className='slist slist--flex' onScroll={this.handleScroll}> <div className='slist slist--flex' onScroll={this.handleScroll}>
<div className='account__section-headline'> <div className='account__section-headline'>
<div style={{width: '100%', display: 'flex'}}> <div style={{ width: '100%', display: 'flex' }}>
<NavLink exact to={`/@${accountUsername}`}> <NavLink exact to={`/@${accountUsername}`}>
<FormattedMessage id='account.posts' defaultMessage='Posts' /> <FormattedMessage id='account.posts' defaultMessage='Posts' />
</NavLink> </NavLink>
@ -213,7 +212,7 @@ class AccountGallery extends ImmutablePureComponent {
{ {
attachments.size == 0 && attachments.size == 0 &&
<div className='empty-column-indicator'> <div className='empty-column-indicator'>
<FormattedMessage id='account_gallery.none' defaultMessage='No media to show.'/> <FormattedMessage id='account_gallery.none' defaultMessage='No media to show.' />
</div> </div>
} }

View File

@ -25,8 +25,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
let accountUsername = username; let accountUsername = username;
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} } else {
else {
let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
accountUsername = account ? account.getIn(['acct'], '') : ''; accountUsername = account ? account.getIn(['acct'], '') : '';
@ -79,8 +78,7 @@ class AccountTimeline extends ImmutablePureComponent {
} }
this.props.dispatch(expandAccountTimeline(accountId, { withReplies })); this.props.dispatch(expandAccountTimeline(accountId, { withReplies }));
} } else {
else {
this.props.dispatch(fetchAccountByUsername(username)); this.props.dispatch(fetchAccountByUsername(username));
} }
} }
@ -137,7 +135,7 @@ class AccountTimeline extends ImmutablePureComponent {
return ( return (
<Column> <Column>
<div className='account__section-headline'> <div className='account__section-headline'>
<div style={{width: '100%', display: 'flex'}}> <div style={{ width: '100%', display: 'flex' }}>
<NavLink exact to={`/@${accountUsername}`}> <NavLink exact to={`/@${accountUsername}`}>
<FormattedMessage id='account.posts' defaultMessage='Posts' /> <FormattedMessage id='account.posts' defaultMessage='Posts' />
</NavLink> </NavLink>

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux' import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { createAuthApp, logIn } from 'gabsocial/actions/auth'; import { createAuthApp, logIn } from 'gabsocial/actions/auth';
import { fetchMe } from 'gabsocial/actions/me'; import { fetchMe } from 'gabsocial/actions/me';
@ -7,9 +7,10 @@ import { Link } from 'react-router-dom';
export default @connect() export default @connect()
class LoginForm extends ImmutablePureComponent { class LoginForm extends ImmutablePureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {isLoading: false}; this.state = { isLoading: false };
} }
componentWillMount() { componentWillMount() {
@ -28,9 +29,9 @@ class LoginForm extends ImmutablePureComponent {
dispatch(logIn(username, password)).then(() => { dispatch(logIn(username, password)).then(() => {
return dispatch(fetchMe()); return dispatch(fetchMe());
}).catch((error) => { }).catch((error) => {
this.setState({isLoading: false}); this.setState({ isLoading: false });
}); });
this.setState({isLoading: true}); this.setState({ isLoading: true });
event.preventDefault(); event.preventDefault();
} }
@ -52,6 +53,7 @@ class LoginForm extends ImmutablePureComponent {
<button name='button' type='submit' className='btn button button-primary'>Log in</button> <button name='button' type='submit' className='btn button button-primary'>Log in</button>
</div> </div>
</form> </form>
) );
} }
} }

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux' import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import LoginForm from './login_form'; import LoginForm from './login_form';
@ -10,10 +10,12 @@ const mapStateToProps = state => ({
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
class LoginPage extends ImmutablePureComponent { class LoginPage extends ImmutablePureComponent {
render() { render() {
const { me } = this.props; const { me } = this.props;
if (me) return <Redirect to='/' />; if (me) return <Redirect to='/' />;
return <LoginForm /> return <LoginForm />;
} }
} }

View File

@ -49,7 +49,7 @@ class ActionBar extends React.PureComponent {
let menu = []; let menu = [];
menu.push({ text: intl.formatMessage(messages.profile), to: `/@${meUsername}` }); menu.push({ text: intl.formatMessage(messages.profile), to: `/@${meUsername}` });
menu.push({ text: intl.formatMessage(messages.messages), to: `/messages` }); menu.push({ text: intl.formatMessage(messages.messages), to: '/messages' });
menu.push(null); menu.push(null);
menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' }); menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' });
menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' }); menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' });
@ -62,13 +62,14 @@ class ActionBar extends React.PureComponent {
menu.push({ text: intl.formatMessage(messages.logout), to: '/auth/sign_out', action: onClickLogOut }); menu.push({ text: intl.formatMessage(messages.logout), to: '/auth/sign_out', action: onClickLogOut });
return ( return (
<div className='compose__action-bar' style={{'marginTop':'-6px'}}> <div className='compose__action-bar' style={{ 'marginTop':'-6px' }}>
<div className='compose__action-bar-dropdown'> <div className='compose__action-bar-dropdown'>
<DropdownMenuContainer items={menu} icon='chevron-down' size={size} direction='right' /> <DropdownMenuContainer items={menu} icon='chevron-down' size={size} direction='right' />
</div> </div>
</div> </div>
); );
} }
} }
export default injectIntl(connect(null, mapDispatchToProps)(ActionBar)); export default injectIntl(connect(null, mapDispatchToProps)(ActionBar));

View File

@ -26,7 +26,7 @@ import Icon from 'gabsocial/components/icon';
const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d';
const messages = defineMessages({ const messages = defineMessages({
placeholder: { id: 'compose_form.placeholder', defaultMessage: "What's on your mind?" }, placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What\'s on your mind?' },
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' }, spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
publish: { id: 'compose_form.publish', defaultMessage: 'Publish' }, publish: { id: 'compose_form.publish', defaultMessage: 'Publish' },
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' }, publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
@ -151,11 +151,11 @@ class ComposeForm extends ImmutablePureComponent {
} }
componentDidMount() { componentDidMount() {
document.addEventListener("click", this.handleClick, false); document.addEventListener('click', this.handleClick, false);
} }
componentWillUnmount() { componentWillUnmount() {
document.removeEventListener("click", this.handleClick, false); document.removeEventListener('click', this.handleClick, false);
} }
componentDidUpdate (prevProps) { componentDidUpdate (prevProps) {
@ -211,7 +211,7 @@ class ComposeForm extends ImmutablePureComponent {
const disabled = this.props.isSubmitting; const disabled = this.props.isSubmitting;
const text = [this.props.spoilerText, countableText(this.props.text)].join(''); const text = [this.props.spoilerText, countableText(this.props.text)].join('');
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxTootChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia); const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxTootChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
const shouldAutoFocus = autoFocus && !showSearch && !isMobile(window.innerWidth) const shouldAutoFocus = autoFocus && !showSearch && !isMobile(window.innerWidth);
let publishText = ''; let publishText = '';
@ -224,7 +224,7 @@ class ComposeForm extends ImmutablePureComponent {
const composeClassNames = classNames({ const composeClassNames = classNames({
'compose-form': true, 'compose-form': true,
'condensed': condensed, 'condensed': condensed,
}) });
return ( return (
<div className={composeClassNames} ref={this.setForm} onClick={this.handleClick}> <div className={composeClassNames} ref={this.setForm} onClick={this.handleClick}>

View File

@ -67,8 +67,8 @@ const mapDispatchToProps = (dispatch) => ({
function mergeProps(stateProps, dispatchProps, ownProps) { function mergeProps(stateProps, dispatchProps, ownProps) {
return Object.assign({}, ownProps, { return Object.assign({}, ownProps, {
...stateProps, ...stateProps,
...dispatchProps ...dispatchProps,
}) });
} }
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(ComposeForm); export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(ComposeForm);

View File

@ -12,7 +12,7 @@ const mapStateToProps = state => {
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']), needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
hashtagWarning: state.getIn(['compose', 'privacy']) !== 'public' && APPROX_HASHTAG_RE.test(state.getIn(['compose', 'text'])), hashtagWarning: state.getIn(['compose', 'privacy']) !== 'public' && APPROX_HASHTAG_RE.test(state.getIn(['compose', 'text'])),
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct', directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
} };
}; };
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning }) => { const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning }) => {

View File

@ -26,8 +26,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
let accountUsername = username; let accountUsername = username;
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} } else {
else {
let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
} }
@ -64,8 +63,7 @@ class Followers extends ImmutablePureComponent {
if (accountId && accountId !== -1) { if (accountId && accountId !== -1) {
this.props.dispatch(fetchAccount(accountId)); this.props.dispatch(fetchAccount(accountId));
this.props.dispatch(fetchFollowers(accountId)); this.props.dispatch(fetchFollowers(accountId));
} } else {
else {
this.props.dispatch(fetchAccountByUsername(username)); this.props.dispatch(fetchAccountByUsername(username));
} }
} }

View File

@ -26,8 +26,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
let accountId = -1; let accountId = -1;
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} } else {
else {
let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
} }
@ -64,8 +63,7 @@ class Following extends ImmutablePureComponent {
if (accountId && accountId !== -1) { if (accountId && accountId !== -1) {
this.props.dispatch(fetchAccount(accountId)); this.props.dispatch(fetchAccount(accountId));
this.props.dispatch(fetchFollowing(accountId)); this.props.dispatch(fetchFollowing(accountId));
} } else {
else {
this.props.dispatch(fetchAccountByUsername(username)); this.props.dispatch(fetchAccountByUsername(username));
} }
} }

View File

@ -39,7 +39,7 @@ const mapStateToProps = state => {
return { return {
myAccount: state.getIn(['accounts', me]), myAccount: state.getIn(['accounts', me]),
unreadFollowRequests: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size, unreadFollowRequests: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size,
} };
}; };
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({

View File

@ -34,7 +34,7 @@ export default @connect(mapStateToProps, mapDispatchToProps)
class Create extends React.PureComponent { class Create extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
} }
static propTypes = { static propTypes = {

View File

@ -38,7 +38,7 @@ export default @connect(mapStateToProps, mapDispatchToProps)
class Edit extends React.PureComponent { class Edit extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object router: PropTypes.object,
} }
static propTypes = { static propTypes = {

View File

@ -22,6 +22,7 @@ const mapStateToProps = (state, { id }) => ({
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl @injectIntl
class GroupCard extends ImmutablePureComponent { class GroupCard extends ImmutablePureComponent {
static propTypes = { static propTypes = {
group: ImmutablePropTypes.map, group: ImmutablePropTypes.map,
relationships: ImmutablePropTypes.map, relationships: ImmutablePropTypes.map,
@ -41,14 +42,15 @@ class GroupCard extends ImmutablePureComponent {
const role = this.getRole(); const role = this.getRole();
return ( return (
<Link to={`/groups/${group.get('id')}`} className="group-card"> <Link to={`/groups/${group.get('id')}`} className='group-card'>
<div className="group-card__header">{coverImageUrl && <img alt="" src={coverImageUrl} />}</div> <div className='group-card__header'>{coverImageUrl && <img alt='' src={coverImageUrl} />}</div>
<div className="group-card__content"> <div className='group-card__content'>
<div className="group-card__title">{group.get('title')}</div> <div className='group-card__title'>{group.get('title')}</div>
<div className="group-card__meta"><strong>{shortNumberFormat(group.get('member_count'))}</strong> {intl.formatMessage(messages.members)}{role && <span> · {role}</span>}</div> <div className='group-card__meta'><strong>{shortNumberFormat(group.get('member_count'))}</strong> {intl.formatMessage(messages.members)}{role && <span> · {role}</span>}</div>
<div className="group-card__description">{group.get('description')}</div> <div className='group-card__description'>{group.get('description')}</div>
</div> </div>
</Link> </Link>
); );
} }
} }

View File

@ -25,6 +25,7 @@ const mapStateToProps = (state, { activeTab }) => ({
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl @injectIntl
class Groups extends ImmutablePureComponent { class Groups extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
activeTab: PropTypes.string.isRequired, activeTab: PropTypes.string.isRequired,
@ -49,21 +50,21 @@ class Groups extends ImmutablePureComponent {
const { intl, activeTab } = this.props; const { intl, activeTab } = this.props;
return ( return (
<div className="group-column-header"> <div className='group-column-header'>
<div className="group-column-header__cta"><Link to="/groups/create" className="button standard-small">{intl.formatMessage(messages.create)}</Link></div> <div className='group-column-header__cta'><Link to='/groups/create' className='button standard-small'>{intl.formatMessage(messages.create)}</Link></div>
<div className="group-column-header__title">{intl.formatMessage(messages.heading)}</div> <div className='group-column-header__title'>{intl.formatMessage(messages.heading)}</div>
<div className="column-header__wrapper"> <div className='column-header__wrapper'>
<h1 className="column-header"> <h1 className='column-header'>
<Link to='/groups' className={classNames('btn grouped', {'active': 'featured' === activeTab})}> <Link to='/groups' className={classNames('btn grouped', { 'active': 'featured' === activeTab })}>
{intl.formatMessage(messages.tab_featured)} {intl.formatMessage(messages.tab_featured)}
</Link> </Link>
<Link to='/groups/browse/member' className={classNames('btn grouped', {'active': 'member' === activeTab})}> <Link to='/groups/browse/member' className={classNames('btn grouped', { 'active': 'member' === activeTab })}>
{intl.formatMessage(messages.tab_member)} {intl.formatMessage(messages.tab_member)}
</Link> </Link>
<Link to='/groups/browse/admin' className={classNames('btn grouped', {'active': 'admin' === activeTab})}> <Link to='/groups/browse/admin' className={classNames('btn grouped', { 'active': 'admin' === activeTab })}>
{intl.formatMessage(messages.tab_admin)} {intl.formatMessage(messages.tab_admin)}
</Link> </Link>
</h1> </h1>
@ -80,10 +81,11 @@ class Groups extends ImmutablePureComponent {
{!showCreateForm && this.renderHeader()} {!showCreateForm && this.renderHeader()}
{showCreateForm && <GroupCreate /> } {showCreateForm && <GroupCreate /> }
<div className="group-card-list"> <div className='group-card-list'>
{groupIds.map(id => <GroupCard key={id} id={id} />)} {groupIds.map(id => <GroupCard key={id} id={id} />)}
</div> </div>
</div> </div>
); );
} }
} }

View File

@ -70,4 +70,5 @@ class GroupMembers extends ImmutablePureComponent {
</Column> </Column>
); );
} }
} }

View File

@ -72,15 +72,16 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
emptyMessage={<FormattedMessage id='group.removed_accounts.empty' defaultMessage='This group does not has any removed accounts.' />} emptyMessage={<FormattedMessage id='group.removed_accounts.empty' defaultMessage='This group does not has any removed accounts.' />}
> >
{accountIds.map(id => <AccountContainer {accountIds.map(id => (<AccountContainer
key={id} key={id}
id={id} id={id}
actionIcon="remove" actionIcon='remove'
onActionClick={() => this.props.dispatch(removeRemovedAccount(group.get('id'), id))} onActionClick={() => this.props.dispatch(removeRemovedAccount(group.get('id'), id))}
actionTitle={intl.formatMessage(messages.remove)} actionTitle={intl.formatMessage(messages.remove)}
/>)} />))}
</ScrollableList> </ScrollableList>
</Column> </Column>
); );
} }
} }

View File

@ -19,6 +19,7 @@ const mapStateToProps = (state, { id }) => ({
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl @injectIntl
class GroupSidebarPanel extends ImmutablePureComponent { class GroupSidebarPanel extends ImmutablePureComponent {
static propTypes = { static propTypes = {
groupIds: ImmutablePropTypes.list, groupIds: ImmutablePropTypes.list,
} }
@ -38,12 +39,13 @@ class GroupSidebarPanel extends ImmutablePureComponent {
</div> </div>
<div className='wtf-panel__content'> <div className='wtf-panel__content'>
<div className="group-sidebar-panel__items"> <div className='group-sidebar-panel__items'>
{groupIds.slice(0, 10).map(groupId => <Item key={groupId} id={groupId} />)} {groupIds.slice(0, 10).map(groupId => <Item key={groupId} id={groupId} />)}
{count > 10 && <Link className="group-sidebar-panel__items__show-all" to='/groups/browse/member'>{intl.formatMessage(messages.show_all)}</Link>} {count > 10 && <Link className='group-sidebar-panel__items__show-all' to='/groups/browse/member'>{intl.formatMessage(messages.show_all)}</Link>}
</div> </div>
</div> </div>
</div> </div>
); );
} }
} }

View File

@ -19,6 +19,7 @@ const mapStateToProps = (state, { id }) => ({
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl @injectIntl
class Item extends ImmutablePureComponent { class Item extends ImmutablePureComponent {
static propTypes = { static propTypes = {
group: ImmutablePropTypes.map, group: ImmutablePropTypes.map,
relationships: ImmutablePropTypes.map, relationships: ImmutablePropTypes.map,
@ -33,13 +34,14 @@ class Item extends ImmutablePureComponent {
const unreadCount = relationships.get('unread_count'); const unreadCount = relationships.get('unread_count');
return ( return (
<Link to={`/groups/${group.get('id')}`} className="group-sidebar-panel__item"> <Link to={`/groups/${group.get('id')}`} className='group-sidebar-panel__item'>
<div className="group-sidebar-panel__item__title">{group.get('title')}</div> <div className='group-sidebar-panel__item__title'>{group.get('title')}</div>
<div className="group-sidebar-panel__item__meta"> <div className='group-sidebar-panel__item__meta'>
{unreadCount > 0 && <span className="group-sidebar-panel__item__meta__unread">{shortNumberFormat(unreadCount)} {intl.formatMessage(messages.new_statuses)}</span>} {unreadCount > 0 && <span className='group-sidebar-panel__item__meta__unread'>{shortNumberFormat(unreadCount)} {intl.formatMessage(messages.new_statuses)}</span>}
{unreadCount === 0 && <span>{intl.formatMessage(messages.no_recent_activity)}</span>} {unreadCount === 0 && <span>{intl.formatMessage(messages.no_recent_activity)}</span>}
</div> </div>
</Link> </Link>
); );
} }
} }

View File

@ -11,11 +11,12 @@ const messages = defineMessages({
join: { id: 'groups.join', defaultMessage: 'Join group' }, join: { id: 'groups.join', defaultMessage: 'Join group' },
leave: { id: 'groups.leave', defaultMessage: 'Leave group' }, leave: { id: 'groups.leave', defaultMessage: 'Leave group' },
removed_accounts: { id: 'groups.removed_accounts', defaultMessage: 'Removed Accounts' }, removed_accounts: { id: 'groups.removed_accounts', defaultMessage: 'Removed Accounts' },
edit: { id: 'groups.edit', defaultMessage: 'Edit' } edit: { id: 'groups.edit', defaultMessage: 'Edit' },
}); });
export default @injectIntl export default @injectIntl
class Header extends ImmutablePureComponent { class Header extends ImmutablePureComponent {
static propTypes = { static propTypes = {
group: ImmutablePropTypes.map, group: ImmutablePropTypes.map,
relationships: ImmutablePropTypes.map, relationships: ImmutablePropTypes.map,
@ -59,7 +60,7 @@ class Header extends ImmutablePureComponent {
return ( return (
<div className='group__header-container'> <div className='group__header-container'>
<div className="group__header"> <div className='group__header'>
<div className='group__cover'> <div className='group__cover'>
<img src={group.get('cover_image_url')} alt='' className='parallax' /> <img src={group.get('cover_image_url')} alt='' className='parallax' />
</div> </div>
@ -74,4 +75,5 @@ class Header extends ImmutablePureComponent {
</div> </div>
); );
} }
} }

View File

@ -5,11 +5,12 @@ import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({ const messages = defineMessages({
group_archived: { id: 'group.detail.archived_group', defaultMessage: 'Archived group' }, group_archived: { id: 'group.detail.archived_group', defaultMessage: 'Archived group' },
group_admin: { id: 'groups.detail.role_admin', defaultMessage: 'You\'re an admin' } group_admin: { id: 'groups.detail.role_admin', defaultMessage: 'You\'re an admin' },
}); });
export default @injectIntl export default @injectIntl
class GroupPanel extends ImmutablePureComponent { class GroupPanel extends ImmutablePureComponent {
static propTypes = { static propTypes = {
group: ImmutablePropTypes.map, group: ImmutablePropTypes.map,
relationships: ImmutablePropTypes.map, relationships: ImmutablePropTypes.map,
@ -19,16 +20,17 @@ class GroupPanel extends ImmutablePureComponent {
const { group, relationships, intl } = this.props; const { group, relationships, intl } = this.props;
return ( return (
<div className="group__panel"> <div className='group__panel'>
<h1 className="group__panel__title"> <h1 className='group__panel__title'>
{group.get('title')} {group.get('title')}
{group.get('archived') && <Icon id='lock' title={intl.formatMessage(messages.group_archived)} />} {group.get('archived') && <Icon id='lock' title={intl.formatMessage(messages.group_archived)} />}
</h1> </h1>
{relationships.get('admin') && <span className="group__panel__label">{intl.formatMessage(messages.group_admin)}</span>} {relationships.get('admin') && <span className='group__panel__label'>{intl.formatMessage(messages.group_admin)}</span>}
<div className="group__panel__description">{group.get('description')}</div> <div className='group__panel__description'>{group.get('description')}</div>
</div> </div>
); );
} }
} }

View File

@ -19,12 +19,13 @@ const mapStateToProps = (state, props) => {
group: state.getIn(['groups', props.params.id]), group: state.getIn(['groups', props.params.id]),
relationships: state.getIn(['group_relationships', props.params.id]), relationships: state.getIn(['group_relationships', props.params.id]),
hasUnread: state.getIn(['timelines', `group:${props.params.id}`, 'unread']) > 0, hasUnread: state.getIn(['timelines', `group:${props.params.id}`, 'unread']) > 0,
} };
}; };
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl @injectIntl
class GroupTimeline extends React.PureComponent { class GroupTimeline extends React.PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object, router: PropTypes.object,
}; };
@ -86,7 +87,7 @@ class GroupTimeline extends React.PureComponent {
<div className='timeline-compose-block__avatar'> <div className='timeline-compose-block__avatar'>
<Avatar account={account} size={46} /> <Avatar account={account} size={46} />
</div> </div>
<ComposeFormContainer group={group} shouldCondense={true} autoFocus={false}/> <ComposeFormContainer group={group} shouldCondense autoFocus={false} />
</div> </div>
)} )}
@ -104,4 +105,5 @@ class GroupTimeline extends React.PureComponent {
</div> </div>
); );
} }
} }

View File

@ -68,7 +68,7 @@ class HomeTimeline extends React.PureComponent {
} }
render () { render () {
const { intl, hasUnread, siteTitle} = this.props; const { intl, hasUnread, siteTitle } = this.props;
return ( return (
<Column label={intl.formatMessage(messages.title)}> <Column label={intl.formatMessage(messages.title)}>
@ -79,7 +79,7 @@ class HomeTimeline extends React.PureComponent {
scrollKey='home_timeline' scrollKey='home_timeline'
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
timelineId='home' timelineId='home'
emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage='Your home timeline is empty! Visit {public} to get started and meet other users.' values={{ public: <Link to='/timeline/local'><FormattedMessage id='empty_column.home.local_tab' defaultMessage='the {site_title} tab' values={{site_title: siteTitle}} /></Link> }} />} emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage='Your home timeline is empty! Visit {public} to get started and meet other users.' values={{ public: <Link to='/timeline/local'><FormattedMessage id='empty_column.home.local_tab' defaultMessage='the {site_title} tab' values={{ site_title: siteTitle }} /></Link> }} />}
/> />
</Column> </Column>
); );

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux' import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import LoginForm from 'gabsocial/features/auth_login/components/login_form'; import LoginForm from 'gabsocial/features/auth_login/components/login_form';
@ -11,13 +11,14 @@ const mapStateToProps = (state, props) => ({
}); });
class LandingPage extends ImmutablePureComponent { class LandingPage extends ImmutablePureComponent {
getSiteLogo = () => { getSiteLogo = () => {
const { instance, soapbox } = this.props; const { instance, soapbox } = this.props;
const logos = { const logos = {
imgLogo: (<img alt={instance.get('title')} src={soapbox.get('logo')} />), imgLogo: (<img alt={instance.get('title')} src={soapbox.get('logo')} />),
textLogo: (<h1>{instance.get('title')}</h1>), textLogo: (<h1>{instance.get('title')}</h1>),
} };
return soapbox.get('logo') ? logos['imgLogo'] : logos['textLogo']; return soapbox.get('logo') ? logos.imgLogo : logos.textLogo;
} }
render() { render() {
@ -36,7 +37,7 @@ class LandingPage extends ImmutablePureComponent {
<Link className='nav-link optional' to='/'>Home</Link> <Link className='nav-link optional' to='/'>Home</Link>
<Link className='nav-link' to='/about'>About</Link> <Link className='nav-link' to='/about'>About</Link>
</div> </div>
<div className='nav-center'></div> <div className='nav-center' />
<div className='nav-right'> <div className='nav-right'>
<div className='hidden-sm'> <div className='hidden-sm'>
<LoginForm /> <LoginForm />
@ -121,8 +122,9 @@ class LandingPage extends ImmutablePureComponent {
</div> </div>
<NotificationsContainer /> <NotificationsContainer />
</div> </div>
) );
} }
} }
export default connect(mapStateToProps)(LandingPage); export default connect(mapStateToProps)(LandingPage);

View File

@ -21,7 +21,7 @@ const getOrderedLists = createSelector([state => state.get('lists')], lists => {
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))); return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title')));
}); });
const mapStateToProps = (state, {accountId}) => ({ const mapStateToProps = (state, { accountId }) => ({
listIds: getOrderedLists(state).map(list=>list.get('id')), listIds: getOrderedLists(state).map(list=>list.get('id')),
account: state.getIn(['accounts', accountId]), account: state.getIn(['accounts', accountId]),
}); });
@ -84,12 +84,12 @@ class ListAdder extends ImmutablePureComponent {
<Account accountId={accountId} /> <Account accountId={accountId} />
</div> </div>
<br/> <br />
<ColumnSubheading text={intl.formatMessage(messages.add)} /> <ColumnSubheading text={intl.formatMessage(messages.add)} />
<NewListForm /> <NewListForm />
<br/> <br />
<ColumnSubheading text={intl.formatMessage(messages.subheading)} /> <ColumnSubheading text={intl.formatMessage(messages.subheading)} />
<div className='list-adder__lists'> <div className='list-adder__lists'>

View File

@ -75,7 +75,7 @@ class ListEditor extends ImmutablePureComponent {
<div className='list-editor'> <div className='list-editor'>
<ColumnSubheading text={intl.formatMessage(messages.changeTitle)} /> <ColumnSubheading text={intl.formatMessage(messages.changeTitle)} />
<EditListForm /> <EditListForm />
<br/> <br />
{ {
accountIds.size > 0 && accountIds.size > 0 &&
@ -87,7 +87,7 @@ class ListEditor extends ImmutablePureComponent {
</div> </div>
} }
<br/> <br />
<ColumnSubheading text={intl.formatMessage(messages.addToList)} /> <ColumnSubheading text={intl.formatMessage(messages.addToList)} />
<Search /> <Search />
<div className='list-editor__accounts'> <div className='list-editor__accounts'>

View File

@ -120,8 +120,8 @@ class ListTimeline extends React.PureComponent {
const emptyMessage = ( const emptyMessage = (
<div> <div>
<FormattedMessage id='empty_column.list' defaultMessage='There is nothing in this list yet. When members of this list create new posts, they will appear here.' /> <FormattedMessage id='empty_column.list' defaultMessage='There is nothing in this list yet. When members of this list create new posts, they will appear here.' />
<br/><br/> <br /><br />
<Button onClick={this.handleEditClick}><FormattedMessage id='list.click_to_add' defaultMessage='Click here to add people'/></Button> <Button onClick={this.handleEditClick}><FormattedMessage id='list.click_to_add' defaultMessage='Click here to add people' /></Button>
</div> </div>
); );
@ -137,7 +137,7 @@ class ListTimeline extends React.PureComponent {
<Icon id='trash' /> <FormattedMessage id='lists.delete' defaultMessage='Delete list' /> <Icon id='trash' /> <FormattedMessage id='lists.delete' defaultMessage='Delete list' />
</button> </button>
<hr/> <hr />
<Link to='/lists' className='text-btn column-header__setting-btn column-header__setting-btn--link'> <Link to='/lists' className='text-btn column-header__setting-btn column-header__setting-btn--link'>
<FormattedMessage id='lists.view_all' defaultMessage='View all lists' /> <FormattedMessage id='lists.view_all' defaultMessage='View all lists' />

View File

@ -61,10 +61,10 @@ class Lists extends ImmutablePureComponent {
return ( return (
<Column icon='list-ul' heading={intl.formatMessage(messages.heading)} backBtnSlim> <Column icon='list-ul' heading={intl.formatMessage(messages.heading)} backBtnSlim>
<br/> <br />
<ColumnSubheading text={intl.formatMessage(messages.add)} /> <ColumnSubheading text={intl.formatMessage(messages.add)} />
<NewListForm /> <NewListForm />
<br/> <br />
<ColumnSubheading text={intl.formatMessage(messages.subheading)} /> <ColumnSubheading text={intl.formatMessage(messages.subheading)} />
<ScrollableList <ScrollableList
scrollKey='lists' scrollKey='lists'

View File

@ -51,7 +51,7 @@ class PinnedStatuses extends ImmutablePureComponent {
statusIds={statusIds} statusIds={statusIds}
scrollKey='pinned_statuses' scrollKey='pinned_statuses'
hasMore={hasMore} hasMore={hasMore}
emptyMessage={<FormattedMessage id='pinned_statuses.none' defaultMessage='No pins to show.'/>} emptyMessage={<FormattedMessage id='pinned_statuses.none' defaultMessage='No pins to show.' />}
/> />
</Column> </Column>
); );

View File

@ -88,7 +88,7 @@ class CommunityTimeline extends React.PureComponent {
</HomeColumnHeader> </HomeColumnHeader>
<ExplanationBox <ExplanationBox
title={<FormattedMessage id='fediverse_tab.explanation_box.title' defaultMessage='What is the Fediverse?' />} title={<FormattedMessage id='fediverse_tab.explanation_box.title' defaultMessage='What is the Fediverse?' />}
explanation={<FormattedMessage id='fediverse_tab.explanation_box.explanation' defaultMessage='{site_title} is part of the Fediverse, a social network made up of thousands of independent social media sites (aka "servers"). The posts you see here are from 3rd-party servers. You have the freedom to engage with them, or to block any server you don&apos;t like. Pay attention to the full username after the second @ symbol to know which server a post is from. To see only {site_title} posts, visit {local}.' values={{site_title: siteTitle, local: <Link to='/timeline/local'><FormattedMessage id='empty_column.home.local_tab' defaultMessage='the {site_title} tab' values={{site_title: siteTitle}} /></Link>}} />} explanation={<FormattedMessage id='fediverse_tab.explanation_box.explanation' defaultMessage='{site_title} is part of the Fediverse, a social network made up of thousands of independent social media sites (aka "servers"). The posts you see here are from 3rd-party servers. You have the freedom to engage with them, or to block any server you don&apos;t like. Pay attention to the full username after the second @ symbol to know which server a post is from. To see only {site_title} posts, visit {local}.' values={{ site_title: siteTitle, local: <Link to='/timeline/local'><FormattedMessage id='empty_column.home.local_tab' defaultMessage='the {site_title} tab' values={{ site_title: siteTitle }} /></Link> }} />}
/> />
<StatusListContainer <StatusListContainer
scrollKey={`${timelineId}_timeline`} scrollKey={`${timelineId}_timeline`}

View File

@ -17,13 +17,13 @@ const mapStateToProps = (state, props) => {
const getStatus = makeGetStatus(); const getStatus = makeGetStatus();
const status = getStatus(state, { const status = getStatus(state, {
id: props.params.statusId, id: props.params.statusId,
username: props.params.username username: props.params.username,
}); });
return { return {
status, status,
accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]), accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
} };
}; };
export default @connect(mapStateToProps) export default @connect(mapStateToProps)

View File

@ -25,7 +25,7 @@ class Header extends ImmutablePureComponent {
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {
if (nextProps.submitted) { if (nextProps.submitted) {
const submittedValue = nextProps.value; const submittedValue = nextProps.value;
this.setState({submittedValue}) this.setState({ submittedValue });
} }
} }
@ -67,6 +67,7 @@ class Header extends ImmutablePureComponent {
</div> </div>
); );
} }
} }
export default connect(mapStateToProps)(Header); export default connect(mapStateToProps)(Header);

View File

@ -234,6 +234,7 @@ class ActionBar extends React.PureComponent {
</div> </div>
); );
} }
} }
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ActionBar)); export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ActionBar));

View File

@ -64,7 +64,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => { const mapStateToProps = (state, props) => {
const status = getStatus(state, { const status = getStatus(state, {
id: props.params.statusId, id: props.params.statusId,
username: props.params.username username: props.params.username,
}); });
let ancestorsIds = Immutable.List(); let ancestorsIds = Immutable.List();
@ -462,7 +462,8 @@ class Status extends ImmutablePureComponent {
aria-label={intl.formatMessage(status.get('hidden') ? messages.revealAll : messages.hideAll)} aria-label={intl.formatMessage(status.get('hidden') ? messages.revealAll : messages.hideAll)}
onClick={this.handleToggleAll} onClick={this.handleToggleAll}
aria-pressed={ aria-pressed={
status.get('hidden') ? 'false' : 'true'}> status.get('hidden') ? 'false' : 'true'}
>
<Icon id={status.get('hidden') ? 'eye-slash' : 'eye' <Icon id={status.get('hidden') ? 'eye-slash' : 'eye'
} }
/> />

View File

@ -26,7 +26,7 @@ export default class Column extends React.PureComponent {
<ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} /> <ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} />
); );
const backBtn = backBtnSlim ? (<ColumnBackButtonSlim/>) : (<ColumnBackButton/>); const backBtn = backBtnSlim ? (<ColumnBackButtonSlim />) : (<ColumnBackButton />);
return ( return (
<div role='region' aria-labelledby={columnHeaderId} className='column'> <div role='region' aria-labelledby={columnHeaderId} className='column'>

View File

@ -27,7 +27,7 @@ class ColumnsArea extends ImmutablePureComponent {
render () { render () {
const { columns, children, intl } = this.props; const { columns, children, intl } = this.props;
const layout = this.props.layout || {LEFT:null,RIGHT:null}; const layout = this.props.layout || { LEFT:null, RIGHT:null };
return ( return (
<div className='page'> <div className='page'>
@ -55,6 +55,7 @@ class ColumnsArea extends ImmutablePureComponent {
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -33,7 +33,7 @@ class ComposeModal extends ImmutablePureComponent {
}; };
onClickClose = () => { onClickClose = () => {
const {composeText, dispatch, onClose, intl} = this.props; const { composeText, dispatch, onClose, intl } = this.props;
if (composeText) { if (composeText) {
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
@ -42,8 +42,7 @@ class ComposeModal extends ImmutablePureComponent {
onConfirm: () => dispatch(cancelReplyCompose()), onConfirm: () => dispatch(cancelReplyCompose()),
onCancel: () => dispatch(openModal('COMPOSE')), onCancel: () => dispatch(openModal('COMPOSE')),
})); }));
} } else {
else {
onClose('COMPOSE'); onClose('COMPOSE');
} }
}; };
@ -67,6 +66,7 @@ class ComposeModal extends ImmutablePureComponent {
</div> </div>
); );
} }
} }
export default injectIntl(connect(mapStateToProps)(ComposeModal)); export default injectIntl(connect(mapStateToProps)(ComposeModal));

View File

@ -32,7 +32,7 @@ class ConfirmationModal extends React.PureComponent {
} }
handleCancel = () => { handleCancel = () => {
const {onClose, onCancel} = this.props; const { onClose, onCancel } = this.props;
onClose(); onClose();
if (onCancel) onCancel(); if (onCancel) onCancel();
} }

View File

@ -17,6 +17,7 @@ class ExplanationBox extends React.PureComponent {
{dismissable && <span className='explanation-box__dismiss'>Dismiss</span>} {dismissable && <span className='explanation-box__dismiss'>Dismiss</span>}
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -12,7 +12,7 @@ const mapStateToProps = state => {
return { return {
locked: state.getIn(['accounts', me, 'locked']), locked: state.getIn(['accounts', me, 'locked']),
count: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size, count: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size,
} };
}; };
export default @withRouter export default @withRouter

View File

@ -34,7 +34,7 @@ class FundingPanel extends ImmutablePureComponent {
return ( return (
<div className='wtf-panel funding-panel'> <div className='wtf-panel funding-panel'>
<div className='wtf-panel-header'> <div className='wtf-panel-header'>
<i role='img' alt='users' className='fa fa-line-chart wtf-panel-header__icon'></i> <i role='img' alt='users' className='fa fa-line-chart wtf-panel-header__icon' />
<span className='wtf-panel-header__label'> <span className='wtf-panel-header__label'>
<span>Funding Goal</span> <span>Funding Goal</span>
</span> </span>
@ -50,13 +50,14 @@ class FundingPanel extends ImmutablePureComponent {
<a className='button' href='/donate'>Donate</a> <a className='button' href='/donate'>Donate</a>
</div> </div>
</div> </div>
) );
} }
}; };
const mapStateToProps = state => { const mapStateToProps = state => {
return { return {
funding: state.getIn(['patron', 'funding']) funding: state.getIn(['patron', 'funding']),
}; };
}; };
@ -64,4 +65,4 @@ export default injectIntl(
connect(mapStateToProps, null, null, { connect(mapStateToProps, null, null, {
forwardRef: true, forwardRef: true,
} }
)(FundingPanel)) )(FundingPanel));

View File

@ -13,13 +13,13 @@ const sourceCode = {
url: 'https://gitlab.com/soapbox-pub/soapbox-fe', url: 'https://gitlab.com/soapbox-pub/soapbox-fe',
repository: 'soapox-pub/soapbox-fe', repository: 'soapox-pub/soapbox-fe',
version: '0.0.0', version: '0.0.0',
} };
const mapStateToProps = state => { const mapStateToProps = state => {
const me = state.get('me'); const me = state.get('me');
return { return {
account: state.getIn(['accounts', me]), account: state.getIn(['accounts', me]),
} };
}; };
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({

View File

@ -48,7 +48,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
<div className='profile-info-panel__content'> <div className='profile-info-panel__content'>
<div className='profile-info-panel-content__name'> <div className='profile-info-panel-content__name'>
<h1> <h1>
<span/> <span />
<small>@{username}</small> <small>@{username}</small>
</h1> </h1>
</div> </div>
@ -79,16 +79,18 @@ class ProfileInfoPanel extends ImmutablePureComponent {
</div> </div>
<div className='profile-info-panel-content__badges'> <div className='profile-info-panel-content__badges'>
{account.get('is_admin') && <Badge slug="admin" title="Admin" />} {account.get('is_admin') && <Badge slug='admin' title='Admin' />}
{account.get('is_moderator') && <Badge slug="moderator" title="Moderator" />} {account.get('is_moderator') && <Badge slug='moderator' title='Moderator' />}
{account.get('is_pro') && <ProBadge />} {account.get('is_pro') && <ProBadge />}
{account.get('is_donor') && <DonorBadge />} {account.get('is_donor') && <DonorBadge />}
{account.get('is_investor') && <InvestorBadge />} {account.get('is_investor') && <InvestorBadge />}
{account.get('acct').includes('@') || <div className='profile-info-panel-content__badges__join-date'> {account.get('acct').includes('@') || <div className='profile-info-panel-content__badges__join-date'>
<Icon id="calendar"/> <Icon id='calendar' />
<FormattedMessage id='account.member_since' defaultMessage='Member since {date}' values={{ <FormattedMessage
date: memberSinceDate id='account.member_since' defaultMessage='Member since {date}' values={{
}} /> date: memberSinceDate,
}}
/>
</div>} </div>}
</div> </div>
@ -131,6 +133,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
</div> </div>
); );
} }
} }
const mapStateToProps = (state, { account }) => { const mapStateToProps = (state, { account }) => {
@ -145,4 +148,4 @@ export default injectIntl(
connect(mapStateToProps, null, null, { connect(mapStateToProps, null, null, {
forwardRef: true, forwardRef: true,
} }
)(ProfileInfoPanel)) )(ProfileInfoPanel));

View File

@ -7,7 +7,7 @@ import { connect } from 'react-redux';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
promoItems: state.getIn(['soapbox', 'promoPanel', 'items']), promoItems: state.getIn(['soapbox', 'promoPanel', 'items']),
}) });
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
class PromoPanel extends React.PureComponent { class PromoPanel extends React.PureComponent {
@ -20,15 +20,16 @@ class PromoPanel extends React.PureComponent {
<div className='wtf-panel promo-panel'> <div className='wtf-panel promo-panel'>
<div className='promo-panel__container'> <div className='promo-panel__container'>
{promoItems.map((item, i) => {promoItems.map((item, i) =>
<div className='promo-panel-item' key={i}> (<div className='promo-panel-item' key={i}>
<a className='promo-panel-item__btn' href={item.get('url')} target='_blank'> <a className='promo-panel-item__btn' href={item.get('url')} target='_blank'>
<Icon id={item.get('icon')} className='promo-panel-item__icon' fixedWidth /> <Icon id={item.get('icon')} className='promo-panel-item__icon' fixedWidth />
{item.get('text')} {item.get('text')}
</a> </a>
</div> </div>)
)} )}
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -17,7 +17,7 @@ const SignUpPanel = ({ siteTitle, me }) => {
<div className='wtf-panel'> <div className='wtf-panel'>
<div className='wtf-panel-header'> <div className='wtf-panel-header'>
<span className='wtf-panel-header__label'> <span className='wtf-panel-header__label'>
<FormattedMessage id='signup_panel.title' defaultMessage='New to {site_title}?' values={{site_title: siteTitle}} /> <FormattedMessage id='signup_panel.title' defaultMessage='New to {site_title}?' values={{ site_title: siteTitle }} />
</span> </span>
</div> </div>
<div className='wtf-panel__content'> <div className='wtf-panel__content'>
@ -25,13 +25,13 @@ const SignUpPanel = ({ siteTitle, me }) => {
<FormattedMessage id='signup_panel.subtitle' defaultMessage='Sign up now to discuss.' /> <FormattedMessage id='signup_panel.subtitle' defaultMessage='Sign up now to discuss.' />
</span> </span>
<div className='wtf-panel__form'> <div className='wtf-panel__form'>
<a className='button' href="/auth/sign_up"> <a className='button' href='/auth/sign_up'>
<FormattedMessage id='account.register' defaultMessage='Sign up' /> <FormattedMessage id='account.register' defaultMessage='Sign up' />
</a> </a>
</div> </div>
</div> </div>
</div> </div>
) );
} };
export default injectIntl(connect(mapStateToProps)(SignUpPanel)); export default injectIntl(connect(mapStateToProps)(SignUpPanel));

View File

@ -64,32 +64,32 @@ class TabsBar extends React.PureComponent {
links.push( links.push(
<Link key='logo' className='tabs-bar__link--logo' to='/' data-preview-title-id='column.home' style={{ padding: '0', backgroundImage: `url(${logo})` }}> <Link key='logo' className='tabs-bar__link--logo' to='/' data-preview-title-id='column.home' style={{ padding: '0', backgroundImage: `url(${logo})` }}>
<FormattedMessage id='tabs_bar.home' defaultMessage='Home' /> <FormattedMessage id='tabs_bar.home' defaultMessage='Home' />
</Link>) </Link>);
} }
links.push( links.push(
<NavLink key='home' className='tabs-bar__link' exact to='/' data-preview-title-id='column.home'> <NavLink key='home' className='tabs-bar__link' exact to='/' data-preview-title-id='column.home'>
<i className='tabs-bar__link__icon home'/> <i className='tabs-bar__link__icon home' />
<FormattedMessage id='tabs_bar.home' defaultMessage='Home' /> <FormattedMessage id='tabs_bar.home' defaultMessage='Home' />
</NavLink>) </NavLink>);
if (account) { if (account) {
links.push( links.push(
<NavLink key='notifications' className='tabs-bar__link' to='/notifications' data-preview-title-id='column.notifications'> <NavLink key='notifications' className='tabs-bar__link' to='/notifications' data-preview-title-id='column.notifications'>
<i className='tabs-bar__link__icon notifications'/> <i className='tabs-bar__link__icon notifications' />
<NotificationsCounterIcon /> <NotificationsCounterIcon />
<FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /> <FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' />
</NavLink>) </NavLink>);
} }
links.push( links.push(
<NavLink key='search' className='tabs-bar__link tabs-bar__link--search' to='/search' data-preview-title-id='tabs_bar.search'> <NavLink key='search' className='tabs-bar__link tabs-bar__link--search' to='/search' data-preview-title-id='tabs_bar.search'>
<i className='tabs-bar__link__icon tabs-bar__link__icon--search'/> <i className='tabs-bar__link__icon tabs-bar__link__icon--search' />
<FormattedMessage id='tabs_bar.search' defaultMessage='Search' /> <FormattedMessage id='tabs_bar.search' defaultMessage='Search' />
</NavLink> </NavLink>
); );
return links.map((link) => return links.map((link) =>
React.cloneElement(link, { React.cloneElement(link, {
'aria-label': formatMessage({ 'aria-label': formatMessage({
id: link.props['data-preview-title-id'] id: link.props['data-preview-title-id'],
}) }),
})); }));
} }
@ -102,10 +102,10 @@ class TabsBar extends React.PureComponent {
let st = pageYOffset || scrollTop; let st = pageYOffset || scrollTop;
if (st > this.lastScrollTop){ if (st > this.lastScrollTop){
let offset = st - this.lastScrollTop; let offset = st - this.lastScrollTop;
if (offset > 50) this.setState({collapsed: true}); if (offset > 50) this.setState({ collapsed: true });
} else { } else {
let offset = this.lastScrollTop - st; let offset = this.lastScrollTop - st;
if (offset > 50) this.setState({collapsed: false}); if (offset > 50) this.setState({ collapsed: false });
} }
this.lastScrollTop = st <= 0 ? 0 : st; this.lastScrollTop = st <= 0 ? 0 : st;
@ -120,7 +120,7 @@ class TabsBar extends React.PureComponent {
const classes = classNames('tabs-bar', { const classes = classNames('tabs-bar', {
'tabs-bar--collapsed': collapsed, 'tabs-bar--collapsed': collapsed,
}) });
return ( return (
<nav className={classes} ref={this.setRef}> <nav className={classes} ref={this.setRef}>
@ -136,7 +136,7 @@ class TabsBar extends React.PureComponent {
<div className='flex'> <div className='flex'>
<div className='tabs-bar__profile'> <div className='tabs-bar__profile'>
<Avatar account={account} /> <Avatar account={account} />
<button className='tabs-bar__sidebar-btn' onClick={onOpenSidebar}></button> <button className='tabs-bar__sidebar-btn' onClick={onOpenSidebar} />
<ActionBar account={account} size={34} /> <ActionBar account={account} size={34} />
</div> </div>
<button className='tabs-bar__button-compose button' onClick={onOpenCompose} aria-label='Gab'> <button className='tabs-bar__button-compose button' onClick={onOpenCompose} aria-label='Gab'>
@ -160,6 +160,7 @@ class TabsBar extends React.PureComponent {
</nav> </nav>
); );
} }
} }
const mapStateToProps = state => { const mapStateToProps = state => {
@ -181,4 +182,4 @@ const mapDispatchToProps = (dispatch) => ({
export default injectIntl( export default injectIntl(
connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true } connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true }
)(TabsBar)) )(TabsBar));

View File

@ -48,8 +48,9 @@ class TrendsPanel extends ImmutablePureComponent {
</div> </div>
</div> </div>
</div> </div>
) );
}; };
}; };
@ -60,11 +61,11 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {
return { return {
fetchTrends: () => dispatch(fetchTrends()), fetchTrends: () => dispatch(fetchTrends()),
} };
}; };
export default injectIntl( export default injectIntl(
connect(mapStateToProps, mapDispatchToProps, null, { connect(mapStateToProps, mapDispatchToProps, null, {
forwardRef: true, forwardRef: true,
} }
)(TrendsPanel)) )(TrendsPanel));

View File

@ -36,7 +36,7 @@ class UnauthorizedModal extends ImmutablePureComponent {
return ( return (
<div className='modal-root__modal compose-modal unauthorized-modal'> <div className='modal-root__modal compose-modal unauthorized-modal'>
<div className='compose-modal__header'> <div className='compose-modal__header'>
<h3 className='compose-modal__header__title'><FormattedMessage id='unauthorized_modal.title' defaultMessage='Sign up for {site_title}' values={{site_title: siteTitle}} /></h3> <h3 className='compose-modal__header__title'><FormattedMessage id='unauthorized_modal.title' defaultMessage='Sign up for {site_title}' values={{ site_title: siteTitle }} /></h3>
<IconButton className='compose-modal__close' title={intl.formatMessage(messages.close)} icon='times' onClick={this.onClickClose} size={20} /> <IconButton className='compose-modal__close' title={intl.formatMessage(messages.close)} icon='times' onClick={this.onClickClose} size={20} />
</div> </div>
<div className='compose-modal__content'> <div className='compose-modal__content'>
@ -50,13 +50,16 @@ class UnauthorizedModal extends ImmutablePureComponent {
</div> </div>
</div> </div>
<div className='unauthorized-modal__footer'> <div className='unauthorized-modal__footer'>
<FormattedMessage id='unauthorized_modal.footer' defaultMessage='Already have an account? {login}.' values={{ <FormattedMessage
login: <a href='/auth/sign_in'><FormattedMessage id='account.login' defaultMessage='Log in' /></a> id='unauthorized_modal.footer' defaultMessage='Already have an account? {login}.' values={{
}} /> login: <a href='/auth/sign_in'><FormattedMessage id='account.login' defaultMessage='Log in' /></a>,
}}
/>
</div> </div>
</div> </div>
); );
} }
} }
export default injectIntl(connect(mapStateToProps)(UnauthorizedModal)); export default injectIntl(connect(mapStateToProps)(UnauthorizedModal));

View File

@ -12,6 +12,7 @@ import { shortNumberFormat } from 'gabsocial/utils/numbers';
import { acctFull } from 'gabsocial/utils/accounts'; import { acctFull } from 'gabsocial/utils/accounts';
class UserPanel extends ImmutablePureComponent { class UserPanel extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
@ -78,8 +79,9 @@ class UserPanel extends ImmutablePureComponent {
</div> </div>
</div> </div>
) );
} }
}; };
@ -96,4 +98,4 @@ export default injectIntl(
connect(mapStateToProps, null, null, { connect(mapStateToProps, null, null, {
forwardRef: true, forwardRef: true,
} }
)(UserPanel)) )(UserPanel));

View File

@ -58,6 +58,7 @@ class WhoToFollowPanel extends ImmutablePureComponent {
</div> </div>
); );
}; };
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
@ -68,11 +69,11 @@ const mapDispatchToProps = dispatch => {
return { return {
fetchSuggestions: () => dispatch(fetchSuggestions()), fetchSuggestions: () => dispatch(fetchSuggestions()),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))), dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
} };
}; };
export default injectIntl( export default injectIntl(
connect(mapStateToProps, mapDispatchToProps, null, { connect(mapStateToProps, mapDispatchToProps, null, {
forwardRef: true, forwardRef: true,
} }
)(WhoToFollowPanel)) )(WhoToFollowPanel));

View File

@ -30,7 +30,7 @@ const makeGetStatusIds = () => createSelector([
}); });
}); });
const mapStateToProps = (state, {timelineId}) => { const mapStateToProps = (state, { timelineId }) => {
const getStatusIds = makeGetStatusIds(); const getStatusIds = makeGetStatusIds();
return { return {

View File

@ -90,7 +90,7 @@ const mapStateToProps = state => {
me: state.get('me'), me: state.get('me'),
accessToken: state.getIn(['auth', 'user', 'access_token']), accessToken: state.getIn(['auth', 'user', 'access_token']),
streamingUrl: state.getIn(['instance', 'urls', 'streaming_api']), streamingUrl: state.getIn(['instance', 'urls', 'streaming_api']),
} };
}; };
const keyMap = { const keyMap = {
@ -239,6 +239,7 @@ class SwitchingColumnsArea extends React.PureComponent {
</Switch> </Switch>
); );
} }
} }
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@ -486,7 +487,7 @@ class UI extends React.PureComponent {
} }
handleHotkeyToggleHelp = () => { handleHotkeyToggleHelp = () => {
this.props.dispatch(openModal("HOTKEYS")); this.props.dispatch(openModal('HOTKEYS'));
} }
handleHotkeyGoToHome = () => { handleHotkeyGoToHome = () => {
@ -526,7 +527,7 @@ class UI extends React.PureComponent {
} }
handleOpenComposeModal = () => { handleOpenComposeModal = () => {
this.props.dispatch(openModal("COMPOSE")); this.props.dispatch(openModal('COMPOSE'));
} }
render () { render () {
@ -554,7 +555,7 @@ class UI extends React.PureComponent {
goToRequests: this.handleHotkeyGoToRequests, goToRequests: this.handleHotkeyGoToRequests,
} : {}; } : {};
const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : <button key='floating-action-button' onClick={this.handleOpenComposeModal} className='floating-action-button' aria-label={intl.formatMessage(messages.publish)}></button>; const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : <button key='floating-action-button' onClick={this.handleOpenComposeModal} className='floating-action-button' aria-label={intl.formatMessage(messages.publish)} />;
return ( return (
<HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused> <HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused>

View File

@ -14,6 +14,7 @@ const mapStateToProps = state => {
}; };
class WrappedRoute extends React.Component { class WrappedRoute extends React.Component {
static propTypes = { static propTypes = {
component: PropTypes.func.isRequired, component: PropTypes.func.isRequired,
page: PropTypes.func, page: PropTypes.func,
@ -83,7 +84,8 @@ class WrappedRoute extends React.Component {
return <Route {...rest} render={this.renderComponent} />; return <Route {...rest} render={this.renderComponent} />;
} }
} }
const wrappedRoute = connect(mapStateToProps)(WrappedRoute); const wrappedRoute = connect(mapStateToProps)(WrappedRoute);
export {wrappedRoute as WrappedRoute}; export { wrappedRoute as WrappedRoute };

View File

@ -68,6 +68,7 @@ class GroupPage extends ImmutablePureComponent {
</div> </div>
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -12,13 +12,14 @@ const mapStateToProps = state => {
const me = state.get('me'); const me = state.get('me');
return { return {
account: state.getIn(['accounts', me]), account: state.getIn(['accounts', me]),
} };
}; };
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
class GroupsPage extends ImmutablePureComponent { class GroupsPage extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map account: ImmutablePropTypes.map,
}; };
render () { render () {
@ -52,6 +53,7 @@ class GroupsPage extends ImmutablePureComponent {
</div> </div>
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -17,13 +17,14 @@ const mapStateToProps = state => {
return { return {
account: state.getIn(['accounts', me]), account: state.getIn(['accounts', me]),
hasPatron: state.getIn(['soapbox', 'extensions', 'patron']), hasPatron: state.getIn(['soapbox', 'extensions', 'patron']),
} };
}; };
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
class HomePage extends ImmutablePureComponent { class HomePage extends ImmutablePureComponent {
render () { render () {
const {children, account, hasPatron} = this.props; const { children, account, hasPatron } = this.props;
return ( return (
<div className='page'> <div className='page'>
@ -45,7 +46,7 @@ class HomePage extends ImmutablePureComponent {
<div className='timeline-compose-block__avatar'> <div className='timeline-compose-block__avatar'>
<Avatar account={account} size={46} /> <Avatar account={account} size={46} />
</div> </div>
<ComposeFormContainer shouldCondense={true} autoFocus={false}/> <ComposeFormContainer shouldCondense autoFocus={false} />
</div> </div>
{children} {children}
@ -62,6 +63,7 @@ class HomePage extends ImmutablePureComponent {
</div> </div>
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -24,8 +24,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
let accountUsername = username; let accountUsername = username;
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} } else {
else {
account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
accountUsername = account ? account.getIn(['acct'], '') : ''; accountUsername = account ? account.getIn(['acct'], '') : '';
@ -42,19 +41,20 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
class ProfilePage extends ImmutablePureComponent { class ProfilePage extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
accountUsername: PropTypes.string.isRequired, accountUsername: PropTypes.string.isRequired,
}; };
render () { render () {
const {children, accountId, account, accountUsername} = this.props; const { children, accountId, account, accountUsername } = this.props;
const bg = account ? account.getIn(['customizations', 'background']) : undefined; const bg = account ? account.getIn(['customizations', 'background']) : undefined;
return ( return (
<div className={bg && `page page--customization page--${bg}` || 'page'}> <div className={bg && `page page--customization page--${bg}` || 'page'}>
<div className='page__top'> <div className='page__top'>
<HeaderContainer accountId={accountId} username={accountUsername}/> <HeaderContainer accountId={accountId} username={accountUsername} />
</div> </div>
<div className='page__columns'> <div className='page__columns'>
@ -85,6 +85,7 @@ class ProfilePage extends ImmutablePureComponent {
</div> </div>
</div> </div>
) );
} }
} }

View File

@ -6,7 +6,7 @@ import WhoToFollowPanel from '../features/ui/components/who_to_follow_panel';
import LinkFooter from '../features/ui/components/link_footer'; import LinkFooter from '../features/ui/components/link_footer';
import SignUpPanel from '../features/ui/components/sign_up_panel'; import SignUpPanel from '../features/ui/components/sign_up_panel';
const SearchPage = ({children}) => ( const SearchPage = ({ children }) => (
<div className='page'> <div className='page'>
<div className='page__top'> <div className='page__top'>
<Header /> <Header />

View File

@ -33,7 +33,7 @@ export default function accounts(state = initialState, action) {
return normalizeAccounts(state, action.accounts); return normalizeAccounts(state, action.accounts);
case ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP: case ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP:
return state.set(-1, ImmutableMap({ return state.set(-1, ImmutableMap({
username: action.username username: action.username,
})); }));
default: default:
return state; return state;

View File

@ -24,4 +24,3 @@ export default function group_relationships(state = initialState, action) {
return state; return state;
} }
}; };

View File

@ -146,8 +146,8 @@ export default function notifications(state = initialState, action) {
return updateNotificationsQueue(state, action.notification, action.intlMessages, action.intlLocale); return updateNotificationsQueue(state, action.notification, action.intlMessages, action.intlLocale);
case NOTIFICATIONS_DEQUEUE: case NOTIFICATIONS_DEQUEUE:
return state.withMutations(mutable => { return state.withMutations(mutable => {
mutable.set('queuedNotifications', ImmutableList()) mutable.set('queuedNotifications', ImmutableList());
mutable.set('totalQueuedNotificationsCount', 0) mutable.set('totalQueuedNotificationsCount', 0);
}); });
case NOTIFICATIONS_EXPAND_SUCCESS: case NOTIFICATIONS_EXPAND_SUCCESS:
return expandNormalizedNotifications(state, action.notifications, action.next); return expandNormalizedNotifications(state, action.notifications, action.next);

View File

@ -170,8 +170,8 @@ export default function timelines(state = initialState, action) {
return updateTimelineQueue(state, action.timeline, fromJS(action.status)); return updateTimelineQueue(state, action.timeline, fromJS(action.status));
case TIMELINE_DEQUEUE: case TIMELINE_DEQUEUE:
return state.update(action.timeline, initialTimeline, map => map.withMutations(mMap => { return state.update(action.timeline, initialTimeline, map => map.withMutations(mMap => {
mMap.set('queuedItems', ImmutableList()) mMap.set('queuedItems', ImmutableList());
mMap.set('totalQueuedItemsCount', 0) mMap.set('totalQueuedItemsCount', 0);
})); }));
case TIMELINE_DELETE: case TIMELINE_DELETE:
return deleteStatus(state, action.id, action.accountId, action.references, action.reblogOf); return deleteStatus(state, action.id, action.accountId, action.references, action.reblogOf);
@ -193,7 +193,7 @@ export default function timelines(state = initialState, action) {
map => map.set('online', false).update('items', items => items.first() ? items.unshift(null) : items) map => map.set('online', false).update('items', items => items.first() ? items.unshift(null) : items)
); );
case GROUP_REMOVE_STATUS_SUCCESS: case GROUP_REMOVE_STATUS_SUCCESS:
return removeStatusFromGroup(state, action.groupId, action.id) return removeStatusFromGroup(state, action.groupId, action.id);
default: default:
return state; return state;
} }

View File

@ -16,7 +16,7 @@ export default function trendsReducer(state = initialState, action) {
return state.set('isLoading', true); return state.set('isLoading', true);
case TRENDS_FETCH_SUCCESS: case TRENDS_FETCH_SUCCESS:
return state.withMutations(map => { return state.withMutations(map => {
map.set('items', fromJS(action.tags.map((x => x)))) map.set('items', fromJS(action.tags.map((x => x))));
map.set('isLoading', false); map.set('isLoading', false);
}); });
case TRENDS_FETCH_FAIL: case TRENDS_FETCH_FAIL:

View File

@ -85,9 +85,9 @@ export default function getStream(streamingAPIBaseURL, accessToken, stream, { co
received(JSON.parse(e.data)); received(JSON.parse(e.data));
} catch(error) { } catch(error) {
console.error(e); console.error(e);
console.error(`Could not parse the above streaming event.\n${error}`) console.error(`Could not parse the above streaming event.\n${error}`);
}
} }
};
return ws; return ws;
}; };

View File

@ -1,7 +1,7 @@
const getDomain = account => { const getDomain = account => {
let re = /https?:\/\/(.*?)\//i; let re = /https?:\/\/(.*?)\//i;
return re.exec(account.get('url'))[1]; return re.exec(account.get('url'))[1];
} };
// user@domain even for local users // user@domain even for local users
export const acctFull = account => { export const acctFull = account => {
@ -13,4 +13,4 @@ export const acctFull = account => {
return account.get('acct'); return account.get('acct');
} }
return [user, domain].join('@'); return [user, domain].join('@');
} };

View File

@ -4,14 +4,14 @@ export const maximumAspectRatio = 2.8;
export const isPanoramic = ar => { export const isPanoramic = ar => {
if (isNaN(ar)) return false; if (isNaN(ar)) return false;
return ar >= maximumAspectRatio; return ar >= maximumAspectRatio;
} };
export const isPortrait = ar => { export const isPortrait = ar => {
if (isNaN(ar)) return false; if (isNaN(ar)) return false;
return ar <= minimumAspectRatio; return ar <= minimumAspectRatio;
} };
export const isNonConformingRatio = ar => { export const isNonConformingRatio = ar => {
if (isNaN(ar)) return false; if (isNaN(ar)) return false;
return !isPanoramic(ar) && !isPortrait(ar); return !isPanoramic(ar) && !isPortrait(ar);
} };

View File

@ -64,7 +64,7 @@ delegate(document, '.btngroup__btn', 'click', ({ target: btn }) => {
if (other_btn_hides) { if (other_btn_hides) {
other_btn_hides.style.display = ''; other_btn_hides.style.display = '';
} }
other_btn.classList.remove('btngroup__btn--active') other_btn.classList.remove('btngroup__btn--active');
}); });
// Set given input // Set given input
@ -73,7 +73,7 @@ delegate(document, '.btngroup__btn', 'click', ({ target: btn }) => {
} }
// Highlight current button // Highlight current button
btn.classList.add('btngroup__btn--active') btn.classList.add('btngroup__btn--active');
// Set visibility of given elements // Set visibility of given elements
if (btn_shows) { if (btn_shows) {
@ -96,26 +96,26 @@ delegate(document, '.btngroup__btn', 'click', ({ target: btn }) => {
delegate(document, '.payform', 'submit', (e) => { delegate(document, '.payform', 'submit', (e) => {
e.preventDefault(); e.preventDefault();
document.getElementById("paybtn").disabled = true; document.getElementById('paybtn').disabled = true;
const stripe_pk = document.querySelector("meta[name='stripe-pk']").content; const stripe_pk = document.querySelector('meta[name=\'stripe-pk\']').content;
const csrf_token = document.querySelector("meta[name='csrf-token']").content; const csrf_token = document.querySelector('meta[name=\'csrf-token\']').content;
const price = Math.floor(document.getElementById("price").value.replace(/[^0-9.]/, "") * 100); const price = Math.floor(document.getElementById('price').value.replace(/[^0-9.]/, '') * 100);
const stripe = Stripe(stripe_pk); const stripe = Stripe(stripe_pk);
const req = new XMLHttpRequest(); const req = new XMLHttpRequest();
function checkout () { function checkout () {
stripe.redirectToCheckout({ stripe.redirectToCheckout({
sessionId: this.responseText sessionId: this.responseText,
}).then(function (result) { }).then(function (result) {
console.log(result.error.message); console.log(result.error.message);
}); });
} }
req.addEventListener("load", checkout); req.addEventListener('load', checkout);
req.open("POST", "/donate/stripe"); req.open('POST', '/donate/stripe');
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setRequestHeader("X-CSRF-Token", csrf_token); req.setRequestHeader('X-CSRF-Token', csrf_token);
req.send("amount=" + price); req.send('amount=' + price);
}); });

View File

@ -128,7 +128,7 @@ function main ( ) {
var image = new Image(); var image = new Image();
image.src = path; image.src = path;
image.addEventListener('load', function() { image.addEventListener('load', function() {
document.querySelector('.theme-glinner .public-layout').style.backgroundImage = "url('"+image.src+"')"; document.querySelector('.theme-glinner .public-layout').style.backgroundImage = 'url(\''+image.src+'\')';
}); });
})(); })();
}); });