mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 19:31:26 +00:00
Merge branch 'main' into refactor-server-tidy
This commit is contained in:
commit
90bad6d077
3 changed files with 65 additions and 51 deletions
|
@ -184,53 +184,6 @@ export class MarkdownTextArea extends Component<
|
|||
</div>
|
||||
<div className="row">
|
||||
<div className="col-sm-12 d-flex flex-wrap">
|
||||
{this.props.buttonTitle && (
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
disabled={this.isDisabled}
|
||||
>
|
||||
{this.state.loading ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<span>{this.props.buttonTitle}</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{this.props.replyType && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
onClick={linkEvent(this, this.handleReplyCancel)}
|
||||
>
|
||||
{i18n.t("cancel")}
|
||||
</button>
|
||||
)}
|
||||
{this.state.content && (
|
||||
<button
|
||||
className={`btn btn-sm btn-secondary mr-2 ${
|
||||
this.state.previewMode && "active"
|
||||
}`}
|
||||
onClick={linkEvent(this, this.handlePreviewToggle)}
|
||||
>
|
||||
{this.state.previewMode ? i18n.t("edit") : i18n.t("preview")}
|
||||
</button>
|
||||
)}
|
||||
{/* A flex expander */}
|
||||
<div className="flex-grow-1"></div>
|
||||
|
||||
{this.props.showLanguage && (
|
||||
<LanguageSelect
|
||||
iconVersion
|
||||
allLanguages={this.props.allLanguages}
|
||||
selectedLanguageIds={
|
||||
languageId ? Array.of(languageId) : undefined
|
||||
}
|
||||
siteLanguages={this.props.siteLanguages}
|
||||
onChange={this.handleLanguageChange}
|
||||
disabled={this.isDisabled}
|
||||
/>
|
||||
)}
|
||||
{this.getFormatButton("bold", this.handleInsertBold)}
|
||||
{this.getFormatButton("italic", this.handleInsertItalic)}
|
||||
{this.getFormatButton("link", this.handleInsertLink)}
|
||||
|
@ -283,6 +236,57 @@ export class MarkdownTextArea extends Component<
|
|||
<Icon icon="help-circle" classes="icon-inline" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="col-sm-12 d-flex align-items-center flex-wrap">
|
||||
{this.props.showLanguage && (
|
||||
<LanguageSelect
|
||||
iconVersion
|
||||
allLanguages={this.props.allLanguages}
|
||||
selectedLanguageIds={
|
||||
languageId ? Array.of(languageId) : undefined
|
||||
}
|
||||
siteLanguages={this.props.siteLanguages}
|
||||
onChange={this.handleLanguageChange}
|
||||
disabled={this.isDisabled}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* A flex expander */}
|
||||
<div className="flex-grow-1"></div>
|
||||
|
||||
{this.props.buttonTitle && (
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
disabled={this.isDisabled}
|
||||
>
|
||||
{this.state.loading ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<span>{this.props.buttonTitle}</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{this.props.replyType && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
onClick={linkEvent(this, this.handleReplyCancel)}
|
||||
>
|
||||
{i18n.t("cancel")}
|
||||
</button>
|
||||
)}
|
||||
{this.state.content && (
|
||||
<button
|
||||
className={`btn btn-sm btn-secondary mr-2 ${
|
||||
this.state.previewMode && "active"
|
||||
}`}
|
||||
onClick={linkEvent(this, this.handlePreviewToggle)}
|
||||
>
|
||||
{this.state.previewMode ? i18n.t("edit") : i18n.t("preview")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, InfernoNode, linkEvent } from "inferno";
|
||||
import { T } from "inferno-i18next-dess";
|
||||
import { Link } from "inferno-router";
|
||||
import {
|
||||
AddModToCommunity,
|
||||
|
@ -144,10 +145,15 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
|||
{myUSerInfo && this.blockCommunity()}
|
||||
{!myUSerInfo && (
|
||||
<div className="alert alert-info" role="alert">
|
||||
{i18n.t("community_not_logged_in_alert", {
|
||||
<T
|
||||
i18nKey="community_not_logged_in_alert"
|
||||
interpolation={{
|
||||
community: name,
|
||||
instance: hostname(actor_id),
|
||||
})}
|
||||
}}
|
||||
>
|
||||
#<code className="user-select-all">#</code>#
|
||||
</T>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -224,6 +224,10 @@ export class CreatePost extends Component<
|
|||
if (res.state === "success") {
|
||||
const postId = res.data.post_view.post.id;
|
||||
this.props.history.replace(`/post/${postId}`);
|
||||
} else {
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue