list fake contacts

This commit is contained in:
Baptiste Lemoine 2020-01-06 20:50:36 +01:00
parent 8ca84658a3
commit d1ca0f69a8
13 changed files with 304 additions and 238 deletions

View File

@ -106,7 +106,7 @@ export function fetchAccount(id) {
dispatch,
getState,
db.transaction('accounts', 'read').objectStore('accounts').index('id'),
id
id,
).then(() => db.close(), error => {
db.close();
throw error;
@ -289,7 +289,6 @@ export function unblockAccountFail(error) {
};
};
export function muteAccount(id, notifications) {
return (dispatch, getState) => {
dispatch(muteAccountRequest(id));
@ -358,7 +357,6 @@ export function unmuteAccountFail(error) {
};
};
export function fetchFollowers(id) {
return (dispatch, getState) => {
dispatch(fetchFollowersRequest(id));
@ -469,6 +467,7 @@ export function fetchFollowingRequest(id) {
};
export function fetchFollowingSuccess(id, accounts, next) {
console.log('id,accounts,next', id, accounts, next);
return {
type: FOLLOWING_FETCH_SUCCESS,
id,
@ -679,7 +678,6 @@ export function authorizeFollowRequestFail(id, error) {
};
};
export function rejectFollowRequest(id) {
return (dispatch, getState) => {
dispatch(rejectFollowRequestRequest(id));

View File

@ -7,8 +7,7 @@ import { useEmoji } from './emojis';
import resizeImage from '../utils/resize_image';
import { importFetchedAccounts } from './importer';
import { updateTimeline } from './timelines';
import { showAlertForError } from './alerts';
import { showAlert } from './alerts';
import { showAlert, showAlertForError } from './alerts';
import { defineMessages } from 'react-intl';
let cancelFetchComposeSuggestionsAccounts, cancelFetchComposeSuggestionsTags;
@ -237,7 +236,8 @@ export function uploadCompose(files) {
},
}).then(({ data }) => dispatch(uploadComposeSuccess(data, f)));
}).catch(error => dispatch(uploadComposeFail(error)));
};
}
;
};
};
@ -259,6 +259,7 @@ export function changeUploadComposeRequest() {
skipLoading: true,
};
};
export function changeUploadComposeSuccess(media) {
return {
type : COMPOSE_UPLOAD_CHANGE_SUCCESS,
@ -463,6 +464,7 @@ export function updateTagHistory(tags) {
export function hydrateCompose() {
return (dispatch, getState) => {
const me = getState().getIn(['meta', 'me']);
console.log('my user id:', me);
const history = tagHistory.get(me);
if (history !== null) {

View File

@ -2,12 +2,12 @@ import { connect } from 'react-redux';
import ComposeForm from '../components/compose_form';
import {
changeCompose,
submitCompose,
changeComposeSpoilerText,
clearComposeSuggestions,
fetchComposeSuggestions,
selectComposeSuggestion,
changeComposeSpoilerText,
insertEmojiCompose,
selectComposeSuggestion,
submitCompose,
uploadCompose,
} from '../../../actions/compose';

View File

@ -5,11 +5,7 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';
import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowing,
expandFollowing,
} from '../../actions/accounts';
import { expandFollowing, fetchAccount, fetchFollowing } from '../../actions/accounts';
import { FormattedMessage } from 'react-intl';
import AccountContainer from '../../containers/account_container';
import Column from '../ui/components/column';
@ -76,7 +72,13 @@ class Following extends ImmutablePureComponent {
);
}
const emptyMessage = blockedBy ? <FormattedMessage id='empty_column.account_unavailable' defaultMessage='Profile unavailable' /> : <FormattedMessage id='account.follows.empty' defaultMessage="This user doesn't follow anyone yet." />;
const emptyMessage = blockedBy ? <FormattedMessage
id='empty_column.account_unavailable'
defaultMessage='Profile unavailable'
/> : <FormattedMessage
id='account.follows.empty'
defaultMessage="This user doesn't follow anyone yet."
/>;
return (
<Column >
@ -87,13 +89,20 @@ class Following extends ImmutablePureComponent {
hasMore={hasMore}
onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll}
prepend={<HeaderContainer accountId={this.props.params.accountId} hideTabs />}
prepend={<HeaderContainer
accountId={this.props.params.accountId}
hideTabs
/>}
alwaysPrepend
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
>
{blockedBy ? [] : accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} />
<AccountContainer
key={id}
id={id}
withNote={false}
/>,
)}
</ScrollableList >
</Column >

View File

@ -222,7 +222,9 @@ class ColumnsArea extends ImmutablePureComponent {
<div className='columns-area__panels__pane columns-area__panels__pane--compositional'>
<div className='columns-area__panels__pane__inner'>
<ComposePanel />
</div >
</div >
<div className='columns-area__panels__main'>

View File

@ -4,7 +4,7 @@ import ComposeFormContainer from 'mastodon/features/compose/containers/compose_f
import NavigationContainer from 'mastodon/features/compose/containers/navigation_container';
import InstantMessaging from './messaging/instantMessaging';
const showIM = false;
const showIM = true;
const ComposePanel = () => (
<div className='compose-panel'>
<SearchContainer openInRoute />

View File

@ -23,7 +23,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
},
});
// const themeIsDark = true;
// const displaythemetoggler = true;
export default @injectIntl
@connect(null, mapDispatchToProps)
@ -31,14 +30,19 @@ class LinkFooter extends React.PureComponent {
static propTypes = {
enableChristmasSnow : PropTypes.bool,
minimumWeekToShowSnow: PropTypes.number,
snowActive : PropTypes.bool,
withHotkeys : PropTypes.bool,
snow : PropTypes.func,
themeIsDark : PropTypes.bool,
theme : PropTypes.string,
onLogout : PropTypes.func.isRequired,
intl : PropTypes.object.isRequired,
};
static defaultProps = {
enableChristmasSnow : true,
themeIsDark : true,
minimumWeekToShowSnow: 48,
};
handleLogoutClick = e => {
@ -60,9 +64,12 @@ class LinkFooter extends React.PureComponent {
var weekNumber = (new Date()).getWeek();
// display snow during the last two weeks of the year
console.log('week', weekNumber);
const shouldWeDisplaySnow = (weekNumber > 48) && props.enableChristmasSnow;
const shouldWeDisplaySnow = (weekNumber > props.minimumWeekToShowSnow) && props.enableChristmasSnow;
this.state = { enableChristmasSnow: shouldWeDisplaySnow };
this.state = {
enableChristmasSnow: shouldWeDisplaySnow,
theme : props.theme,
};
// make snow effect
if (shouldWeDisplaySnow) {
@ -84,12 +91,11 @@ class LinkFooter extends React.PureComponent {
if (this.state.snow) {
if (this.state.snowActive) {
this.state.snow.stop();
this.state.snowActive = false;
this.state.enableChristmasSnow = false;
} else {
this.state.snow.start();
this.state.snowActive = true;
this.state.enableChristmasSnow = true;
}
}
};
@ -99,7 +105,7 @@ class LinkFooter extends React.PureComponent {
render() {
const { withHotkeys } = this.props;
var snowClasses = this.props.snowActive ? 'snow-button active' : 'snow-button ';
var snowClasses = this.props.enableChristmasSnow ? 'snow-button active' : 'snow-button ';
return (
@ -107,24 +113,24 @@ class LinkFooter extends React.PureComponent {
<div className='extras'>
{/*// TODO*/}
{/*<button className='mod-theme btn btn-block'>*/}
{/* {themeIsDark ? (*/}
{/* <span*/}
{/* onClick={this.changeTheme('light')}*/}
{/* title='set light'*/}
{/* >*/}
{/* <i className='fa fa-pencil-o' />*/}
{/* </span >*/}
{/* ) : (*/}
{/* <span*/}
{/* onClick={this.changeTheme('dark')}*/}
{/* title='set dark'*/}
{/* >*/}
{/* <i className='fa fa-pencil' />*/}
{/* </span >*/}
{/* )}*/}
{/*</button >*/}
// TODO
<button className='mod-theme btn btn-block'>
{this.themeIsDark ? (
<span
onClick={this.setState('theme', 'light')}
title='set light'
>
<i className='fa fa-pencil-o' /> to light
</span >
) : (
<span
onClick={this.changeTheme('dark')}
title='set dark'
>
<i className='fa fa-pencil' /> to dark
</span >
)}
</button >
{this.state.enableChristmasSnow && (
<div
@ -138,6 +144,9 @@ class LinkFooter extends React.PureComponent {
/>
</div >
<div > Joyeuses fêtes!</div >
</div >
)}
{isStaff && (
<a href='/admin/tags?pending_review=1'>
@ -151,7 +160,8 @@ class LinkFooter extends React.PureComponent {
<i className='fa fa-paper-plane' />
contactez nous
</a >
<a href='https://liberapay.com/cipherbliss'><i className='fa fa-coffee' /> Supportez Cipherbliss</a >
<a href='https://liberapay.com/cipherbliss'><i className='fa fa-coffee' /> Supportez
Cipherbliss</a >
<a href='https://peertube.cipherbliss.com'> <i className='fa fa-play ' /> Videos</a >
<a href='https://framadate.org/'> <i className='fa fa-calendar' /> FramaDate</a >
@ -164,19 +174,19 @@ class LinkFooter extends React.PureComponent {
<a href='/web/timelines/tag/ironèmes'> <i className='fa fa-file-text-o' /> #ironèmes</a >
</div >
</div >
)}
</div >
<ul >
{invitesEnabled && <li ><a
{invitesEnabled && (
<li >
<a
href='/invites'
target='_blank'
><FormattedMessage
>
<FormattedMessage
id='getting_started.invite'
defaultMessage='Invite people'
/> ·</a >
</li >}
</li >
)}
{withHotkeys && <li ><Link to='/keyboard-shortcuts'>
<FormattedMessage
id='navigation_bar.keyboard_shortcuts'

View File

@ -1,25 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';
import accounts, { me } from '../../../../initial_state';
export default class ContactsList extends React.PureComponent {
static propTypes = {
// myAccount : PropTypes.any,
showList : PropTypes.bool,
contactList : PropTypes.array,
conversationList: PropTypes.array,
following_count : PropTypes.number,
};
static defaultProps = {
showList : true,
// myAccount : '',
userID : me,
following_count: 0,
contactList : ['machin', 'bidule', 'chuck norris'],
};
constructor(props) {
super(props);
console.log('me', me);
console.log('account', accounts.accounts[me]);
console.log('i follow accounts.accounts[me].followingCount', accounts.accounts[me].following_count);
// this.props.myAccount = accounts.accounts[me];
// this.props.following_count = accounts.accounts[me].following_count;
this.state = {
showList : true,
following_count : accounts.accounts[me].following_count,
showList : props.showList,
contactList : ['machin', 'bidule', 'chuck norris'],
conversationList: ['machin', 'bidule', 'chuck norris'],
};
// fetchFollowing(1);
}
submitCompose() {
@ -27,9 +41,7 @@ export default class ContactsList extends React.PureComponent {
}
toggleList = () => {
console.log('toggle');
this.setState((state) => {
console.log('state.showList', state.showList);
return {
showList: !state.showList,
};
@ -38,19 +50,16 @@ export default class ContactsList extends React.PureComponent {
render() {
// return (
// <div >
// liste de contacts
// </div >
// );
const renderedList = this.state.contactList.forEach(elem => {
// const renderedList = 'la liste';
console.log('this.state.contactList', this.state.contactList);
const renderedList = this.state.contactList.map(elem => {
console.log('elem', elem);
return (
<li className='contact-item'>
{elem}
<li className='contact-item'> {elem}
</li >
);
});
const classList = 'btn btn-primary toggle-list ' + (this.state.showList ? 'active' : 'inactive');
return (
<div className='messaging-container'>
<div className='messaging-box'>
@ -60,16 +69,21 @@ export default class ContactsList extends React.PureComponent {
className='fa fa-envelope column-header__icon fa-fw'
/>
Messaging box
</div >
<div className='user-list column-header'>
<h2 className='title'>la liste de {this.state.contactList.lengh} contacts
<div className='user-list'>
<h2 className='title'>
la liste de {this.state.following_count} contacts
<button
className='btn btn-primary'
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 && (

View File

@ -25,5 +25,5 @@ export const usePendingItems = getMeta('use_pending_items');
export const showTrends = getMeta('trends');
export const title = getMeta('title');
export const cropImages = getMeta('crop_images');
console.log('initialState', initialState);
export default initialState;

View File

@ -1,9 +1,10 @@
import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from '../actions/importer';
import { Map as ImmutableMap, fromJS } from 'immutable';
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

@ -141,7 +141,7 @@
position: fixed;
bottom: 0;
left: 1em;
width: 268px;
width: 32vw;
z-index: 10;
text-align: right;

View File

@ -26,10 +26,37 @@ $messagingBoxHeight: 20em;
right: 1em;
width: $messagingBoxWidth;
background: $ui-base-color;
height: 80%;
color: white;
.messager-textarea {
width: 100%;
}
.title {
color: white;
}
}
.contact-list {
display: block;
padding: 1em;
min-height: 5em;
list-style-type: none;
color: white;
}
.toggle-list {
float: right;
margin-left: 1em;
background: $ui-primary-color;
border: 0;
padding: .5em;
&.active {
background: $highlight-text-color;
}
}
.conversation {

View File

@ -2333,6 +2333,9 @@ a.account__display-name {
.columns-area__panels__pane--navigational {
display: none;
}
.getting-started__footer{
width: 250px;
}
}
@media screen and (min-width: 600px + (285px * 2) + (10px * 2)) {