save stuff

This commit is contained in:
Baptiste Lemoine 2020-01-16 17:10:18 +01:00
parent 9bef612c35
commit 6a616a0c33
14 changed files with 154 additions and 105 deletions

View File

@ -236,7 +236,7 @@ class Conversation extends ImmutablePureComponent {
className='status__action-bar-button conversation_reply' className='status__action-bar-button conversation_reply'
title={intl.formatMessage(messages.reply)} title={intl.formatMessage(messages.reply)}
icon='reply' icon='reply'
size='15em' size={40}
onClick={this.handleReply} onClick={this.handleReply}
/> />
</div > </div >

View File

@ -72,13 +72,13 @@ class Following extends ImmutablePureComponent {
); );
} }
const emptyMessage = blockedBy ? <FormattedMessage const emptyMessage = blockedBy ? (<FormattedMessage
id='empty_column.account_unavailable' id='empty_column.account_unavailable'
defaultMessage='Profile unavailable' defaultMessage='Profile unavailable'
/> : <FormattedMessage />) : (<FormattedMessage
id='account.follows.empty' id='account.follows.empty'
defaultMessage="This user doesn't follow anyone yet." defaultMessage="This user doesn't follow anyone yet."
/>; />);
return ( return (
<Column > <Column >
@ -98,11 +98,11 @@ class Following extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{blockedBy ? [] : accountIds.map(id => {blockedBy ? [] : accountIds.map(id =>
<AccountContainer (<AccountContainer
key={id} key={id}
id={id} id={id}
withNote={false} withNote={false}
/>, />),
)} )}
</ScrollableList > </ScrollableList >
</Column > </Column >

View File

@ -240,7 +240,10 @@ class ColumnsArea extends ImmutablePureComponent {
</div > </div >
<LinkFooter withHotkeys /> <LinkFooter withHotkeys />
{floatingActionButton} {floatingActionButton}
<InstantMessaging /> <div className='hidden_nope'>
<InstantMessaging />
</div >
</div > </div >
); );
} }

View File

@ -165,8 +165,15 @@ class LinkFooter extends React.PureComponent {
</div > </div >
)} )}
{isStaff && ( {isStaff && (
<span > <span className='staff-actions'>
<NavLink
exact
activeClassName='active'
to={'/tk-example/'}
title='tk example link'
>
example link
</NavLink >
<a <a
className='btn-warning' className='btn-warning'
href='/admin/tags?pending_review=1' href='/admin/tags?pending_review=1'

View File

@ -5,6 +5,7 @@ import api from '../../../../api';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { mockContactList } from './mocks/mockContactList'; import { mockContactList } from './mocks/mockContactList';
import Contact from './Contact'; import Contact from './Contact';
import classNames from 'classnames';
export default class ContactsList extends ImmutablePureComponent { export default class ContactsList extends ImmutablePureComponent {
@ -79,11 +80,15 @@ export default class ContactsList extends ImmutablePureComponent {
} }
const showListClass = (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; const classList = 'btn btn-primary toggle-list ' + showListClass;
return ( return (
<div className='messaging-container'> <div className='messaging-container'>
<div className={classListContainer}> <div
className={classNames('messaging-box ', {
'active' : this.state.showList,
'inactive': !this.state.showList,
})}
>
<div className='card-title '> <div className='card-title '>
<i <i
role='img' role='img'

View File

@ -13,12 +13,11 @@ export default class ConversationItem extends React.PureComponent {
newMessages: PropTypes.number, newMessages: PropTypes.number,
displayed : PropTypes.bool, displayed : PropTypes.bool,
}; };
following = [];
static defaultProps = { static defaultProps = {
newMessages: 0, newMessages: 0,
displayed : true, displayed : true,
}; };
following = [];
constructor(props) { constructor(props) {
super(props); super(props);

View File

@ -18,7 +18,10 @@ export default class ConversationStream extends React.PureComponent {
messagesLists = this.props.messages.map(message => { messagesLists = this.props.messages.map(message => {
return ( return (
<li className={'message ' + message.who}> <li
className={'message ' + message.who}
key={message.id}
>
<p >{message.text}</p > <p >{message.text}</p >
<div className='arrow-down' /> <div className='arrow-down' />
</li > </li >

View File

@ -1,16 +1,33 @@
import React from 'react'; import React from 'react';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ContactsList from './contacts-list'; import ContactsList from './contacts-list';
import ConversationStack from './conversationStack'; import ConversationStack from './conversationStack';
const mapStateToProps = (state, props) => ({
isAccount : !!state.getIn(['accounts', props.params.accountId]),
accountIds: state.getIn(['user_lists', 'following', props.params.accountId, 'items']),
hasMore : !!state.getIn(['user_lists', 'following', props.params.accountId, 'next']),
blockedBy : state.getIn(['relationships', props.params.accountId, 'blocked_by'], false),
});
// @connect(mapStateToProps)
/** /**
* main component for IM, gathers contact list and list of conversations * main component for IM, gathers contact list and list of conversations
*/ */
export default class InstantMessaging extends React.PureComponent { export default class InstantMessaging extends ImmutablePureComponent {
// static propTypes = { static propTypes = {
// following : PropTypes.array, // params : PropTypes.object.isRequired,
// conversations: PropTypes.array, dispatch : PropTypes.func.isRequired,
// }; shouldUpdateScroll: PropTypes.func,
accountIds : ImmutablePropTypes.list,
hasMore : PropTypes.bool,
blockedBy : PropTypes.bool,
isAccount : PropTypes.bool,
multiColumn : PropTypes.bool,
};
// static defaultProps = { // static defaultProps = {
// threadsCompile: true, // threadsCompile: true,
// }; // };
@ -30,6 +47,7 @@ export default class InstantMessaging extends React.PureComponent {
// }; // };
render() { render() {
return ( return (
<div className='main-instant-messaging'> <div className='main-instant-messaging'>

View File

@ -1,14 +1,14 @@
export const mockMessages = [ export const mockMessages = [
{ text: 'oh hello there! 😋 ', who: 'theirs' }, { id: 0, text: 'oh hello there! 😋 ', who: 'theirs' },
{ text: 'General Emoji', who: 'ours' }, { id: 1, text: 'General Emoji', who: 'ours' },
{ text: 'we just achieved comedy', who: 'theirs' }, { id: 2, text: 'we just achieved comedy', who: 'theirs' },
] ]
; ;
export const mockMessages2 = [ export const mockMessages2 = [
{ text: 'oh oh oh ', who: 'theirs' }, { id: 0, text: 'oh oh oh ', who: 'theirs' },
{ text: 'General Emoji', who: 'ours' }, { id: 1, text: 'General Emoji', who: 'ours' },
{ text: 'DANGER!!', who: 'theirs' }, { id: 2, text: 'DANGER!!', who: 'theirs' },
{ text: 'JUST KIDDING WILL ROBINSON.', who: 'theirs' }, { id: 3, text: 'JUST KIDDING WILL ROBINSON.', who: 'theirs' },
] ]
; ;

View File

@ -57,6 +57,7 @@ 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';
import InstantMessaging from './components/messaging/instantMessaging';
const messages = defineMessages({ const messages = defineMessages({
beforeUnload: { id: 'ui.beforeunload', defaultMessage: 'Your draft will be lost if you leave Mastodon.' }, beforeUnload: { id: 'ui.beforeunload', defaultMessage: 'Your draft will be lost if you leave Mastodon.' },
@ -192,7 +193,7 @@ class SwitchingColumnsArea extends React.PureComponent {
{redirect} {redirect}
<WrappedRoute <WrappedRoute
path='/tk-example' path='/tk-example'
component={GettingStarted} component={InstantMessaging}
content={children} content={children}
/> />
<WrappedRoute <WrappedRoute

View File

@ -72,3 +72,13 @@
color: $inverted-text-color; color: $inverted-text-color;
} }
} }
.hidden {
display: none;
&:before {
content: "hidden div here";
background: yellow;
padding: 1em;
}
}

View File

@ -1,84 +1,87 @@
.main-instant-messaging {
.conversation { .conversation {
.conversation__content { .conversation__content {
padding-right: 0; padding-right: 0;
} }
.conversation_reply, .conversation_reply,
.icon-button { .icon-button {
&:hover { &:hover {
color: $ui-highlight-color; color: $ui-highlight-color;
background: mix($ui-base-color, $ui-secondary-color); background: mix($ui-base-color, $ui-secondary-color);
}
}
.conversation_reply,
.icon-button,
.status__action-bar-dropdown {
display: inline-block;
float: right;
width: 18em;
height: 3.2em;
text-align: center;
} }
} }
.conversation_reply, .conversations_list {
.icon-button, @extend .fixed-box;
.status__action-bar-dropdown { right: $messagingBoxWidth + 2em;
display: inline-block; bottom: 0;
float: right; width: 100%;
width: 18em; padding: 0.5em;
height: 3.2em; overflow-x: auto;
text-align: center;
}
}
.conversations_list {
@extend .fixed-box;
right: $messagingBoxWidth + 2em;
bottom: 0;
width: 100%;
padding: 0.5em;
overflow-x: auto;
border: 0;
}
.conversation-item {
float: right;
width: 20em;
margin-left: 2em;
padding: 1em;
border-radius: 15px;
border: 3px solid $classic-primary-color;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
background: $classic-base-color;
&.has-new-message {
background: $ui-highlight-color;
color: $classic-primary-color;
}
&.is-focused {
border-color: $ui-base-color;
}
.username {
font-weight: bold;
}
.conversation-stream,
.conversation_input {
height: 100%;
display: block;
}
&.hidden {
.conversation-stream,
.conversation_input {
display: none;
}
}
.btn {
background: $classic-base-color;
color: $ui-base-color;
float: right;
padding: 0 1em;
margin-left: 1em;
border: 0; border: 0;
} }
.conversation-item {
float: right;
width: 20em;
margin-left: 2em;
padding: 1em;
border-radius: 15px;
border: 3px solid $classic-primary-color;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
background: $classic-base-color;
&.has-new-message {
background: $ui-highlight-color;
color: $classic-primary-color;
}
&.is-focused {
border-color: $ui-base-color;
}
.username {
font-weight: bold;
}
.conversation-stream,
.conversation_input {
height: 100%;
display: block;
}
&.hidden {
.conversation-stream,
.conversation_input {
display: none;
}
}
.btn {
background: $classic-base-color;
color: $ui-base-color;
float: right;
padding: 0 1em;
margin-left: 1em;
border: 0;
}
}
} }

View File

@ -5,7 +5,7 @@
= render 'shared/error_messages', object: resource = render 'shared/error_messages', object: resource
.fields-group .fields-group
= f.not-a-real-input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }, hint: false = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }, hint: false
.actions .actions
= f.button :button, t('auth.reset_password'), type: :submit = f.button :button, t('auth.reset_password'), type: :submit

View File

@ -7,11 +7,11 @@
= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
.fields-group .fields-group
- if use_seamless_external_login? - if use_seamless_external_login?
= f.not-a-real-input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.username_or_email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.username_or_email') }, hint: false = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.username_or_email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.username_or_email') }, hint: false
- else - else
= f.not-a-real-input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }, hint: false = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }, hint: false
.fields-group .fields-group
= f.not-a-real-input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }, hint: false = f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }, hint: false
.actions .actions
= f.button :button, t('auth.login'), type: :submit = f.button :button, t('auth.login'), type: :submit