Open platform to collect and prioritize feedback
add tslint-react (#182)
Guilherme Oenning727f9a772109
diff --git a/package-lock.json b/package-lock.jsonindex 750479234..c0feb1dac 100644--- a/package-lock.json+++ b/package-lock.json@@ -5129,9 +5129,9 @@"dev": true},"resolve": {- "version": "1.4.0",- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz",- "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==",+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz",+ "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==","dev": true,"requires": {"path-parse": "1.0.5"@@ -5636,20 +5636,76 @@"dev": true},"tslint": {- "version": "5.7.0",- "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz",- "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=",+ "version": "5.8.0",+ "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.8.0.tgz",+ "integrity": "sha1-H0mtWy53x2w69N3K5VKuTjYS6xM=","dev": true,"requires": {"babel-code-frame": "6.26.0",- "colors": "1.1.2",+ "builtin-modules": "1.1.1",+ "chalk": "2.3.0","commander": "2.11.0","diff": "3.3.1","glob": "7.1.2","minimatch": "3.0.4",- "resolve": "1.4.0",+ "resolve": "1.5.0","semver": "5.4.1","tslib": "1.7.1",+ "tsutils": "2.12.2"+ },+ "dependencies": {+ "ansi-styles": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",+ "dev": true,+ "requires": {+ "color-convert": "1.9.0"+ }+ },+ "chalk": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",+ "dev": true,+ "requires": {+ "ansi-styles": "3.2.0",+ "escape-string-regexp": "1.0.5",+ "supports-color": "4.5.0"+ }+ },+ "has-flag": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",+ "dev": true+ },+ "supports-color": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",+ "dev": true,+ "requires": {+ "has-flag": "2.0.0"+ }+ },+ "tsutils": {+ "version": "2.12.2",+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.2.tgz",+ "integrity": "sha1-rVikhl0X7D3bZjG2ylO+FKVlb/M=",+ "dev": true,+ "requires": {+ "tslib": "1.7.1"+ }+ }+ }+ },+ "tslint-react": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/tslint-react/-/tslint-react-3.2.0.tgz",+ "integrity": "sha1-hR+1BSAcY9A0PFFybmNk9+mtLpk=",+ "dev": true,+ "requires": {"tsutils": "2.12.0"}},@@ -5691,9 +5747,9 @@"dev": true},"typescript": {- "version": "2.5.3",- "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz",- "integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==",+ "version": "2.6.1",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz",+ "integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=","dev": true},"ua-parser-js": {diff --git a/package.json b/package.jsonindex 467914a05..06002c850 100644--- a/package.json+++ b/package.json@@ -8,7 +8,7 @@"build": "rm -rf dist && webpack -p","test": "rm -rf output && tsc && mocha -t 30000 output/tsc/tests/testcases/*.js","watch": "rm -rf dist && webpack --watch",- "lint": "tslint public/**/**.tsx public/**/**.ts"+ "lint": "tslint -c tslint.json 'public/**/*.{ts,tsx}'"},"dependencies": {"axios": "^0.16.2",@@ -43,8 +43,9 @@"sass-loader": "^6.0.6","selenium-webdriver": "^3.6.0","ts-loader": "^2.3.7",- "tslint": "^5.7.0",- "typescript": "^2.5.3",+ "tslint": "^5.8.0",+ "tslint-react": "^3.2.0",+ "typescript": "^2.6.1","webpack": "^3.6.0","webpack-clean-obsolete-chunks": "^0.2.0"}diff --git a/public/components/CommentInput.tsx b/public/components/CommentInput.tsxindex a65097cb9..a1da0cb46 100644--- a/public/components/CommentInput.tsx+++ b/public/components/CommentInput.tsx@@ -10,77 +10,82 @@ import { Session, IdeaService, Failure } from '@fider/services';import { showSignIn } from '@fider/utils/page';interface CommentInputProps {- idea: Idea;+ idea: Idea;}interface CommentInputState {- content: string;- error?: Failure;+ content: string;+ error?: Failure;}export class CommentInput extends React.Component<CommentInputProps, CommentInputState> {- private input: HTMLTextAreaElement;+ private input: HTMLTextAreaElement;- @inject(injectables.Session)- public session: Session;+ @inject(injectables.Session)+ public session: Session;- @inject(injectables.IdeaService)- public service: IdeaService;+ @inject(injectables.IdeaService)+ public service: IdeaService;- private user?: CurrentUser;+ private user?: CurrentUser;- constructor() {- super();- this.user = this.session.getCurrentUser();+ constructor() {+ super();+ this.user = this.session.getCurrentUser();- this.state = {- content: ''- };- }+ this.state = {+ content: ''+ };+ }- private onTextFocused() {- if (!this.user) {- this.input.blur();- showSignIn();- }+ private onTextFocused() {+ if (!this.user) {+ this.input.blur();+ showSignIn();}+ }++ public async submit() {+ this.setState({+ error: undefined+ });- public async submit() {+ const result = await this.service.addComment(this.props.idea.number, this.state.content);+ if (result.ok) {+ location.reload();+ } else {this.setState({- error: undefined+ error: result.error,});-- const result = await this.service.addComment(this.props.idea.number, this.state.content);- if (result.ok) {- location.reload();- } else {- this.setState({- error: result.error,- });- }}+ }- public render() {- const user = this.session.getCurrentUser();+ public render() {+ const user = this.session.getCurrentUser();- return <div className={`comment-input ${user && 'authenticated' }`}>- { this.user && <Gravatar user={ this.user } /> }- <div className="ui form">- { this.user && <UserName user={ this.user } /> }- <DisplayError error={this.state.error} />- <div className="field">- <Textarea onChange={(e) => { this.setState({ content: e.currentTarget.value }); }}- onFocus={() => this.onTextFocused()}- inputRef={(e) => this.input = e!}- rows={1}- placeholder="Write a comment..."/>- </div>- { this.state.content &&- <Button className="primary" onClick={ () => this.submit() }>- Submit- </Button>- }- </div>- </div>;- }+ return (+ <div className={`comment-input ${user && 'authenticated' }`}>+ {this.user && <Gravatar user={this.user} />}+ <div className="ui form">+ {this.user && <UserName user={this.user} />}+ <DisplayError error={this.state.error} />+ <div className="field">+ <Textarea+ onChange={(e) => { this.setState({ content: e.currentTarget.value }); }}+ onFocus={() => this.onTextFocused()}+ inputRef={(e) => this.input = e!}+ rows={1}+ placeholder="Write a comment..."+ />+ </div>+ {+ this.state.content &&+ <Button className="primary" onClick={() => this.submit()}>+ Submit+ </Button>+ }+ </div>+ </div>+ );+ }}diff --git a/public/components/IdeaFilter.tsx b/public/components/IdeaFilter.tsxindex b542ddeae..7e520edd2 100644--- a/public/components/IdeaFilter.tsx+++ b/public/components/IdeaFilter.tsx@@ -61,22 +61,24 @@ export class IdeaFilter extends React.Component<IdeaFilterProps, {}> {activeFilter = 'recent';}- return <h4 className="ui header">- <div className="content">- Showing {' '}- <div className="ui inline dropdown" ref={(e) => this.element = e!}>- <div className="text">{ names[activeFilter] }</div>- <i className="dropdown icon"></i>- <div className="menu">- <div className="header">What do you want to see?</div>- <div className={`item ${activeFilter === 'recent' && 'active'}`} data-value="recent" data-text="recent ideas">Recent</div>- <div className={`item ${activeFilter === 'most-wanted' && 'active'}`} data-value="most-wanted" data-text="most wanted ideas">Most Wanted</div>- <div className={`item ${activeFilter === 'most-discussed' && 'active'}`} data-value="most-discussed" data-text="most discussed ideas">Most Discussed</div>- <div className={`item ${activeFilter === 'completed' && 'active'}`} data-value="completed" data-text="completed ideas">Completed</div>- <div className={`item ${activeFilter === 'declined' && 'active'}`} data-value="declined" data-text="declined ideas">Declined</div>- </div>- </div>- </div>- </h4>;+ return (+ <h4 className="ui header">+ <div className="content">+ Showing {' '}+ <div className="ui inline dropdown" ref={(e) => this.element = e!}>+ <div className="text">{names[activeFilter]}</div>+ <i className="dropdown icon" />+ <div className="menu">+ <div className="header">What do you want to see?</div>+ <div className={`item ${activeFilter === 'recent' && 'active'}`} data-value="recent" data-text="recent ideas">Recent</div>+ <div className={`item ${activeFilter === 'most-wanted' && 'active'}`} data-value="most-wanted" data-text="most wanted ideas">Most Wanted</div>+ <div className={`item ${activeFilter === 'most-discussed' && 'active'}`} data-value="most-discussed" data-text="most discussed ideas">Most Discussed</div>+ <div className={`item ${activeFilter === 'completed' && 'active'}`} data-value="completed" data-text="completed ideas">Completed</div>+ <div className={`item ${activeFilter === 'declined' && 'active'}`} data-value="declined" data-text="declined ideas">Declined</div>+ </div>+ </div>+ </div>+ </h4>+ );}}diff --git a/public/components/IdeaInput.tsx b/public/components/IdeaInput.tsxindex de5cd4f91..edad97ed0 100644--- a/public/components/IdeaInput.tsx+++ b/public/components/IdeaInput.tsx@@ -66,24 +66,30 @@ export class IdeaInput extends React.Component<IdeaInputProps, IdeaInputState> {public render() {const buttonCss = this.state.title === '' ? 'primary disabled' : 'primary';- const details = <div>- <div className="field">- <Textarea onChange={(e) => this.setState({ description: e.currentTarget.value })} placeholder="Describe your idea" />- </div>- <Button className={ buttonCss } onClick={ (e) => this.submit(e) }>- Submit- </Button>- </div>;+ const details = (+ <div>+ <div className="field">+ <Textarea onChange={(e) => this.setState({ description: e.currentTarget.value })} placeholder="Describe your idea" />+ </div>+ <Button className={buttonCss} onClick={(e) => this.submit(e)}>+ Submit+ </Button>+ </div>+ );- return <Form ref={(f) => { this.form = f!; } } >- <input id="new-idea-input"- type="text"- ref={ (e) => this.title = e! }- onFocus={ () => this.onTitleFocused() }- maxLength={100}- onKeyUp={(e) => { this.setState({ title: e.currentTarget.value }); }}- placeholder={this.props.placeholder} />- { this.state.title && details }- </Form>;+ return (+ <Form ref={(f) => { this.form = f!; }} >+ <input+ id="new-idea-input"+ type="text"+ ref={(e) => this.title = e!}+ onFocus={() => this.onTitleFocused()}+ maxLength={100}+ onKeyUp={(e) => { this.setState({ title: e.currentTarget.value }); }}+ placeholder={this.props.placeholder}+ />+ {this.state.title && details}+ </Form>+ );}}diff --git a/public/components/ResponseForm.tsx b/public/components/ResponseForm.tsxindex a6784f141..d128a257a 100644--- a/public/components/ResponseForm.tsx+++ b/public/components/ResponseForm.tsx@@ -54,49 +54,57 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseFor}public render() {- const button = <Button className="icon fluid text-left" onClick={async () => this.showModal()}>- <i className="announcement icon"></i> Respond- </Button>;-- const modal = <div className="ui form modal" ref={(e) => this.modal = e! }>-- <div className="content">- <DisplayError fields={['status']} error={this.state.error} />- <div className="two fields">- <div className="field">- <label>Status</label>- <select className="ui dropdown"- defaultValue={this.props.idea.status.toString()}- onChange={ (e) => this.setState({ status: parseInt(e.currentTarget.value, 10) }) }>- <option value="0">Open</option>- <option value="1">Started</option>- <option value="2">Completed</option>- <option value="3">Declined</option>- </select>- </div>- </div>- <DisplayError fields={['text']} error={this.state.error} />- <div className="field">- <Textarea- onChange={ (e) => this.setState({ text: e.currentTarget.value }) }- defaultValue={ this.state.text }- placeholder="What's going on with this idea? Let your users know what are your plans..." />- </div>- </div>-- <div className="actions">- <Button className="primary" onClick={() => this.submit()}>- Submit- </Button>- <Button className="basic" onClick={async () => this.closeModel()}>- Cancel- </Button>- </div>- </div>;-- return <div>- { button }- { modal }- </div>;+ const button = (+ <Button className="icon fluid text-left" onClick={async () => this.showModal()}>+ <i className="announcement icon" /> Respond+ </Button>+ );++ const modal = (+ <div className="ui form modal" ref={(e) => this.modal = e!}>+ <div className="content">+ <DisplayError fields={['status']} error={this.state.error} />+ <div className="two fields">+ <div className="field">+ <label>Status</label>+ <select+ className="ui dropdown"+ defaultValue={this.props.idea.status.toString()}+ onChange={(e) => this.setState({ status: parseInt(e.currentTarget.value, 10) })}+ >+ <option value="0">Open</option>+ <option value="1">Started</option>+ <option value="2">Completed</option>+ <option value="3">Declined</option>+ </select>+ </div>+ </div>+ <DisplayError fields={['text']} error={this.state.error} />+ <div className="field">+ <Textarea+ onChange={(e) => this.setState({ text: e.currentTarget.value })}+ defaultValue={this.state.text}+ placeholder="What's going on with this idea? Let your users know what are your plans..."+ />+ </div>+ </div>++ <div className="actions">+ <Button className="primary" onClick={() => this.submit()}>+ Submit+ </Button>+ <Button className="basic" onClick={async () => this.closeModel()}>+ Cancel+ </Button>+ </div>+ </div>+ );++ return (+ <div>+ {button}+ {modal}+ </div>+ );}}diff --git a/public/components/ShowIdeaResponse.tsx b/public/components/ShowIdeaResponse.tsxindex 56c54b162..518fdd0ba 100644--- a/public/components/ShowIdeaResponse.tsx+++ b/public/components/ShowIdeaResponse.tsx@@ -8,19 +8,22 @@ interface IdeaResponseProps {}export const ShowIdeaResponse = (props: IdeaResponseProps): JSX.Element => {- const status = IdeaStatus.Get(props.status);+ const status = IdeaStatus.Get(props.status);- if (props.response && status.show) {- return <div className="fdr-response item ui segment">- <span className={`ui mini label ${status.color}`}>{ status.title }</span>- <Gravatar user={ props.response.user }/> <UserName user={props.response.user} />- <span className="info">- <Moment date={props.response.respondedOn} />- </span>- <div className="content">- <MultiLineText text={ props.response.text } style="full" />- </div>- </div>;- }- return <div/>;+ if (props.response && status.show) {+ return (+ <div className="fdr-response item ui segment">+ <span className={`ui mini label ${status.color}`}>{status.title}</span>+ <Gravatar user={props.response.user}/> <UserName user={props.response.user} />+ <span className="info">+ <Moment date={props.response.respondedOn} />+ </span>+ <div className="content">+ <MultiLineText text={props.response.text} style="full" />+ </div>+ </div>+ );+ }++ return <div/>;};diff --git a/public/components/SignInModal.tsx b/public/components/SignInModal.tsxindex 4c79d2932..630d00545 100644--- a/public/components/SignInModal.tsx+++ b/public/components/SignInModal.tsx@@ -2,14 +2,16 @@ import * as React from 'react';import { SignInControl } from '@fider/components/common';export class SignInModal extends React.Component<{}, {}> {- public render() {- return <div id="signin-modal" className="ui modal small">- <div className="header">- Sign in to raise your voice- </div>- <div className="content">- <SignInControl signInByEmail={ true } />- </div>- </div>;- }+ public render() {+ return (+ <div id="signin-modal" className="ui modal small">+ <div className="header">+ Sign in to raise your voice+ </div>+ <div className="content">+ <SignInControl signInByEmail={true} />+ </div>+ </div>+ );+ }}diff --git a/public/components/SupportCounter.tsx b/public/components/SupportCounter.tsxindex 1e4ec937a..24315ca4b 100644--- a/public/components/SupportCounter.tsx+++ b/public/components/SupportCounter.tsx@@ -57,20 +57,27 @@ export class SupportCounter extends React.Component<SupportCounterProps, Supportconst noTouch = !('ontouchstart' in window);const status = IdeaStatus.Get(this.props.idea.status);- const vote = <button- className={`ui button ${noTouch ? 'no-touch' : ''} ${this.state.supported ? 'supported' : ''} `}- onClick={async () => await this.supportOrUndo()}>- <i className="medium caret up icon"></i>- { this.state.total }- </button>;+ const vote = (+ <button+ className={`ui button ${noTouch ? 'no-touch' : ''} ${this.state.supported ? 'supported' : ''} `}+ onClick={async () => await this.supportOrUndo()}+ >+ <i className="medium caret up icon" />+ {this.state.total}+ </button>+ );- const disabled = <div className="ui button disabled">- <i className="medium caret up icon"></i>- { this.state.total }- </div>;+ const disabled = (+ <div className="ui button disabled">+ <i className="medium caret up icon" />+ {this.state.total}+ </div>+ );- return <div className="support-counter ui">- { status.closed ? disabled : vote }- </div>;+ return (+ <div className="support-counter ui">+ {status.closed ? disabled : vote}+ </div>+ );}}diff --git a/public/components/common/Button.tsx b/public/components/common/Button.tsxindex 5dd549547..9a03fc257 100644--- a/public/components/common/Button.tsx+++ b/public/components/common/Button.tsx@@ -58,13 +58,17 @@ export class Button extends React.Component<ButtonProps, ButtonState> {public render() {const cssClasses = `ui ${this.props.size} button ${this.props.className || ''} ${this.state.clicked ? 'loading disabled' : ''}`;if (this.props.href) {- return <a href={ this.props.href } className={ cssClasses } onClick={ () => this.click() }>- { this.props.children }- </a>;+ return (+ <a href={this.props.href} className={cssClasses} onClick={() => this.click()}>+ {this.props.children}+ </a>+ );} else {- return <button type="button" className={ cssClasses } onClick={ (e) => this.click(e) }>- { this.props.children }- </button>;+ return (+ <button type="button" className={cssClasses} onClick={(e) => this.click(e)}>+ {this.props.children}+ </button>+ );}}diff --git a/public/components/common/DisplayError.tsx b/public/components/common/DisplayError.tsxindex 332a76193..2b3a34c11 100644--- a/public/components/common/DisplayError.tsx+++ b/public/components/common/DisplayError.tsx@@ -13,7 +13,7 @@ interface DisplayErrorProps {export const DisplayError = (props: DisplayErrorProps) => {if (!props.error) {- return <div></div>;+ return null;}const pointing = props.pointing || 'below';@@ -31,7 +31,12 @@ export const DisplayError = (props: DisplayErrorProps) => {}}- return items.length > 0 ? <div className={`display-error ui pointing ${pointing} red basic label`}>- <ul>{ items }</ul>- </div> : null;+ return (+ items.length > 0+ ? (+ <div className={`display-error ui pointing ${pointing} red basic label`}>+ <ul>{items}</ul>+ </div>+ ) : null+ );};diff --git a/public/components/common/EnvironmentInfo.tsx b/public/components/common/EnvironmentInfo.tsxindex f4a9823bd..46222a4ce 100644--- a/public/components/common/EnvironmentInfo.tsx+++ b/public/components/common/EnvironmentInfo.tsx@@ -10,13 +10,18 @@ export class EnvironmentInfo extends React.Component<{}, {}> {public render() {if (!this.session.isProduction()) {const settings = this.session.getAppSettings();- return <div id="environment-info" className=" ui mini negative message no-border no-margin">- Env: { settings.environment } |- Compiler: { settings.compiler } |- Version: { settings.version } |- BuildTime: { settings.buildTime }- </div>;+ return (+ <div+ id="environment-info"+ className=" ui mini negative message no-border no-margin"+ >+ Env: {settings.environment} |+ Compiler: {settings.compiler} |+ Version: {settings.version} |+ BuildTime: {settings.buildTime}+ </div>+ );}return <div/>;}-}\ No newline at end of file+}diff --git a/public/components/common/Footer.tsx b/public/components/common/Footer.tsxindex ebb79b533..b1bd6509e 100644--- a/public/components/common/Footer.tsx+++ b/public/components/common/Footer.tsx@@ -2,14 +2,16 @@ import * as React from 'react';const logo = require('@fider/assets/images/logo-small.png');export const Footer = () => {- return <div id="footer" className="ui vertical footer segment">- <div className="ui center aligned container">- <div className="ui inverted section divider"></div>- <div className="ui horizontal small divided link list">- <div id="powered-by">- <a className="item" target="_blank" href="http://getfider.com/"><img src={logo} /></a>- </div>- </div>- </div>- </div>;+ return (+ <div id="footer" className="ui vertical footer segment">+ <div className="ui center aligned container">+ <div className="ui inverted section divider"/>+ <div className="ui horizontal small divided link list">+ <div id="powered-by">+ <a className="item" target="_blank" href="http://getfider.com/"><img src={logo} /></a>+ </div>+ </div>+ </div>+ </div>+ );};diff --git a/public/components/common/Form.tsx b/public/components/common/Form.tsxindex c4c71db77..131b1a983 100644--- a/public/components/common/Form.tsx+++ b/public/components/common/Form.tsx@@ -33,9 +33,11 @@ export class Form extends React.Component<FormProps, FormState> {}public render() {- return <form autoComplete="off" className="ui form" onSubmit={ (e) => this.submit(e) }>- <DisplayError error={this.state && this.state.failure} />- { this.props.children }- </form>;+ return (+ <form autoComplete="off" className="ui form" onSubmit={(e) => this.submit(e)}>+ <DisplayError error={this.state && this.state.failure} />+ {this.props.children}+ </form>+ );}}diff --git a/public/components/common/Gravatar.tsx b/public/components/common/Gravatar.tsxindex b5d28274e..34e881f82 100644--- a/public/components/common/Gravatar.tsx+++ b/public/components/common/Gravatar.tsx@@ -16,9 +16,13 @@ export const Gravatar = (props: GravatarProps) => {const isCollaborator = props.user ? props.user.role >= 2 : false;let element: any;- return <img ref={(e) => element = e }- onError={() => { element.src = fallback; }}- className={`fdr-avatar image ${isCollaborator && 'staff'}`}- title={ name }- src={ `https://www.gravatar.com/avatar/${hash}?d=${encodeURIComponent(fallback)}` }/>;+ return (+ <img+ ref={(e) => element = e}+ onError={() => { element.src = fallback; }}+ className={`fdr-avatar image ${isCollaborator && 'staff'}`}+ title={name}+ src={`https://www.gravatar.com/avatar/${hash}?d=${encodeURIComponent(fallback)}`}+ />+ );};diff --git a/public/components/common/Header.tsx b/public/components/common/Header.tsxindex 7b812e0d2..d8f3b8f4c 100644--- a/public/components/common/Header.tsx+++ b/public/components/common/Header.tsx@@ -27,41 +27,46 @@ export class Header extends React.Component<{}, {}> {}public render() {- const items = this.user && <div className="menu">- <div className="name header">- <i className="user icon"></i>- { this.user.name }- </div>- <a href="/settings" className="item">Settings</a>- <div className="divider"></div>- {- this.session.isCollaborator() && [- <div key={1} className="header">- <i className="setting icon"></i>- Administration- </div>,- <a key={2} href="/admin" className="item">General Settings</a>,- <a key={3} href="/admin/members" className="item">Members</a>,- <div key={4} className="divider"></div>- ]- }- <a href="/signout?redirect=/" className="item signout">Sign out</a>- </div>;+ const items = this.user && (+ <div className="menu">+ <div className="name header">+ <i className="user icon" />+ {this.user.name}+ </div>+ <a href="/settings" className="item">Settings</a>+ <div className="divider" />+ {+ this.session.isCollaborator() && [+ <div key={1} className="header">+ <i className="setting icon" />+ Administration+ </div>,+ <a key={2} href="/admin" className="item">General Settings</a>,+ <a key={3} href="/admin/members" className="item">Members</a>,+ <div key={4} className="divider" />+ ]+ }+ <a href="/signout?redirect=/" className="item signout">Sign out</a>+ </div>+ );++ return (+ <div>+ <EnvironmentInfo />+ <div id="menu" className="ui small borderless menu">+ <div className="ui container">+ <a href="/" className="header item">+ {this.tenant.name}+ </a>+ <div onClick={() => this.showModal()} className={`ui right simple dropdown item signin ${!this.user && 'subtitle'}`}>+ {this.user && <Gravatar user={this.user} />}+ {!this.user && 'Sign in'} {this.user && <i className="dropdown icon" />}+ {items}+ </div>+ </div>+ </div>+ </div>+ );- return <div>- <EnvironmentInfo />- <div id="menu" className="ui small borderless menu">- <div className="ui container">- <a href="/" className="header item">- { this.tenant.name }- </a>- <div onClick={ () => this.showModal() } className={`ui right simple dropdown item signin ${!this.user && 'subtitle'}`}>- { this.user && <Gravatar user={ this.user } /> }- { !this.user && 'Sign in' } { this.user && <i className="dropdown icon"></i> }- { items }- </div>- </div>- </div>- </div>;}}diff --git a/public/components/common/Moment.tsx b/public/components/common/Moment.tsxindex 4ffac5b2a..ae5ef660f 100644--- a/public/components/common/Moment.tsx+++ b/public/components/common/Moment.tsx@@ -7,14 +7,16 @@ interface MomentText {export const Moment = (props: MomentText) => {if (!props.date) {- return <span></span>;+ return <span />;}const m = moment(props.date);const diff = m.diff(new Date(), 'years');const display = (diff !== 0) ? m.format('MMMM D, YYYY') : m.fromNow();- return <span className="date" title={m.format('MMMM D, YYYY')}>- { display }- </span>;+ return (+ <span className="date" title={m.format('MMMM D, YYYY')}>+ {display}+ </span>+ );};diff --git a/public/components/common/MultiLineText.tsx b/public/components/common/MultiLineText.tsxindex 40146ed76..c5a54727a 100644--- a/public/components/common/MultiLineText.tsx+++ b/public/components/common/MultiLineText.tsx@@ -12,9 +12,14 @@ interface MultiLineText {export const MultiLineText = (props: MultiLineText) => {if (!props.text) {- return <p></p>;+ return <p />;}const func = props.style === 'full' ? full : simple;- return <div className={ `markdown-body ${props.className || ''}` } dangerouslySetInnerHTML={{__html: func.render(props.text)}}></div>;+ return (+ <div+ className={`markdown-body ${props.className || ''}`}+ dangerouslySetInnerHTML={{__html: func.render(props.text)}}+ />+ );};diff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsxindex 76e836a2d..4d2afd708 100644--- a/public/components/common/SignInControl.tsx+++ b/public/components/common/SignInControl.tsx@@ -50,50 +50,59 @@ export class SignInControl extends React.Component<SignInControlProps, SignInConconst settings = this.session.get<AuthSettings>('auth');if (this.state.sent) {- return <div>- <p>We sent a sign in link to <b>{ this.state.email }</b>. <br /> Please check your inbox.</p>- <p><a href="#" onClick={() => hideSignIn()}>OK</a></p>- </div>;+ return (+ <div>+ <p>We sent a sign in link to <b>{this.state.email}</b>. <br /> Please check your inbox.</p>+ <p><a href="#" onClick={() => hideSignIn()}>OK</a></p>+ </div>+ );}- const google = settings.providers.google &&- <div className="column">- <SocialSignInButton provider="google" />- </div>;- const facebook = settings.providers.facebook &&+ const google = settings.providers.google && (<div className="column">+ <SocialSignInButton provider="google" />+ </div>+ );+ const facebook = settings.providers.facebook && (+ <div className="column"><SocialSignInButton provider="facebook" />- </div>;- const github = settings.providers.github &&- <div className="column">+ </div>+ );+ const github = settings.providers.github && (+ <div className="column"><SocialSignInButton provider="github" />- </div>;+ </div>+ );const hasOAuth = !!(google || facebook || github);- return <div className="signin-options">- {- hasOAuth && <div>- <div className="ui stackable three column centered grid">- { facebook }- { google }- { github }- </div>- <p className="info">We'll never post to any of your accounts</p>- <div className="ui horizontal divider">OR</div>- </div>- }+ return (+ <div className="signin-options">+ {+ hasOAuth && (+ <div>+ <div className="ui stackable three column centered grid">+ {facebook}+ {google}+ {github}+ </div>+ <p className="info">We'll never post to any of your accounts</p>+ <div className="ui horizontal divider">OR</div>+ </div>+ )+ }- { this.props.signInByEmail && <div>- <p>Enter your e-mail address to sign in</p>- <Form ref={(f) => { this.form = f!; } } onSubmit={() => this.signIn() }>- <div id="email-signin" className="ui small action fluid input">- <input onChange={ (e) => this.setState({ email: e.currentTarget.value }) } type="text" placeholder="[email protected]" className="small" />- <Button onClick={ () => this.signIn() } className={`positive ${this.state.email === '' && 'disabled'}`}>- Sign in- </Button>- </div>- </Form>- </div> }- </div>;+ { this.props.signInByEmail && <div>+ <p>Enter your e-mail address to sign in</p>+ <Form ref={(f) => { this.form = f!; }} onSubmit={() => this.signIn()}>+ <div id="email-signin" className="ui small action fluid input">+ <input onChange={(e) => this.setState({ email: e.currentTarget.value })} type="text" placeholder="[email protected]" className="small" />+ <Button onClick={() => this.signIn()} className={`positive ${this.state.email === '' && 'disabled'}`}>+ Sign in+ </Button>+ </div>+ </Form>+ </div> }+ </div>+ );}}diff --git a/public/components/common/SocialSignInButton.tsx b/public/components/common/SocialSignInButton.tsxindex b44dadebd..dd4465cfa 100644--- a/public/components/common/SocialSignInButton.tsx+++ b/public/components/common/SocialSignInButton.tsx@@ -6,40 +6,41 @@ import { Button } from '@fider/components/common';import { AuthSettings } from '@fider/models';interface SocialSignInButtonProps {- provider: 'google' | 'facebook' | 'github';+ provider: 'google' | 'facebook' | 'github';}const providers = {- google: {- name: 'Google',- class: 'google plus',- icon: 'google'- },- facebook: {- name: 'Facebook',- class: 'facebook',- icon: 'facebook f'- },- github: {- name: 'GitHub',- class: 'github black',- icon: 'github'- }+ google: {+ name: 'Google',+ class: 'google plus',+ icon: 'google'+ },+ facebook: {+ name: 'Facebook',+ class: 'facebook',+ icon: 'facebook f'+ },+ github: {+ name: 'GitHub',+ class: 'github black',+ icon: 'github'+ }};export class SocialSignInButton extends React.Component<SocialSignInButtonProps, {}> {+ @inject(injectables.Session)+ public session: Session;- @inject(injectables.Session)- public session: Session;+ public render() {+ const auth = this.session.get<AuthSettings>('auth');- public render() {- const auth = this.session.get<AuthSettings>('auth');+ const href = `${auth.endpoint}/oauth/${this.props.provider}?redirect=${location.href}`;- const href = `${auth.endpoint}/oauth/${this.props.provider}?redirect=${location.href}`;-- return <Button size="small" href={href} className={`${providers[this.props.provider].class} fluid`}>- <i className={`icon ${providers[this.props.provider].icon}`}></i>- <span>{ providers[this.props.provider].name }</span>- </Button>;- }+ return (+ <Button size="small" href={href} className={`${providers[this.props.provider].class} fluid`}>+ <i className={`icon ${providers[this.props.provider].icon}`} />+ <span>{providers[this.props.provider].name}</span>+ </Button>+ );+ }}diff --git a/public/components/common/UserName.tsx b/public/components/common/UserName.tsxindex 3c4f85c6e..8a0ccb565 100644--- a/public/components/common/UserName.tsx+++ b/public/components/common/UserName.tsx@@ -7,5 +7,5 @@ interface UserNameProps {export const UserName = (props: UserNameProps) => {const isCollaborator = props.user.role >= 2;- return <span className={`name ${isCollaborator ? 'staff' : ''}`}>{ props.user.name }</span>;+ return <span className={`name ${isCollaborator ? 'staff' : ''}`}>{props.user.name}</span>;};diff --git a/public/index.tsx b/public/index.tsxindex 5d6014656..45f61891b 100644--- a/public/index.tsx+++ b/public/index.tsx@@ -60,8 +60,8 @@ document.addEventListener('DOMContentLoaded', () => {ReactDOM.render(<div><SignInModal />- <div id={ config.id }>- { React.createElement(config.component) }+ <div id={config.id}>+ {React.createElement(config.component)}</div></div>, root);diff --git a/public/pages/admin/AdminHomePage.tsx b/public/pages/admin/AdminHomePage.tsxindex 7858290bd..51bcf97f5 100644--- a/public/pages/admin/AdminHomePage.tsx+++ b/public/pages/admin/AdminHomePage.tsx@@ -9,143 +9,153 @@ import { inject, injectables } from '@fider/di';import { Session, TenantService, Failure } from '@fider/services';interface AdminHomePageState {- title: string;- welcomeMessage: string;- invitation: string;- cname: string;- error?: Failure;+ title: string;+ welcomeMessage: string;+ invitation: string;+ cname: string;+ error?: Failure;}export class AdminHomePage extends React.Component<{}, AdminHomePageState> {- @inject(injectables.Session)- public session: Session;+ @inject(injectables.Session)+ public session: Session;- @inject(injectables.TenantService)- public service: TenantService;+ @inject(injectables.TenantService)+ public service: TenantService;- private tenant: Tenant;+ private tenant: Tenant;- constructor(props: {}) {- super(props);- this.tenant = this.session.getCurrentTenant();+ constructor(props: {}) {+ super(props);+ this.tenant = this.session.getCurrentTenant();- this.state = {- title: this.tenant.name,- cname: this.tenant.cname,- welcomeMessage: this.tenant.welcomeMessage,- invitation: this.tenant.invitation- };+ this.state = {+ title: this.tenant.name,+ cname: this.tenant.cname,+ welcomeMessage: this.tenant.welcomeMessage,+ invitation: this.tenant.invitation+ };- setTitle(`Administration · ${document.title}`);- }+ setTitle(`Administration · ${document.title}`);+ }- private async confirm() {- const result = await this.service.updateSettings(- this.state.title,- this.state.invitation,- this.state.welcomeMessage,- this.state.cname,- );- if (result.ok) {- location.href = `/`;- } else if (result.error) {- this.setState({ error: result.error });- }+ private async confirm() {+ const result = await this.service.updateSettings(+ this.state.title,+ this.state.invitation,+ this.state.welcomeMessage,+ this.state.cname,+ );+ if (result.ok) {+ location.href = `/`;+ } else if (result.error) {+ this.setState({ error: result.error });}+ }- public render() {- return <div>- <Header />- <div className="page ui container">- <h2 className="ui header">- <i className="circular settings icon"></i>- <div className="content">- General Settings- <div className="sub header">Manage your site settings</div>- </div>- </h2>+ public render() {+ return (+ <div>+ <Header />+ <div className="page ui container">+ <h2 className="ui header">+ <i className="circular settings icon" />+ <div className="content">+ General Settings+ <div className="sub header">Manage your site settings</div>+ </div>+ </h2>- <div className="ui grid">- <div className="eight wide computer sixteen wide mobile column">- <div className="ui form">- <DisplayError fields={['title']} error={this.state.error} />- <div className="field">- <label htmlFor="title">Title</label>- <input id="title"- type="text"- maxLength={60}- disabled={ !this.session.isAdmin() }- value={ this.state.title }- onChange={(e) => this.setState({ title: e.currentTarget.value })}/>- <div className="info">- <p>Use this field to change the title that is shown on the top of your page.</p>- </div>- </div>- <DisplayError fields={['welcomeMessage']} error={this.state.error} />- <div className="field">- <label htmlFor="welcome-message">Welcome Message</label>- <Textarea id="welcome-message"- disabled={ !this.session.isAdmin() }- onChange={(e) => this.setState({ welcomeMessage: e.currentTarget.value })}- value={ this.state.welcomeMessage } />- <div className="info">- <p>Use this space to change message of your initial page.</p>- <p>Common use case for this area is a brief description of what is your company/product, why you created this space and how the visitors can collaborate.</p>- <p>This field is powered by Commonmark. You can style and add links to your message. Learn more at <a target="_blank" href="http://commonmark.org/help/">http://commonmark.org/help/</a>.</p>- </div>- </div>- <DisplayError fields={['invitation']} error={this.state.error} />- <div className="field">- <label htmlFor="invitation">Invitation</label>- <input id="invitation"- type="text"- maxLength={60}- disabled={ !this.session.isAdmin() }- value={ this.state.invitation }- onChange={(e) => this.setState({ invitation: e.currentTarget.value })}/>- <div className="info">- <p>This is your customized message to invite visitors to share their ideas and suggestions.</p>- </div>- </div>- {- !this.session.isSingleHostMode() && [- <DisplayError key={1} fields={['cname']} error={this.state.error} />,- <div key={2} className="field">- <label htmlFor="cname">Custom Domain</label>- <input id="cname"- type="text"- placeholder="feedback.yourcompany.com"- maxLength={100}- disabled={ !this.session.isAdmin() }- value={ this.state.cname }- onChange={(e) => this.setState({ cname: e.currentTarget.value })}/>- <div className="info">- {- this.state.cname ? [- <p key={0}>Input following record into your domain DNS zone records:</p>,- <p key={1}><strong>{ this.state.cname }</strong> CNAME <strong>{ this.session.getCurrentTenant().subdomain }{ this.session.getAppSettings().domain }</strong></p>,- <div key={2} className="ui negative message">- <p>Custom Domain is a <strong>experimental feature</strong> and you're invited to test it. In case of any issue, feedback or question, please contact us at <a href="mailto:[email protected]">[email protected]</a>.</p>- </div>- ] :- <p>Custom domains allow you to access your app via your own domain name (for example, <code>feedback.yourcomany.com</code>).</p>- }- </div>- </div>- ]- }- {- this.session.isAdmin() &&- <div className="field">- <Button className="positive" size="tiny" onClick={async () => await this.confirm()}>Confirm</Button>- </div>- }- </div>- </div>+ <div className="ui grid">+ <div className="eight wide computer sixteen wide mobile column">+ <div className="ui form">+ <DisplayError fields={['title']} error={this.state.error} />+ <div className="field">+ <label htmlFor="title">Title</label>+ <input+ id="title"+ type="text"+ maxLength={60}+ disabled={!this.session.isAdmin()}+ value={this.state.title}+ onChange={(e) => this.setState({ title: e.currentTarget.value })}+ />+ <div className="info">+ <p>Use this field to change the title that is shown on the top of your page.</p>+ </div>+ </div>+ <DisplayError fields={['welcomeMessage']} error={this.state.error} />+ <div className="field">+ <label htmlFor="welcome-message">Welcome Message</label>+ <Textarea+ id="welcome-message"+ disabled={!this.session.isAdmin()}+ onChange={(e) => this.setState({ welcomeMessage: e.currentTarget.value })}+ value={this.state.welcomeMessage}+ />+ <div className="info">+ <p>Use this space to change message of your initial page.</p>+ <p>Common use case for this area is a brief description of what is your company/product, why you created this space and how the visitors can collaborate.</p>+ <p>This field is powered by Commonmark. You can style and add links to your message. Learn more at <a target="_blank" href="http://commonmark.org/help/">http://commonmark.org/help/</a>.</p>+ </div>+ </div>+ <DisplayError fields={['invitation']} error={this.state.error} />+ <div className="field">+ <label htmlFor="invitation">Invitation</label>+ <input+ id="invitation"+ type="text"+ maxLength={60}+ disabled={!this.session.isAdmin()}+ value={this.state.invitation}+ onChange={(e) => this.setState({ invitation: e.currentTarget.value })}+ />+ <div className="info">+ <p>This is your customized message to invite visitors to share their ideas and suggestions.</p>+ </div>+ </div>+ {+ !this.session.isSingleHostMode() && [+ <DisplayError key={1} fields={['cname']} error={this.state.error} />,+ <div key={2} className="field">+ <label htmlFor="cname">Custom Domain</label>+ <input+ id="cname"+ type="text"+ placeholder="feedback.yourcompany.com"+ maxLength={100}+ disabled={!this.session.isAdmin()}+ value={this.state.cname}+ onChange={(e) => this.setState({ cname: e.currentTarget.value })}+ />+ <div className="info">+ {+ this.state.cname ? [+ <p key={0}>Input following record into your domain DNS zone records:</p>,+ <p key={1}><strong>{this.state.cname}</strong> CNAME <strong>{this.session.getCurrentTenant().subdomain}{this.session.getAppSettings().domain}</strong></p>,+ <div key={2} className="ui negative message">+ <p>Custom Domain is a <strong>experimental feature</strong> and you're invited to test it. In case of any issue, feedback or question, please contact us at <a href="mailto:[email protected]">[email protected]</a>.</p>+ </div>+ ] :+ <p>Custom domains allow you to access your app via your own domain name (for example, <code>feedback.yourcomany.com</code>).</p>+ }</div>+ </div>+ ]+ }+ {+ this.session.isAdmin() &&+ <div className="field">+ <Button className="positive" size="tiny" onClick={async () => await this.confirm()}>Confirm</Button></div>- <Footer />- </div>;- }+ }+ </div>+ </div>+ </div>+ </div>+ <Footer />+ </div>+ );+ }}diff --git a/public/pages/admin/MembersPage.tsx b/public/pages/admin/MembersPage.tsxindex e740b5c05..2ee5c7bd6 100644--- a/public/pages/admin/MembersPage.tsx+++ b/public/pages/admin/MembersPage.tsx@@ -59,128 +59,135 @@ export class MembersPage extends React.Component<{}, MembersPageState> {}private showUser(user: User, role: UserRole, addable: boolean, removable: boolean) {- if (user.id === this.currentUser.id || this.currentUser.role !== UserRole.Administrator) {- removable = false;- }-- return <div key={user.id} className="item">- <Gravatar user={user} />- <div className="content">- <UserName user={user} />- </div>- <div className="right floated content">- {- removable &&- <Button size="mini" onClick={() => this.changeRole(user, UserRole.Visitor)} className="red showover">- <i className="remove icon"></i>- Remove- </Button>- }- {- addable &&- <Button size="mini" onClick={() => this.changeRole(user, role)} className="green showover">- <i className="add icon"></i>- Add- </Button>- }- </div>- </div>;+ if (user.id === this.currentUser.id || this.currentUser.role !== UserRole.Administrator) {+ removable = false;+ }++ return (+ <div key={user.id} className="item">+ <Gravatar user={user} />+ <div className="content">+ <UserName user={user} />+ </div>+ <div className="right floated content">+ {+ removable &&+ <Button size="mini" onClick={() => this.changeRole(user, UserRole.Visitor)} className="red showover">+ <i className="remove icon" />Remove+ </Button>+ }+ {+ addable &&+ <Button size="mini" onClick={() => this.changeRole(user, role)} className="green showover">+ <i className="add icon" />Add+ </Button>+ }+ </div>+ </div>+ );}private filterVisitors(property: string, text: string) {- let filtered: User[] = [];- if (text) {- filtered = this.state.visitors.filter((x) => x.name.toLowerCase().indexOf(text.toLowerCase()) >= 0);- }-- if (property === 'administrator') {- this.setState({- newAdministratorFilter: text,- filteredNewAdministrators: filtered- });- } else if (property === 'collaborator') {- this.setState({- newCollaboratorFilter: text,- filteredNewCollaborators: filtered- });- }+ let filtered: User[] = [];+ if (text) {+ filtered = this.state.visitors.filter((x) => x.name.toLowerCase().indexOf(text.toLowerCase()) >= 0);+ }++ if (property === 'administrator') {+ this.setState({+ newAdministratorFilter: text,+ filteredNewAdministrators: filtered+ });+ } else if (property === 'collaborator') {+ this.setState({+ newCollaboratorFilter: text,+ filteredNewCollaborators: filtered+ });+ }}public render() {- return <div>- <Header />- <div className="page ui container">- <h2 className="ui header">- <i className="circular users icon"></i>- <div className="content">- Members- <div className="sub header">Manage your account administrators and collaborators.</div>- </div>- </h2>-- <div className="ui grid">-- <div className="eight wide computer sixteen wide mobile column">- <div className="ui segment">- <h4 className="ui header">Administrators</h4>- <p className="info">Administrators have full access to edit and manage content, permissions and settings.</p>- <div className="ui middle aligned very relaxed selection list">- { this.state.administrators.map((x) => this.showUser(x, UserRole.Administrator, false, true)) }- </div>- { this.currentUser.role === UserRole.Administrator && <div className="ui mini form">- <p>Add new administrator</p>- <div className="mini field">- <input- type="text"- value={this.state.newAdministratorFilter}- onChange={(x) => this.filterVisitors('administrator', x.currentTarget.value)}- placeholder="Search users by name"- />- </div>- <div className="ui middle aligned very relaxed selection list">- { this.state.filteredNewAdministrators.map((x) => this.showUser(x, UserRole.Administrator, true, false)) }- </div>- {- this.state.newAdministratorFilter &&- this.state.filteredNewAdministrators.length === 0 &&- <p className="info">No users to show.</p>- }- </div> }- </div>- </div>-- <div className="eight wide computer sixteen wide mobile column">- <div className="ui segment">- <h4 className="ui header">Collaborators</h4>- <p className="info">Collaborators can edit and manage content, but not permissions and settings.</p>- <div className="ui middle aligned very relaxed selection list">- { this.state.collaborators.map((x) => this.showUser(x, UserRole.Collaborator, false, true)) }- </div>- { this.currentUser.role === UserRole.Administrator && <div className="ui mini form">- <p>Add new collaborator</p>- <div className="mini field">- <input- type="text"- value={this.state.newCollaboratorFilter}- onChange={(x) => this.filterVisitors('collaborator', x.currentTarget.value)}- placeholder="Search users by name"- />- </div>- <div className="ui middle aligned very relaxed selection list">- { this.state.filteredNewCollaborators.map((x) => this.showUser(x, UserRole.Collaborator, true, false)) }- </div>- {- this.state.newCollaboratorFilter &&- this.state.filteredNewCollaborators.length === 0 &&- <p className="info">No users to show.</p>- }- </div> }- </div>- </div>-+ return (+ <div>+ <Header />+ <div className="page ui container">+ <h2 className="ui header">+ <i className="circular users icon" />+ <div className="content">+ Members+ <div className="sub header">Manage your account administrators and collaborators.</div>+ </div>+ </h2>++ <div className="ui grid">++ <div className="eight wide computer sixteen wide mobile column">+ <div className="ui segment">+ <h4 className="ui header">Administrators</h4>+ <p className="info">Administrators have full access to edit and manage content, permissions and settings.</p>+ <div className="ui middle aligned very relaxed selection list">+ {this.state.administrators.map((x) => this.showUser(x, UserRole.Administrator, false, true))}+ </div>+ {+ this.currentUser.role === UserRole.Administrator &&+ <div className="ui mini form">+ <p>Add new administrator</p>+ <div className="mini field">+ <input+ type="text"+ value={this.state.newAdministratorFilter}+ onChange={(x) => this.filterVisitors('administrator', x.currentTarget.value)}+ placeholder="Search users by name"+ />+ </div>+ <div className="ui middle aligned very relaxed selection list">+ {this.state.filteredNewAdministrators.map((x) => this.showUser(x, UserRole.Administrator, true, false))}</div>+ {+ this.state.newAdministratorFilter &&+ this.state.filteredNewAdministrators.length === 0 &&+ <p className="info">No users to show.</p>+ }+ </div>+ }+ </div>+ </div>++ <div className="eight wide computer sixteen wide mobile column">+ <div className="ui segment">+ <h4 className="ui header">Collaborators</h4>+ <p className="info">Collaborators can edit and manage content, but not permissions and settings.</p>+ <div className="ui middle aligned very relaxed selection list">+ {this.state.collaborators.map((x) => this.showUser(x, UserRole.Collaborator, false, true))}</div>- <Footer />- </div>;+ {+ this.currentUser.role === UserRole.Administrator &&+ <div className="ui mini form">+ <p>Add new collaborator</p>+ <div className="mini field">+ <input+ type="text"+ value={this.state.newCollaboratorFilter}+ onChange={(x) => this.filterVisitors('collaborator', x.currentTarget.value)}+ placeholder="Search users by name"+ />+ </div>+ <div className="ui middle aligned very relaxed selection list">+ {this.state.filteredNewCollaborators.map((x) => this.showUser(x, UserRole.Collaborator, true, false))}+ </div>+ {+ this.state.newCollaboratorFilter &&+ this.state.filteredNewCollaborators.length === 0 &&+ <p className="info">No users to show.</p>+ }+ </div>+ }+ </div>+ </div>+ </div>+ </div>+ <Footer />+ </div>+ );}}diff --git a/public/pages/signup/SignUpPage.scss b/public/pages/signup/SignUpPage.scssindex 2dd0737bd..6c9873adf 100644--- a/public/pages/signup/SignUpPage.scss+++ b/public/pages/signup/SignUpPage.scss@@ -1,18 +1,18 @@#fdr-signup-page {- .page {- margin-top: 50px;- max-width: 500px !important;- }+ .page {+ margin-top: 50px;+ max-width: 500px !important;+ }- .fdr-avatar {- margin-right: 5px;- }+ .fdr-avatar {+ margin-right: 5px;+ }- .logo {- height: 100px;- }+ .logo {+ height: 100px;+ }- .ui.basic.red.label {- width: auto;- }+ .ui.basic.red.label {+ width: auto;+ }}\ No newline at end of filediff --git a/public/pages/signup/SignUpPage.tsx b/public/pages/signup/SignUpPage.tsxindex e4c31eada..40f832b1c 100644--- a/public/pages/signup/SignUpPage.tsx+++ b/public/pages/signup/SignUpPage.tsx@@ -116,90 +116,101 @@ export class SignUpPage extends React.Component<{}, SignUpPageState> {}public render() {- const modal = this.state.submitted &&- <div id="submitted-modal" className="ui modal small">- <div className="header">Thank you for registering!</div>- <div className="content">- <p>Please check your inbox for a confirmation link to finish your registration.</p>- </div>- </div>;-- return <div>- <EnvironmentInfo />- <div className="page ui container">- { modal }- <img className="logo" src={logo} />-- <h3 className="ui header">1. Who are you?</h3>- <DisplayError fields={['token']} error={this.state.error} />-- {- this.user ?- <div>- <p>- Hello, - <Gravatar name={this.user.name} email={this.user.email} />- <b>{this.user.name}</b> ({this.user.email})- </p>- </div> :- <div>- <p>We need to identify you to setup your new Fider account.</p>- <SignInControl signInByEmail={ false } />- <div className="ui form">- <DisplayError fields={['name', 'email']} error={this.state.error} />- <div className="fluid field">- <input id="name" onChange={(e) => this.setState({ name: e.currentTarget.value }) } type="text" placeholder="your name" className="small" />- </div>- <div className="fluid field">- <input id="email" onChange={(e) => this.setState({ email: e.currentTarget.value }) } type="text" placeholder="[email protected]" className="small" />- </div>- </div>- </div>- }+ const modal = this.state.submitted && (+ <div id="submitted-modal" className="ui modal small">+ <div className="header">Thank you for registering!</div>+ <div className="content">+ <p>Please check your inbox for a confirmation link to finish your registration.</p>+ </div>+ </div>+ );++ return (+ <div>+ <EnvironmentInfo />+ <div className="page ui container">+ {modal}+ <img className="logo" src={logo} />++ <h3 className="ui header">1. Who are you?</h3>+ <DisplayError fields={['token']} error={this.state.error} />++ {+ this.user ?+ <div>+ <p>+ Hello, + <Gravatar name={this.user.name} email={this.user.email} />+ <b>{this.user.name}</b> ({this.user.email})+ </p>+ </div> :+ <div>+ <p>We need to identify you to setup your new Fider account.</p>+ <SignInControl signInByEmail={false} />+ <div className="ui form">+ <DisplayError fields={['name', 'email']} error={this.state.error} />+ <div className="fluid field">+ <input id="name" onChange={(e) => this.setState({ name: e.currentTarget.value })} type="text" placeholder="your name" className="small" />+ </div>+ <div className="fluid field">+ <input id="email" onChange={(e) => this.setState({ email: e.currentTarget.value })} type="text" placeholder="[email protected]" className="small" />+ </div>+ </div>+ </div>+ }- <div className="ui section divider"></div>+ <div className="ui section divider" />- <h3 className="ui header">2. What is this Feedback Forum for?</h3>+ <h3 className="ui header">2. What is this Feedback Forum for?</h3>- <DisplayError fields={['tenantName', 'subdomain']} error={this.state.error} />- <div className="ui form">- <div className="fluid field">- <input id="tenantName" type="text"- placeholder="your company or product name"- maxLength={60}- onChange={(e) => this.setState({ tenantName: e.currentTarget.value })}/>- </div>- { !this.session.isSingleHostMode() && <div className="fluid field">- <div className="ui right labeled input">- <input id="subdomain" type="text"- maxLength={40}- placeholder="subdomain"- onChange={(e) => this.checkAvailability(e.currentTarget.value)} />- <div className="ui label">{ this.settings.domain }</div>- {- this.state.subdomain.available &&- <div className="ui left pointing green basic label">- Great!- </div>- }- {- this.state.subdomain.message &&- <div className="ui left pointing red basic label">- { this.state.subdomain.message }- </div>- }- </div>- </div> }+ <DisplayError fields={['tenantName', 'subdomain']} error={this.state.error} />+ <div className="ui form">+ <div className="fluid field">+ <input+ id="tenantName"+ type="text"+ placeholder="your company or product name"+ maxLength={60}+ onChange={(e) => this.setState({ tenantName: e.currentTarget.value })}+ />+ </div>+ {+ !this.session.isSingleHostMode() && <div className="fluid field">+ <div className="ui right labeled input">+ <input+ id="subdomain"+ type="text"+ maxLength={40}+ placeholder="subdomain"+ onChange={(e) => this.checkAvailability(e.currentTarget.value)}+ />+ <div className="ui label">{this.settings.domain}</div>+ {+ this.state.subdomain.available &&+ <div className="ui left pointing green basic label">+ Great!+ </div>+ }+ {+ this.state.subdomain.message &&+ <div className="ui left pointing red basic label">+ {this.state.subdomain.message}+ </div>+ }</div>- <div className="ui section divider"></div>+ </div>+ }+ </div>+ <div className="ui section divider" />- <h3 className="ui header">3. Review and continue</h3>+ <h3 className="ui header">3. Review and continue</h3>- <p>Make sure information provided above is correct before proceeding.</p>+ <p>Make sure information provided above is correct before proceeding.</p>- <Button className="positive" size="large" onClick={() => this.confirm()}>Confirm</Button>- </div>- <Footer />- </div>;+ <Button className="positive" size="large" onClick={() => this.confirm()}>Confirm</Button>+ </div>+ <Footer />+ </div>+ );}}diff --git a/public/pages/site/CompleteSignInProfilePage.tsx b/public/pages/site/CompleteSignInProfilePage.tsxindex c39fdde34..cee5cf3a1 100644--- a/public/pages/site/CompleteSignInProfilePage.tsx+++ b/public/pages/site/CompleteSignInProfilePage.tsx@@ -40,31 +40,36 @@ export class CompleteSignInProfilePage extends React.Component<{}, CompleteSignI}public render() {- const modal = <div id="signin-complete-modal" className="ui modal small">- <div className="header">- Complete your profile- </div>- <div className="content">- <p>Because this is your first sign in, please input your display name.</p>- <Form ref={(f) => { this.form = f!; } } onSubmit={() => this.submit() }>- <div className="ui small action fluid input">- <input- onChange={(e) => this.setState({ name: e.currentTarget.value }) }- type="text"- maxLength={100}- placeholder="Your display name"- className="small" />- <button onClick={ () => this.form.submit() } className={`ui small positive button ${this.state.name === '' && 'disabled'}`}>- Submit- </button>- </div>- </Form>- </div>- </div>;+ const modal = (+ <div id="signin-complete-modal" className="ui modal small">+ <div className="header">+ Complete your profile+ </div>+ <div className="content">+ <p>Because this is your first sign in, please input your display name.</p>+ <Form ref={(f) => { this.form = f!; }} onSubmit={() => this.submit()}>+ <div className="ui small action fluid input">+ <input+ onChange={(e) => this.setState({ name: e.currentTarget.value })}+ type="text"+ maxLength={100}+ placeholder="Your display name"+ className="small"+ />+ <button onClick={() => this.form.submit()} className={`ui small positive button ${this.state.name === '' && 'disabled'}`}>+ Submit+ </button>+ </div>+ </Form>+ </div>+ </div>+ );- return <div>- { modal }- <SiteHomePage />- </div>;+ return (+ <div>+ {modal}+ <SiteHomePage />+ </div>+ );}}diff --git a/public/pages/site/ShowIdeaPage.tsx b/public/pages/site/ShowIdeaPage.tsxindex 17d2d06a5..2a9a3de02 100644--- a/public/pages/site/ShowIdeaPage.tsx+++ b/public/pages/site/ShowIdeaPage.tsx@@ -23,155 +23,158 @@ interface ShowIdeaPageState {}export class ShowIdeaPage extends React.Component<{}, ShowIdeaPageState> {- private user?: CurrentUser;- private idea: Idea;- private comments: Comment[];-- @inject(injectables.Session)- public session: Session;-- @inject(injectables.IdeaService)- public ideaService: IdeaService;-- constructor(props: {}) {- super(props);-- this.user = this.session.getCurrentUser();- this.idea = this.session.get<Idea>('idea');- this.comments = this.session.getArray<Comment>('comments');-- this.state = {- editMode: false,- newTitle: this.idea.title,- newDescription: this.idea.description- };-- setTitle(`${this.idea.title} · ${document.title}`);+ private user?: CurrentUser;+ private idea: Idea;+ private comments: Comment[];++ @inject(injectables.Session)+ public session: Session;++ @inject(injectables.IdeaService)+ public ideaService: IdeaService;++ constructor(props: {}) {+ super(props);++ this.user = this.session.getCurrentUser();+ this.idea = this.session.get<Idea>('idea');+ this.comments = this.session.getArray<Comment>('comments');++ this.state = {+ editMode: false,+ newTitle: this.idea.title,+ newDescription: this.idea.description+ };++ setTitle(`${this.idea.title} · ${document.title}`);+ }++ private async saveChanges() {+ const result = await this.ideaService.updateIdea(this.idea.number, this.state.newTitle, this.state.newDescription);+ if (result.ok) {+ this.setState({+ error: undefined,+ editMode: false+ });+ this.idea.title = this.state.newTitle;+ this.idea.description = this.state.newDescription;+ this.forceUpdate();+ } else {+ this.setState({+ error: result.error+ });}+ }- private async saveChanges() {- const result = await this.ideaService.updateIdea(this.idea.number, this.state.newTitle, this.state.newDescription);- if (result.ok) {- this.setState({- error: undefined,- editMode: false- });- this.idea.title = this.state.newTitle;- this.idea.description = this.state.newDescription;- this.forceUpdate();- } else {- this.setState({- error: result.error- });- }- }+ public render() {- public render() {-- const commentsList = this.comments.map((c) =>- <div key={c.id} className="comment">- <Gravatar user={ c.user } />- <div className="content">- <UserName user={c.user} />- <div className="metadata">- · <Moment date={c.createdOn} />- </div>- <div className="text">- <MultiLineText text={ c.content } style="simple" />- </div>+ const commentsList = this.comments.map((c) => (+ <div key={c.id} className="comment">+ <Gravatar user={c.user} />+ <div className="content">+ <UserName user={c.user} />+ <div className="metadata">+ · <Moment date={c.createdOn} />+ </div>+ <div className="text">+ <MultiLineText text={c.content} style="simple" /></div></div>- );-- return <div>- <Header />- <div className="page ui container">- <div className="ui stackable grid container">- <div className="thirteen wide column">- <div className="ui items unstackable">- <div className="item">- <SupportCounter user={this.user} idea={this.idea} />-- <div className="idea-header">- { this.state.editMode- ? [- <div key={1} className="ui input huge fluid">- <input type="text" onChange={(e) => this.setState({ newTitle: e.currentTarget.value }) } defaultValue={ this.state.newTitle } />- </div>,- <DisplayError key={0} fields={['title']} pointing="above" error={this.state.error} />- ]- : <h1 className="ui header">{ this.idea.title }</h1>- }-- <span className="info">- Shared <Moment date={this.idea.createdOn} /> by <Gravatar user={ this.idea.user } /> <UserName user={this.idea.user} />- </span>- </div>- </div>- </div>-- <span className="subtitle">Description</span>- {- this.state.editMode- ? <div className="ui form">- <div className="field">- <DisplayError fields={['description']} error={this.state.error} />- <Textarea onChange={(e) => this.setState({ newDescription: e.currentTarget.value }) } defaultValue={ this.state.newDescription } />- </div>- </div>- : this.idea.description- ? <MultiLineText className="description" text={ this.idea.description } style="simple" />- : <p className="description">This idea doesn't have a description.</p>- }-- <ShowIdeaResponse status={ this.idea.status } response={ this.idea.response } />+ </div>+ ));++ return (+ <div>+ <Header />+ <div className="page ui container">+ <div className="ui stackable grid container">+ <div className="thirteen wide column">+ <div className="ui items unstackable">+ <div className="item">+ <SupportCounter user={this.user} idea={this.idea} />++ <div className="idea-header">+ { this.state.editMode+ ? [+ <div key={1} className="ui input huge fluid">+ <input type="text" onChange={(e) => this.setState({ newTitle: e.currentTarget.value })} defaultValue={this.state.newTitle} />+ </div>,+ <DisplayError key={0} fields={['title']} pointing="above" error={this.state.error} />+ ]+ : <h1 className="ui header">{this.idea.title}</h1>+ }+ <span className="info">+ Shared <Moment date={this.idea.createdOn} /> by <Gravatar user={this.idea.user} /> <UserName user={this.idea.user} />+ </span>+ </div>+ </div>+ </div>++ <span className="subtitle">Description</span>+ {+ this.state.editMode+ ? <div className="ui form">+ <div className="field">+ <DisplayError fields={['description']} error={this.state.error} />+ <Textarea onChange={(e) => this.setState({ newDescription: e.currentTarget.value })} defaultValue={this.state.newDescription} /></div>+ </div>+ : this.idea.description+ ? <MultiLineText className="description" text={this.idea.description} style="simple" />+ : <p className="description">This idea doesn't have a description.</p>+ }- {- this.session.isCollaborator() &&- <div className="three wide column">- <span className="subtitle">Actions</span>- { this.state.editMode && <div className="ui list">- <div className="item">- <Button className="positive icon fluid text-left" onClick={async () => this.saveChanges() }>- <i className="save icon"></i> Save- </Button>- </div>- <div className="item">- <Button className="icon fluid text-left" onClick={async () => this.setState({ error: undefined, editMode: false }) }>- <i className="cancel icon"></i> Cancel- </Button>- </div>- </div>- }-- { !this.state.editMode && <div className="ui list">- <div className="item">- <Button className="icon fluid text-left" onClick={async () => this.setState({ editMode: true }) }>- <i className="edit icon"></i> Edit- </Button>- </div>- <div className="item">- <ResponseForm idea={ this.idea } />- </div>- </div>- }- </div>- }+ <ShowIdeaResponse status={this.idea.status} response={this.idea.response} />+ </div>- <div className="sixteen wide column">- <div className="ui comments">- <span className="subtitle">Discussion</span>- { commentsList }- <CommentInput idea={this.idea} />- </div>+ {+ this.session.isCollaborator() &&+ <div className="three wide column">+ <span className="subtitle">Actions</span>+ { this.state.editMode && <div className="ui list">+ <div className="item">+ <Button className="positive icon fluid text-left" onClick={async () => this.saveChanges()}>+ <i className="save icon" /> Save+ </Button>+ </div>+ <div className="item">+ <Button className="icon fluid text-left" onClick={async () => this.setState({ error: undefined, editMode: false })}>+ <i className="cancel icon" /> Cancel+ </Button></div></div>-+ }++ {+ !this.state.editMode &&+ <div className="ui list">+ <div className="item">+ <Button className="icon fluid text-left" onClick={async () => this.setState({ editMode: true })}>+ <i className="edit icon" /> Edit+ </Button>+ </div>+ <div className="item">+ <ResponseForm idea={this.idea} />+ </div>+ </div>+ }+ </div>+ }++ <div className="sixteen wide column">+ <div className="ui comments">+ <span className="subtitle">Discussion</span>+ {commentsList}+ <CommentInput idea={this.idea} /></div>- <Footer />- </div>;+ </div>+ </div>++ </div>+ <Footer />+ </div>+ );}}diff --git a/public/pages/site/SiteHomePage.tsx b/public/pages/site/SiteHomePage.tsxindex 37ecaae4e..632035b69 100644--- a/public/pages/site/SiteHomePage.tsx+++ b/public/pages/site/SiteHomePage.tsx@@ -23,26 +23,33 @@ interface SiteHomePageState {}const EmptyList = () => {- return <div className="center">- <p><i className="icon lightbulb" aria-hidden="true"></i></p>- <p>It's lonely out here. Start by sharing an idea!</p>- </div>;+ return (+ <div className="center">+ <p><i className="icon lightbulb" aria-hidden="true" /></p>+ <p>It's lonely out here. Start by sharing an idea!</p>+ </div>+ );};const ListIdeaItem = (props: { idea: Idea, user?: CurrentUser }) => {- return <div className="item">- <SupportCounter user={props.user} idea={props.idea} />- <div className="content">- { props.idea.totalComments > 0 && <div className="info right">- { props.idea.totalComments } <i className="comments outline icon"/>- </div> }- <a className="title" href={`/ideas/${props.idea.number}/${props.idea.slug}`}>- { props.idea.title }- </a>- <MultiLineText className="description" text={ props.idea.description } style="simple" />- <ShowIdeaResponse status={ props.idea.status } response={ props.idea.response } />- </div>- </div>;+ return (+ <div className="item">+ <SupportCounter user={props.user} idea={props.idea} />+ <div className="content">+ {+ props.idea.totalComments > 0 &&+ <div className="info right">+ {props.idea.totalComments} <i className="comments outline icon"/>+ </div>+ }+ <a className="title" href={`/ideas/${props.idea.number}/${props.idea.slug}`}>+ {props.idea.title}+ </a>+ <MultiLineText className="description" text={props.idea.description} style="simple" />+ <ShowIdeaResponse status={props.idea.status} response={props.idea.response} />+ </div>+ </div>+ );};export class SiteHomePage extends React.Component<{}, SiteHomePageState> {@@ -115,7 +122,7 @@ export class SiteHomePage extends React.Component<{}, SiteHomePageState> {});}- private showMore(event: React.SyntheticEvent<TouchEvent>): void {+ private showMore(event: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>): void {event.preventDefault();this.setState({showCount: this.state.showCount + defaultShowCount@@ -137,73 +144,79 @@ export class SiteHomePage extends React.Component<{}, SiteHomePageState> {});}- public render() {- const ideasToList = this.state.ideas.slice(0, this.state.showCount);-- const displayIdeas = (ideasToList.length > 0) ?- <div className="ui divided unstackable items fdr-idea-list">- { ideasToList.map((x) => <ListIdeaItem key={x.id} user={this.user} idea={x} />) }- {- this.state.ideas.length > this.state.showCount &&- <h5 className="ui blue header show-more"- onTouchEnd={ this.showMore.bind(this) }- onClick={ this.showMore.bind(this) }>- View { this.state.ideas.length - this.state.showCount } more ideas- </h5>- }- </div>- : <p className="no-ideas-found">No ideas found for given filter.</p>;-- const welcomeMessage = this.tenant.welcomeMessage ||- `## Welcome to our feedback forum!+ public render() {+ const ideasToList = this.state.ideas.slice(0, this.state.showCount);++ const displayIdeas = (ideasToList.length > 0)+ ? (+ <div className="ui divided unstackable items fdr-idea-list">+ {ideasToList.map((x) => <ListIdeaItem key={x.id} user={this.user} idea={x} />)}+ {+ this.state.ideas.length > this.state.showCount &&+ <h5+ className="ui blue header show-more"+ onTouchEnd={(e) => this.showMore(e)}+ onClick={(e) => this.showMore(e)}+ >+ View {this.state.ideas.length - this.state.showCount} more ideas+ </h5>+ }+ </div>+ )+ : <p className="no-ideas-found">No ideas found for given filter.</p>;++ const welcomeMessage = this.tenant.welcomeMessage ||+ `## Welcome to our feedback forum!We'd love to hear what you're thinking about. What can we do better? This is the place for you to vote, discuss and share ideas.`;- return <div>- <Header />- <div className="page ui container">+ return (+ <div>+ <Header />+ <div className="page ui container">- <div className="ui grid stackable">- <div className="six wide column">- <MultiLineText className="welcome-message" text={ welcomeMessage } style="full" />- <IdeaInput placeholder={this.tenant.invitation || 'I suggest you...'} />- </div>- <div className="ten wide column">- {- this.allIdeas.length === 0- ? <EmptyList />- : <div>- <div className="ui grid">- { !this.state.searching && <div className="ten wide mobile ten wide tablet twelve wide computer column filter-column">- <IdeaFilter activeFilter={ this.state.activeFilter } filterChanged={ this.filterChanged.bind(this) } />- </div> }- <div className={ !this.state.searching ? `six wide mobile six wide tablet four wide computer column` : 'column' }>- <div className="ui search">- <div className="ui icon fluid input">- <input- onFocus={ () => this.setState({ searching: true }) }- onBlur={ (x) => this.setState({ searching: !!this.state.search }) }- onChange={ (x) => this.searchIdea(x.currentTarget.value) }- value={ this.state.search }- type="text"- placeholder="Search..." />- {- this.state.searching- ? <i onClick={ () => this.resetSearch() } className="cancel link icon"></i>- : <i className="search icon"></i>- }- </div>- </div>- </div>- </div>- { displayIdeas }- </div>- }+ <div className="ui grid stackable">+ <div className="six wide column">+ <MultiLineText className="welcome-message" text={welcomeMessage} style="full" />+ <IdeaInput placeholder={this.tenant.invitation || 'I suggest you...'} />+ </div>+ <div className="ten wide column">+ {+ this.allIdeas.length === 0+ ? <EmptyList />+ : <div>+ <div className="ui grid">+ { !this.state.searching && <div className="ten wide mobile ten wide tablet twelve wide computer column filter-column">+ <IdeaFilter activeFilter={this.state.activeFilter} filterChanged={(name) => this.filterChanged(name)} />+ </div> }+ <div className={!this.state.searching ? `six wide mobile six wide tablet four wide computer column` : 'column'}>+ <div className="ui search">+ <div className="ui icon fluid input">+ <input+ onFocus={() => this.setState({ searching: true })}+ onBlur={(x) => this.setState({ searching: !!this.state.search })}+ onChange={(x) => this.searchIdea(x.currentTarget.value)}+ value={this.state.search}+ type="text"+ placeholder="Search..."+ />+ {+ this.state.searching+ ? <i onClick={() => this.resetSearch()} className="cancel link icon" />+ : <i className="search icon" />+ }+ </div>+ </div></div></div>-+ {displayIdeas}</div>- <Footer />- </div>;- }+ }+ </div>+ </div>+ </div>+ <Footer />+ </div>+ );+ }}diff --git a/public/pages/site/UserSettingsPage.tsx b/public/pages/site/UserSettingsPage.tsxindex d132af99b..aeb0cf892 100644--- a/public/pages/site/UserSettingsPage.tsx+++ b/public/pages/site/UserSettingsPage.tsx@@ -38,58 +38,63 @@ export class UserSettingsPage extends React.Component<{}, UserSettingsPageState>}public render() {- return <div>- <Header />- <div className="page ui container">- <h2 className="ui header">- <i className="circular id badge icon"></i>- <div className="content">- Settings- <div className="sub header">Manage your profile settings</div>- </div>- </h2>+ return (+ <div>+ <Header />+ <div className="page ui container">+ <h2 className="ui header">+ <i className="circular id badge icon" />+ <div className="content">+ Settings+ <div className="sub header">Manage your profile settings</div>+ </div>+ </h2>- <div className="ui grid">- <div className="eight wide computer sixteen wide mobile column">- <div className="ui form">- <div className="field">- <label htmlFor="email">Avatar</label>- <p><Gravatar user={ this.user } /></p>- <div className="info">- <p>- This site uses <a href="https://en.gravatar.com/" target="blank">Gravatar</a> to display profile avatars. <br/>- A letter avatar based on your name is generated for profiles without a Gravatar.- </p>- </div>- </div>- <div className="field">- <label htmlFor="email">E-mail</label>- <p><b>{ this.user.email }</b></p>- <div className="info">- {- this.user.email ? <p>Your e-mail is private and will never be displayed to anyone.</p>- : <p>Your account doesn't have an e-mail.</p>- }- </div>- </div>- <DisplayError fields={['name']} error={this.state.error} />- <div className="field">- <label htmlFor="name">Name</label>- <input id="name"- type="text"- maxLength={100}- value={ this.state.name }- onChange={(e) => this.setState({ name: e.currentTarget.value })}/>- </div>- <div className="field">- <Button className="positive" size="tiny" onClick={async () => await this.confirm()}>Confirm</Button>- </div>+ <div className="ui grid">+ <div className="eight wide computer sixteen wide mobile column">+ <div className="ui form">+ <div className="field">+ <label htmlFor="email">Avatar</label>+ <p><Gravatar user={this.user} /></p>+ <div className="info">+ <p>+ This site uses <a href="https://en.gravatar.com/" target="blank">Gravatar</a> to display profile avatars. <br/>+ A letter avatar based on your name is generated for profiles without a Gravatar.+ </p></div>- </div></div>-+ <div className="field">+ <label htmlFor="email">E-mail</label>+ <p><b>{this.user.email}</b></p>+ <div className="info">+ {+ this.user.email+ ? <p>Your e-mail is private and will never be displayed to anyone.</p>+ : <p>Your account doesn't have an e-mail.</p>+ }+ </div>+ </div>+ <DisplayError fields={['name']} error={this.state.error} />+ <div className="field">+ <label htmlFor="name">Name</label>+ <input+ id="name"+ type="text"+ maxLength={100}+ value={this.state.name}+ onChange={(e) => this.setState({ name: e.currentTarget.value })}+ />+ </div>+ <div className="field">+ <Button className="positive" size="tiny" onClick={async () => await this.confirm()}>Confirm</Button>+ </div></div>- <Footer />- </div>;+ </div>+ </div>++ </div>+ <Footer />+ </div>+ );}}diff --git a/tslint.json b/tslint.jsonindex 09b91193f..3e99d64b3 100644--- a/tslint.json+++ b/tslint.json@@ -1,12 +1,12 @@{- "extends": "tslint:recommended",+ "extends": [ "tslint:recommended", "tslint-react"],"rules": {"object-literal-sort-keys": false,"trailing-comma": [false],"indent": [- true, "spaces", 4+ true, "spaces", 2],"interface-name": [false@@ -26,6 +26,8 @@],"max-classes-per-file": [false- ]+ ],+ "jsx-no-lambda": false,+ "jsx-no-multiline-js": false}}\ No newline at end of file