* Removing monads. Fixes #884 * Fixing post fetching. * Dont show not_logged_in error for navbar. * Adding the lemmy-js-client RC. * Fixing registration application mode
This commit is contained in:
parent
37c200571b
commit
b64f47cfe9
66 changed files with 5186 additions and 6250 deletions
|
@ -1,4 +1,3 @@
|
|||
import { Option } from "@sniptt/monads";
|
||||
import { Component, linkEvent } from "inferno";
|
||||
import { pictrsUri } from "../../env";
|
||||
import { i18n } from "../../i18next";
|
||||
|
@ -8,7 +7,7 @@ import { Icon } from "./icon";
|
|||
|
||||
interface ImageUploadFormProps {
|
||||
uploadTitle: string;
|
||||
imageSrc: Option<string>;
|
||||
imageSrc?: string;
|
||||
onUpload(url: string): any;
|
||||
onRemove(): any;
|
||||
rounded?: boolean;
|
||||
|
@ -39,31 +38,26 @@ export class ImageUploadForm extends Component<
|
|||
htmlFor={this.id}
|
||||
className="pointer text-muted small font-weight-bold"
|
||||
>
|
||||
{this.props.imageSrc.match({
|
||||
some: imageSrc => (
|
||||
<span className="d-inline-block position-relative">
|
||||
<img
|
||||
src={imageSrc}
|
||||
height={this.props.rounded ? 60 : ""}
|
||||
width={this.props.rounded ? 60 : ""}
|
||||
className={`img-fluid ${
|
||||
this.props.rounded ? "rounded-circle" : ""
|
||||
}`}
|
||||
/>
|
||||
<a
|
||||
onClick={linkEvent(this, this.handleRemoveImage)}
|
||||
aria-label={i18n.t("remove")}
|
||||
>
|
||||
<Icon icon="x" classes="mini-overlay" />
|
||||
</a>
|
||||
</span>
|
||||
),
|
||||
none: (
|
||||
<span className="btn btn-secondary">
|
||||
{this.props.uploadTitle}
|
||||
</span>
|
||||
),
|
||||
})}
|
||||
{this.props.imageSrc ? (
|
||||
<span className="d-inline-block position-relative">
|
||||
<img
|
||||
src={this.props.imageSrc}
|
||||
height={this.props.rounded ? 60 : ""}
|
||||
width={this.props.rounded ? 60 : ""}
|
||||
className={`img-fluid ${
|
||||
this.props.rounded ? "rounded-circle" : ""
|
||||
}`}
|
||||
/>
|
||||
<a
|
||||
onClick={linkEvent(this, this.handleRemoveImage)}
|
||||
aria-label={i18n.t("remove")}
|
||||
>
|
||||
<Icon icon="x" classes="mini-overlay" />
|
||||
</a>
|
||||
</span>
|
||||
) : (
|
||||
<span className="btn btn-secondary">{this.props.uploadTitle}</span>
|
||||
)}
|
||||
</label>
|
||||
<input
|
||||
id={this.id}
|
||||
|
@ -71,7 +65,7 @@ export class ImageUploadForm extends Component<
|
|||
accept="image/*,video/*"
|
||||
name={this.id}
|
||||
className="d-none"
|
||||
disabled={UserService.Instance.myUserInfo.isNone()}
|
||||
disabled={!UserService.Instance.myUserInfo}
|
||||
onChange={linkEvent(this, this.handleImageUpload)}
|
||||
/>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue