From 9c968a0b2358de20965e1fa804c5e72839aa3653 Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Sat, 21 Dec 2019 17:03:26 +0100 Subject: [PATCH] :zap: refacto messaging into several components --- .../contacts-list.js} | 78 ++++--------------- .../messaging/conversation-stream.js | 14 ++++ .../ui/components/messaging/conversations.js | 24 ++++++ .../ui/components/messaging/messaging.js | 61 +++++++++++++++ .../ui/components/navigation_panel.js | 2 +- 5 files changed, 114 insertions(+), 65 deletions(-) rename app/javascript/mastodon/features/ui/components/{messaging.js => messaging/contacts-list.js} (63%) create mode 100644 app/javascript/mastodon/features/ui/components/messaging/conversation-stream.js create mode 100644 app/javascript/mastodon/features/ui/components/messaging/conversations.js create mode 100644 app/javascript/mastodon/features/ui/components/messaging/messaging.js diff --git a/app/javascript/mastodon/features/ui/components/messaging.js b/app/javascript/mastodon/features/ui/components/messaging/contacts-list.js similarity index 63% rename from app/javascript/mastodon/features/ui/components/messaging.js rename to app/javascript/mastodon/features/ui/components/messaging/contacts-list.js index a6e91167b..e023089bc 100644 --- a/app/javascript/mastodon/features/ui/components/messaging.js +++ b/app/javascript/mastodon/features/ui/components/messaging/contacts-list.js @@ -1,75 +1,21 @@ import React from 'react'; +import { isStaff } from '../../../../initial_state'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { isStaff } from '../../../initial_state'; - -export default class Messaging extends React.PureComponent { - - static propTypes = { - following : ImmutablePropTypes.list, - conversations: ImmutablePropTypes.list, - }; - const; - newMessage = 'meh'; - - openConversationWith(account) { - let conversationFound = account; - // if conversation exist, focus on it - if (conversationFound) { - - } else { - - } - // else, create conversation and focus on it - }; +export default class ContactsList extends React.PureComponent { submitCompose() { - }; - - 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() { - const contactlist = null; + // return ( //
- // messagerie todo - // - // + // liste de contacts //
// ); - // const contactlist = this.props.following.foreEach(elem => ( - //
  • - //
    - // Machin - //
    - //
    3 min
    - //
  • - // )); + const contactlist = null; + return (
    @@ -88,7 +34,11 @@ export default class Messaging extends React.PureComponent {

    User list

      - {contactlist} + {contactlist && +

      + la liste de contacts +

      + }
    @@ -133,8 +83,8 @@ export default class Messaging extends React.PureComponent {