mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
Merge branch 'main' into nicer-error-hnadling
This commit is contained in:
commit
d944140a76
7 changed files with 500 additions and 1276 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 007e53683768aeba63e9e4c179c1d240217bcee2
|
Subproject commit a1fff8b481f4b02327e4ee04088606af627628f2
|
|
@ -60,7 +60,7 @@
|
||||||
"inferno-server": "^8.1.1",
|
"inferno-server": "^8.1.1",
|
||||||
"isomorphic-cookie": "^1.2.4",
|
"isomorphic-cookie": "^1.2.4",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
"lemmy-js-client": "0.17.2-rc.14",
|
"lemmy-js-client": "0.17.2-rc.15",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.1",
|
||||||
"markdown-it-container": "^3.0.0",
|
"markdown-it-container": "^3.0.0",
|
||||||
"markdown-it-emoji": "^2.0.2",
|
"markdown-it-emoji": "^2.0.2",
|
||||||
|
@ -111,12 +111,12 @@
|
||||||
"prettier-plugin-organize-imports": "^3.2.2",
|
"prettier-plugin-organize-imports": "^3.2.2",
|
||||||
"prettier-plugin-packagejson": "^2.4.3",
|
"prettier-plugin-packagejson": "^2.4.3",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
|
"service-worker-webpack": "^1.0.0",
|
||||||
"sortpack": "^2.3.4",
|
"sortpack": "^2.3.4",
|
||||||
"style-loader": "^3.3.2",
|
"style-loader": "^3.3.2",
|
||||||
"terser": "^5.17.3",
|
"terser": "^5.17.3",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.0.4",
|
||||||
"webpack-dev-server": "4.15.0",
|
"webpack-dev-server": "4.15.0"
|
||||||
"service-worker-webpack": "^1.0.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.9.0"
|
"node": ">=8.9.0"
|
||||||
|
|
|
@ -17,7 +17,6 @@ import { UserService, WebSocketService } from "../../services";
|
||||||
import {
|
import {
|
||||||
capitalizeFirstLetter,
|
capitalizeFirstLetter,
|
||||||
myAuth,
|
myAuth,
|
||||||
myFirstDiscussionLanguageId,
|
|
||||||
wsClient,
|
wsClient,
|
||||||
wsSubscribe,
|
wsSubscribe,
|
||||||
} from "../../utils";
|
} from "../../utils";
|
||||||
|
@ -77,21 +76,11 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
|
||||||
: undefined
|
: undefined
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
let selectedLang =
|
|
||||||
typeof this.props.node !== "number"
|
|
||||||
? this.props.node.comment_view.comment.language_id
|
|
||||||
: myFirstDiscussionLanguageId(
|
|
||||||
this.props.allLanguages,
|
|
||||||
this.props.siteLanguages,
|
|
||||||
UserService.Instance.myUserInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
{UserService.Instance.myUserInfo ? (
|
{UserService.Instance.myUserInfo ? (
|
||||||
<MarkdownTextArea
|
<MarkdownTextArea
|
||||||
initialContent={initialContent}
|
initialContent={initialContent}
|
||||||
initialLanguageId={selectedLang}
|
|
||||||
showLanguage
|
showLanguage
|
||||||
buttonTitle={this.state.buttonTitle}
|
buttonTitle={this.state.buttonTitle}
|
||||||
finished={this.state.finished}
|
finished={this.state.finished}
|
||||||
|
|
|
@ -111,6 +111,11 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
|
||||||
multiple={this.props.multiple}
|
multiple={this.props.multiple}
|
||||||
disabled={this.props.disabled}
|
disabled={this.props.disabled}
|
||||||
>
|
>
|
||||||
|
{!this.props.multiple && (
|
||||||
|
<option selected disabled hidden>
|
||||||
|
{i18n.t("language_select_placeholder")}
|
||||||
|
</option>
|
||||||
|
)}
|
||||||
{filteredLangs.map(l => (
|
{filteredLangs.map(l => (
|
||||||
<option
|
<option
|
||||||
key={l.id}
|
key={l.id}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import {
|
||||||
ghostArchiveUrl,
|
ghostArchiveUrl,
|
||||||
isImage,
|
isImage,
|
||||||
myAuth,
|
myAuth,
|
||||||
myFirstDiscussionLanguageId,
|
|
||||||
pictrsDeleteToast,
|
pictrsDeleteToast,
|
||||||
relTags,
|
relTags,
|
||||||
setupTippy,
|
setupTippy,
|
||||||
|
@ -187,13 +186,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let firstLang =
|
let firstLang = this.state.form.language_id;
|
||||||
this.state.form.language_id ??
|
|
||||||
myFirstDiscussionLanguageId(
|
|
||||||
this.props.allLanguages,
|
|
||||||
this.props.siteLanguages,
|
|
||||||
UserService.Instance.myUserInfo
|
|
||||||
);
|
|
||||||
let selectedLangs = firstLang ? Array.of(firstLang) : undefined;
|
let selectedLangs = firstLang ? Array.of(firstLang) : undefined;
|
||||||
|
|
||||||
let url = this.state.form.url;
|
let url = this.state.form.url;
|
||||||
|
|
|
@ -1459,20 +1459,6 @@ export function postToCommentSortType(sort: SortType): CommentSortType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function myFirstDiscussionLanguageId(
|
|
||||||
allLanguages: Language[],
|
|
||||||
siteLanguages: number[],
|
|
||||||
myUserInfo = UserService.Instance.myUserInfo
|
|
||||||
): number | undefined {
|
|
||||||
return selectableLanguages(
|
|
||||||
allLanguages,
|
|
||||||
siteLanguages,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
myUserInfo
|
|
||||||
).at(0)?.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function canCreateCommunity(
|
export function canCreateCommunity(
|
||||||
siteRes: GetSiteResponse,
|
siteRes: GetSiteResponse,
|
||||||
myUserInfo = UserService.Instance.myUserInfo
|
myUserInfo = UserService.Instance.myUserInfo
|
||||||
|
|
Loading…
Reference in a new issue