mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-30 00:01:15 +00:00
fix: Fix some more private message form stuff
This commit is contained in:
parent
b231fd1e5b
commit
7145e0be27
3 changed files with 33 additions and 17 deletions
|
@ -23,15 +23,27 @@ import NavigationPrompt from "./navigation-prompt";
|
|||
import ProgressBar from "./progress-bar";
|
||||
|
||||
interface MarkdownTextAreaProps {
|
||||
/**
|
||||
* Initial content inside the textarea
|
||||
*/
|
||||
initialContent?: string;
|
||||
/**
|
||||
* Numerical ID of the language to select in dropdown
|
||||
*/
|
||||
initialLanguageId?: number;
|
||||
placeholder?: string;
|
||||
buttonTitle?: string;
|
||||
maxLength?: number;
|
||||
/**
|
||||
* Whether this form is for a reply to a Private Message
|
||||
*/
|
||||
replyType?: boolean;
|
||||
focus?: boolean;
|
||||
disabled?: boolean;
|
||||
finished?: boolean;
|
||||
/**
|
||||
* Whether to show the language selector
|
||||
*/
|
||||
showLanguage?: boolean;
|
||||
hideNavigationWarnings?: boolean;
|
||||
onContentChange?(val: string): void;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { myAuthRequired } from "@utils/app";
|
||||
import { capitalizeFirstLetter } from "@utils/helpers";
|
||||
import { Component, InfernoNode, linkEvent } from "inferno";
|
||||
import { Component, InfernoNode } from "inferno";
|
||||
import { T } from "inferno-i18next-dess";
|
||||
import {
|
||||
CreatePrivateMessage,
|
||||
|
@ -19,6 +19,7 @@ import { PersonListing } from "../person/person-listing";
|
|||
interface PrivateMessageFormProps {
|
||||
recipient: Person;
|
||||
privateMessageView?: PrivateMessageView; // If a pm is given, that means this is an edit
|
||||
replyType?: boolean;
|
||||
onCancel?(): any;
|
||||
onCreate?(form: CreatePrivateMessage): void;
|
||||
onEdit?(form: EditPrivateMessage): void;
|
||||
|
@ -113,6 +114,8 @@ export class PrivateMessageForm extends Component<
|
|||
allLanguages={[]}
|
||||
siteLanguages={[]}
|
||||
hideNavigationWarnings
|
||||
onReplyCancel={() => handleCancel()}
|
||||
replyType={this.props.replyType}
|
||||
buttonTitle={
|
||||
this.props.privateMessageView
|
||||
? capitalizeFirstLetter(I18NextService.i18n.t("save"))
|
||||
|
@ -121,18 +124,6 @@ export class PrivateMessageForm extends Component<
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mb-3 d-flex justify-content-end">
|
||||
{this.props.privateMessageView && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary w-auto"
|
||||
onClick={linkEvent(this, this.handleCancel)}
|
||||
>
|
||||
{I18NextService.i18n.t("cancel")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ export class PrivateMessage extends Component<
|
|||
<>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleMarkRead)}
|
||||
data-tippy-content={
|
||||
|
@ -174,6 +175,7 @@ export class PrivateMessage extends Component<
|
|||
<li className="list-inline-item">{this.reportButton}</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleReplyClick)}
|
||||
data-tippy-content={I18NextService.i18n.t("reply")}
|
||||
|
@ -188,6 +190,7 @@ export class PrivateMessage extends Component<
|
|||
<>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleEditClick)}
|
||||
data-tippy-content={I18NextService.i18n.t("edit")}
|
||||
|
@ -198,6 +201,7 @@ export class PrivateMessage extends Component<
|
|||
</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleDeleteClick)}
|
||||
data-tippy-content={
|
||||
|
@ -228,6 +232,7 @@ export class PrivateMessage extends Component<
|
|||
)}
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleViewSource)}
|
||||
data-tippy-content={I18NextService.i18n.t("view_source")}
|
||||
|
@ -276,10 +281,17 @@ export class PrivateMessage extends Component<
|
|||
</form>
|
||||
)}
|
||||
{this.state.showReply && (
|
||||
<div className="row">
|
||||
<div className="col-sm-6">
|
||||
<PrivateMessageForm
|
||||
privateMessageView={message_view}
|
||||
replyType={true}
|
||||
recipient={otherPerson}
|
||||
onCreate={this.props.onCreate}
|
||||
onCancel={this.handleReplyCancel}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{/* A collapsed clearfix */}
|
||||
{this.state.collapsed && <div className="row col-12"></div>}
|
||||
|
@ -290,6 +302,7 @@ export class PrivateMessage extends Component<
|
|||
get reportButton() {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link btn-animate text-muted py-0"
|
||||
onClick={linkEvent(this, this.handleShowReportDialog)}
|
||||
data-tippy-content={I18NextService.i18n.t("show_report_dialog")}
|
||||
|
|
Loading…
Reference in a new issue