This commit is contained in:
mgabdev 2020-02-24 16:56:07 -05:00
parent d255982ec5
commit 7679012e2f
84 changed files with 1048 additions and 1132 deletions

View File

@ -21,7 +21,8 @@ const messages = defineMessages({
unmute_notifications: { id: 'account.unmute_notifications', defaultMessage: 'Unmute notifications from @{name}' },
})
export default @injectIntl
export default
@injectIntl
class Account extends ImmutablePureComponent {
static propTypes = {

View File

@ -14,7 +14,8 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
export default @connect(makeMapStateToProps)
export default
@connect(makeMapStateToProps)
class AutosuggestAccount extends ImmutablePureComponent {
static propTypes = {

View File

@ -8,7 +8,8 @@ const messages = defineMessages({
retry: { id: 'bundle_column_error.retry', defaultMessage: 'Try again' },
});
export default @injectIntl
export default
@injectIntl
class BundleColumnError extends PureComponent {
static propTypes = {

View File

@ -1,5 +1,5 @@
import { defineMessages, injectIntl } from 'react-intl';
import IconButton from '../icon_button';
import IconButton from './icon_button';
const messages = defineMessages({
error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' },
@ -7,7 +7,8 @@ const messages = defineMessages({
close: { id: 'bundle_modal_error.close', defaultMessage: 'Close' },
});
export default @injectIntl
export default
@injectIntl
class BundleModalError extends PureComponent {
static propTypes = {

View File

@ -1 +0,0 @@
export { default } from './bundle_modal_error';

View File

@ -9,7 +9,8 @@ const messages = defineMessages({
hide: { id: 'column_header.hide_settings', defaultMessage: 'Hide settings' },
})
export default @injectIntl
export default
@injectIntl
class ColumnHeader extends PureComponent {
static contextTypes = {

View File

@ -6,7 +6,8 @@ const messages = defineMessages({
missing: { id: 'missing_indicator.sublabel', defaultMessage: 'This resource could not be found.' },
})
export default @injectIntl
export default
@injectIntl
class ColumnIndicator extends PureComponent {
static propTypes = {

View File

@ -5,7 +5,8 @@ const messages = defineMessages({
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' },
});
export default @injectIntl
export default
@injectIntl
class Domain extends PureComponent {
static propTypes = {

View File

@ -3,12 +3,36 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import detectPassiveEvents from 'detect-passive-events';
import Overlay from 'react-overlays/lib/Overlay';
import spring from 'react-motion/lib/spring';
import Motion from '../../features/ui/util/optional_motion';
import { openDropdownMenu, closeDropdownMenu } from '../../actions/dropdown_menu';
import { openModal, closeModal } from '../../actions/modal';
import { isUserTouching } from '../../utils/is_mobile';
import Motion from '../../features/ui/util/optional_motion'
import IconButton from '../icon_button';
const listenerOptions = detectPassiveEvents.hasSupport ? { passive: true } : false;
let id = 0;
const mapStateToProps = state => ({
isModalOpen: state.get('modal').modalType === 'ACTIONS',
dropdownPlacement: state.getIn(['dropdown_menu', 'placement']),
openDropdownId: state.getIn(['dropdown_menu', 'openId']),
openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
});
const mapDispatchToProps = (dispatch, { status, items }) => ({
onOpen(id, onItemClick, dropdownPlacement, keyboard) {
dispatch(isUserTouching() ? openModal('ACTIONS', {
status,
actions: items,
onClick: onItemClick,
}) : openDropdownMenu(id, dropdownPlacement, keyboard));
},
onClose(id) {
dispatch(closeModal());
dispatch(closeDropdownMenu(id));
},
});
class DropdownMenu extends PureComponent {
static contextTypes = {
@ -158,7 +182,9 @@ class DropdownMenu extends PureComponent {
}
export default class Dropdown extends ImmutablePureComponent {
export default
@connect(mapStateToProps, mapDispatchToProps)
class Dropdown extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,4 +1,5 @@
import ComposeIcon from './assets/compose_icon';
import Icon from './icon'
import Button from './button'
export default class FloatingActionButton extends Component {
static propTypes = {
@ -14,9 +15,9 @@ export default class FloatingActionButton extends Component {
const { onClick, message } = this.props;
return (
<button onClick={onClick} className='floating-action-button' aria-label={message}>
<ComposeIcon />
</button>
<Button onClick={onClick} className='floating-action-button' aria-label={message}>
<Icon id='compose' />
</Button>
)
}
}

View File

@ -1,25 +0,0 @@
const ComposeIcon = ({
className = 'compose-icon',
width = '26px',
height = '26px',
viewBox = '0 0 50 50'
}) => (
<svg
className={className}
version='1.1'
xmlns='http://www.w3.org/2000/svg'
width={width}
height={height}
viewBox={viewBox}
>
<g>
<path className='compose-icon__path' d="M 37.007812 16.101562 C 36.582031 15.675781 35.828125 15.675781 35.402344 16.101562 L 13.820312 37.703125 C 13.5625 37.960938 13.445312 38.328125 13.503906 38.6875 C 13.5625 39.050781 13.789062 39.359375 14.113281 39.523438 L 15.886719 40.410156 L 15.886719 43.394531 L 10.457031 44.945312 L 4.976562 39.460938 L 6.53125 34.027344 L 9.511719 34.027344 L 10.398438 35.800781 C 10.5625 36.128906 10.871094 36.355469 11.230469 36.414062 C 11.292969 36.425781 11.351562 36.429688 11.414062 36.429688 C 11.710938 36.429688 12 36.3125 12.214844 36.097656 L 33.800781 14.496094 C 34.011719 14.28125 34.132812 13.996094 34.132812 13.691406 C 34.132812 13.390625 34.011719 13.101562 33.800781 12.890625 L 29.625 8.710938 C 29.414062 8.5 29.125 8.378906 28.824219 8.378906 L 28.820312 8.378906 C 28.519531 8.382812 28.230469 8.503906 28.019531 8.714844 L 4.867188 32.09375 C 4.855469 32.105469 4.859375 32.121094 4.847656 32.132812 C 4.730469 32.261719 4.632812 32.40625 4.582031 32.582031 L 2.613281 39.480469 L 0.0429688 48.480469 C -0.0703125 48.878906 0.0429688 49.304688 0.332031 49.597656 C 0.550781 49.8125 0.839844 49.929688 1.136719 49.929688 C 1.238281 49.929688 1.34375 49.914062 1.445312 49.886719 L 10.4375 47.316406 L 17.332031 45.34375 C 17.355469 45.335938 17.367188 45.320312 17.386719 45.316406 C 17.460938 45.289062 17.523438 45.25 17.589844 45.210938 C 17.652344 45.171875 17.71875 45.136719 17.773438 45.089844 C 17.789062 45.074219 17.804688 45.070312 17.820312 45.058594 L 41.179688 21.886719 C 41.390625 21.675781 41.511719 21.386719 41.515625 21.082031 C 41.515625 20.78125 41.394531 20.492188 41.179688 20.277344 Z M 37.007812 16.101562"/>
<path className='compose-icon__path' d="M 48.597656 8.101562 L 41.792969 1.289062 C 40.074219 -0.429688 37.089844 -0.429688 35.371094 1.292969 L 31.210938 5.488281 C 30.773438 5.933594 30.773438 6.648438 31.214844 7.09375 L 42.800781 18.6875 C 43.023438 18.910156 43.3125 19.019531 43.601562 19.019531 C 43.890625 19.019531 44.179688 18.910156 44.402344 18.691406 L 48.597656 14.527344 C 49.457031 13.667969 49.929688 12.527344 49.929688 11.316406 C 49.929688 10.101562 49.457031 8.960938 48.597656 8.101562 Z M 48.597656 8.101562"/>
</g>
<g>
<path className='compose-icon__path' d="M 17.015625 7.59375 L 10.40625 7.59375 L 10.40625 0.996094 C 10.40625 0.453125 9.964844 0 9.421875 0 L 8.578125 0 C 8.035156 0 7.59375 0.453125 7.59375 0.996094 L 7.59375 7.59375 L 0.984375 7.59375 C 0.441406 7.59375 0 8.03125 0 8.574219 L 0 9.425781 C 0 9.96875 0.441406 10.40625 0.984375 10.40625 L 7.59375 10.40625 L 7.59375 17.027344 C 7.59375 17.570312 8.035156 18 8.578125 18 L 9.421875 18 C 9.964844 18 10.40625 17.570312 10.40625 17.027344 L 10.40625 10.40625 L 17.015625 10.40625 C 17.558594 10.40625 18 9.96875 18 9.425781 L 18 8.574219 C 18 8.03125 17.558594 7.59375 17.015625 7.59375 Z M 17.015625 7.59375"/>
</g>
</svg>
)
export default ComposeIcon

View File

@ -1,28 +0,0 @@
.floating-action-button {
display: none;
position: fixed;
z-index: 1000;
border: none;
background-color: $gab-brand-default;
padding-top: 6px;
padding-left: 10px;
@include circle(56px);
@include abs-position(auto, 14px, 14px, auto, false);
@media screen and (max-width: $nav-breakpoint-3) {
display: block !important;
}
&:hover,
&:focus,
&:active {
background-color: lighten($gab-brand-default, 5%);
}
.compose-icon {
&__path {
fill: #fff;
}
}
}

View File

@ -1 +0,0 @@
export { default } from './floating_action_button';

View File

@ -1,39 +0,0 @@
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { defineMessages, injectIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { shortNumberFormat } from '../../utils/numbers';
const messages = defineMessages({
members: { id: 'groups.card.members', defaultMessage: 'Members' },
});
export default
@injectIntl
class GroupListItem extends ImmutablePureComponent {
static propTypes = {
group: ImmutablePropTypes.map.isRequired,
}
render() {
const { intl, group } = this.props;
if (!group) return null;
return (
<div className='trends__item'>
<div className='trends__item__name'>
<Link to={`/groups/${group.get('id')}`}>
<strong>{group.get('title')}</strong>
<br />
<span>
{shortNumberFormat(group.get('member_count'))}
&nbsp;
{intl.formatMessage(messages.members)}
</span>
</Link>
</div>
</div>
);
}
}

View File

@ -1,39 +0,0 @@
import Sidebar from '../sidebar'
export default class ProfileLayout extends PureComponent {
static propTypes = {
layout: PropTypes.object,
title: PropTypes.string,
showBackBtn: PropTypes.bool,
}
render() {
const { children } = this.props
return (
<div className={[_s.default, _s.flexRow, _s.width100PC, _s.heightMin100VH, _s.backgroundcolorSecondary3].join(' ')}>
<Sidebar />
<main role='main' className={[_s.default, _s.flexShrink1, _s.flexGrow1, _s.borderColorSecondary2, _s.borderLeft1PX].join(' ')}>
<div className={[_s.default, _s.height350PX, _s.width100PC].join(' ')}>
<img
className={[_s.default, _s.height350PX, _s.width100PC, _s.objectFitCover].join(' ')}
src='https://gab.com/media/user/bz-5cf53d08403d4.jpeg'
/>
</div>
<div className={[_s.default, _s.width1015PX, _s.flexRow, _s.justifyContentSpaceBetween, _s.paddingLeft15PX, _s.paddingVertical15PX].join(' ')}>
<div className={[_s.default, _s.z1].join(' ')}>
{children}
</div>
</div>
</main>
</div>
)
}
}

View File

@ -33,7 +33,8 @@ const mapDispatchToProps = (dispatch) => ({
},
})
export default @connect(null, mapDispatchToProps)
export default
@connect(null, mapDispatchToProps)
@injectIntl
class LinkFooter extends PureComponent {

View File

@ -5,7 +5,8 @@ const messages = defineMessages({
load_more: { id: 'status.load_more', defaultMessage: 'Load more' },
})
export default @injectIntl
export default
@injectIntl
class LoadMore extends PureComponent {
static propTypes = {

View File

@ -0,0 +1,153 @@
import { defineMessages, injectIntl } from 'react-intl'
import ImmutablePureComponent from 'react-immutable-pure-component'
import ModalLayout from './modal_layout'
import Text from '../text'
import Heading from '../heading'
const messages = defineMessages({
heading: { id: 'keyboard_shortcuts.heading', defaultMessage: 'Keyboard Shortcuts' },
close: { id: 'lightbox.close', defaultMessage: 'Close' },
hotkey: { id: 'keyboard_shortcuts.hotkey', defaultMessage: 'Hotkey' },
reply: { id: 'keyboard_shortcuts.reply', defaultMessage: 'reply' },
mention: { id: 'keyboard_shortcuts.mention', defaultMessage: 'mention author' },
profile: { id: 'keyboard_shortcuts.profile', defaultMessage: 'open author\'s profile' },
favourite: { id: 'keyboard_shortcuts.favourite', defaultMessage: 'favorite' },
boost: { id: 'keyboard_shortcuts.boost', defaultMessage: 'repost' },
enter: { id: 'keyboard_shortcuts.enter', defaultMessage: 'open status' },
toggle_hidden: { id: 'keyboard_shortcuts.toggle_hidden', defaultMessage: 'show/hide text behind CW' },
toggle_sensitivity: { id: 'keyboard_shortcuts.toggle_sensitivity', defaultMessage: 'show/hide media' },
up: { id: 'keyboard_shortcuts.up', defaultMessage: 'move up in the list' },
down: { id: 'keyboard_shortcuts.down', defaultMessage: 'move down in the list' },
column: { id: 'keyboard_shortcuts.column', defaultMessage: 'focus a status in one of the columns' },
compose: { id: 'keyboard_shortcuts.compose', defaultMessage: 'focus the compose textarea' },
gab: { id: 'keyboard_shortcuts.toot', defaultMessage: 'start a brand new gab' },
back: { id: 'keyboard_shortcuts.back', defaultMessage: 'navigate back' },
search: { id: 'keyboard_shortcuts.search', defaultMessage: 'focus search' },
unfocus: { id: 'keyboard_shortcuts.unfocus', defaultMessage: 'un-focus compose textarea/search' },
home: { id: 'keyboard_shortcuts.home', defaultMessage: 'open home timeline' },
notifications: { id: 'keyboard_shortcuts.notifications', defaultMessage: 'open notifications column' },
direct: { id: 'keyboard_shortcuts.direct', defaultMessage: 'open direct messages column' },
start: { id: 'keyboard_shortcuts.start', defaultMessage: 'open "get started" column' },
favourites: { id: 'keyboard_shortcuts.favourites', defaultMessage: 'open favorites list' },
pinned: { id: 'keyboard_shortcuts.pinned', defaultMessage: 'open pinned gabs list' },
my_profile: { id: 'keyboard_shortcuts.my_profile', defaultMessage: 'open your profile' },
blocked: { id: 'keyboard_shortcuts.blocked', defaultMessage: 'open blocked users list' },
muted: { id: 'keyboard_shortcuts.muted', defaultMessage: 'open muted users list' },
requests: { id: 'keyboard_shortcuts.requests', defaultMessage: 'open follow requests list' },
legend: { id: 'keyboard_shortcuts.legend', defaultMessage: 'display this legend' },
})
export default
@injectIntl
class HotkeysModal extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
}
render() {
const { intl } = this.props
return (
<ModalLayout title={intl.formatMessage(messages.heading)}>
<div className={[_s.default, _s.flexRow].join(' ')}>
<table>
<thead>
<tr>
<th>
<Heading size='h4'>
{intl.formatMessage(messages.hotkey)}
</Heading>
</th>
</tr>
</thead>
<tbody>
<HotKeysModalRow hotkey='r' action={intl.formatMessage(messages.reply)} />
<HotKeysModalRow hotkey='m' action={intl.formatMessage(messages.mention)} />
<HotKeysModalRow hotkey='p' action={intl.formatMessage(messages.profile)} />
<HotKeysModalRow hotkey='f' action={intl.formatMessage(messages.favourite)} />
<HotKeysModalRow hotkey='b' action={intl.formatMessage(messages.boost)} />
<HotKeysModalRow hotkey='enter, o' action={intl.formatMessage(messages.enter)} />
<HotKeysModalRow hotkey='x' action={intl.formatMessage(messages.toggle_hidden)} />
<HotKeysModalRow hotkey='h' action={intl.formatMessage(messages.toggle_sensitivity)} />
<HotKeysModalRow hotkey='up, k' action={intl.formatMessage(messages.up)} />
</tbody>
</table>
<table>
<thead>
<tr>
<th>
<Heading size='h4'>
{intl.formatMessage(messages.hotkey)}
</Heading>
</th>
</tr>
</thead>
<tbody>
<HotKeysModalRow hotkey='down, j' action={intl.formatMessage(messages.down)} />
<HotKeysModalRow hotkey='1 - 9' action={intl.formatMessage(messages.column)} />
<HotKeysModalRow hotkey='n' action={intl.formatMessage(messages.compose)} />
<HotKeysModalRow hotkey='alt + n' action={intl.formatMessage(messages.gab)} />
<HotKeysModalRow hotkey='backspace' action={intl.formatMessage(messages.back)} />
<HotKeysModalRow hotkey='s' action={intl.formatMessage(messages.search)} />
<HotKeysModalRow hotkey='esc' action={intl.formatMessage(messages.unfocus)} />
<HotKeysModalRow hotkey='g + h' action={intl.formatMessage(messages.home)} />
<HotKeysModalRow hotkey='g + n' action={intl.formatMessage(messages.notifications)} />
<HotKeysModalRow hotkey='g + d' action={intl.formatMessage(messages.direct)} />
</tbody>
</table>
<table>
<thead>
<tr>
<th>
<Heading size='h4'>
{intl.formatMessage(messages.hotkey)}
</Heading>
</th>
</tr>
</thead>
<tbody>
<HotKeysModalRow hotkey='g + s' action={intl.formatMessage(messages.start)} />
<HotKeysModalRow hotkey='g + f' action={intl.formatMessage(messages.favourites)} />
<HotKeysModalRow hotkey='g + p' action={intl.formatMessage(messages.pinned)} />
<HotKeysModalRow hotkey='g + u' action={intl.formatMessage(messages.my_profile)} />
<HotKeysModalRow hotkey='g + b' action={intl.formatMessage(messages.blocked)} />
<HotKeysModalRow hotkey='g + m' action={intl.formatMessage(messages.muted)} />
<HotKeysModalRow hotkey='g + r' action={intl.formatMessage(messages.requests)} />
<HotKeysModalRow hotkey='?' action={intl.formatMessage(messages.legend)} />
</tbody>
</table>
</div>
</ModalLayout>
)
}
}
class HotKeysModalRow extends PureComponent {
static propTypes = {
hotkey: PropTypes.string.isRequired,
action: PropTypes.string.isRequired,
}
render() {
const { hotkey, action } = this.props
return (
<tr>
<td>
<kbd>
<Text size='small'>
{hotkey}
</Text>
</kbd>
</td>
<td>
<Text size='small'>
{action}
</Text>
</td>
</tr>
)
}
}

View File

@ -1,206 +0,0 @@
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import IconButton from '../../icon_button';
const messages = defineMessages({
heading: { id: 'keyboard_shortcuts.heading', defaultMessage: 'Keyboard Shortcuts' },
close: { id: 'lightbox.close', defaultMessage: 'Close' },
hotkey: { id: 'keyboard_shortcuts.hotkey', defaultMessage: 'Hotkey' },
reply: { id: 'keyboard_shortcuts.reply', defaultMessage: 'reply' },
mention: { id: 'keyboard_shortcuts.mention', defaultMessage: 'mention author' },
profile: { id: 'keyboard_shortcuts.profile', defaultMessage: 'open author\'s profile' },
favourite: { id: 'keyboard_shortcuts.favourite', defaultMessage: 'favorite' },
boost: { id: 'keyboard_shortcuts.boost', defaultMessage: 'repost' },
enter: { id: 'keyboard_shortcuts.enter', defaultMessage: 'open status' },
toggle_hidden: { id: 'keyboard_shortcuts.toggle_hidden', defaultMessage: 'show/hide text behind CW' },
toggle_sensitivity: { id: 'keyboard_shortcuts.toggle_sensitivity', defaultMessage: 'show/hide media' },
up: { id: 'keyboard_shortcuts.up', defaultMessage: 'move up in the list' },
down: { id: 'keyboard_shortcuts.down', defaultMessage: 'move down in the list' },
column: { id: 'keyboard_shortcuts.column', defaultMessage: 'focus a status in one of the columns' },
compose: { id: 'keyboard_shortcuts.compose', defaultMessage: 'focus the compose textarea' },
gab: { id: 'keyboard_shortcuts.toot', defaultMessage: 'start a brand new gab' },
back: { id: 'keyboard_shortcuts.back', defaultMessage: 'navigate back' },
search: { id: 'keyboard_shortcuts.search', defaultMessage: 'focus search' },
unfocus: { id: 'keyboard_shortcuts.unfocus', defaultMessage: 'un-focus compose textarea/search' },
home: { id: 'keyboard_shortcuts.home', defaultMessage: 'open home timeline' },
notifications: { id: 'keyboard_shortcuts.notifications', defaultMessage: 'open notifications column' },
direct: { id: 'keyboard_shortcuts.direct', defaultMessage: 'open direct messages column' },
start: { id: 'keyboard_shortcuts.start', defaultMessage: 'open "get started" column' },
favourites: { id: 'keyboard_shortcuts.favourites', defaultMessage: 'open favorites list' },
pinned: { id: 'keyboard_shortcuts.pinned', defaultMessage: 'open pinned gabs list' },
my_profile: { id: 'keyboard_shortcuts.my_profile', defaultMessage: 'open your profile' },
blocked: { id: 'keyboard_shortcuts.blocked', defaultMessage: 'open blocked users list' },
muted: { id: 'keyboard_shortcuts.muted', defaultMessage: 'open muted users list' },
requests: { id: 'keyboard_shortcuts.requests', defaultMessage: 'open follow requests list' },
legend: { id: 'keyboard_shortcuts.legend', defaultMessage: 'display this legend' },
});
export default @injectIntl
class HotkeysModal extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
onClose: PropTypes.func.isRequired,
};
render () {
const { intl, onClose } = this.props;
return (
<div className='modal-root__modal hotkeys-modal'>
<div className='keyboard-shortcuts'>
<div className='keyboard-shortcuts__header'>
<h3 className='keyboard-shortcuts__header__title'>
{intl.formatMessage(messages.heading)}
</h3>
<IconButton
className='keyboard-shortcuts__close'
title={intl.formatMessage(messages.close)}
icon='times'
onClick={onClose}
size={20}
/>
</div>
<div className='keyboard-shortcuts__content'>
<table>
<thead>
<tr>
<th>{intl.formatMessage(messages.hotkey)}</th>
</tr>
</thead>
<tbody>
<tr>
<td><kbd>r</kbd></td>
<td>{intl.formatMessage(messages.reply)}</td>
</tr>
<tr>
<td><kbd>m</kbd></td>
<td>{intl.formatMessage(messages.mention)}</td>
</tr>
<tr>
<td><kbd>p</kbd></td>
<td>{intl.formatMessage(messages.profile)}</td>
</tr>
<tr>
<td><kbd>f</kbd></td>
<td>{intl.formatMessage(messages.favourite)}</td>
</tr>
<tr>
<td><kbd>b</kbd></td>
<td>{intl.formatMessage(messages.boost)}</td>
</tr>
<tr>
<td><kbd>enter</kbd>, <kbd>o</kbd></td>
<td>{intl.formatMessage(messages.enter)}</td>
</tr>
<tr>
<td><kbd>x</kbd></td>
<td>{intl.formatMessage(messages.toggle_hidden)}</td>
</tr>
<tr>
<td><kbd>h</kbd></td>
<td>{intl.formatMessage(messages.toggle_sensitivity)}</td>
</tr>
<tr>
<td><kbd>up</kbd>, <kbd>k</kbd></td>
<td>{intl.formatMessage(messages.up)}</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>{intl.formatMessage(messages.hotkey)}</th>
</tr>
</thead>
<tbody>
<tr>
<td><kbd>down</kbd>, <kbd>j</kbd></td>
<td>{intl.formatMessage(messages.down)}</td>
</tr>
<tr>
<td><kbd>1</kbd> - <kbd>9</kbd></td>
<td>{intl.formatMessage(messages.column)}</td>
</tr>
<tr>
<td><kbd>n</kbd></td>
<td>{intl.formatMessage(messages.compose)}</td>
</tr>
<tr>
<td><kbd>alt</kbd> + <kbd>n</kbd></td>
<td>{intl.formatMessage(messages.gab)}</td>
</tr>
<tr>
<td><kbd>backspace</kbd></td>
<td>{intl.formatMessage(messages.back)}</td>
</tr>
<tr>
<td><kbd>s</kbd></td>
<td>{intl.formatMessage(messages.search)}</td>
</tr>
<tr>
<td><kbd>esc</kbd></td>
<td>{intl.formatMessage(messages.unfocus)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>h</kbd></td>
<td>{intl.formatMessage(messages.home)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>n</kbd></td>
<td>{intl.formatMessage(messages.notifications)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>d</kbd></td>
<td>{intl.formatMessage(messages.direct)}</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>{intl.formatMessage(messages.hotkey)}</th>
</tr>
</thead>
<tbody>
<tr>
<td><kbd>g</kbd> + <kbd>s</kbd></td>
<td>{intl.formatMessage(messages.start)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>f</kbd></td>
<td>{intl.formatMessage(messages.favourites)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>p</kbd></td>
<td>{intl.formatMessage(messages.pinned)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>u</kbd></td>
<td>{intl.formatMessage(messages.my_profile)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>b</kbd></td>
<td>{intl.formatMessage(messages.blocked)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>m</kbd></td>
<td>{intl.formatMessage(messages.muted)}</td>
</tr>
<tr>
<td><kbd>g</kbd> + <kbd>r</kbd></td>
<td>{intl.formatMessage(messages.requests)}</td>
</tr>
<tr>
<td><kbd>?</kbd></td>
<td>{intl.formatMessage(messages.legend)}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
);
}
}

View File

@ -1,72 +0,0 @@
.keyboard-shortcuts {
padding: 8px 0 0;
overflow: hidden;
background-color: $classic-base-color;
border-radius: 6px;
@media screen and (max-width: 960px) {
height: 90vh;
}
&__header {
display: block;
position: relative;
border-bottom: 1px solid lighten($classic-base-color, 8%);
border-radius: 6px 6px 0 0;
padding: 12px 0;
&__title {
display: block;
width: 80%;
color: $primary-text-color;
@include text-sizing(18px, 700, 24px, center);
@include margin-center;
}
}
&__close {
@include abs-position(10px, 10px);
}
&__content {
display: flex;
flex-direction: row;
padding: 15px;
@media screen and (max-width: 960px) {
flex-direction: column;
overflow: hidden;
overflow-y: scroll;
height: calc(100% - 80px);
-webkit-overflow-scrolling: touch;
}
}
table {
thead {
display: block;
padding-left: 10px;
margin-bottom: 10px;
color: $primary-text-color;
@include text-sizing(16px, 600);
}
tr {
font-size: 12px;
}
td {
padding: 0 10px 8px;
}
kbd {
display: inline-block;
padding: 2px 8px;
background-color: lighten($ui-base-color, 8%);
@include border-design(darken($ui-base-color, 4%), 1px, 4px);
}
}
}

View File

@ -4,11 +4,11 @@ import ComposeModal from './compose_modal/compose_modal';
import ConfirmationModal from './confirmation_modal/confirmation_modal';
import EmbedModal from './embed_modal/embed_modal';
import FocalPointModal from './focal_point_modal/focal_point_modal';
import HotkeysModal from './hotkeys_modal/hotkeys_modal';
import HotkeysModal from './hotkeys_modal';
import MediaModal from './media_modal/media_modal';
import MuteModal from './mute_modal/mute_modal';
import ReportModal from './report_modal/report_modal';
import UnauthorizedModal from './unauthorized_modal/unauthorized_modal';
import UnauthorizedModal from './unauthorized_modal';
import VideoModal from './video_modal/video_modal';
export {

View File

@ -1,44 +0,0 @@
.modal {
padding: 8px 0 0;
overflow: hidden;
background-color: $classic-base-color;
border-radius: 6px;
flex-direction: column;
margin: 10px 0;
&__content {
display: flex;
flex-direction: row;
flex: 1;
padding: 10px;
overflow-y: hidden;
}
@media screen and (max-width:895px) {
margin: 0;
@include size(98vw, 98vh);
}
}
.modal-header {
display: block;
position: relative;
border-bottom: 1px solid lighten($classic-base-color, 8%);
border-radius: 6px 6px 0 0;
@include vertical-padding(12px);
&__title {
display: block;
width: 80%;
color: $gab-background-base-light;
@include text-sizing(18px, 700, 24px, center);
@include margin-center;
}
&__close {
@include abs-position(10px, 10px);
}
}

View File

@ -1,25 +1,28 @@
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
import classNames from 'classnames';
import { openModal } from '../../actions/modal';
import { cancelReplyCompose } from '../../actions/compose';
import { Fragment } from 'react'
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl'
import classNames from 'classnames/bind'
import { openModal } from '../../actions/modal'
import { cancelReplyCompose } from '../../actions/compose'
const messages = defineMessages({
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
});
})
const mapStateToProps = state => ({
composeId: state.getIn(['compose', 'id']),
composeText: state.getIn(['compose', 'text']),
});
})
const mapDispatchToProps = (dispatch) => ({
onOpenModal(type, opts) {
dispatch(openModal(type, opts));
dispatch(openModal(type, opts))
},
onCancelReplyCompose() {
dispatch(cancelReplyCompose());
dispatch(cancelReplyCompose())
},
});
})
const cx = classNames.bind(_s)
export default @connect(mapStateToProps, mapDispatchToProps)
@injectIntl
@ -34,23 +37,23 @@ class ModalBase extends PureComponent {
composeId: PropTypes.string,
composeText: PropTypes.string,
type: PropTypes.string,
};
}
state = {
revealed: !!this.props.children,
};
}
activeElement = this.state.revealed ? document.activeElement : null;
activeElement = this.state.revealed ? document.activeElement : null
handleKeyUp = (e) => {
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
&& !!this.props.children) {
this.handleOnClose();
this.handleOnClose()
}
}
handleOnClose = () => {
const { onOpenModal, composeText, composeId, onClose, intl, type, onCancelReplyCompose } = this.props;
const { onOpenModal, composeText, composeId, onClose, intl, type, onCancelReplyCompose } = this.props
if (!composeId && composeText && type == 'COMPOSE') {
onOpenModal('CONFIRM', {
@ -58,80 +61,86 @@ class ModalBase extends PureComponent {
confirm: intl.formatMessage(messages.confirm),
onConfirm: () => onCancelReplyCompose(),
onCancel: () => onOpenModal('COMPOSE'),
});
})
} else {
onClose();
onClose()
}
};
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false);
window.addEventListener('keyup', this.handleKeyUp, false)
}
componentWillReceiveProps (nextProps) {
if (!!nextProps.children && !this.props.children) {
this.activeElement = document.activeElement;
this.activeElement = document.activeElement
this.getSiblings().forEach(sibling => sibling.setAttribute('inert', true));
this.getSiblings().forEach(sibling => sibling.setAttribute('inert', true))
} else if (!nextProps.children) {
this.setState({ revealed: false });
this.setState({ revealed: false })
}
if (!nextProps.children && !!this.props.children) {
this.activeElement.focus();
this.activeElement = null;
this.activeElement.focus()
this.activeElement = null
}
}
componentDidUpdate (prevProps) {
if (!this.props.children && !!prevProps.children) {
this.getSiblings().forEach(sibling => sibling.removeAttribute('inert'));
this.getSiblings().forEach(sibling => sibling.removeAttribute('inert'))
}
if (this.props.children) {
requestAnimationFrame(() => {
this.setState({ revealed: true });
});
this.setState({ revealed: true })
})
}
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp);
window.removeEventListener('keyup', this.handleKeyUp)
}
getSiblings = () => {
return Array(...this.node.parentElement.childNodes).filter(node => node !== this.node);
return Array(...this.node.parentElement.childNodes).filter(node => node !== this.node)
}
setRef = ref => {
this.node = ref;
this.node = ref
}
render () {
const { children } = this.props;
const { revealed } = this.state;
const visible = !!children;
const { children } = this.props
if (!visible) {
return (
<div className='modal-base modal-base--hidden' ref={this.setRef} />
);
}
const visible = !!children
const classes = classNames('modal-base', {
'modal-base--hidden': !revealed,
});
const containerClasses = cx({
default: 1,
z4: 1,
displayNone: !visible,
})
return (
<div className={classes} ref={this.setRef}>
<div style={{ pointerEvents: visible ? 'auto' : 'none' }}>
<div role='presentation' className='modal-base__overlay' onClick={() => this.handleOnClose()} />
<div role='dialog' className='modal-base__container'>
{children}
</div>
</div>
<div ref={this.setRef} className={containerClasses}>
{
!!visible &&
<Fragment>
<div
role='presentation'
className={[_s.default, _s.backgroundColorPrimaryOpaque, _s.positionFixed, _s.z3, _s.top0, _s.right0, _s.bottom0, _s.left0].join(' ')}
onClick={this.handleOnClose}
/>
<div
role='dialog'
className={[_s.default, _s.positionFixed, _s.alignItemsCenter, _s.justifyContentCenter, _s.z4, _s.width100PC, _s.height100PC, _s.pointerEventsNone, _s.top0, _s.rightAuto, _s.bottomAuto, _s.left0].join(' ')}
>
{children}
</div>
</Fragment>
}
</div>
);
)
}
}

View File

@ -1,40 +1,46 @@
import { defineMessages, injectIntl } from 'react-intl';
import IconButton from '../icon_button';
import './modal_layout';
import { defineMessages, injectIntl } from 'react-intl'
import Button from '../button'
import Block from '../block'
import Heading from '../heading'
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
});
})
export default @injectIntl
export default
@injectIntl
class ModalLayout extends PureComponent {
static propTypes = {
title: PropTypes.string,
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
};
}
render() {
const { title, children, intl, onClose } = this.props;
const { title, children, intl, onClose } = this.props
return (
<div className='modal modal--layout modal--root'>
<div className='modal-header'>
<h3 className='modal-header__title'>{title}</h3>
<IconButton
className='modal-header__close-btn'
title={intl.formatMessage(messages.close)}
icon='times'
onClick={onClose}
size={20}
/>
</div>
<div className='modal__content'>
{children}
</div>
<div className={[_s.width645PX].join(' ')}>
<Block>
<div className={[_s.default, _s.flexRow, _s.alignItemsCenter, _s.justifyContentCenter, _s.borderBottom1PX, _s.borderColorSecondary, _s.height53PX, _s.paddingHorizontal15PX].join(' ')}>
<Heading size='h3'>
{title}
</Heading>
<Button
className=''
title={intl.formatMessage(messages.close)}
onClick={onClose}
icon='times'
iconWidth='20px'
iconWidth='20px'
/>
</div>
<div className={[_s.default, _s.paddingHorizontal15PX, _s.paddingVertical10PX].join(' ')}>
{children}
</div>
</Block>
</div>
)
};
}
}

View File

@ -1,6 +1,6 @@
import Base from '../modal_base';
import Bundle from '../../features/ui/util/bundle';
import BundleModalError from '../bundle_modal_error';
import ModalBase from './modal_base'
import Bundle from '../../features/ui/util/bundle'
import BundleModalError from '../bundle_modal_error'
import {
ActionsModal,
MediaModal,
@ -11,7 +11,8 @@ import {
HotkeysModal,
ComposeModal,
UnauthorizedModal,
} from '../modal';
ProUpgradeModal,
} from '.'
import {
MuteModal,
ReportModal,
@ -19,8 +20,8 @@ import {
ListEditor,
ListAdder,
StatusRevisionModal,
} from '../../features/ui/util/async-components';
import ModalLoading from '../modal_loading';
} from '../../features/ui/util/async-components'
import ModalLoading from '../modal_loading'
const MODAL_COMPONENTS = {
'MEDIA': () => Promise.resolve({ default: MediaModal }),
@ -39,7 +40,7 @@ const MODAL_COMPONENTS = {
'COMPOSE': () => Promise.resolve({ default: ComposeModal }),
'UNAUTHORIZED': () => Promise.resolve({ default: UnauthorizedModal }),
'PRO_UPGRADE': () => Promise.resolve({ default: ProUpgradeModal }),
};
}
export default class ModalRoot extends PureComponent {
@ -47,46 +48,54 @@ export default class ModalRoot extends PureComponent {
type: PropTypes.string,
props: PropTypes.object,
onClose: PropTypes.func.isRequired,
};
}
getSnapshotBeforeUpdate () {
return { visible: !!this.props.type };
return { visible: !!this.props.type }
}
componentDidUpdate (prevProps, prevState, { visible }) {
if (visible) {
document.body.classList.add('with-modals--active');
document.body.classList.add('with-modals--active')
} else {
document.body.classList.remove('with-modals--active');
document.body.classList.remove('with-modals--active')
}
}
renderLoading = modalId => () => {
return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null
}
renderError = (props) => {
return <BundleModalError {...props} onClose={this.onClickClose} />;
return <BundleModalError {...props} onClose={this.onClickClose} />
}
onClickClose = () => {
const { onClose, type } = this.props;
onClose(type);
const { onClose, type } = this.props
onClose(type)
}
render () {
const { type, props } = this.props;
const visible = !!type;
const { type, props } = this.props
const visible = !!type
return (
<Base onClose={this.onClickClose} type={type}>
{visible && (
<Bundle fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}>
{(SpecificComponent) => <SpecificComponent {...props} onClose={this.onClickClose} />}
<ModalBase onClose={this.onClickClose} type={type}>
{
visible &&
<Bundle
fetchComponent={MODAL_COMPONENTS[type]}
loading={this.renderLoading(type)}
error={this.renderError}
renderDelay={200}
>
{
(SpecificComponent) => <SpecificComponent {...props} onClose={this.onClickClose} />
}
</Bundle>
)}
</Base>
);
}
</ModalBase>
)
}
}

View File

@ -0,0 +1,53 @@
import { defineMessages, injectIntl } from 'react-intl'
import ImmutablePureComponent from 'react-immutable-pure-component'
import ModalLayout from './modal_layout'
import Text from '../text'
import Button from '../button'
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
signup: { id: 'unauthorized_modal.title', defaultMessage: 'Sign up for Gab' },
text: { id: 'unauthorized_modal.text', defaultMessage: 'You need to be logged in to do that.' },
register: { id: 'account.register', defaultMessage: 'Sign up' },
alreadyHaveAccount: { id: 'unauthorized_modal.footer', defaultMessage: 'Already have an account? {login}.' },
login: { id: 'account.login', defaultMessage: 'Log in' },
})
export default
@injectIntl
class UnauthorizedModal extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
}
render() {
const { intl } = this.props
return (
<ModalLayout title={intl.formatMessage(messages.signup)}>
<div className={[_s.default, _s.paddingHorizontal10PX, _s.paddingVertical10PX].join(' ')}>
<Text className={_s.marginBottom15PX}>
{intl.formatMessage(messages.text)}
</Text>
<Button href='/auth/sign_up' className={[_s.width240PX, _s.marginLeftAuto, _s.marginLeftAuto].join(' ')}>
{intl.formatMessage(messages.register)}
</Button>
</div>
<div className={[_s.default, _s.paddingHorizontal10PX, _s.paddingVertical10PX].join(' ')}>
<Text color='secondary'>
{
intl.formatMessage(messages.login, {
login: (
<Button text href='/auth/sign_in'>
{intl.formatMessage(messages.login)}
</Button>
)
})
}
</Text>
</div>
</ModalLayout>
)
}
}

View File

@ -1,49 +0,0 @@
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import IconButton from '../../icon_button';
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
signup: {id: 'unauthorized_modal.title', defaultMessage: 'Sign up for Gab' },
text: { id: 'unauthorized_modal.text', defaultMessage: 'You need to be logged in to do that.' },
register: { id: 'account.register', defaultMessage: 'Sign up' },
alreadyHaveAccount: { id: 'unauthorized_modal.footer', defaultMessage: 'Already have an account? {login}.' },
login: { id: 'account.login', defaultMessage: 'Log in' },
});
export default @injectIntl
class UnauthorizedModal extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
onClose: PropTypes.func.isRequired,
};
onClickClose = () => {
this.props.onClose('UNAUTHORIZED');
};
render () {
const { intl } = this.props;
return (
<div className='modal-root__modal compose-modal unauthorized-modal'>
<div className='compose-modal__header'>
<h3 className='compose-modal__header__title'>{intl.formatMessage(messages.signup)}</h3>
<IconButton className='compose-modal__close' title={intl.formatMessage(messages.close)} icon='times' onClick={this.onClickClose} size={20} />
</div>
<div className='compose-modal__content'>
<div className='unauthorized-modal__content'>
<span className='unauthorized-modal-content__text'>{intl.formatMessage(messages.text)}</span>
<a href='/auth/sign_up' className='unauthorized-modal-content__button button'>{intl.formatMessage(messages.register)}</a>
</div>
</div>
<div className='unauthorized-modal__footer'>
{intl.formatMessage(messages.login, {
login: <a href='/auth/sign_in'>{intl.formatMessage(messages.login)}</a>
})}
</div>
</div>
);
}
}

View File

@ -1,41 +0,0 @@
.unauthorized-modal {
width: 440px !important;
@media screen and (max-width:895px) {
@include size(330px, 270px);
}
&__content {
@include size(100%, 150px);
@include flex(center, center, column);
}
&__footer {
border-top: 1px solid #666;
padding: 10px;
@include flex(center, center);
>span {
font-size: 14px;
color: $secondary-text-color;
a {
color: $gab-brand-default !important;
}
}
}
}
.unauthorized-modal-content {
&__text {
display: block;
margin-bottom: 18px;
color: #fff;
font-size: 14px;
}
&__button {
width: 200px;
}
}

View File

@ -1 +0,0 @@
export { default } from './modal_base';

View File

@ -1,34 +0,0 @@
.modal-base {
position: relative;
z-index: 9999;
&--hidden {
display: none;
}
&__overlay {
position: fixed;
background: rgba($base-overlay-background, 0.7);
@include abs-position(0, 0, 0, 0, false);
}
&__container {
position: fixed;
align-content: space-around;
z-index: 9999;
@include size(100%);
@include flex(center, center, column);
@include abs-position(0, auto, auto, 0, false);
@include unselectable;
}
}
// .modal-base__modal {
// pointer-events: auto;
// display: flex;
// z-index: 9999;
// max-height: 100%;
// overflow-y: hidden;
// }

View File

@ -1 +0,0 @@
export { default } from './modal_root';

View File

@ -0,0 +1,70 @@
import { defineMessages, injectIntl } from 'react-intl';
import { fetchSuggestions, dismissSuggestion } from '../../actions/suggestions';
import ImmutablePureComponent from 'react-immutable-pure-component';
import ImmutablePropTypes from 'react-immutable-proptypes';
import AccountContainer from '../../containers/account_container';
import PanelLayout from './panel_layout';
const messages = defineMessages({
dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' },
title: { id: 'who_to_follow.title', defaultMessage: 'Who to Follow' },
show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' },
});
const mapStateToProps = state => ({
suggestions: state.getIn(['suggestions', 'items']),
});
const mapDispatchToProps = dispatch => {
return {
fetchSuggestions: () => dispatch(fetchSuggestions()),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
}
};
export default @connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class WhoToFollowPanel extends ImmutablePureComponent {
static propTypes = {
suggestions: ImmutablePropTypes.list.isRequired,
fetchSuggestions: PropTypes.func.isRequired,
dismissSuggestion: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
componentDidMount () {
this.props.fetchSuggestions();
}
render() {
const { intl, /* suggestions, */ dismissSuggestion } = this.props;
// : testing!!! :
const suggestions = [
"1",
]
// if (suggestions.isEmpty()) {
// return null;
// }
return (
<PanelLayout
title={intl.formatMessage(messages.title)}
footerButtonTitle={intl.formatMessage(messages.show_more)}
footerButtonTo='/explore'
>
<div className={_s.default}>
{suggestions && suggestions.map(accountId => (
<AccountContainer
key={accountId}
id={accountId}
actionIcon='times'
actionTitle={intl.formatMessage(messages.dismissSuggestion)}
onActionClick={dismissSuggestion}
/>
))}
</div>
</PanelLayout>
);
};
};

View File

@ -0,0 +1,70 @@
import { defineMessages, injectIntl } from 'react-intl';
import { fetchSuggestions, dismissSuggestion } from '../../actions/suggestions';
import ImmutablePureComponent from 'react-immutable-pure-component';
import ImmutablePropTypes from 'react-immutable-proptypes';
import AccountContainer from '../../containers/account_container';
import PanelLayout from './panel_layout';
const messages = defineMessages({
dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' },
title: { id: 'who_to_follow.title', defaultMessage: 'Who to Follow' },
show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' },
});
const mapStateToProps = state => ({
suggestions: state.getIn(['suggestions', 'items']),
});
const mapDispatchToProps = dispatch => {
return {
fetchSuggestions: () => dispatch(fetchSuggestions()),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
}
};
export default @connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class WhoToFollowPanel extends ImmutablePureComponent {
static propTypes = {
suggestions: ImmutablePropTypes.list.isRequired,
fetchSuggestions: PropTypes.func.isRequired,
dismissSuggestion: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
componentDidMount () {
this.props.fetchSuggestions();
}
render() {
const { intl, /* suggestions, */ dismissSuggestion } = this.props;
// : testing!!! :
const suggestions = [
"1",
]
// if (suggestions.isEmpty()) {
// return null;
// }
return (
<PanelLayout
title={intl.formatMessage(messages.title)}
footerButtonTitle={intl.formatMessage(messages.show_more)}
footerButtonTo='/explore'
>
<div className={_s.default}>
{suggestions && suggestions.map(accountId => (
<AccountContainer
key={accountId}
id={accountId}
actionIcon='times'
actionTitle={intl.formatMessage(messages.dismissSuggestion)}
onActionClick={dismissSuggestion}
/>
))}
</div>
</PanelLayout>
);
};
};

View File

@ -1 +0,0 @@
export { default } from './permalink';

View File

@ -1,37 +0,0 @@
import classNames from 'classnames';
export default class Permalink extends PureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
className: PropTypes.string,
href: PropTypes.string.isRequired,
children: PropTypes.node,
blank: PropTypes.bool,
button: PropTypes.bool,
};
handleClick = e => {
if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
this.context.router.history.push(this.props.href);
}
}
render () {
const { href, children, className, blank, ...other } = this.props;
const classes = classNames('permalink', className);
const target = blank ? '_blank' : null;
return (
<a target={target} href={href} onClick={this.handleClick} className={classes} {...other}>
{children}
</a>
);
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -0,0 +1,9 @@
export default class Popover extends PureComponent {
render() {
return (
<div>
{ /* */ }
</div>
)
}
}

View File

@ -1,5 +1,4 @@
import { injectIntl, defineMessages } from 'react-intl';
import moment from 'moment';
import { injectIntl, defineMessages } from 'react-intl'
const messages = defineMessages({
just_now: { id: 'relative_time.just_now', defaultMessage: 'now' },
@ -12,7 +11,7 @@ const messages = defineMessages({
minutes_remaining: { id: 'time_remaining.minutes', defaultMessage: '{number, plural, one {# minute} other {# minutes}} left' },
hours_remaining: { id: 'time_remaining.hours', defaultMessage: '{number, plural, one {# hour} other {# hours}} left' },
days_remaining: { id: 'time_remaining.days', defaultMessage: '{number, plural, one {# day} other {# days}} left' },
});
})
const dateFormatOptions = {
hour12: false,
@ -21,94 +20,94 @@ const dateFormatOptions = {
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
};
}
const shortDateFormatOptions = {
month: 'short',
day: 'numeric',
};
}
const SECOND = 1000;
const MINUTE = 1000 * 60;
const HOUR = 1000 * 60 * 60;
const DAY = 1000 * 60 * 60 * 24;
const SECOND = 1000
const MINUTE = 1000 * 60
const HOUR = 1000 * 60 * 60
const DAY = 1000 * 60 * 60 * 24
const MAX_DELAY = 2147483647;
const MAX_DELAY = 2147483647
const selectUnits = delta => {
const absDelta = Math.abs(delta);
const absDelta = Math.abs(delta)
if (absDelta < MINUTE) {
return 'second';
return 'second'
} else if (absDelta < HOUR) {
return 'minute';
return 'minute'
} else if (absDelta < DAY) {
return 'hour';
return 'hour'
}
return 'day';
};
return 'day'
}
const getUnitDelay = units => {
switch (units) {
case 'second':
return SECOND;
case 'minute':
return MINUTE;
case 'hour':
return HOUR;
case 'day':
return DAY;
default:
return MAX_DELAY;
case 'second':
return SECOND
case 'minute':
return MINUTE
case 'hour':
return HOUR
case 'day':
return DAY
default:
return MAX_DELAY
}
};
}
export const timeAgoString = (intl, date, now, year) => {
const delta = now - date.getTime();
const delta = now - date.getTime()
let relativeTime;
let relativeTime
if (delta < 10 * SECOND) {
relativeTime = intl.formatMessage(messages.just_now);
relativeTime = intl.formatMessage(messages.just_now)
} else if (delta < 7 * DAY) {
if (delta < MINUTE) {
relativeTime = intl.formatMessage(messages.seconds, { number: Math.floor(delta / SECOND) });
relativeTime = intl.formatMessage(messages.seconds, { number: Math.floor(delta / SECOND) })
} else if (delta < HOUR) {
relativeTime = intl.formatMessage(messages.minutes, { number: Math.floor(delta / MINUTE) });
relativeTime = intl.formatMessage(messages.minutes, { number: Math.floor(delta / MINUTE) })
} else if (delta < DAY) {
relativeTime = intl.formatMessage(messages.hours, { number: Math.floor(delta / HOUR) });
relativeTime = intl.formatMessage(messages.hours, { number: Math.floor(delta / HOUR) })
} else {
relativeTime = intl.formatMessage(messages.days, { number: Math.floor(delta / DAY) });
relativeTime = intl.formatMessage(messages.days, { number: Math.floor(delta / DAY) })
}
} else if (date.getFullYear() === year) {
relativeTime = intl.formatDate(date, shortDateFormatOptions);
relativeTime = intl.formatDate(date, shortDateFormatOptions)
} else {
relativeTime = intl.formatDate(date, { ...shortDateFormatOptions, year: 'numeric' });
relativeTime = intl.formatDate(date, { ...shortDateFormatOptions, year: 'numeric' })
}
return relativeTime;
};
return relativeTime
}
const timeRemainingString = (intl, date, now) => {
const delta = date.getTime() - now;
const delta = date.getTime() - now
let relativeTime;
let relativeTime
if (delta < 10 * SECOND) {
relativeTime = intl.formatMessage(messages.moments_remaining);
relativeTime = intl.formatMessage(messages.moments_remaining)
} else if (delta < MINUTE) {
relativeTime = intl.formatMessage(messages.seconds_remaining, { number: Math.floor(delta / SECOND) });
relativeTime = intl.formatMessage(messages.seconds_remaining, { number: Math.floor(delta / SECOND) })
} else if (delta < HOUR) {
relativeTime = intl.formatMessage(messages.minutes_remaining, { number: Math.floor(delta / MINUTE) });
relativeTime = intl.formatMessage(messages.minutes_remaining, { number: Math.floor(delta / MINUTE) })
} else if (delta < DAY) {
relativeTime = intl.formatMessage(messages.hours_remaining, { number: Math.floor(delta / HOUR) });
relativeTime = intl.formatMessage(messages.hours_remaining, { number: Math.floor(delta / HOUR) })
} else {
relativeTime = intl.formatMessage(messages.days_remaining, { number: Math.floor(delta / DAY) });
relativeTime = intl.formatMessage(messages.days_remaining, { number: Math.floor(delta / DAY) })
}
return relativeTime;
};
return relativeTime
}
export default @injectIntl
class RelativeTimestamp extends Component {
@ -118,68 +117,68 @@ class RelativeTimestamp extends Component {
timestamp: PropTypes.string.isRequired,
year: PropTypes.number.isRequired,
futureDate: PropTypes.bool,
};
}
state = {
now: this.props.intl.now(),
};
}
static defaultProps = {
year: (new Date()).getFullYear(),
};
}
shouldComponentUpdate (nextProps, nextState) {
shouldComponentUpdate(nextProps, nextState) {
// As of right now the locale doesn't change without a new page load,
// but we might as well check in case that ever changes.
return this.props.timestamp !== nextProps.timestamp ||
this.props.intl.locale !== nextProps.intl.locale ||
this.state.now !== nextState.now;
this.state.now !== nextState.now
}
componentWillReceiveProps (nextProps) {
componentWillReceiveProps(nextProps) {
if (this.props.timestamp !== nextProps.timestamp) {
this.setState({ now: this.props.intl.now() });
this.setState({ now: this.props.intl.now() })
}
}
componentDidMount () {
this._scheduleNextUpdate(this.props, this.state);
componentDidMount() {
this._scheduleNextUpdate(this.props, this.state)
}
componentWillUpdate (nextProps, nextState) {
this._scheduleNextUpdate(nextProps, nextState);
componentWillUpdate(nextProps, nextState) {
this._scheduleNextUpdate(nextProps, nextState)
}
componentWillUnmount () {
clearTimeout(this._timer);
componentWillUnmount() {
clearTimeout(this._timer)
}
_scheduleNextUpdate (props, state) {
clearTimeout(this._timer);
_scheduleNextUpdate(props, state) {
clearTimeout(this._timer)
const { timestamp } = props;
const delta = (new Date(timestamp)).getTime() - state.now;
const unitDelay = getUnitDelay(selectUnits(delta));
const unitRemainder = Math.abs(delta % unitDelay);
const updateInterval = 1000 * 10;
const delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
const { timestamp } = props
const delta = (new Date(timestamp)).getTime() - state.now
const unitDelay = getUnitDelay(selectUnits(delta))
const unitRemainder = Math.abs(delta % unitDelay)
const updateInterval = 1000 * 10
const delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder)
this._timer = setTimeout(() => {
this.setState({ now: this.props.intl.now() });
}, delay);
this.setState({ now: this.props.intl.now() })
}, delay)
}
render () {
const { timestamp, intl, year, futureDate } = this.props;
render() {
const { timestamp, intl, year, futureDate } = this.props
const date = new Date(timestamp);
const relativeTime = futureDate ? timeRemainingString(intl, date, this.state.now) : timeAgoString(intl, date, this.state.now, year);
const date = new Date(timestamp)
const relativeTime = futureDate ? timeRemainingString(intl, date, this.state.now) : timeAgoString(intl, date, this.state.now, year)
return (
<time dateTime={timestamp} title={intl.formatDate(date, dateFormatOptions)}>
{relativeTime}
</time>
);
)
}
}

View File

@ -1 +0,0 @@
export { default } from './relative_timestamp';

View File

@ -1,9 +1,9 @@
import { NavLink } from 'react-router-dom'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { injectIntl, defineMessages } from 'react-intl'
import Button from './button'
import { closeSidebar } from '../actions/sidebar'
import { openModal } from '../actions/modal'
import { me } from '../initial_state'
import { makeGetAccount } from '../selectors'
import SidebarSectionTitle from './sidebar_section_title'
@ -44,9 +44,13 @@ const mapDispatchToProps = (dispatch) => ({
onClose() {
dispatch(closeSidebar())
},
onOpenComposeModal() {
dispatch(openModal('PRO_UPGRADE'))
},
})
export default @connect(mapStateToProps, mapDispatchToProps)
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class Sidebar extends ImmutablePureComponent {
@ -55,6 +59,7 @@ class Sidebar extends ImmutablePureComponent {
account: ImmutablePropTypes.map,
sidebarOpen: PropTypes.bool,
onClose: PropTypes.func.isRequired,
onOpenComposeModal: PropTypes.func.isRequired,
}
state = {
@ -84,6 +89,11 @@ class Sidebar extends ImmutablePureComponent {
})
}
handleOpenComposeModal = () => {
console.log("handleOpenComposeModal")
this.props.onOpenComposeModal()
}
render() {
const { sidebarOpen, intl, account } = this.props
const { moreOpen } = this.state
@ -114,6 +124,11 @@ class Sidebar extends ImmutablePureComponent {
to: '/notifications',
count: 40,
},
{
title: 'Bookmarks',
icon: 'bookmarks',
to: '/bookmarks',
},
{
title: 'Groups',
icon: 'group',
@ -210,6 +225,7 @@ class Sidebar extends ImmutablePureComponent {
<Button
block
onClick={this.handleOpenComposeModal}
className={[_s.paddingVertical15PX, _s.fontSize15PX, _s.fontWeightBold].join(' ')}
>
Gab

View File

@ -5,7 +5,7 @@ import classNames from 'classnames/bind'
import { Link } from 'react-router-dom';
import { openModal } from '../../actions/modal';
import { me, isStaff } from '../../initial_state';
import DropdownMenuContainer from '../../containers/dropdown_menu_container';
import Dropdown from '../dropdown_menu'
import ComposeFormContainer from '../../features/compose/containers/compose_form_container';
import Icon from '../icon';

View File

@ -4,7 +4,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
import classNames from 'classnames/bind'
import { isRtl } from '../../utils/rtl';
import Permalink from '../permalink/permalink';
import Button from '../button'
import Icon from '../icon';
const MAX_HEIGHT = 200;
@ -180,9 +180,9 @@ class StatusContent extends ImmutablePureComponent {
let mentionsPlaceholder = '';
const mentionLinks = status.get('mentions').map(item => (
<Permalink to={`/${item.get('acct')}`} href={`/${item.get('acct')}`} key={item.get('id')} className='mention'>
<Button to={`/${item.get('acct')}`} href={`/${item.get('acct')}`} key={item.get('id')} className='mention'>
@<span>{item.get('username')}</span>
</Permalink>
</Button>
)).reduce((aggregate, item) => [...aggregate, item, ' '], []);
const toggleText = intl.formatMessage(hidden ? messages.showMore : messages.showLess);

View File

@ -0,0 +1,82 @@
import { defineMessages, injectIntl } from 'react-intl'
import spring from 'react-motion/lib/spring'
import Motion from '../features/ui/util/optional_motion'
import Text from './text'
const messages = defineMessages({
title: { id: 'upload_area.title', defaultMessage: 'Drag & drop to upload' },
})
export default
@injectIntl
class UploadArea extends PureComponent {
static propTypes = {
active: PropTypes.bool,
onClose: PropTypes.func,
intl: PropTypes.object.isRequired,
}
handleKeyUp = (e) => {
if (!this.props.active) return
const keyCode = e.keyCode
switch(keyCode) {
case 27:
e.preventDefault()
e.stopPropagation()
this.props.onClose()
break
}
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false)
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp)
}
render () {
const { active, intl } = this.props
return (
<Motion
defaultStyle={{
backgroundOpacity: 0,
backgroundScale: 0.95
}}
style={{
backgroundOpacity: spring(active ? 1 : 0, { stiffness: 150, damping: 15 }),
backgroundScale: spring(active ? 1 : 0.95, { stiffness: 200, damping: 3 })
}}
>
{({ backgroundOpacity, backgroundScale }) => (
<div
className={[_s.default, _s.alignItemsCenter, _s.justifyContentCenter, _s.backgroundColorPrimaryOpaque, _s.width100PC, _s.height100PC, _s.positionAbsolute, _s.top0, _s.rightAuto, _s.bottomAuto, _s.left0].join(' ')}
style={{
visibility: active ? 'visible' : 'hidden',
opacity: backgroundOpacity
}}
>
<div className={[_s.default, _s.width340PX, _s.height260PX, _s.paddingHorizontal10PX, _s.paddingVertical10PX].join(' ')}>
<div
className={[_s.default, _s.positionAbsolute, _s.backgroundColorPrimary, _s.height100PC, _s.width100PC, _s.radiusSmall].join(' ')}
style={{
transform: `scale(${backgroundScale})`
}}
/>
<div className={[_s.default, _s.height100PC, _s.width100PC, _s.border2PX, _s.borderColorSecondary, _s.borderDashed, _s.radiusSmall, _s.alignItemsCenter, _s.justifyContentCenter].join(' ')}>
<Text size='medium' color='secondary'>
{intl.formatMessage(messages.title)}
</Text>
</div>
</div>
</div>
)}
</Motion>
)
}
}

View File

@ -1 +0,0 @@
export { default } from './upload_area';

View File

@ -1,50 +0,0 @@
import { FormattedMessage } from 'react-intl';
import spring from 'react-motion/lib/spring';
import Motion from '../../features/ui/util/optional_motion';
export default class UploadArea extends PureComponent {
static propTypes = {
active: PropTypes.bool,
onClose: PropTypes.func,
};
handleKeyUp = (e) => {
if (!this.props.active) return;
const keyCode = e.keyCode;
switch(keyCode) {
case 27:
e.preventDefault();
e.stopPropagation();
this.props.onClose();
break;
}
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false);
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp);
}
render () {
const { active } = this.props;
return (
<Motion defaultStyle={{ backgroundOpacity: 0, backgroundScale: 0.95 }} style={{ backgroundOpacity: spring(active ? 1 : 0, { stiffness: 150, damping: 15 }), backgroundScale: spring(active ? 1 : 0.95, { stiffness: 200, damping: 3 }) }}>
{({ backgroundOpacity, backgroundScale }) => (
<div className='upload-area' style={{ visibility: active ? 'visible' : 'hidden', opacity: backgroundOpacity }}>
<div className='upload-area__drop'>
<div className='upload-area__background' style={{ transform: `scale(${backgroundScale})` }} />
<div className='upload-area__content'><FormattedMessage id='upload_area.title' defaultMessage='Drag & drop to upload' /></div>
</div>
</div>
)}
</Motion>
);
}
}

View File

@ -1,42 +0,0 @@
.upload-area {
background: rgba($base-overlay-background, 0.8);
opacity: 0;
visibility: hidden;
z-index: 9999;
@include flex(center, center);
@include size(100%);
@include abs-position(0, auto, auto, 0);
* {
pointer-events: none;
}
&__drop {
display: flex;
box-sizing: border-box;
position: relative;
padding: 8px;
@include size(320px, 160px);
}
&__background {
z-index: -1;
border-radius: 4px;
background: $ui-base-color;
box-shadow: 0 0 5px rgba($base-shadow-color, 0.2);
@include abs-position(0, 0, 0, 0);
}
&__content {
flex: 1;
color: $secondary-text-color;
border: 2px dashed $ui-base-lighter-color;
border-radius: 4px;
@include flex(center, center);
@include text-sizing(18px, 500);
}
}

View File

@ -1,27 +0,0 @@
import { openDropdownMenu, closeDropdownMenu } from '../actions/dropdown_menu';
import { openModal, closeModal } from '../actions/modal';
import { isUserTouching } from '../utils/is_mobile';
import DropdownMenu from '../components/dropdown_menu';
const mapStateToProps = state => ({
isModalOpen: state.get('modal').modalType === 'ACTIONS',
dropdownPlacement: state.getIn(['dropdown_menu', 'placement']),
openDropdownId: state.getIn(['dropdown_menu', 'openId']),
openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
});
const mapDispatchToProps = (dispatch, { status, items }) => ({
onOpen(id, onItemClick, dropdownPlacement, keyboard) {
dispatch(isUserTouching() ? openModal('ACTIONS', {
status,
actions: items,
onClick: onItemClick,
}) : openDropdownMenu(id, dropdownPlacement, keyboard));
},
onClose(id) {
dispatch(closeModal());
dispatch(closeDropdownMenu(id));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(DropdownMenu);

View File

@ -7,7 +7,7 @@ import Video from '../features/video';
import Card from '../features/status/components/card';
import Poll from '../components/poll';
import MediaGallery from '../components/media_gallery';
import ModalRoot from '../components/modal_root';
import ModalRoot from '../components/modal/modal_root';
import { MediaModal } from '../components/modal';
const { localeData, messages } = getLocale();

View File

@ -1,6 +1,6 @@
import { closeModal } from '../actions/modal';
import { cancelReplyCompose } from '../actions/compose';
import ModalRoot from '../components/modal_root';
import ModalRoot from '../components/modal/modal_root';
const mapStateToProps = state => ({
type: state.get('modal').modalType,

View File

@ -1,28 +1,28 @@
import { injectIntl } from 'react-intl';
import { NotificationStack } from 'react-notification';
import { dismissAlert } from '../actions/alerts';
import { getAlerts } from '../selectors';
import { injectIntl } from 'react-intl'
import { NotificationStack } from 'react-notification'
import { dismissAlert } from '../actions/alerts'
import { getAlerts } from '../selectors'
const mapStateToProps = (state, { intl }) => {
const notifications = getAlerts(state);
const notifications = getAlerts(state)
notifications.forEach(notification => ['title', 'message'].forEach(key => {
const value = notification[key];
const value = notification[key]
if (typeof value === 'object') {
notification[key] = intl.formatMessage(value);
notification[key] = intl.formatMessage(value)
}
}));
}))
return { notifications };
};
return { notifications }
}
const mapDispatchToProps = (dispatch) => {
return {
onDismiss: alert => {
dispatch(dismissAlert(alert));
dispatch(dismissAlert(alert))
},
};
};
}
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(NotificationStack));
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(NotificationStack))

View File

@ -8,7 +8,7 @@ import Button from '../../../components/button';
import { autoPlayGif, me, isStaff } from '../../../initial_state';
import Avatar from '../../../components/avatar';
import { shortNumberFormat } from '../../../utils/numbers';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import Dropdown from '../../../components/dropdown_menu'
import ProfileInfoPanel from './profile_info_panel/profile_info_panel';
const messages = defineMessages({

View File

@ -1,112 +1,111 @@
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl'
import {
expandCommunityTimeline,
expandPublicTimeline,
} from '../../actions/timelines';
} from '../../actions/timelines'
import {
connectCommunityStream,
connectPublicStream,
} from '../../actions/streaming';
import StatusListContainer from '../../containers/status_list_container';;
// import ColumnSettingsContainer from '.containers/column_settings_container';
import Column from '../../components/column';
} from '../../actions/streaming'
import StatusListContainer from '../../containers/status_list_container'
const messages = defineMessages({
title: { id: 'column.community', defaultMessage: 'Community timeline' },
});
empty: { id: 'empty_column.community', defaultMessage: 'The community timeline is empty. Write something publicly to get the ball rolling!' },
})
const mapStateToProps = state => {
const allFediverse = state.getIn(['settings', 'community', 'other', 'allFediverse']);
const onlyMedia = state.getIn(['settings', 'community', 'other', 'onlyMedia']);
const allFediverse = state.getIn(['settings', 'community', 'other', 'allFediverse'])
const onlyMedia = state.getIn(['settings', 'community', 'other', 'onlyMedia'])
const timelineId = allFediverse ? 'public' : 'community';
const timelineId = allFediverse ? 'public' : 'community'
return {
timelineId,
allFediverse,
onlyMedia,
hasUnread: state.getIn(['timelines', `${timelineId}${onlyMedia ? ':media' : ''}`, 'unread']) > 0,
};
};
// hasUnread: state.getIn(['timelines', `${timelineId}${onlyMedia ? ':media' : ''}`, 'unread']) > 0,
}
}
export default @connect(mapStateToProps)
export default
@connect(mapStateToProps)
@injectIntl
class CommunityTimeline extends PureComponent {
static contextTypes = {
router: PropTypes.object,
};
}
static propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool,
// hasUnread: PropTypes.bool,
onlyMedia: PropTypes.bool,
allFediverse: PropTypes.bool,
timelineId: PropTypes.string,
};
}
componentDidMount () {
const { dispatch, onlyMedia, allFediverse } = this.props;
const { dispatch, onlyMedia, allFediverse } = this.props
if (allFediverse) {
dispatch(expandPublicTimeline({ onlyMedia }));
this.disconnect = dispatch(connectPublicStream({ onlyMedia }));
dispatch(expandPublicTimeline({ onlyMedia }))
this.disconnect = dispatch(connectPublicStream({ onlyMedia }))
}
else {
dispatch(expandCommunityTimeline({ onlyMedia }));
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }));
dispatch(expandCommunityTimeline({ onlyMedia }))
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
}
}
componentDidUpdate (prevProps) {
if (prevProps.onlyMedia !== this.props.onlyMedia || prevProps.allFediverse !== this.props.allFediverse) {
const { dispatch, onlyMedia, allFediverse } = this.props;
const { dispatch, onlyMedia, allFediverse } = this.props
this.disconnect();
this.disconnect()
if (allFediverse) {
dispatch(expandPublicTimeline({ onlyMedia }));
this.disconnect = dispatch(connectPublicStream({ onlyMedia }));
dispatch(expandPublicTimeline({ onlyMedia }))
this.disconnect = dispatch(connectPublicStream({ onlyMedia }))
}
else {
dispatch(expandCommunityTimeline({ onlyMedia }));
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }));
dispatch(expandCommunityTimeline({ onlyMedia }))
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
}
}
}
componentWillUnmount () {
if (this.disconnect) {
this.disconnect();
this.disconnect = null;
this.disconnect()
this.disconnect = null
}
}
handleLoadMore = maxId => {
const { dispatch, onlyMedia, allFediverse } = this.props;
const { dispatch, onlyMedia, allFediverse } = this.props
if (allFediverse) {
dispatch(expandPublicTimeline({ maxId, onlyMedia }));
dispatch(expandPublicTimeline({ maxId, onlyMedia }))
}
else {
dispatch(expandCommunityTimeline({ maxId, onlyMedia }));
dispatch(expandCommunityTimeline({ maxId, onlyMedia }))
}
}
render () {
const { intl, hasUnread, onlyMedia, timelineId, allFediverse } = this.props;
const { intl, onlyMedia, timelineId } = this.props
const emptyMessage = intl.formatMessage(messages.empty)
return (
<Column label={intl.formatMessage(messages.title)}>
<StatusListContainer
scrollKey={`${timelineId}_timeline`}
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
onLoadMore={this.handleLoadMore}
emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The community timeline is empty. Write something publicly to get the ball rolling!' />}
/>
</Column>
);
<StatusListContainer
scrollKey={`${timelineId}_timeline`}
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
onLoadMore={this.handleLoadMore}
emptyMessage={emptyMessage}
/>
)
}
}

View File

@ -1,6 +1,6 @@
import { defineMessages, injectIntl } from 'react-intl';
import { openModal } from '../../../../actions/modal';
import DropdownMenuContainer from '../../../../containers/dropdown_menu_container';
import Dropdown from '../../../../components/dropdown_menu'
import { meUsername } from '../../../../initial_state';
const messages = defineMessages({

View File

@ -3,7 +3,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl';
import ActionBar from '../action_bar';
import Avatar from '../../../../components/avatar';
import Permalink from '../../../../components/permalink';
import Button from '../../../../components/button'
import IconButton from '../../../../components/icon_button';
import { me } from '../../../../initial_state';
@ -26,15 +26,15 @@ class NavigationBar extends ImmutablePureComponent {
return (
<div className='navigation-bar'>
<Permalink href={account.get('url')} to={`/${account.get('acct')}`}>
<Button href={account.get('url')} to={`/${account.get('acct')}`}>
<span style={{ display: 'none' }}>{account.get('acct')}</span>
<Avatar account={account} size={48} />
</Permalink>
</Button>
<div className='navigation-bar__profile'>
<Permalink href={account.get('url')} to={`/${account.get('acct')}`}>
<Button href={account.get('url')} to={`/${account.get('acct')}`}>
<strong className='navigation-bar__profile-account'>@{account.get('acct')}</strong>
</Permalink>
</Button>
<a href='/settings/profile' className='navigation-bar__profile-edit'>
<FormattedMessage id='navigation_bar.edit_profile' defaultMessage='Edit profile' />

View File

@ -3,7 +3,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { authorizeFollowRequest, rejectFollowRequest } from '../../../../actions/accounts';
import { makeGetAccount } from '../../../../selectors';
import Permalink from '../../../../components/permalink';
import Button from '../../../../components/button'
import Avatar from '../../../../components/avatar';
import DisplayName from '../../../../components/display_name';
import IconButton from '../../../../components/icon_button';
@ -51,12 +51,12 @@ class AccountAuthorize extends ImmutablePureComponent {
return (
<div className='account-authorize__wrapper'>
<div className='account-authorize'>
<Permalink href={`/${account.get('acct')}`} to={`/${account.get('acct')}`} className='account-authorize__display-name'>
<Button href={`/${account.get('acct')}`} to={`/${account.get('acct')}`} className='account-authorize__display-name'>
<div className='account-authorize__avatar'>
<Avatar account={account} size={48} />
</div>
<DisplayName account={account} />
</Permalink>
</Button>
<div className='account__header__content' dangerouslySetInnerHTML={content} />
</div>

View File

@ -12,7 +12,7 @@ import { FormattedMessage } from 'react-intl';
import AccountContainer from '../../../containers/account_container';
import Column from '../../../components/column';
import ScrollableList from '../../../components/scrollable_list';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import Dropdown from '../../../components/dropdown_menu'
const mapStateToProps = (state, { params: { id } }) => ({
group: state.getIn(['groups', id]),

View File

@ -2,7 +2,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { defineMessages, injectIntl } from 'react-intl';
import { NavLink } from 'react-router-dom';
import DropdownMenuContainer from '../../../../containers/dropdown_menu_container';
import Dropdown from '../../../../components/dropdown_menu'
import Button from '../../../../components/button';
const messages = defineMessages({
@ -24,7 +24,7 @@ class Header extends ImmutablePureComponent {
router: PropTypes.object,
};
getActionButton() {
getActionButton() {
const { group, relationships, toggleMembership, intl } = this.props;
const toggle = () => toggleMembership(group, relationships);

View File

@ -11,7 +11,8 @@ const mapStateToProps = state => ({
isPartial: state.getIn(['timelines', 'home', 'isPartial']),
})
export default @connect(mapStateToProps)
export default
@connect(mapStateToProps)
@injectIntl
class HomeTimeline extends PureComponent {

View File

@ -4,7 +4,7 @@ import { HotKeys } from 'react-hotkeys';
import ImmutablePropTypes from 'react-immutable-proptypes';
import StatusContainer from '../../../../containers/status_container';
import AccountContainer from '../../../../containers/account_container';
import Permalink from '../../../../components/permalink';
import Button from '../../../../components/button'
import Icon from '../../../../components/icon';
const notificationForScreenReader = (intl, message, timestamp) => {
@ -240,7 +240,7 @@ class Notification extends ImmutablePureComponent {
const { notification } = this.props;
const account = notification.get('account');
const displayNameHtml = { __html: account.get('display_name_html') };
const link = <bdi><Permalink className='notification__display-name' href={`/${account.get('acct')}`} title={account.get('acct')} to={`/${account.get('acct')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
const link = <bdi><Button className='notification__display-name' href={`/${account.get('acct')}`} title={account.get('acct')} to={`/${account.get('acct')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
switch(notification.get('type')) {
// case 'follow':

View File

@ -3,7 +3,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { defineMessages, injectIntl } from 'react-intl';
import { openModal } from '../../../../actions/modal';
import { me, isStaff } from '../../../../initial_state';
import DropdownMenuContainer from '../../../../containers/dropdown_menu_container';
import Dropdown from '../../../../components/dropdown_menu';
import IconButton from '../../../../components/icon_button';
const messages = defineMessages({

View File

@ -1,28 +1,27 @@
'use strict';
'use strict'
import classNames from 'classnames';
import { HotKeys } from 'react-hotkeys';
import { defineMessages, injectIntl } from 'react-intl';
import { Switch, Redirect, withRouter } from 'react-router-dom';
import { debounce } from 'lodash';
import { uploadCompose, resetCompose } from '../../actions/compose';
import { expandHomeTimeline } from '../../actions/timelines';
import { HotKeys } from 'react-hotkeys'
import { defineMessages, injectIntl } from 'react-intl'
import { Switch, Redirect, withRouter } from 'react-router-dom'
import { debounce } from 'lodash'
import { uploadCompose, resetCompose } from '../../actions/compose'
import { expandHomeTimeline } from '../../actions/timelines'
import {
initializeNotifications,
expandNotifications,
} from '../../actions/notifications';
import { fetchFilters } from '../../actions/filters';
import { clearHeight } from '../../actions/height_cache';
import { openModal } from '../../actions/modal';
import WrappedRoute from './util/wrapped_route';
// import NotificationsContainer from '../../containers/notifications_container';
// import ModalContainer from '../../containers/modal_container';
// import UploadArea from '../../components/upload_area';
// import TrendsPanel from './components/trends_panel';
// import { WhoToFollowPanel } from '../../components/panel';
// import LinkFooter from '../../components/link_footer';
} from '../../actions/notifications'
import { fetchFilters } from '../../actions/filters'
import { clearHeight } from '../../actions/height_cache'
import { openModal } from '../../actions/modal'
import WrappedRoute from './util/wrapped_route'
import NotificationsContainer from '../../containers/notifications_container'
import ModalContainer from '../../containers/modal_container'
import UploadArea from '../../components/upload_area'
// import TrendsPanel from './components/trends_panel'
// import { WhoToFollowPanel } from '../../components/panel'
// import LinkFooter from '../../components/link_footer'
import ProfilePage from '../../pages/profile_page'
// import GroupPage from '../../pages/group_page';
// import GroupPage from '../../pages/group_page'
import GroupsPage from '../../pages/groups_page'
import SearchPage from '../../pages/search_page'
import ErrorPage from '../../pages/error_page'
@ -30,12 +29,13 @@ import HomePage from '../../pages/home_page'
import NotificationsPage from '../../pages/notifications_page'
import ListPage from '../../pages/list_page'
import ListsPage from '../../pages/lists_page'
// import GroupSidebarPanel from '../groups/sidebar_panel';
import SettingsPage from '../../pages/settings_page'
// import GroupSidebarPanel from '../groups/sidebar_panel'
import {
Status,
// GettingStarted,
// CommunityTimeline,
CommunityTimeline,
AccountTimeline,
// AccountGallery,
HomeTimeline,
@ -63,25 +63,25 @@ import {
// GroupRemovedAccounts,
// GroupCreate,
// GroupEdit,
} from './util/async-components';
import { me, meUsername } from '../../initial_state';
} from './util/async-components'
import { me, meUsername } from '../../initial_state'
// 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';
import { fetchGroups } from '../../actions/groups';
import '../../components/status'
import { fetchGroups } from '../../actions/groups'
const messages = defineMessages({
beforeUnload: { id: 'ui.beforeunload', defaultMessage: 'Your draft will be lost if you leave Gab Social.' },
publish: { id: 'compose_form.publish', defaultMessage: 'Gab' },
});
})
const mapStateToProps = state => ({
isComposing: state.getIn(['compose', 'is_composing']),
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
dropdownMenuIsOpen: state.getIn(['dropdown_menu', 'openId']) !== null,
});
})
const keyMap = {
help: '?',
@ -109,7 +109,7 @@ const keyMap = {
goToRequests: 'g r',
toggleHidden: 'x',
toggleSensitive: 'h',
};
}
class SwitchingArea extends PureComponent {
@ -117,7 +117,7 @@ class SwitchingArea extends PureComponent {
children: PropTypes.node,
location: PropTypes.object,
onLayoutChange: PropTypes.func.isRequired,
};
}
componentWillMount() {
window.addEventListener('resize', this.handleResize, {
@ -148,7 +148,7 @@ class SwitchingArea extends PureComponent {
<Redirect from='/' to='/home' exact />
<WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} />
{/*<WrappedRoute path='/timeline/all' exact page={HomePage} component={CommunityTimeline} content={children} />*/}
<WrappedRoute path='/timeline/all' exact page={HomePage} component={CommunityTimeline} content={children} />
<WrappedRoute path='/groups' exact page={GroupsPage} component={GroupsCollection} content={children} componentParams={{ activeTab: 'featured' }} />
<WrappedRoute path='/groups/browse/member' exact page={GroupsPage} component={GroupsCollection} content={children} componentParams={{ activeTab: 'member' }} />
@ -184,10 +184,11 @@ class SwitchingArea extends PureComponent {
<WrappedRoute path='/settings/mutes' exact page={SettingsPage} component={Mutes} content={children} />
<WrappedRoute path='/settings/development' exact page={SettingsPage} component={Mutes} content={children} />
<WrappedRoute path='/settings/billing' exact page={SettingsPage} component={Mutes} content={children} />
*/ }
*/ }
<Redirect from='/@:username' to='/:username' exact />
<WrappedRoute path='/:username' publicRoute exact page={ProfilePage} component={AccountTimeline} content={children} />
{ /*
<Redirect from='/@:username/with_replies' to='/:username/with_replies' />
<WrappedRoute path='/:username/with_replies' component={AccountTimeline} page={ProfilePage} content={children} componentParams={{ withReplies: true }} />
@ -220,7 +221,7 @@ class SwitchingArea extends PureComponent {
*/}
<WrappedRoute page={ErrorPage} component={GenericNotFound} content={children} />
</Switch>
);
)
}
}
@ -295,7 +296,7 @@ class UI extends PureComponent {
e.stopPropagation()
try {
e.dataTransfer.dropEffect = 'copy';
e.dataTransfer.dropEffect = 'copy'
} catch (err) {
//
}
@ -320,10 +321,10 @@ class UI extends PureComponent {
}
handleDragLeave = (e) => {
e.preventDefault();
e.stopPropagation();
e.preventDefault()
e.stopPropagation()
this.dragTargets = this.dragTargets.filter(el => el !== e.target && this.node.contains(el));
this.dragTargets = this.dragTargets.filter(el => el !== e.target && this.node.contains(el))
if (this.dragTargets.length > 0) return
@ -348,99 +349,99 @@ class UI extends PureComponent {
handleServiceWorkerPostMessage = ({ data }) => {
if (data.type === 'navigate') {
this.context.router.history.push(data.path);
this.context.router.history.push(data.path)
} else {
console.warn('Unknown message type:', data.type);
console.warn('Unknown message type:', data.type)
}
}
componentWillMount() {
window.addEventListener('beforeunload', this.handleBeforeUnload, false);
window.addEventListener('beforeunload', this.handleBeforeUnload, false)
document.addEventListener('dragenter', this.handleDragEnter, false);
document.addEventListener('dragover', this.handleDragOver, false);
document.addEventListener('drop', this.handleDrop, false);
document.addEventListener('dragleave', this.handleDragLeave, false);
document.addEventListener('dragend', this.handleDragEnd, false);
document.addEventListener('dragenter', this.handleDragEnter, false)
document.addEventListener('dragover', this.handleDragOver, false)
document.addEventListener('drop', this.handleDrop, false)
document.addEventListener('dragleave', this.handleDragLeave, false)
document.addEventListener('dragend', this.handleDragEnd, false)
if ('serviceWorker' in navigator) {
navigator.serviceWorker.addEventListener('message', this.handleServiceWorkerPostMessage);
navigator.serviceWorker.addEventListener('message', this.handleServiceWorkerPostMessage)
}
if (typeof window.Notification !== 'undefined' && Notification.permission === 'default') {
window.setTimeout(() => Notification.requestPermission(), 120 * 1000);
window.setTimeout(() => Notification.requestPermission(), 120 * 1000)
}
if (me) {
this.props.dispatch(expandHomeTimeline());
this.props.dispatch(expandNotifications());
this.props.dispatch(initializeNotifications());
this.props.dispatch(fetchGroups('member'));
this.props.dispatch(expandHomeTimeline())
this.props.dispatch(expandNotifications())
this.props.dispatch(initializeNotifications())
this.props.dispatch(fetchGroups('member'))
setTimeout(() => this.props.dispatch(fetchFilters()), 500);
setTimeout(() => this.props.dispatch(fetchFilters()), 500)
}
}
componentDidMount() {
if (!me) return;
if (!me) return
this.hotkeys.__mousetrap__.stopCallback = (e, element) => {
return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName);
};
return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName)
}
}
componentWillUnmount() {
window.removeEventListener('beforeunload', this.handleBeforeUnload);
document.removeEventListener('dragenter', this.handleDragEnter);
document.removeEventListener('dragover', this.handleDragOver);
document.removeEventListener('drop', this.handleDrop);
document.removeEventListener('dragleave', this.handleDragLeave);
document.removeEventListener('dragend', this.handleDragEnd);
window.removeEventListener('beforeunload', this.handleBeforeUnload)
document.removeEventListener('dragenter', this.handleDragEnter)
document.removeEventListener('dragover', this.handleDragOver)
document.removeEventListener('drop', this.handleDrop)
document.removeEventListener('dragleave', this.handleDragLeave)
document.removeEventListener('dragend', this.handleDragEnd)
}
setRef = c => {
this.node = c;
this.node = c
}
handleHotkeyNew = e => {
e.preventDefault();
e.preventDefault()
const element = this.node.querySelector('.compose-form__autosuggest-wrapper textarea');
const element = this.node.querySelector('.compose-form__autosuggest-wrapper textarea')
if (element) {
element.focus();
element.focus()
}
}
handleHotkeySearch = e => {
e.preventDefault();
e.preventDefault()
const element = this.node.querySelector('.search__input');
const element = this.node.querySelector('.search__input')
if (element) {
element.focus();
element.focus()
}
}
handleHotkeyForceNew = e => {
this.handleHotkeyNew(e);
this.props.dispatch(resetCompose());
this.handleHotkeyNew(e)
this.props.dispatch(resetCompose())
}
handleHotkeyFocusColumn = e => {
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');
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')
if (container) {
const status = container.querySelector('.focusable');
const status = container.querySelector('.focusable')
if (status) {
if (container.scrollTop > status.offsetTop) {
status.scrollIntoView(true);
status.scrollIntoView(true)
}
status.focus();
status.focus()
}
}
}
@ -454,7 +455,7 @@ class UI extends PureComponent {
}
setHotkeysRef = c => {
this.hotkeys = c;
this.hotkeys = c
}
handleHotkeyToggleHelp = () => {
@ -502,8 +503,8 @@ class UI extends PureComponent {
}
render() {
const { draggingOver } = this.state;
const { children, location, dropdownMenuIsOpen } = this.props;
const { draggingOver } = this.state
const { children, location, dropdownMenuIsOpen } = this.props
const handlers = me ? {
help: this.handleHotkeyToggleHelp,
@ -521,7 +522,7 @@ class UI extends PureComponent {
goToBlocked: this.handleHotkeyGoToBlocked,
goToMuted: this.handleHotkeyGoToMuted,
goToRequests: this.handleHotkeyGoToRequests,
} : {};
} : {}
return (
<HotKeys
@ -544,14 +545,12 @@ class UI extends PureComponent {
{children}
</SwitchingArea>
{ /*
<NotificationsContainer />
<ModalContainer />
<UploadArea active={draggingOver} onClose={this.closeUploadModal} />
*/ }
</div>
</HotKeys>
);
)
}
}

View File

@ -1,7 +1,7 @@
import Sticky from 'react-stickynode'
import Search from '../search'
import ColumnHeader from '../column_header'
import Sidebar from '../sidebar'
import Search from '../components/search'
import ColumnHeader from '../components/column_header'
import Sidebar from '../components/sidebar'
export default class DefaultLayout extends PureComponent {
static propTypes = {

View File

@ -0,0 +1,55 @@
import Sticky from 'react-stickynode'
import Sidebar from '../components/sidebar'
import Image from '../components/image'
export default class ProfileLayout extends PureComponent {
static propTypes = {
layout: PropTypes.object,
title: PropTypes.string,
showBackBtn: PropTypes.bool,
}
render() {
const { children, layout } = this.props
return (
<div className={[_s.default, _s.flexRow, _s.width100PC, _s.heightMin100VH, _s.backgroundcolorSecondary3].join(' ')}>
<Sidebar />
<main role='main' className={[_s.default, _s.flexShrink1, _s.flexGrow1, _s.borderColorSecondary2, _s.borderLeft1PX].join(' ')}>
<div className={[_s.default, _s.width1015PX, _s.flexRow, _s.justifyContentSpaceBetween, _s.paddingLeft15PX, _s.paddingVertical15PX].join(' ')}>
<div className={[_s.default, _s.z1, _s.width100PC].join(' ')}>
<div className={[_s.default, _s.height350PX, _s.width100PC].join(' ')}>
<Image className={_s.height350PX} src='https://gab.com/media/user/bz-5cf53d08403d4.jpeg' />
</div>
<div className={[_s.default, _s.backgroundColorPrimary].join(' ')}>
</div>
<div className={[_s.default, _s.width1015PX, _s.flexRow, _s.justifyContentSpaceBetween, _s.paddingLeft15PX, _s.paddingVertical15PX].join(' ')}>
<div className={[_s.default, _s.width645PX, _s.z1].join(' ')}>
<div className={_s.default}>
{children}
</div>
</div>
<div className={[_s.default, _s.width340PX].join(' ')}>
<Sticky top={73} enabled>
<div className={[_s.default, _s.width340PX].join(' ')}>
{layout}
</div>
</Sticky>
</div>
</div>
</div>
</div>
</main>
</div>
)
}
}

View File

@ -1,7 +1,7 @@
import Sticky from 'react-stickynode'
import Search from '../search'
import ColumnHeader from '../column_header'
import Sidebar from '../sidebar'
import Search from '../components/search'
import ColumnHeader from '../components/column_header'
import Sidebar from '../components/sidebar'
export default class SearchLayout extends PureComponent {
static propTypes = {

View File

@ -5,7 +5,7 @@ import { fetchGroup } from '../actions/groups';
import HeaderContainer from '../features/groups/timeline/containers/header_container';
import GroupPanel from '../features/groups/timeline/components/panel';
// import GroupSidebarPanel from '../features/groups/sidebar_panel';
import DefaultLayout from '../components/layouts/default_layout';
import DefaultLayout from '../layouts/default_layout';
import { WhoToFollowPanel } from '../components/panel';
import LinkFooter from '../components/link_footer';

View File

@ -1,7 +1,7 @@
import { Fragment } from 'react'
import LinkFooter from '../components/link_footer'
import GroupsPanel from '../components/panel/groups_panel'
import DefaultLayout from '../components/layouts/default_layout'
import DefaultLayout from '../layouts/default_layout'
export default class GroupsPage extends PureComponent {

View File

@ -6,7 +6,7 @@ import ProgressPanel from '../components/panel/progress_panel'
import UserPanel from '../components/panel/user_panel'
import TrendsPanel from '../components/panel/trends_panel'
import HashtagsPanel from '../components/panel/hashtags_panel'
import DefaultLayout from '../components/layouts/default_layout'
import DefaultLayout from '../layouts/default_layout'
import TimelineComposeBlock from '../components/timeline_compose_block'
import Divider from '../components/divider'

View File

@ -2,7 +2,7 @@ import { Fragment } from 'react'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import LinkFooter from '../components/link_footer'
import DefaultLayout from '../components/layouts/default_layout'
import DefaultLayout from '../layouts/default_layout'
import ListDetailsPanel from '../components/panel/list_details_panel'
const mapStateToProps = (state, props) => ({

View File

@ -2,7 +2,7 @@ import { Fragment } from 'react'
import LinkFooter from '../components/link_footer'
import WhoToFollowPanel from '../components/panel/who_to_follow_panel'
import TrendsPanel from '../components/panel/trends_panel'
import DefaultLayout from '../components/layouts/default_layout'
import DefaultLayout from '../layouts/default_layout'
export default class ListsPage extends PureComponent {

View File

@ -2,7 +2,7 @@ import { Fragment } from 'react'
import LinkFooter from '../components/link_footer'
import WhoToFollowPanel from '../components/panel/who_to_follow_panel'
import TrendsPanel from '../components/panel/trends_panel'
import DefaultLayout from '../components/layouts/default_layout'
import DefaultLayout from '../layouts/default_layout'
export default class NotificationsPage extends PureComponent {
render() {

View File

@ -1,26 +1,25 @@
import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
// import HeaderContainer from '../features/account_timeline/containers/header_container';
// import ProfileInfoPanel from '../features/account_timeline/components/profile_info_panel/profile_info_panel';
// import { WhoToFollowPanel, SignUpPanel } from '../components/panel';
// import LinkFooter from '../components/link_footer';
import ProfileLayout from '../components/layouts/profile_layout';
import { Fragment } from 'react'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import LinkFooter from '../components/link_footer'
import ProfileInfoPanel from '../components/panel/profile_info_panel'
import MediaGalleryPanel from '../components/panel/media_gallery_panel'
import ProfileLayout from '../layouts/profile_layout'
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
const accounts = state.getIn(['accounts']);
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase());
const accounts = state.getIn(['accounts'])
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase())
let accountId = -1;
let account = null;
let accountUsername = username;
let accountId = -1
let account = null
let accountUsername = username
if (accountFetchError) {
accountId = null;
accountId = null
}
else {
account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1;
accountUsername = account ? account.getIn(['acct'], '') : '';
account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase())
accountId = account ? account.getIn(['id'], null) : -1
accountUsername = account ? account.getIn(['acct'], '') : ''
}
//Children components fetch information
@ -29,10 +28,11 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) =
account,
accountId,
accountUsername,
};
};
}
}
export default @connect(mapStateToProps)
export default
@connect(mapStateToProps)
class ProfilePage extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map,
@ -42,14 +42,23 @@ class ProfilePage extends ImmutablePureComponent {
PropTypes.number,
]).isRequired,
children: PropTypes.node,
};
}
render() {
const { accountId, account, accountUsername } = this.props;
const { accountId, account, accountUsername } = this.props
return (
<ProfileLayout>
{ /*this.props.children */ }
<ProfileLayout
account={account}
layout={(
<Fragment>
<ProfileInfoPanel />
<MediaGalleryPanel />
<LinkFooter />
</Fragment>
)}
>
{ /* this.props.children */ }
</ProfileLayout>
)
}

View File

@ -2,7 +2,7 @@ import { Fragment } from 'react'
import LinkFooter from '../components/link_footer'
import WhoToFollowPanel from '../components/panel/who_to_follow_panel'
import TrendsPanel from '../components/panel/trends_panel'
import SearchLayout from '../components/layouts/search_layout'
import SearchLayout from '../layouts/search_layout'
export default class SearchPage extends PureComponent {
render() {

View File

@ -0,0 +1,12 @@
export default class SettingsPage extends PureComponent {
render() {
const { children } = this.props;
return (
<div>
{children}
</div>
)
}
}

View File

@ -115,6 +115,8 @@ body {
.border2PX { border-width: 2px; }
.borderBottom2PX { border-bottom-width: 2px; }
.borderDashed { border-style: dashed; }
.marginAuto { margin: auto; }
.displayNone { display: none; }
@ -136,6 +138,7 @@ body {
.backgroundSubtle2Dark_onHover:hover { background-color: #d9e0e5; }
.backgroundcolorSecondary3 { background-color: #F6F6F9; }
.backgroundColorPrimary { background-color: #fff; }
.backgroundColorPrimaryOpaque { background-color: rgba(255,255,255,0.8); }
.backgroundColorBrandLightOpaque { background-color: rgba(54, 233, 145, 0.1); }
.backgroundColorOpaque { background-color: rgba(0,0,0, 0.4); }
.backgroundColorBrandLight { background-color: #36e991; }
@ -154,8 +157,10 @@ body {
.fillcolorSecondary { fill: #666; }
.bottom0 { bottom: 0; }
.bottomAuto { bottom: auto; }
.left0 { left: 0px; }
.right0 { right: 0px; }
.rightAuto { right: auto; }
.top0 { top: 0px; }
.lineHeight125 { line-height: 1.25em; }
@ -253,6 +258,7 @@ body {
.z1 { z-index: 1; }
.z2 { z-index: 2; }
.z3 { z-index: 3; }
.z4 { z-index: 4; }
.marginVertical5PX {
margin-top: 5px;