Fixed a bunch of linting issues in components (#8921)
This commit is contained in:
parent
618a7b94fe
commit
a7938ed287
22 changed files with 171 additions and 196 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { h } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from '@crayons';
|
||||
import { defaultChildrenPropTypes } from '../common-prop-types';
|
||||
import { Button } from '@crayons';
|
||||
|
||||
export const snackbarItemProps = {
|
||||
children: defaultChildrenPropTypes.isRequired,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from '@crayons';
|
||||
import { generateMainImage } from '../actions';
|
||||
import { validateFileInputs } from '../../packs/validateFileInputs';
|
||||
import { Button } from '@crayons';
|
||||
|
||||
export class ArticleCoverImage extends Component {
|
||||
constructor(props) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from '@crayons';
|
||||
import { Options } from './Options';
|
||||
import { Button } from '@crayons';
|
||||
|
||||
const Icon = () => (
|
||||
<svg
|
||||
|
|
@ -77,9 +77,7 @@ export class EditorActions extends Component {
|
|||
className="mr-2 whitespace-nowrap"
|
||||
onClick={onSaveDraft}
|
||||
>
|
||||
Save
|
||||
{' '}
|
||||
<span className="hidden s:inline">draft</span>
|
||||
Save <span className="hidden s:inline">draft</span>
|
||||
</Button>
|
||||
)}
|
||||
{version === 'v2' && (
|
||||
|
|
@ -109,9 +107,7 @@ export class EditorActions extends Component {
|
|||
className="whitespace-nowrap fw-normal"
|
||||
size="s"
|
||||
>
|
||||
Revert
|
||||
{' '}
|
||||
<span className="hidden s:inline">new changes</span>
|
||||
Revert <span className="hidden s:inline">new changes</span>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,19 +4,29 @@ import { Close } from './Close';
|
|||
import { Tabs } from './Tabs';
|
||||
import { PageTitle } from './PageTitle';
|
||||
|
||||
export const Header = ({onPreview, previewShowing, organizations, organizationId, onToggle, logoSvg}) => {
|
||||
export const Header = ({
|
||||
onPreview,
|
||||
previewShowing,
|
||||
organizations,
|
||||
organizationId,
|
||||
onToggle,
|
||||
logoSvg,
|
||||
}) => {
|
||||
return (
|
||||
<div className="crayons-article-form__header">
|
||||
<a href="/" className="crayons-article-form__logo" aria-label="Home" dangerouslySetInnerHTML={{__html: logoSvg}} />
|
||||
<a
|
||||
href="/"
|
||||
className="crayons-article-form__logo"
|
||||
aria-label="Home"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: logoSvg }}
|
||||
/>
|
||||
<PageTitle
|
||||
organizations={organizations}
|
||||
organizationId={organizationId}
|
||||
onToggle={onToggle}
|
||||
/>
|
||||
<Tabs
|
||||
onPreview={onPreview}
|
||||
previewShowing={previewShowing}
|
||||
/>
|
||||
<Tabs onPreview={onPreview} previewShowing={previewShowing} />
|
||||
<Close />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import { Button } from '@crayons';
|
||||
import { generateMainImage } from '../actions';
|
||||
import { validateFileInputs } from '../../packs/validateFileInputs';
|
||||
import { ClipboardButton } from './ClipboardButton';
|
||||
import { Button } from '@crayons';
|
||||
|
||||
function isNativeAndroid() {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ export class Feed extends Component {
|
|||
|
||||
this.setState({ bookmarkedFeedItems: new Set(reading_list_ids) });
|
||||
|
||||
Feed.getFeedItems(timeFrame).then(feedItems => {
|
||||
Feed.getFeedItems(timeFrame).then((feedItems) => {
|
||||
// Ensure first article is one with a main_image
|
||||
const featuredStory = feedItems.find(story => story.main_image !== null);
|
||||
const featuredStory = feedItems.find(
|
||||
(story) => story.main_image !== null,
|
||||
);
|
||||
// Remove that first one from the array.
|
||||
const index = feedItems.indexOf(featuredStory);
|
||||
feedItems.splice(index, 1);
|
||||
|
|
@ -29,8 +31,8 @@ export class Feed extends Component {
|
|||
const { timeFrame } = this.props;
|
||||
if (prevProps.timeFrame !== timeFrame) {
|
||||
// The feed timeframe has changed. Get new feed data.
|
||||
Feed.getFeedItems(timeFrame).then(feedItems => {
|
||||
this.setState(_prevState => ({ feedItems }));
|
||||
Feed.getFeedItems(timeFrame).then((feedItems) => {
|
||||
this.setState((_prevState) => ({ feedItems }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +53,7 @@ export class Feed extends Component {
|
|||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'same-origin',
|
||||
}).then(response => response.json());
|
||||
}).then((response) => response.json());
|
||||
}
|
||||
|
||||
static getPodcastEpisodes() {
|
||||
|
|
@ -64,7 +66,7 @@ export class Feed extends Component {
|
|||
user.followed_podcast_ids.length > 0
|
||||
) {
|
||||
const data = JSON.parse(el.dataset.episodes);
|
||||
data.forEach(episode => {
|
||||
data.forEach((episode) => {
|
||||
if (user.followed_podcast_ids.indexOf(episode.podcast.id) > -1) {
|
||||
episodes.push(episode);
|
||||
}
|
||||
|
|
@ -78,7 +80,7 @@ export class Feed extends Component {
|
|||
*
|
||||
* @param {Event} event
|
||||
*/
|
||||
bookmarkClick = event => {
|
||||
bookmarkClick = (event) => {
|
||||
// The assumption is that the user is logged on at this point.
|
||||
const { userStatus } = document.body;
|
||||
event.preventDefault();
|
||||
|
|
@ -95,12 +97,12 @@ export class Feed extends Component {
|
|||
getCsrfToken()
|
||||
.then(sendFetch('reaction-creation', data))
|
||||
// eslint-disable-next-line consistent-return
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
return response.json().then(json => {
|
||||
return response.json().then((json) => {
|
||||
const articleId = Number(button.dataset.reactableId);
|
||||
|
||||
this.setState(previousState => {
|
||||
this.setState((previousState) => {
|
||||
const { bookmarkedFeedItems } = previousState;
|
||||
|
||||
const { result } = json;
|
||||
|
|
@ -138,7 +140,7 @@ export class Feed extends Component {
|
|||
|
||||
return (
|
||||
<div
|
||||
ref={element => {
|
||||
ref={(element) => {
|
||||
this.feedContainer = element;
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { h } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from '@crayons';
|
||||
import { CommentListItem } from './CommentListItem';
|
||||
import { Button } from '@crayons';
|
||||
|
||||
const numberOfCommentsToShow = 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export const ContentTitle = ({ article }) => (
|
|||
person
|
||||
</span>
|
||||
)}
|
||||
{/* eslint-disable-next-line react/no-danger */}
|
||||
<span dangerouslySetInnerHTML={{ __html: filterXSS(article.title) }} />
|
||||
</a>
|
||||
</h2>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import ConfigImage from '../../assets/images/overflow-horizontal.svg';
|
||||
import { setupPusher } from '../utilities/connect';
|
||||
import debounceAction from '../utilities/debounceAction';
|
||||
import {
|
||||
conductModeration,
|
||||
getAllMessages,
|
||||
|
|
@ -36,9 +38,6 @@ import ActionMessage from './actionMessage';
|
|||
import Content from './content';
|
||||
import VideoContent from './videoContent';
|
||||
|
||||
import { setupPusher } from '../utilities/connect';
|
||||
import debounceAction from '../utilities/debounceAction';
|
||||
|
||||
export default class Chat extends Component {
|
||||
static propTypes = {
|
||||
pusherKey: PropTypes.number.isRequired,
|
||||
|
|
@ -1050,22 +1049,15 @@ export default class Chat extends Component {
|
|||
return (
|
||||
<div className="chatmessage" style={{ color: 'grey' }}>
|
||||
<div className="chatmessage__body">
|
||||
You and
|
||||
{' '}
|
||||
You and{' '}
|
||||
<a href={`/${activeChannel.channel_modified_slug}`}>
|
||||
{activeChannel.channel_modified_slug}
|
||||
</a>
|
||||
{' '}
|
||||
are connected because you both follow each other. All interactions
|
||||
{' '}
|
||||
</a>{' '}
|
||||
are connected because you both follow each other. All interactions{' '}
|
||||
<em>
|
||||
<b>must</b>
|
||||
</em>
|
||||
{' '}
|
||||
abide by the
|
||||
{' '}
|
||||
<a href="/code-of-conduct">code of conduct</a>
|
||||
.
|
||||
</em>{' '}
|
||||
abide by the <a href="/code-of-conduct">code of conduct</a>.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -1074,19 +1066,11 @@ export default class Chat extends Component {
|
|||
return (
|
||||
<div className="chatmessage" style={{ color: 'grey' }}>
|
||||
<div className="chatmessage__body">
|
||||
You have joined
|
||||
{' '}
|
||||
{activeChannel.channel_name}
|
||||
! All interactions
|
||||
{' '}
|
||||
You have joined {activeChannel.channel_name}! All interactions{' '}
|
||||
<em>
|
||||
<b>must</b>
|
||||
</em>
|
||||
{' '}
|
||||
abide by the
|
||||
{' '}
|
||||
<a href="/code-of-conduct">code of conduct</a>
|
||||
.
|
||||
</em>{' '}
|
||||
abide by the <a href="/code-of-conduct">code of conduct</a>.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -1209,8 +1193,7 @@ export default class Chat extends Component {
|
|||
>
|
||||
<span role="img" aria-label="emoji">
|
||||
👋
|
||||
</span>
|
||||
{' '}
|
||||
</span>{' '}
|
||||
New Invitations!
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -1226,8 +1209,7 @@ export default class Chat extends Component {
|
|||
>
|
||||
<span role="img" aria-label="emoji">
|
||||
👋
|
||||
</span>
|
||||
{' '}
|
||||
</span>{' '}
|
||||
New Requests
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,59 +5,6 @@ import ChannelRequest from './channelRequest';
|
|||
import RequestManager from './requestManager';
|
||||
import ChatChannelSettings from './ChatChannelSettings/ChatChannelSettings';
|
||||
|
||||
function display(resource) {
|
||||
switch (resource.type_of) {
|
||||
case 'loading-user':
|
||||
return <div title="Loading user" className="loading-user" />;
|
||||
|
||||
case 'article':
|
||||
return <Article resource={resource} />;
|
||||
|
||||
case 'channel-request':
|
||||
return (
|
||||
<ChannelRequest
|
||||
resource={resource.data}
|
||||
handleJoiningRequest={resource.handleJoiningRequest}
|
||||
/>
|
||||
);
|
||||
|
||||
case 'channel-request-manager':
|
||||
return (
|
||||
<RequestManager
|
||||
resource={resource.data}
|
||||
handleRequestRejection={resource.handleRequestRejection}
|
||||
handleRequestApproval={resource.handleRequestApproval}
|
||||
/>
|
||||
);
|
||||
|
||||
case 'chat-channel-setting':
|
||||
return (
|
||||
<ChatChannelSettings
|
||||
resource={resource.data}
|
||||
activeMembershipId={resource.activeMembershipId}
|
||||
/>
|
||||
);
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function smartSvgIcon(content, d) {
|
||||
return (
|
||||
<svg
|
||||
data-content={content}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<path data-content={content} fill="none" d="M0 0h24v24H0z" />
|
||||
<path data-content={content} d={d} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export default class Content extends Component {
|
||||
static propTypes = {
|
||||
resource: PropTypes.shape({
|
||||
|
|
@ -138,7 +85,6 @@ export default class Content extends Component {
|
|||
type="button"
|
||||
className="activechatchannel__activecontentexitbutton crayons-btn crayons-btn--secondary"
|
||||
data-content="exit"
|
||||
type="button"
|
||||
title="exit"
|
||||
>
|
||||
{smartSvgIcon(
|
||||
|
|
@ -151,7 +97,6 @@ export default class Content extends Component {
|
|||
className="activechatchannel__activecontentexitbutton activechatchannel__activecontentexitbutton--fullscreen crayons-btn crayons-btn--secondary"
|
||||
data-content="fullscreen"
|
||||
style={{ left: '39px' }}
|
||||
type="button"
|
||||
title="fullscreen"
|
||||
>
|
||||
{' '}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { h } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from '@crayons';
|
||||
import { defaultChildrenPropTypes } from '../../common-prop-types';
|
||||
import { Button } from '@crayons';
|
||||
|
||||
function getAdditionalClassNames({ size, className }) {
|
||||
let additionalClassNames = '';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { h, Component } from 'preact';
|
||||
import { request } from '@utilities/http';
|
||||
import { SingleRepo } from './singleRepo';
|
||||
import { request } from '@utilities/http';
|
||||
|
||||
export class GithubRepos extends Component {
|
||||
state = {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import linkState from 'linkstate';
|
||||
import Tags from '../shared/components/tags';
|
||||
import { OrganizationPicker } from '../organization/OrganizationPicker';
|
||||
import Title from './components/Title';
|
||||
import BodyMarkdown from './components/BodyMarkdown';
|
||||
import Categories from './components/Categories';
|
||||
import ContactViaConnect from './components/ContactViaConnect';
|
||||
import ExpireDate from './components/ExpireDate';
|
||||
import Tags from '../shared/components/tags';
|
||||
import { OrganizationPicker } from '../organization/OrganizationPicker';
|
||||
|
||||
export default class ListingForm extends Component {
|
||||
constructor(props) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ const SingleListing = ({
|
|||
|
||||
return (
|
||||
<div
|
||||
data-testid="single-listing"
|
||||
className={definedClass}
|
||||
id={`single-listing-${listing.id}`}
|
||||
data-testid={`single-listing-${listing.id}`}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import Navigation from './Navigation';
|
||||
import { getContentOfToken, updateOnboarding } from '../utilities';
|
||||
import Navigation from './Navigation';
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
class EmailPreferencesForm extends Component {
|
||||
|
|
@ -53,7 +53,10 @@ class EmailPreferencesForm extends Component {
|
|||
const { email_newsletter, email_digest_periodic } = this.state;
|
||||
const { prev, slidesCount, currentSlideIndex } = this.props;
|
||||
return (
|
||||
<div data-testid="onboarding-email-preferences-form" className="onboarding-main crayons-modal">
|
||||
<div
|
||||
data-testid="onboarding-email-preferences-form"
|
||||
className="onboarding-main crayons-modal"
|
||||
>
|
||||
<div className="crayons-modal__box">
|
||||
<Navigation
|
||||
prev={prev}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import Navigation from './Navigation';
|
||||
import { getContentOfToken } from '../utilities';
|
||||
import Navigation from './Navigation';
|
||||
|
||||
class FollowTags extends Component {
|
||||
constructor(props) {
|
||||
|
|
@ -100,7 +100,10 @@ class FollowTags extends Component {
|
|||
const canSkip = selectedTags.length === 0;
|
||||
|
||||
return (
|
||||
<div data-testid="onboarding-follow-tags" className="onboarding-main crayons-modal">
|
||||
<div
|
||||
data-testid="onboarding-follow-tags"
|
||||
className="onboarding-main crayons-modal"
|
||||
>
|
||||
<div className="crayons-modal__box overflow-auto">
|
||||
<Navigation
|
||||
prev={prev}
|
||||
|
|
@ -132,8 +135,7 @@ class FollowTags extends Component {
|
|||
}}
|
||||
>
|
||||
<div className="onboarding-tags__item__inner">
|
||||
#
|
||||
{tag.name}
|
||||
#{tag.name}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => this.handleClick(tag)}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import { h, Component } from 'preact';
|
|||
import PropTypes from 'prop-types';
|
||||
import he from 'he';
|
||||
|
||||
import Navigation from './Navigation';
|
||||
import { getContentOfToken } from '../utilities';
|
||||
import Navigation from './Navigation';
|
||||
|
||||
class FollowUsers extends Component {
|
||||
constructor(props) {
|
||||
|
|
@ -140,7 +140,10 @@ class FollowUsers extends Component {
|
|||
const canSkip = selectedUsers.length === 0;
|
||||
|
||||
return (
|
||||
<div data-testid="onboarding-follow-users" className="onboarding-main crayons-modal">
|
||||
<div
|
||||
data-testid="onboarding-follow-users"
|
||||
className="onboarding-main crayons-modal"
|
||||
>
|
||||
<div className="crayons-modal__box overflow-auto">
|
||||
<Navigation
|
||||
prev={prev}
|
||||
|
|
@ -155,7 +158,10 @@ class FollowUsers extends Component {
|
|||
<h2 className="subtitle">Let's review a few things first</h2>
|
||||
</header>
|
||||
|
||||
<div data-testid="onboarding-users" className="onboarding-modal-scroll-container">
|
||||
<div
|
||||
data-testid="onboarding-users"
|
||||
className="onboarding-modal-scroll-container"
|
||||
>
|
||||
{users.map((user) => (
|
||||
<button
|
||||
data-testid="onboarding-user-button"
|
||||
|
|
@ -181,7 +187,11 @@ class FollowUsers extends Component {
|
|||
{he.unescape(user.summary || '')}
|
||||
</p>
|
||||
</div>
|
||||
<button data-testid="onboarding-user-following-status" type="button" className="user-following-status">
|
||||
<button
|
||||
data-testid="onboarding-user-following-status"
|
||||
type="button"
|
||||
className="user-following-status"
|
||||
>
|
||||
{selectedUsers.includes(user) ? 'Following' : 'Follow'}
|
||||
</button>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import Navigation from './Navigation';
|
||||
import { getContentOfToken, userData, updateOnboarding } from '../utilities';
|
||||
import Navigation from './Navigation';
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
class IntroSlide extends Component {
|
||||
|
|
@ -102,7 +102,10 @@ class IntroSlide extends Component {
|
|||
}
|
||||
|
||||
return (
|
||||
<div data-testid="onboarding-intro-slide" className="onboarding-main introduction crayons-modal crayons-modal--m">
|
||||
<div
|
||||
data-testid="onboarding-intro-slide"
|
||||
className="onboarding-main introduction crayons-modal crayons-modal--m"
|
||||
>
|
||||
<div className="crayons-modal__box overflow-auto">
|
||||
<div className="onboarding-content">
|
||||
<figure>
|
||||
|
|
@ -112,12 +115,12 @@ class IntroSlide extends Component {
|
|||
alt={communityConfig.communityName}
|
||||
/>
|
||||
</figure>
|
||||
<h1 data-testid="onboarding-introduction-title" className="introduction-title">
|
||||
<h1
|
||||
data-testid="onboarding-introduction-title"
|
||||
className="introduction-title"
|
||||
>
|
||||
{this.user.name}
|
||||
— welcome to
|
||||
{' '}
|
||||
{communityConfig.communityName}
|
||||
!
|
||||
— welcome to {communityConfig.communityName}!
|
||||
</h1>
|
||||
<h2 className="introduction-subtitle">
|
||||
{communityConfig.communityDescription}
|
||||
|
|
@ -129,7 +132,10 @@ class IntroSlide extends Component {
|
|||
<fieldset>
|
||||
<ul>
|
||||
<li className="checkbox-item">
|
||||
<label data-testid="checked-code-of-conduct" htmlFor="checked_code_of_conduct">
|
||||
<label
|
||||
data-testid="checked-code-of-conduct"
|
||||
htmlFor="checked_code_of_conduct"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="checked_code_of_conduct"
|
||||
|
|
@ -137,8 +143,7 @@ class IntroSlide extends Component {
|
|||
checked={checked_code_of_conduct}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
You agree to uphold our
|
||||
{' '}
|
||||
You agree to uphold our{' '}
|
||||
<a
|
||||
href="/code-of-conduct"
|
||||
data-no-instant
|
||||
|
|
@ -151,7 +156,10 @@ class IntroSlide extends Component {
|
|||
</li>
|
||||
|
||||
<li className="checkbox-item">
|
||||
<label data-testid="checked-terms-and-conditions" htmlFor="checked_terms_and_conditions">
|
||||
<label
|
||||
data-testid="checked-terms-and-conditions"
|
||||
htmlFor="checked_terms_and_conditions"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="checked_terms_and_conditions"
|
||||
|
|
@ -159,8 +167,7 @@ class IntroSlide extends Component {
|
|||
checked={checked_terms_and_conditions}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
You agree to our
|
||||
{' '}
|
||||
You agree to our{' '}
|
||||
<a
|
||||
href="/terms"
|
||||
data-no-instant
|
||||
|
|
@ -198,7 +205,7 @@ IntroSlide.propTypes = {
|
|||
communityConfig: PropTypes.shape({
|
||||
communityLogo: PropTypes.string.isRequired,
|
||||
communityName: PropTypes.string.isRequired,
|
||||
communityDescription: PropTypes.string.isRequired
|
||||
communityDescription: PropTypes.string.isRequired,
|
||||
}).isRequired,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h, Component } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import Navigation from './Navigation';
|
||||
import { userData, getContentOfToken, updateOnboarding } from '../utilities';
|
||||
import Navigation from './Navigation';
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
class ProfileForm extends Component {
|
||||
|
|
@ -74,7 +74,10 @@ class ProfileForm extends Component {
|
|||
const { canSkip } = this.state;
|
||||
|
||||
return (
|
||||
<div data-testid="onboarding-profile-form" className="onboarding-main crayons-modal">
|
||||
<div
|
||||
data-testid="onboarding-profile-form"
|
||||
className="onboarding-main crayons-modal"
|
||||
>
|
||||
<div className="crayons-modal__box">
|
||||
<Navigation
|
||||
prev={prev}
|
||||
|
|
@ -86,12 +89,12 @@ class ProfileForm extends Component {
|
|||
<div className="onboarding-content about">
|
||||
<header className="onboarding-content-header">
|
||||
<h1 className="title">Build your profile</h1>
|
||||
<h2 data-testid="onboarding-profile-subtitle" className="subtitle">
|
||||
<h2
|
||||
data-testid="onboarding-profile-subtitle"
|
||||
className="subtitle"
|
||||
>
|
||||
Tell us a little bit about yourself — this is how others will
|
||||
see you on
|
||||
{' '}
|
||||
{communityConfig.communityName}
|
||||
. You’ll always be
|
||||
see you on {communityConfig.communityName}. You’ll always be
|
||||
able to edit this later in your Settings.
|
||||
</h2>
|
||||
</header>
|
||||
|
|
@ -166,7 +169,7 @@ ProfileForm.propTypes = {
|
|||
currentSlideIndex: PropTypes.func.isRequired,
|
||||
communityConfig: PropTypes.shape({
|
||||
communityName: PropTypes.string.isRequired,
|
||||
communityDescription: PropTypes.string.isRequired
|
||||
communityDescription: PropTypes.string.isRequired,
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,76 +4,84 @@ const remoteMedia = document.getElementById('remote-media');
|
|||
const muteButton = document.getElementById('mute-toggle');
|
||||
const videoToggleButton = document.getElementById('videohide-toggle');
|
||||
const localMediaContainer = document.getElementById('local-media');
|
||||
const roomType = document.getElementById('room-type').dataset.type//Group
|
||||
const roomType = document.getElementById('room-type').dataset.type; //Group
|
||||
|
||||
connect(root.dataset.token, { name: 'room-name', audio: true, type: roomType, video: { width: 800 } }).then(room => {
|
||||
connect(root.dataset.token, {
|
||||
name: 'room-name',
|
||||
audio: true,
|
||||
type: roomType,
|
||||
video: { width: 800 },
|
||||
}).then((room) => {
|
||||
room.participants.forEach(participantConnected);
|
||||
room.on('participantConnected', participantConnected);
|
||||
|
||||
room.on('participantDisconnected', participantDisconnected);
|
||||
room.once('disconnected', error => room.participants.forEach(participantDisconnected));
|
||||
muteButton.onclick = function(e) {
|
||||
room.once('disconnected', (_error) =>
|
||||
room.participants.forEach(participantDisconnected),
|
||||
);
|
||||
muteButton.onclick = function (e) {
|
||||
e.preventDefault();
|
||||
room.localParticipant.audioTracks.forEach(function(trackPub) {
|
||||
room.localParticipant.audioTracks.forEach(function (trackPub) {
|
||||
if (muteButton.dataset.muted === 'true') {
|
||||
muteButton.dataset.muted = 'false'
|
||||
muteButton.dataset.muted = 'false';
|
||||
muteButton.classList.remove('crayons-btn--danger');
|
||||
muteButton.innerHTML = 'Mute'
|
||||
muteButton.innerHTML = 'Mute';
|
||||
trackPub.track.enable();
|
||||
} else {
|
||||
muteButton.dataset.muted = 'true'
|
||||
muteButton.dataset.muted = 'true';
|
||||
muteButton.classList.add('crayons-btn--danger');
|
||||
muteButton.innerHTML = 'Unmute'
|
||||
muteButton.innerHTML = 'Unmute';
|
||||
trackPub.track.disable();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
videoToggleButton.onclick = function(e) {
|
||||
videoToggleButton.onclick = function (e) {
|
||||
e.preventDefault();
|
||||
room.localParticipant.videoTracks.forEach(function(trackPub) {
|
||||
room.localParticipant.videoTracks.forEach(function (trackPub) {
|
||||
if (videoToggleButton.dataset.hidden === 'true') {
|
||||
videoToggleButton.dataset.hidden = 'false'
|
||||
videoToggleButton.dataset.hidden = 'false';
|
||||
videoToggleButton.classList.remove('crayons-btn--danger');
|
||||
videoToggleButton.innerHTML = 'Hide';
|
||||
localMediaContainer.classList.remove('video-hidden');
|
||||
trackPub.track.enable();
|
||||
} else {
|
||||
videoToggleButton.dataset.hidden = 'true'
|
||||
videoToggleButton.dataset.hidden = 'true';
|
||||
videoToggleButton.classList.add('crayons-btn--danger');
|
||||
videoToggleButton.innerHTML = 'Unhide';
|
||||
localMediaContainer.classList.add('video-hidden');
|
||||
trackPub.track.disable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
createLocalVideoTrack().then(track => {
|
||||
createLocalVideoTrack().then((track) => {
|
||||
localMediaContainer.appendChild(track.attach());
|
||||
document.getElementById('video-controls').classList.add('showing');
|
||||
});
|
||||
|
||||
|
||||
function participantConnected(participant) {
|
||||
const numExistingDivs = document.getElementsByClassName('individual-video').length;
|
||||
const numExistingDivs = document.getElementsByClassName('individual-video')
|
||||
.length;
|
||||
const div = document.createElement('div');
|
||||
div.id = participant.sid;
|
||||
div.className = "individual-video" + (numExistingDivs > 3 ? " one-of-many-videos" : "")
|
||||
div.innerHTML = '<div class="participant-info">\
|
||||
<div class="participant-name">'+ participant.identity + '</div>\
|
||||
div.className = `individual-video${
|
||||
numExistingDivs > 3 ? ' one-of-many-videos' : ''
|
||||
}`;
|
||||
div.innerHTML = `<div class="participant-info">\
|
||||
<div class="participant-name">${participant.identity}</div>\
|
||||
<div class="disabled-audio-indicator">audio off</div>\
|
||||
<div class="disabled-video-indicator">video off</div>\
|
||||
</div>'
|
||||
</div>`;
|
||||
|
||||
participant.on('trackSubscribed', track => trackSubscribed(div, track));
|
||||
participant.on('trackSubscribed', (track) => trackSubscribed(div, track));
|
||||
participant.on('trackUnsubscribed', trackUnsubscribed);
|
||||
|
||||
participant.on('trackDisabled', track => trackDisabled(div, track));
|
||||
participant.on('trackEnabled', track => trackEnabled(div, track));
|
||||
participant.on('trackDisabled', (track) => trackDisabled(div, track));
|
||||
participant.on('trackEnabled', (track) => trackEnabled(div, track));
|
||||
|
||||
participant.tracks.forEach(publication => {
|
||||
participant.tracks.forEach((publication) => {
|
||||
if (publication.isSubscribed) {
|
||||
trackSubscribed(div, publication.track);
|
||||
}
|
||||
|
|
@ -88,34 +96,35 @@ function participantDisconnected(participant) {
|
|||
function trackSubscribed(div, track) {
|
||||
div.appendChild(track.attach());
|
||||
if (!track.isEnabled) {
|
||||
if(track.kind === 'video') {
|
||||
div.classList.add('disabled-video')
|
||||
if (track.kind === 'video') {
|
||||
div.classList.add('disabled-video');
|
||||
} else {
|
||||
div.classList.add('disabled-audio')
|
||||
div.classList.add('disabled-audio');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function trackUnsubscribed(track) {
|
||||
track.detach().forEach(element => element.remove());
|
||||
track.detach().forEach((element) => element.remove());
|
||||
}
|
||||
|
||||
function trackDisabled(div, track) {
|
||||
if(track.kind === 'video') {
|
||||
div.classList.add('disabled-video')
|
||||
if (track.kind === 'video') {
|
||||
div.classList.add('disabled-video');
|
||||
} else {
|
||||
div.classList.add('disabled-audio')
|
||||
div.classList.add('disabled-audio');
|
||||
}
|
||||
}
|
||||
|
||||
function trackEnabled(div, track) {
|
||||
if(track.kind === 'video') {
|
||||
div.classList.remove('disabled-video')
|
||||
if (track.kind === 'video') {
|
||||
div.classList.remove('disabled-video');
|
||||
} else {
|
||||
div.classList.remove('disabled-audio')
|
||||
div.classList.remove('disabled-audio');
|
||||
}
|
||||
}
|
||||
|
||||
if (navigator.userAgent === 'DEV-Native-ios') {
|
||||
root.innerHTML = '<h2 class="platform-unavailable-message">This feature is not yet available on iPhone</h2>'
|
||||
}
|
||||
root.innerHTML =
|
||||
'<h2 class="platform-unavailable-message">This feature is not yet available on iPhone</h2>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,16 @@ export const ItemListItem = ({ item, children }) => {
|
|||
<a className="item" href={adaptedItem.path}>
|
||||
<div
|
||||
className="item-title"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: filterXSS(adaptedItem.title) }}
|
||||
/>
|
||||
|
||||
<div className="item-details">
|
||||
<a datatestid="item-user" className="item-user" href={`/${adaptedItem.user.username}`}>
|
||||
<a
|
||||
datatestid="item-user"
|
||||
className="item-user"
|
||||
href={`/${adaptedItem.user.username}`}
|
||||
>
|
||||
<img src={adaptedItem.user.profile_image_90} alt="Profile Pic" />
|
||||
{`${adaptedItem.user.name}・`}
|
||||
{`${adaptedItem.publishedDate}・`}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* global require module */
|
||||
/* global require module process */
|
||||
const path = require('path');
|
||||
const { environment } = require('@rails/webpacker');
|
||||
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')
|
||||
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack');
|
||||
const erb = require('./loaders/erb');
|
||||
|
||||
/*
|
||||
|
|
@ -61,8 +61,9 @@ if (process.env.HONEYBADGER_API_KEY && process.env.ASSETS_URL) {
|
|||
assetsUrl: process.env.ASSETS_URL,
|
||||
silent: false,
|
||||
ignoreErrors: false,
|
||||
revision: process.env.HEROKU_SLUG_COMMIT || 'master'
|
||||
}))
|
||||
revision: process.env.HEROKU_SLUG_COMMIT || 'master',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = environment;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue