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) Mastodon is available on [GitHub](https://github.com/tootsuite/mastodon)
and provided thanks to the work of the following contributors: and provided thanks to the work of the following contributors:
* [Tykayn](https://framagit.org/tykayn) for the Bliss version
* [Gargron](https://github.com/Gargron) * [Gargron](https://github.com/Gargron)
* [ThibG](https://github.com/ThibG) * [ThibG](https://github.com/ThibG)

View File

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

View File

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

View File

@ -81,21 +81,18 @@ 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 ( return (
<div className='messaging-container'> <div className='messaging-container'>
<div className='messaging-box'> <div className={classListContainer}>
<div className='title column-header'> <div className='title column-header'>
<i <i
role='img' role='img'
className='fa fa-envelope column-header__icon fa-fw' className='fa fa-envelope column-header__icon fa-fw'
/> />
Messaging box {this.state.following_count} contacts
</div >
<div className='user-list'>
<h2 className='title'>
la liste de {this.state.following_count} contacts
<button <button
className={classList} className={classList}
onClick={this.toggleList} onClick={this.toggleList}
@ -107,10 +104,11 @@ export default class ContactsList extends ImmutablePureComponent {
<i className='fa fa-caret-left' /> <i className='fa fa-caret-left' />
)} )}
</button > </button >
</h2 > </div >
<div className='user-list'>
{this.state.showList && ( {this.state.showList && (
<div className='contact-list-container'> <div className='contact-list-container'>
<h3 >show list</h3 >
<ul className='contact-list'> <ul className='contact-list'>
{renderedList} {renderedList}
</ul > </ul >

View File

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

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import ContactsList from './contacts-list'; import ContactsList from './contacts-list';
import ConversationStack from './conversationStack';
export default class InstantMessaging extends React.PureComponent { 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() { render() {
return ( return (
<div > <div >
<div className='debug'>
messagerie todo
<ContactsList /> <ContactsList />
</div > <ConversationStack />
{/*<Conversation />*/}
</div > </div >
); );
} }

View File

@ -10,51 +10,50 @@ import LoadingBarContainer from './containers/loading_bar_container';
import ModalContainer from './containers/modal_container'; import ModalContainer from './containers/modal_container';
import { isMobile } from '../../is_mobile'; import { isMobile } from '../../is_mobile';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { uploadCompose, resetCompose } from '../../actions/compose'; import { resetCompose, uploadCompose } from '../../actions/compose';
import { expandHomeTimeline } from '../../actions/timelines'; import { expandHomeTimeline } from '../../actions/timelines';
import { expandNotifications } from '../../actions/notifications'; import { expandNotifications } from '../../actions/notifications';
import { fetchFilters } from '../../actions/filters'; import { fetchFilters } from '../../actions/filters';
import { clearHeight } from '../../actions/height_cache'; import { clearHeight } from '../../actions/height_cache';
import { focusApp, unfocusApp } from 'mastodon/actions/app'; import { focusApp, unfocusApp } from 'mastodon/actions/app';
import { submitMarkers } from 'mastodon/actions/markers'; 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 UploadArea from './components/upload_area';
import ColumnsAreaContainer from './containers/columns_area_container'; import ColumnsAreaContainer from './containers/columns_area_container';
import DocumentTitle from './components/document_title'; import DocumentTitle from './components/document_title';
import { import {
Compose,
Status,
GettingStarted,
KeyboardShortcuts,
PublicTimeline,
CommunityTimeline,
AccountTimeline,
AccountGallery, AccountGallery,
HomeTimeline, AccountTimeline,
Blocks,
BookmarkedStatuses,
CommunityTimeline,
Compose,
Directory,
DirectTimeline,
DomainBlocks,
FavouritedStatuses,
Favourites,
Followers, Followers,
Following, Following,
Reblogs,
Favourites,
DirectTimeline,
HashtagTimeline,
Notifications,
FollowRequests, FollowRequests,
GenericNotFound, GenericNotFound,
FavouritedStatuses, GettingStarted,
BookmarkedStatuses, HashtagTimeline,
ListTimeline, HomeTimeline,
Blocks, KeyboardShortcuts,
DomainBlocks,
Mutes,
PinnedStatuses,
Lists, Lists,
ListTimeline,
Mutes,
Notifications,
PinnedStatuses,
PublicTimeline,
Reblogs,
Search, Search,
Directory, Status,
} from './util/async-components'; } 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 previewMediaState } from './components/media_modal';
import { previewState as previewVideoState } from './components/video_modal'; import { previewState as previewVideoState } from './components/video_modal';
// Dummy import, to make sure that <Status /> ends up in the application bundle. // Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles. // Without this it ends up in ~8 very commonly used bundles.
import '../../components/status'; import '../../components/status';
@ -114,6 +113,12 @@ class SwitchingColumnsArea extends React.PureComponent {
state = { state = {
mobile: isMobile(window.innerWidth), 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 }); window.addEventListener('resize', this.handleResize, { passive: true });
@ -146,13 +151,6 @@ class SwitchingColumnsArea extends React.PureComponent {
return location.state !== previewMediaState && location.state !== previewVideoState; return location.state !== previewMediaState && location.state !== previewVideoState;
} }
handleLayoutChange = debounce(() => {
// The cached heights are no longer accurate, invalidate
this.props.onLayoutChange();
}, 500, {
trailing: true,
})
handleResize = () => { handleResize = () => {
const mobile = isMobile(window.innerWidth); const mobile = isMobile(window.innerWidth);
@ -163,59 +161,217 @@ class SwitchingColumnsArea extends React.PureComponent {
} else { } else {
this.handleLayoutChange(); this.handleLayoutChange();
} }
} };
setRef = c => { setRef = c => {
if (c) { if (c) {
this.node = c.getWrappedInstance(); this.node = c.getWrappedInstance();
} }
} };
render() { render() {
const { children } = this.props; const { children } = this.props;
const { mobile } = this.state; const { mobile } = this.state;
const singleColumn = forceSingleColumn || mobile; 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 ( return (
<ColumnsAreaContainer ref={this.setRef} singleColumn={singleColumn}> <ColumnsAreaContainer
ref={this.setRef}
singleColumn={singleColumn}
>
<WrappedSwitch > <WrappedSwitch >
{redirect} {redirect}
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} /> <WrappedRoute
<WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} /> path='/tk-example'
<WrappedRoute path='/timelines/home' component={HomeTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> component={GettingStarted}
<WrappedRoute path='/timelines/public' exact component={PublicTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> content={children}
<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
<WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> path='/getting-started'
<WrappedRoute path='/timelines/list/:id' component={ListTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> 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
<WrappedRoute path='/favourites' component={FavouritedStatuses} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> path='/notifications'
<WrappedRoute path='/bookmarks' component={BookmarkedStatuses} content={children} /> component={Notifications}
<WrappedRoute path='/pinned' component={PinnedStatuses} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> 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
<WrappedRoute path='/directory' component={Directory} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> 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
<WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> path='/statuses/new'
<WrappedRoute path='/statuses/:statusId/reblogs' component={Reblogs} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> component={Compose}
<WrappedRoute path='/statuses/:statusId/favourites' component={Favourites} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> 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
<WrappedRoute path='/accounts/:accountId/with_replies' component={AccountTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll, withReplies: true }} /> path='/accounts/:accountId'
<WrappedRoute path='/accounts/:accountId/followers' component={Followers} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> exact
<WrappedRoute path='/accounts/:accountId/following' component={Following} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> component={AccountTimeline}
<WrappedRoute path='/accounts/:accountId/media' component={AccountGallery} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> 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
<WrappedRoute path='/blocks' component={Blocks} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> path='/follow_requests'
<WrappedRoute path='/domain_blocks' component={DomainBlocks} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> component={FollowRequests}
<WrappedRoute path='/mutes' component={Mutes} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> content={children}
<WrappedRoute path='/lists' component={Lists} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> 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} /> <WrappedRoute
component={GenericNotFound}
content={children}
/>
</WrappedSwitch > </WrappedSwitch >
</ColumnsAreaContainer > </ColumnsAreaContainer >
); );
@ -259,20 +415,20 @@ class UI extends React.PureComponent {
// but we set user-friendly message for other browsers, e.g. Edge. // but we set user-friendly message for other browsers, e.g. Edge.
e.returnValue = intl.formatMessage(messages.beforeUnload); e.returnValue = intl.formatMessage(messages.beforeUnload);
} }
} };
handleWindowFocus = () => { handleWindowFocus = () => {
this.props.dispatch(focusApp()); this.props.dispatch(focusApp());
} };
handleWindowBlur = () => { handleWindowBlur = () => {
this.props.dispatch(unfocusApp()); this.props.dispatch(unfocusApp());
} };
handleLayoutChange = () => { handleLayoutChange = () => {
// The cached heights are no longer accurate, invalidate // The cached heights are no longer accurate, invalidate
this.props.dispatch(clearHeight()); this.props.dispatch(clearHeight());
} };
handleDragEnter = (e) => { handleDragEnter = (e) => {
e.preventDefault(); e.preventDefault();
@ -288,7 +444,7 @@ class UI extends React.PureComponent {
if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files') && this.props.canUploadMore) { if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files') && this.props.canUploadMore) {
this.setState({ draggingOver: true }); this.setState({ draggingOver: true });
} }
} };
handleDragOver = (e) => { handleDragOver = (e) => {
if (this.dataTransferIsText(e.dataTransfer)) return false; if (this.dataTransferIsText(e.dataTransfer)) return false;
@ -303,7 +459,7 @@ class UI extends React.PureComponent {
} }
return false; return false;
} };
handleDrop = (e) => { handleDrop = (e) => {
if (this.dataTransferIsText(e.dataTransfer)) return; 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) { if (e.dataTransfer && e.dataTransfer.files.length >= 1 && this.props.canUploadMore) {
this.props.dispatch(uploadCompose(e.dataTransfer.files)); this.props.dispatch(uploadCompose(e.dataTransfer.files));
} }
} };
handleDragLeave = (e) => { handleDragLeave = (e) => {
e.preventDefault(); e.preventDefault();
@ -329,15 +485,15 @@ class UI extends React.PureComponent {
} }
this.setState({ draggingOver: false }); this.setState({ draggingOver: false });
} };
dataTransferIsText = (dataTransfer) => { dataTransferIsText = (dataTransfer) => {
return (dataTransfer && Array.from(dataTransfer.types).filter((type) => type === 'text/plain').length === 1); return (dataTransfer && Array.from(dataTransfer.types).filter((type) => type === 'text/plain').length === 1);
} };
closeUploadModal = () => { closeUploadModal = () => {
this.setState({ draggingOver: false }); this.setState({ draggingOver: false });
} };
handleServiceWorkerPostMessage = ({ data }) => { handleServiceWorkerPostMessage = ({ data }) => {
if (data.type === 'navigate') { if (data.type === 'navigate') {
@ -345,7 +501,7 @@ class UI extends React.PureComponent {
} else { } else {
console.warn('Unknown message type:', data.type); console.warn('Unknown message type:', data.type);
} }
} };
componentWillMount() { componentWillMount() {
window.addEventListener('focus', this.handleWindowFocus, false); window.addEventListener('focus', this.handleWindowFocus, false);
@ -392,7 +548,7 @@ class UI extends React.PureComponent {
setRef = c => { setRef = c => {
this.node = c; this.node = c;
} };
handleHotkeyNew = e => { handleHotkeyNew = e => {
e.preventDefault(); e.preventDefault();
@ -402,7 +558,7 @@ class UI extends React.PureComponent {
if (element) { if (element) {
element.focus(); element.focus();
} }
} };
handleHotkeySearch = e => { handleHotkeySearch = e => {
e.preventDefault(); e.preventDefault();
@ -412,12 +568,12 @@ class UI extends React.PureComponent {
if (element) { if (element) {
element.focus(); element.focus();
} }
} };
handleHotkeyForceNew = e => { handleHotkeyForceNew = e => {
this.handleHotkeyNew(e); this.handleHotkeyNew(e);
this.props.dispatch(resetCompose()); this.props.dispatch(resetCompose());
} };
handleHotkeyFocusColumn = e => { 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
@ -435,7 +591,7 @@ class UI extends React.PureComponent {
status.focus(); status.focus();
} }
} }
} };
handleHotkeyBack = () => { handleHotkeyBack = () => {
if (window.history && window.history.length === 1) { if (window.history && window.history.length === 1) {
@ -443,11 +599,11 @@ class UI extends React.PureComponent {
} else { } else {
this.context.router.history.goBack(); this.context.router.history.goBack();
} }
} };
setHotkeysRef = c => { setHotkeysRef = c => {
this.hotkeys = c; this.hotkeys = c;
} };
handleHotkeyToggleHelp = () => { handleHotkeyToggleHelp = () => {
if (this.props.location.pathname === '/keyboard-shortcuts') { if (this.props.location.pathname === '/keyboard-shortcuts') {
@ -455,55 +611,55 @@ class UI extends React.PureComponent {
} else { } else {
this.context.router.history.push('/keyboard-shortcuts'); this.context.router.history.push('/keyboard-shortcuts');
} }
} };
handleHotkeyGoToHome = () => { handleHotkeyGoToHome = () => {
this.context.router.history.push('/timelines/home'); this.context.router.history.push('/timelines/home');
} };
handleHotkeyGoToNotifications = () => { handleHotkeyGoToNotifications = () => {
this.context.router.history.push('/notifications'); this.context.router.history.push('/notifications');
} };
handleHotkeyGoToLocal = () => { handleHotkeyGoToLocal = () => {
this.context.router.history.push('/timelines/public/local'); this.context.router.history.push('/timelines/public/local');
} };
handleHotkeyGoToFederated = () => { handleHotkeyGoToFederated = () => {
this.context.router.history.push('/timelines/public'); this.context.router.history.push('/timelines/public');
} };
handleHotkeyGoToDirect = () => { handleHotkeyGoToDirect = () => {
this.context.router.history.push('/timelines/direct'); this.context.router.history.push('/timelines/direct');
} };
handleHotkeyGoToStart = () => { handleHotkeyGoToStart = () => {
this.context.router.history.push('/getting-started'); this.context.router.history.push('/getting-started');
} };
handleHotkeyGoToFavourites = () => { handleHotkeyGoToFavourites = () => {
this.context.router.history.push('/favourites'); this.context.router.history.push('/favourites');
} };
handleHotkeyGoToPinned = () => { handleHotkeyGoToPinned = () => {
this.context.router.history.push('/pinned'); this.context.router.history.push('/pinned');
} };
handleHotkeyGoToProfile = () => { handleHotkeyGoToProfile = () => {
this.context.router.history.push(`/accounts/${me}`); this.context.router.history.push(`/accounts/${me}`);
} };
handleHotkeyGoToBlocked = () => { handleHotkeyGoToBlocked = () => {
this.context.router.history.push('/blocks'); this.context.router.history.push('/blocks');
} };
handleHotkeyGoToMuted = () => { handleHotkeyGoToMuted = () => {
this.context.router.history.push('/mutes'); this.context.router.history.push('/mutes');
} };
handleHotkeyGoToRequests = () => { handleHotkeyGoToRequests = () => {
this.context.router.history.push('/follow_requests'); this.context.router.history.push('/follow_requests');
} };
render() { render() {
const { draggingOver } = this.state; const { draggingOver } = this.state;
@ -531,16 +687,32 @@ class UI extends React.PureComponent {
}; };
return ( return (
<HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused> <HotKeys
<div className={classNames('ui', { 'is-composing': isComposing })} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}> keyMap={keyMap}
<SwitchingColumnsArea location={location} onLayoutChange={this.handleLayoutChange}> 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} {children}
</SwitchingColumnsArea > </SwitchingColumnsArea >
<NotificationsContainer /> <NotificationsContainer />
<LoadingBarContainer className='loading-bar' /> <LoadingBarContainer className='loading-bar' />
<ModalContainer /> <ModalContainer />
<UploadArea active={draggingOver} onClose={this.closeUploadModal} /> <UploadArea
active={draggingOver}
onClose={this.closeUploadModal}
/>
<DocumentTitle /> <DocumentTitle />
</div > </div >
</HotKeys > </HotKeys >

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; 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 ColumnLoading from '../components/column_loading';
import BundleColumnError from '../components/bundle_column_error'; import BundleColumnError from '../components/bundle_column_error';
@ -46,19 +46,26 @@ export class WrappedRoute extends React.Component {
const { component, content, multiColumn, componentParams } = this.props; const { component, content, multiColumn, componentParams } = this.props;
return ( return (
<BundleContainer fetchComponent={component} loading={this.renderLoading} error={this.renderError}> <BundleContainer
{Component => <Component params={match.params} multiColumn={multiColumn} {...componentParams}>{content}</Component>} fetchComponent={component}
loading={this.renderLoading}
error={this.renderError}
>
{Component => (<Component
params={match.params}
multiColumn={multiColumn} {...componentParams}
>{content}</Component >)}
</BundleContainer > </BundleContainer >
); );
} };
renderLoading = () => { renderLoading = () => {
return <ColumnLoading />; return <ColumnLoading />;
} };
renderError = (props) => { renderError = (props) => {
return <BundleColumnError {...props} />; return <BundleColumnError {...props} />;
} };
render() { render() {
const { component: Component, content, ...rest } = this.props; const { component: Component, content, ...rest } = this.props;

View File

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

View File

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

View File

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

View File

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

View File

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