Skip to content

Commit

Permalink
Hide list panel from nav bar in mobile layout (mastodon#19337)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts authored and Nonexistent committed Nov 1, 2022
1 parent ab58e21 commit a18e461
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
12 changes: 6 additions & 6 deletions app/javascript/mastodon/features/ui/components/list_panel.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { createSelector } from 'reselect';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { fetchLists } from 'mastodon/actions/lists';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { NavLink, withRouter } from 'react-router-dom';
import Icon from 'mastodon/components/icon';
import { withRouter } from 'react-router-dom';
import { fetchLists } from 'mastodon/actions/lists';
import ColumnLink from './column_link';

const getOrderedLists = createSelector([state => state.get('lists')], lists => {
if (!lists) {
Expand Down Expand Up @@ -42,11 +42,11 @@ class ListPanel extends ImmutablePureComponent {
}

return (
<div>
<div className='list-panel'>
<hr />

{lists.map(list => (
<NavLink key={list.get('id')} className='column-link column-link--transparent' strict to={`/lists/${list.get('id')}`}><Icon className='column-link__icon' id='list-ul' fixedWidth />{list.get('title')}</NavLink>
<ColumnLink icon='list-ul' key={list.get('id')} strict text={list.get('title')} to={`/lists/${list.get('id')}`} transparent />
))}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Link } from 'react-router-dom';
import Logo from 'mastodon/components/logo';
import TrendsContainer from 'mastodon/features/getting_started/containers/trends_container';
import { showTrends, timelinePreview } from 'mastodon/initial_state';
import ColumnLink from './column_link';
import FollowRequestsColumnLink from './follow_requests_column_link';
import ListPanel from './list_panel';
import NotificationsCounterIcon from './notifications_counter_icon';
import SignInBanner from './sign_in_banner';
import ColumnLink from 'mastodon/features/ui/components/column_link';

const messages = defineMessages({
home: { id: 'tabs_bar.home', defaultMessage: 'Home' },
Expand Down
13 changes: 12 additions & 1 deletion app/javascript/mastodon/is_mobile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
// @ts-check

import { supportsPassiveEvents } from 'detect-passive-events';
import { forceSingleColumn } from 'mastodon/initial_state';

const LAYOUT_BREAKPOINT = 630;

/**
* @param {number} width
* @returns {boolean}
*/
export const isMobile = width => width <= LAYOUT_BREAKPOINT;

/**
* @returns {string}
*/
export const layoutFromWindow = () => {
if (isMobile(window.innerWidth)) {
return 'mobile';
Expand All @@ -17,11 +26,13 @@ export const layoutFromWindow = () => {

const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;

const listenerOptions = supportsPassiveEvents ? { passive: true } : false;

let userTouching = false;
let listenerOptions = supportsPassiveEvents ? { passive: true } : false;

const touchListener = () => {
userTouching = true;

window.removeEventListener('touchstart', touchListener, listenerOptions);
};

Expand Down
4 changes: 2 additions & 2 deletions app/javascript/styles/mastodon/about.scss
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ $small-breakpoint: 960px;
th,
td {
padding: 8px;
align-self: start;
align-items: start;
align-self: flex-start;
align-items: flex-start;
word-break: break-all;

&.nowrap {
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2673,6 +2673,10 @@ $ui-header-height: 55px;
.column-link span {
display: none;
}

.list-panel {
display: none;
}
}
}

Expand Down Expand Up @@ -2755,7 +2759,7 @@ $ui-header-height: 55px;

.column-actions {
display: flex;
align-items: start;
align-items: flex-start;
justify-content: center;
padding: 40px;
padding-top: 40px;
Expand Down

0 comments on commit a18e461

Please sign in to comment.