cut components for messaging

Signed-off-by: Baptiste Lemoine <contact@cipherbliss.com>
This commit is contained in:
Baptiste Lemoine 2020-01-07 12:21:34 +01:00
parent ef47cee872
commit fe7ce9f2e0
13 changed files with 481 additions and 270 deletions

View File

@ -3,6 +3,7 @@ Authors
Mastodon is available on [GitHub](https://github.com/tootsuite/mastodon)
and provided thanks to the work of the following contributors:
* [Tykayn](https://framagit.org/tykayn) for the Bliss version
* [Gargron](https://github.com/Gargron)
* [ThibG](https://github.com/ThibG)

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { Link, NavLink } from 'react-router-dom';
import { invitesEnabled, repository, source_url, version } from 'mastodon/initial_state';
import { logOut } from 'mastodon/utils/log_out';
import { openModal } from 'mastodon/actions/modal';
@ -104,17 +104,32 @@ class LinkFooter extends React.PureComponent {
}
render() {
const HashTagNavlinks = ['Mastoart', 'OpenStreetMaps', 'Ironèmes', 'vélo'];
const { withHotkeys } = this.props;
var snowClasses = this.props.enableChristmasSnow ? 'snow-button active' : 'snow-button ';
const navToTags = HashTagNavlinks.map(element => {
return (
<li className='tag-element btn-small btn'>
<NavLink
exact
activeClassName='active'
to={'/timelines/tag/' + element}
title='Mastoart'
>
#{element}
</NavLink >
</li >
);
});
return (
<div className='getting-started__footer hide-on-smaller-screens'>
<div className='links-started__footer desktop-only'>
<div className='extras'>
// TODO
<button className='mod-theme btn btn-block'>
<button className='mod-theme btn btn-block btn-small btn-primary pull-left'>
{this.themeIsDark ? (
<span
onClick={this.setState('theme', 'light')}
@ -150,13 +165,26 @@ class LinkFooter extends React.PureComponent {
</div >
)}
{isStaff && (
<span >
<a href='/admin/tags?pending_review=1'>
<i className='fa fa-fire' />
Trending hashtags</a >
<a
className='btn-warning'
href='/admin/tags?pending_review=1'
>
<i className='fa fa-fire' />
Trending hashtags
</a >
<a
className='btn-warning'
href='/admin/accounts'
>
<i className='fa fa-users' />
Comptes
</a >
</span >
)}
<br />
<div className='external-utilities'>
<a href='https://mastodon.cipherbliss.com/@tykayn'>
<i className='fa fa-paper-plane' />
@ -170,10 +198,11 @@ class LinkFooter extends React.PureComponent {
<a href='https://framapad.org/'> <i className='fa fa-file-text' /> Pad</a >
<a href='https://framagit.org/tykayn/mastodon'> <i className='fa fa-gitlab' /> Source</a >
<hr />
<a href='/web/timelines/tag/vélo'> <i className='fa fa-bicycle' /> #vélo</a >
<a href='/web/timelines/tag/openstreetmap'> <i className='fa fa-map-o' /> #OpenStreetMap</a >
<a href='/web/timelines/tag/mastoart'> <i className='fa fa-paint-brush' /> #Mastoart</a >
<a href='/web/timelines/tag/ironèmes'> <i className='fa fa-file-text-o' /> #ironèmes</a >
<div className='suggested-tags'>
<ul >
{navToTags}
</ul >
</div >
</div >
</div >
<ul >

View File

@ -1,6 +1,7 @@
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import React from 'react';
import Permalink from '../../../../components/permalink';
export default class Contact extends ImmutablePureComponent {
@ -21,6 +22,7 @@ export default class Contact extends ImmutablePureComponent {
};
render() {
const account = this.props.account;
return (
<div
className='contact media'
@ -28,14 +30,22 @@ export default class Contact extends ImmutablePureComponent {
>
<div className='name media-left'>
<div className='avatar image is-32x32'>
<img
className='is-rounded'
src={this.props.account.avatar}
alt='avatar'
/>
</div >
<Permalink
key={account.id}
className='account__display-name'
title={account.acct}
href={account.url}
to={`/accounts/${account.id}`}
>
<div className='avatar image is-32x32'>
<img
className='is-rounded'
src={this.props.account.avatar}
alt='avatar'
/>
</div >
</Permalink >
</div >
<div className='media-content'>
<div className='username'>

View File

@ -81,36 +81,34 @@ export default class ContactsList extends ImmutablePureComponent {
});
}
const classList = 'btn btn-primary toggle-list ' + (this.state.showList ? 'active' : 'inactive');
const showListClass = (this.state.showList ? 'active' : 'inactive');
const classListContainer = 'messaging-box ' + showListClass;
const classList = 'btn btn-primary toggle-list ' + showListClass;
return (
<div className='messaging-container'>
<div className='messaging-box'>
<div className={classListContainer}>
<div className='title column-header'>
<i
role='img'
className='fa fa-envelope column-header__icon fa-fw'
/>
Messaging box
{this.state.following_count} contacts
<button
className={classList}
onClick={this.toggleList}
>
{this.state.showList && (
<i className='fa fa-caret-up' />
)}
{!this.state.showList && (
<i className='fa fa-caret-left' />
)}
</button >
</div >
<div className='user-list'>
<h2 className='title'>
la liste de {this.state.following_count} contacts
<button
className={classList}
onClick={this.toggleList}
>
{this.state.showList && (
<i className='fa fa-caret-up' />
)}
{!this.state.showList && (
<i className='fa fa-caret-left' />
)}
</button >
</h2 >
{this.state.showList && (
<div className='contact-list-container'>
<h3 >show list</h3 >
<ul className='contact-list'>
{renderedList}
</ul >

View File

@ -1,10 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { mockContactList } from './mockContactList';
const following = ['bidule', 'chose', 'truc'];
const following = mockContactList;
export default class Conversation extends React.Component {
export default class ConversationStack extends React.Component {
static propTypes = {
following: PropTypes.array,
@ -15,8 +16,8 @@ export default class Conversation extends React.Component {
following: following,
};
openConversationWith(name) {
console.log('openConversationWith name', name);
openConversationWith(account) {
console.log('openConversationWith name', account.username);
}
render() {
@ -28,7 +29,7 @@ export default class Conversation extends React.Component {
className='username'
onClick={this.openConversationWith(elem)}
>
Machin {elem}
Machin {elem.username}
</div >
<div className='last-active'>3 min</div >
</li >),

View File

@ -1,5 +1,6 @@
import React from 'react';
import ContactsList from './contacts-list';
import ConversationStack from './conversationStack';
export default class InstantMessaging extends React.PureComponent {
@ -25,39 +26,12 @@ export default class InstantMessaging extends React.PureComponent {
//
// };
// constructor() {
// super();
//
// this.props.conversations = [
// {
// withAccount: '@machin',
// messages : [],
// opened : true,
// },
// {
// withAccount: '@chuck',
// messages : [],
// opened : false,
// },
// ];
// this.props.following = [
// { username: 'wulfila', handle: '@wulfila' },
// { username: 'machin', handle: '@machin' },
// { username: 'chuck norris', handle: '@chuck' },
// ];
//
// }
render() {
return (
<div >
<div className='debug'>
messagerie todo
<ContactsList />
</div >
{/*<Conversation />*/}
<ContactsList />
<ConversationStack />
</div >
);
}

View File

@ -10,51 +10,50 @@ import LoadingBarContainer from './containers/loading_bar_container';
import ModalContainer from './containers/modal_container';
import { isMobile } from '../../is_mobile';
import { debounce } from 'lodash';
import { uploadCompose, resetCompose } from '../../actions/compose';
import { resetCompose, uploadCompose } from '../../actions/compose';
import { expandHomeTimeline } from '../../actions/timelines';
import { expandNotifications } from '../../actions/notifications';
import { fetchFilters } from '../../actions/filters';
import { clearHeight } from '../../actions/height_cache';
import { focusApp, unfocusApp } from 'mastodon/actions/app';
import { submitMarkers } from 'mastodon/actions/markers';
import { WrappedSwitch, WrappedRoute } from './util/react_router_helpers';
import { WrappedRoute, WrappedSwitch } from './util/react_router_helpers';
import UploadArea from './components/upload_area';
import ColumnsAreaContainer from './containers/columns_area_container';
import DocumentTitle from './components/document_title';
import {
Compose,
Status,
GettingStarted,
KeyboardShortcuts,
PublicTimeline,
CommunityTimeline,
AccountTimeline,
AccountGallery,
HomeTimeline,
AccountTimeline,
Blocks,
BookmarkedStatuses,
CommunityTimeline,
Compose,
Directory,
DirectTimeline,
DomainBlocks,
FavouritedStatuses,
Favourites,
Followers,
Following,
Reblogs,
Favourites,
DirectTimeline,
HashtagTimeline,
Notifications,
FollowRequests,
GenericNotFound,
FavouritedStatuses,
BookmarkedStatuses,
ListTimeline,
Blocks,
DomainBlocks,
Mutes,
PinnedStatuses,
GettingStarted,
HashtagTimeline,
HomeTimeline,
KeyboardShortcuts,
Lists,
ListTimeline,
Mutes,
Notifications,
PinnedStatuses,
PublicTimeline,
Reblogs,
Search,
Directory,
Status,
} from './util/async-components';
import { me, forceSingleColumn } from '../../initial_state';
import { forceSingleColumn, me } from '../../initial_state';
import { previewState as previewMediaState } from './components/media_modal';
import { previewState as previewVideoState } from './components/video_modal';
// Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles.
import '../../components/status';
@ -64,58 +63,64 @@ const messages = defineMessages({
});
const mapStateToProps = state => ({
isComposing: state.getIn(['compose', 'is_composing']),
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
isComposing : state.getIn(['compose', 'is_composing']),
hasComposingText : state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
dropdownMenuIsOpen: state.getIn(['dropdown_menu', 'openId']) !== null,
canUploadMore : !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
dropdownMenuIsOpen : state.getIn(['dropdown_menu', 'openId']) !== null,
});
const keyMap = {
help: '?',
new: 'n',
search: 's',
forceNew: 'option+n',
focusColumn: ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
reply: 'r',
favourite: 'f',
boost: 'b',
mention: 'm',
open: ['enter', 'o'],
openProfile: 'p',
moveDown: ['down', 'j'],
moveUp: ['up', 'k'],
back: 'backspace',
goToHome: 'g h',
help : '?',
new : 'n',
search : 's',
forceNew : 'option+n',
focusColumn : ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
reply : 'r',
favourite : 'f',
boost : 'b',
mention : 'm',
open : ['enter', 'o'],
openProfile : 'p',
moveDown : ['down', 'j'],
moveUp : ['up', 'k'],
back : 'backspace',
goToHome : 'g h',
goToNotifications: 'g n',
goToLocal: 'g l',
goToFederated: 'g t',
goToDirect: 'g d',
goToStart: 'g s',
goToFavourites: 'g f',
goToPinned: 'g p',
goToProfile: 'g u',
goToBlocked: 'g b',
goToMuted: 'g m',
goToRequests: 'g r',
toggleHidden: 'x',
toggleSensitive: 'h',
openMedia: 'e',
goToLocal : 'g l',
goToFederated : 'g t',
goToDirect : 'g d',
goToStart : 'g s',
goToFavourites : 'g f',
goToPinned : 'g p',
goToProfile : 'g u',
goToBlocked : 'g b',
goToMuted : 'g m',
goToRequests : 'g r',
toggleHidden : 'x',
toggleSensitive : 'h',
openMedia : 'e',
};
class SwitchingColumnsArea extends React.PureComponent {
static propTypes = {
children: PropTypes.node,
location: PropTypes.object,
children : PropTypes.node,
location : PropTypes.object,
onLayoutChange: PropTypes.func.isRequired,
};
state = {
mobile: isMobile(window.innerWidth),
};
handleLayoutChange = debounce(() => {
// The cached heights are no longer accurate, invalidate
this.props.onLayoutChange();
}, 500, {
trailing: true,
});
componentWillMount () {
componentWillMount() {
window.addEventListener('resize', this.handleResize, { passive: true });
if (this.state.mobile || forceSingleColumn) {
@ -127,7 +132,7 @@ class SwitchingColumnsArea extends React.PureComponent {
}
}
componentDidUpdate (prevProps, prevState) {
componentDidUpdate(prevProps, prevState) {
if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) {
this.node.handleChildrenContentChange();
}
@ -138,21 +143,14 @@ class SwitchingColumnsArea extends React.PureComponent {
}
}
componentWillUnmount () {
componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
}
shouldUpdateScroll (_, { location }) {
shouldUpdateScroll(_, { location }) {
return location.state !== previewMediaState && location.state !== previewVideoState;
}
handleLayoutChange = debounce(() => {
// The cached heights are no longer accurate, invalidate
this.props.onLayoutChange();
}, 500, {
trailing: true,
})
handleResize = () => {
const mobile = isMobile(window.innerWidth);
@ -163,61 +161,219 @@ class SwitchingColumnsArea extends React.PureComponent {
} else {
this.handleLayoutChange();
}
}
};
setRef = c => {
if (c) {
this.node = c.getWrappedInstance();
}
}
};
render () {
render() {
const { children } = this.props;
const { mobile } = this.state;
const singleColumn = forceSingleColumn || mobile;
const redirect = singleColumn ? <Redirect from='/' to='/timelines/home' exact /> : <Redirect from='/' to='/getting-started' exact />;
const redirect = singleColumn ? (<Redirect
from='/'
to='/timelines/home'
exact
/>) : (<Redirect
from='/'
to='/getting-started'
exact
/>);
return (
<ColumnsAreaContainer ref={this.setRef} singleColumn={singleColumn}>
<WrappedSwitch>
<ColumnsAreaContainer
ref={this.setRef}
singleColumn={singleColumn}
>
<WrappedSwitch >
{redirect}
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} />
<WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} />
<WrappedRoute path='/timelines/home' component={HomeTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/timelines/public' exact component={PublicTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/timelines/public/local' exact component={CommunityTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/timelines/direct' component={DirectTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/timelines/list/:id' component={ListTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute
path='/tk-example'
component={GettingStarted}
content={children}
/>
<WrappedRoute
path='/getting-started'
component={GettingStarted}
content={children}
/>
<WrappedRoute
path='/keyboard-shortcuts'
component={KeyboardShortcuts}
content={children}
/>
<WrappedRoute
path='/timelines/home'
component={HomeTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/timelines/public'
exact
component={PublicTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/timelines/public/local'
exact
component={CommunityTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/timelines/direct'
component={DirectTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/timelines/tag/:id'
component={HashtagTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/timelines/list/:id'
component={ListTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute path='/notifications' component={Notifications} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/favourites' component={FavouritedStatuses} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/bookmarks' component={BookmarkedStatuses} content={children} />
<WrappedRoute path='/pinned' component={PinnedStatuses} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute
path='/notifications'
component={Notifications}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/favourites'
component={FavouritedStatuses}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/bookmarks'
component={BookmarkedStatuses}
content={children}
/>
<WrappedRoute
path='/pinned'
component={PinnedStatuses}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute path='/search' component={Search} content={children} />
<WrappedRoute path='/directory' component={Directory} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute
path='/search'
component={Search}
content={children}
/>
<WrappedRoute
path='/directory'
component={Directory}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute path='/statuses/new' component={Compose} content={children} />
<WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/statuses/:statusId/reblogs' component={Reblogs} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/statuses/:statusId/favourites' component={Favourites} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute
path='/statuses/new'
component={Compose}
content={children}
/>
<WrappedRoute
path='/statuses/:statusId'
exact
component={Status}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/statuses/:statusId/reblogs'
component={Reblogs}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/statuses/:statusId/favourites'
component={Favourites}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute path='/accounts/:accountId' exact component={AccountTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/accounts/:accountId/with_replies' component={AccountTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll, withReplies: true }} />
<WrappedRoute path='/accounts/:accountId/followers' component={Followers} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/accounts/:accountId/following' component={Following} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/accounts/:accountId/media' component={AccountGallery} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute
path='/accounts/:accountId'
exact
component={AccountTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/accounts/:accountId/with_replies'
component={AccountTimeline}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll, withReplies: true }}
/>
<WrappedRoute
path='/accounts/:accountId/followers'
component={Followers}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/accounts/:accountId/following'
component={Following}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/accounts/:accountId/media'
component={AccountGallery}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute path='/follow_requests' component={FollowRequests} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/blocks' component={Blocks} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/domain_blocks' component={DomainBlocks} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/mutes' component={Mutes} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/lists' component={Lists} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute
path='/follow_requests'
component={FollowRequests}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/blocks'
component={Blocks}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/domain_blocks'
component={DomainBlocks}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/mutes'
component={Mutes}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute
path='/lists'
component={Lists}
content={children}
componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }}
/>
<WrappedRoute component={GenericNotFound} content={children} />
</WrappedSwitch>
</ColumnsAreaContainer>
<WrappedRoute
component={GenericNotFound}
content={children}
/>
</WrappedSwitch >
</ColumnsAreaContainer >
);
}
@ -233,15 +389,15 @@ class UI extends React.PureComponent {
};
static propTypes = {
dispatch: PropTypes.func.isRequired,
children: PropTypes.node,
isComposing: PropTypes.bool,
hasComposingText: PropTypes.bool,
dispatch : PropTypes.func.isRequired,
children : PropTypes.node,
isComposing : PropTypes.bool,
hasComposingText : PropTypes.bool,
hasMediaAttachments: PropTypes.bool,
canUploadMore: PropTypes.bool,
location: PropTypes.object,
intl: PropTypes.object.isRequired,
dropdownMenuIsOpen: PropTypes.bool,
canUploadMore : PropTypes.bool,
location : PropTypes.object,
intl : PropTypes.object.isRequired,
dropdownMenuIsOpen : PropTypes.bool,
};
state = {
@ -259,20 +415,20 @@ class UI extends React.PureComponent {
// but we set user-friendly message for other browsers, e.g. Edge.
e.returnValue = intl.formatMessage(messages.beforeUnload);
}
}
};
handleWindowFocus = () => {
this.props.dispatch(focusApp());
}
};
handleWindowBlur = () => {
this.props.dispatch(unfocusApp());
}
};
handleLayoutChange = () => {
// The cached heights are no longer accurate, invalidate
this.props.dispatch(clearHeight());
}
};
handleDragEnter = (e) => {
e.preventDefault();
@ -288,7 +444,7 @@ class UI extends React.PureComponent {
if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files') && this.props.canUploadMore) {
this.setState({ draggingOver: true });
}
}
};
handleDragOver = (e) => {
if (this.dataTransferIsText(e.dataTransfer)) return false;
@ -303,7 +459,7 @@ class UI extends React.PureComponent {
}
return false;
}
};
handleDrop = (e) => {
if (this.dataTransferIsText(e.dataTransfer)) return;
@ -316,7 +472,7 @@ class UI extends React.PureComponent {
if (e.dataTransfer && e.dataTransfer.files.length >= 1 && this.props.canUploadMore) {
this.props.dispatch(uploadCompose(e.dataTransfer.files));
}
}
};
handleDragLeave = (e) => {
e.preventDefault();
@ -329,15 +485,15 @@ class UI extends React.PureComponent {
}
this.setState({ draggingOver: false });
}
};
dataTransferIsText = (dataTransfer) => {
return (dataTransfer && Array.from(dataTransfer.types).filter((type) => type === 'text/plain').length === 1);
}
};
closeUploadModal = () => {
this.setState({ draggingOver: false });
}
};
handleServiceWorkerPostMessage = ({ data }) => {
if (data.type === 'navigate') {
@ -345,9 +501,9 @@ class UI extends React.PureComponent {
} else {
console.warn('Unknown message type:', data.type);
}
}
};
componentWillMount () {
componentWillMount() {
window.addEventListener('focus', this.handleWindowFocus, false);
window.addEventListener('blur', this.handleWindowBlur, false);
window.addEventListener('beforeunload', this.handleBeforeUnload, false);
@ -358,7 +514,7 @@ class UI extends React.PureComponent {
document.addEventListener('dragleave', this.handleDragLeave, false);
document.addEventListener('dragend', this.handleDragEnd, false);
if ('serviceWorker' in navigator) {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.addEventListener('message', this.handleServiceWorkerPostMessage);
}
@ -372,13 +528,13 @@ class UI extends React.PureComponent {
setTimeout(() => this.props.dispatch(fetchFilters()), 500);
}
componentDidMount () {
componentDidMount() {
this.hotkeys.__mousetrap__.stopCallback = (e, element) => {
return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName);
};
}
componentWillUnmount () {
componentWillUnmount() {
window.removeEventListener('focus', this.handleWindowFocus);
window.removeEventListener('blur', this.handleWindowBlur);
window.removeEventListener('beforeunload', this.handleBeforeUnload);
@ -392,7 +548,7 @@ class UI extends React.PureComponent {
setRef = c => {
this.node = c;
}
};
handleHotkeyNew = e => {
e.preventDefault();
@ -402,7 +558,7 @@ class UI extends React.PureComponent {
if (element) {
element.focus();
}
}
};
handleHotkeySearch = e => {
e.preventDefault();
@ -412,15 +568,15 @@ class UI extends React.PureComponent {
if (element) {
element.focus();
}
}
};
handleHotkeyForceNew = e => {
this.handleHotkeyNew(e);
this.props.dispatch(resetCompose());
}
};
handleHotkeyFocusColumn = e => {
const index = (e.key * 1) + 1; // First child is drawer, skip that
const index = (e.key * 1) + 1; // First child is drawer, skip that
const column = this.node.querySelector(`.column:nth-child(${index})`);
if (!column) return;
const container = column.querySelector('.scrollable');
@ -435,7 +591,7 @@ class UI extends React.PureComponent {
status.focus();
}
}
}
};
handleHotkeyBack = () => {
if (window.history && window.history.length === 1) {
@ -443,11 +599,11 @@ class UI extends React.PureComponent {
} else {
this.context.router.history.goBack();
}
}
};
setHotkeysRef = c => {
this.hotkeys = c;
}
};
handleHotkeyToggleHelp = () => {
if (this.props.location.pathname === '/keyboard-shortcuts') {
@ -455,95 +611,111 @@ class UI extends React.PureComponent {
} else {
this.context.router.history.push('/keyboard-shortcuts');
}
}
};
handleHotkeyGoToHome = () => {
this.context.router.history.push('/timelines/home');
}
};
handleHotkeyGoToNotifications = () => {
this.context.router.history.push('/notifications');
}
};
handleHotkeyGoToLocal = () => {
this.context.router.history.push('/timelines/public/local');
}
};
handleHotkeyGoToFederated = () => {
this.context.router.history.push('/timelines/public');
}
};
handleHotkeyGoToDirect = () => {
this.context.router.history.push('/timelines/direct');
}
};
handleHotkeyGoToStart = () => {
this.context.router.history.push('/getting-started');
}
};
handleHotkeyGoToFavourites = () => {
this.context.router.history.push('/favourites');
}
};
handleHotkeyGoToPinned = () => {
this.context.router.history.push('/pinned');
}
};
handleHotkeyGoToProfile = () => {
this.context.router.history.push(`/accounts/${me}`);
}
};
handleHotkeyGoToBlocked = () => {
this.context.router.history.push('/blocks');
}
};
handleHotkeyGoToMuted = () => {
this.context.router.history.push('/mutes');
}
};
handleHotkeyGoToRequests = () => {
this.context.router.history.push('/follow_requests');
}
};
render () {
render() {
const { draggingOver } = this.state;
const { children, isComposing, location, dropdownMenuIsOpen } = this.props;
const handlers = {
help: this.handleHotkeyToggleHelp,
new: this.handleHotkeyNew,
search: this.handleHotkeySearch,
forceNew: this.handleHotkeyForceNew,
focusColumn: this.handleHotkeyFocusColumn,
back: this.handleHotkeyBack,
goToHome: this.handleHotkeyGoToHome,
help : this.handleHotkeyToggleHelp,
new : this.handleHotkeyNew,
search : this.handleHotkeySearch,
forceNew : this.handleHotkeyForceNew,
focusColumn : this.handleHotkeyFocusColumn,
back : this.handleHotkeyBack,
goToHome : this.handleHotkeyGoToHome,
goToNotifications: this.handleHotkeyGoToNotifications,
goToLocal: this.handleHotkeyGoToLocal,
goToFederated: this.handleHotkeyGoToFederated,
goToDirect: this.handleHotkeyGoToDirect,
goToStart: this.handleHotkeyGoToStart,
goToFavourites: this.handleHotkeyGoToFavourites,
goToPinned: this.handleHotkeyGoToPinned,
goToProfile: this.handleHotkeyGoToProfile,
goToBlocked: this.handleHotkeyGoToBlocked,
goToMuted: this.handleHotkeyGoToMuted,
goToRequests: this.handleHotkeyGoToRequests,
goToLocal : this.handleHotkeyGoToLocal,
goToFederated : this.handleHotkeyGoToFederated,
goToDirect : this.handleHotkeyGoToDirect,
goToStart : this.handleHotkeyGoToStart,
goToFavourites : this.handleHotkeyGoToFavourites,
goToPinned : this.handleHotkeyGoToPinned,
goToProfile : this.handleHotkeyGoToProfile,
goToBlocked : this.handleHotkeyGoToBlocked,
goToMuted : this.handleHotkeyGoToMuted,
goToRequests : this.handleHotkeyGoToRequests,
};
return (
<HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused>
<div className={classNames('ui', { 'is-composing': isComposing })} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}>
<SwitchingColumnsArea location={location} onLayoutChange={this.handleLayoutChange}>
<HotKeys
keyMap={keyMap}
handlers={handlers}
ref={this.setHotkeysRef}
attach={window}
focused
>
<div
className={classNames('ui', { 'is-composing': isComposing })}
ref={this.setRef}
style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}
>
<SwitchingColumnsArea
location={location}
onLayoutChange={this.handleLayoutChange}
>
{children}
</SwitchingColumnsArea>
</SwitchingColumnsArea >
<NotificationsContainer />
<LoadingBarContainer className='loading-bar' />
<ModalContainer />
<UploadArea active={draggingOver} onClose={this.closeUploadModal} />
<UploadArea
active={draggingOver}
onClose={this.closeUploadModal}
/>
<DocumentTitle />
</div>
</HotKeys>
</div >
</HotKeys >
);
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Switch, Route } from 'react-router-dom';
import { Route, Switch } from 'react-router-dom';
import ColumnLoading from '../components/column_loading';
import BundleColumnError from '../components/bundle_column_error';
@ -9,13 +9,13 @@ import BundleContainer from '../containers/bundle_container';
// Small wrapper to pass multiColumn to the route components
export class WrappedSwitch extends React.PureComponent {
render () {
render() {
const { multiColumn, children } = this.props;
return (
<Switch>
<Switch >
{React.Children.map(children, child => React.cloneElement(child, { multiColumn }))}
</Switch>
</Switch >
);
}
@ -23,7 +23,7 @@ export class WrappedSwitch extends React.PureComponent {
WrappedSwitch.propTypes = {
multiColumn: PropTypes.bool,
children: PropTypes.node,
children : PropTypes.node,
};
// Small Wrapper to extract the params from the route and pass
@ -32,9 +32,9 @@ WrappedSwitch.propTypes = {
export class WrappedRoute extends React.Component {
static propTypes = {
component: PropTypes.func.isRequired,
content: PropTypes.node,
multiColumn: PropTypes.bool,
component : PropTypes.func.isRequired,
content : PropTypes.node,
multiColumn : PropTypes.bool,
componentParams: PropTypes.object,
};
@ -46,21 +46,28 @@ export class WrappedRoute extends React.Component {
const { component, content, multiColumn, componentParams } = this.props;
return (
<BundleContainer fetchComponent={component} loading={this.renderLoading} error={this.renderError}>
{Component => <Component params={match.params} multiColumn={multiColumn} {...componentParams}>{content}</Component>}
</BundleContainer>
<BundleContainer
fetchComponent={component}
loading={this.renderLoading}
error={this.renderError}
>
{Component => (<Component
params={match.params}
multiColumn={multiColumn} {...componentParams}
>{content}</Component >)}
</BundleContainer >
);
}
};
renderLoading = () => {
return <ColumnLoading />;
}
};
renderError = (props) => {
return <BundleColumnError {...props} />;
}
};
render () {
render() {
const { component: Component, content, ...rest } = this.props;
return <Route {...rest} render={this.renderComponent} />;

View File

@ -4,7 +4,6 @@ import { fromJS, Map as ImmutableMap } from 'immutable';
const initialState = ImmutableMap();
const normalizeAccount = (state, account) => {
console.log('account', account);
account = { ...account };
delete account.followers_count;

View File

@ -1,3 +1,6 @@
@import '~bulma/bulma';
@import '~bulma/sass/utilities/mixins';
@import 'bliss/variables';
@import 'bliss/mixins';
@import 'bliss/variables';

View File

@ -2265,9 +2265,7 @@ a.account__display-name {
.columns-area__panels__pane--compositional {
display: none;
}
.hide-on-smaller-screens{
display: none;
}
}
@media screen and (min-width: 600px + (285px * 1) + (10px * 1)) {

View File

@ -136,7 +136,7 @@
}
}
.getting-started__footer {
.links-started__footer {
display: block;
position: fixed;
bottom: 0;
@ -144,6 +144,11 @@
width: 32vw;
z-index: 10;
text-align: right;
color: $ui-primary-color;
hr {
border-color: $ui-primary-color;
}
.fa {
margin-right: 1ch;
@ -164,5 +169,6 @@
a {
margin-left: 2ch;
color: $ui-primary-color;
}
}

View File

@ -1,5 +1,5 @@
$messagingBoxWidth: 15em;
$messagingBoxHeight: 20em;
$messagingBoxWidth: 20em;
$messagingBoxHeight: 100%;
.fixed-box {
border: solid 1px white;
@ -26,8 +26,13 @@ $messagingBoxHeight: 20em;
right: 1em;
width: $messagingBoxWidth;
background: $ui-base-color;
height: 80%;
height: 4em;
color: white;
z-index: 10;
&.active {
height: $messagingBoxHeight;
}
.messager-textarea {
width: 100%;
@ -38,6 +43,10 @@ $messagingBoxHeight: 20em;
}
}
.contact-list-container {
overflow-x: auto;
}
.contact-list {
display: block;
padding: 1em;
@ -45,8 +54,12 @@ $messagingBoxHeight: 20em;
list-style-type: none;
color: white;
.contact {
margin-bottom: 0.5rem;
}
}
.toggle-list {
float: right;
margin-left: 1em;