mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-23 06:59:02 +00:00
A few more updates.
This commit is contained in:
parent
079ed3b865
commit
16191b9fe5
|
@ -1 +1 @@
|
|||
Subproject commit a2f59fcbf7529a1f7dd5cda894381ef2000b9ef5
|
||||
Subproject commit c97005696d132acf2cad3506df4f3c2256142349
|
12
package.json
12
package.json
|
@ -38,16 +38,16 @@
|
|||
"express": "~4.18.1",
|
||||
"html-to-text": "^8.2.1",
|
||||
"i18next": "^21.8.14",
|
||||
"inferno": "^8.0.3",
|
||||
"inferno-create-element": "^8.0.3",
|
||||
"inferno": "^8.0.5",
|
||||
"inferno-create-element": "^8.0.5",
|
||||
"inferno-helmet": "^5.2.1",
|
||||
"inferno-hydrate": "^8.0.3",
|
||||
"inferno-hydrate": "^8.0.5",
|
||||
"inferno-i18next-dess": "0.0.2",
|
||||
"inferno-router": "^8.0.3",
|
||||
"inferno-server": "^8.0.3",
|
||||
"inferno-router": "^8.0.5",
|
||||
"inferno-server": "^8.0.5",
|
||||
"isomorphic-cookie": "^1.2.4",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"lemmy-js-client": "0.17.0-rc.56",
|
||||
"lemmy-js-client": "0.17.0-rc.57",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-container": "^3.0.0",
|
||||
"markdown-it-footnote": "^3.0.3",
|
||||
|
|
|
@ -385,4 +385,12 @@ br.big {
|
|||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
|
||||
.lang-select-action {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.lang-select-action:focus {
|
||||
width: auto;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ interface LanguageSelectProps {
|
|||
onChange(val: number[]): any;
|
||||
showAll?: boolean;
|
||||
showSite?: boolean;
|
||||
iconVersion?: boolean;
|
||||
}
|
||||
|
||||
export class LanguageSelect extends Component<LanguageSelectProps, any> {
|
||||
|
@ -46,16 +47,9 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
|
|||
}
|
||||
|
||||
render() {
|
||||
let selectedLangs = this.props.selectedLanguageIds;
|
||||
let filteredLangs = selectableLanguages(
|
||||
this.props.allLanguages,
|
||||
this.props.siteLanguages,
|
||||
this.props.showAll,
|
||||
this.props.showSite,
|
||||
UserService.Instance.myUserInfo
|
||||
);
|
||||
|
||||
return (
|
||||
return this.props.iconVersion ? (
|
||||
this.selectBtn
|
||||
) : (
|
||||
<div className="form-group row">
|
||||
<label
|
||||
className={classNames("col-form-label", {
|
||||
|
@ -72,23 +66,7 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
|
|||
"col-sm-10": !this.props.multiple,
|
||||
})}
|
||||
>
|
||||
<select
|
||||
className="form-control custom-select"
|
||||
id={this.id}
|
||||
onChange={linkEvent(this, this.handleLanguageChange)}
|
||||
aria-label="action"
|
||||
multiple={this.props.multiple}
|
||||
>
|
||||
{filteredLangs.map(l => (
|
||||
<option
|
||||
key={l.id}
|
||||
value={l.id}
|
||||
selected={selectedLangs.unwrapOr([]).includes(l.id)}
|
||||
>
|
||||
{l.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{this.selectBtn}
|
||||
{this.props.multiple && (
|
||||
<div className="input-group-append">
|
||||
<button
|
||||
|
@ -104,6 +82,40 @@ export class LanguageSelect extends Component<LanguageSelectProps, any> {
|
|||
);
|
||||
}
|
||||
|
||||
get selectBtn() {
|
||||
let selectedLangs = this.props.selectedLanguageIds;
|
||||
let filteredLangs = selectableLanguages(
|
||||
this.props.allLanguages,
|
||||
this.props.siteLanguages,
|
||||
this.props.showAll,
|
||||
this.props.showSite,
|
||||
UserService.Instance.myUserInfo
|
||||
);
|
||||
|
||||
return (
|
||||
<select
|
||||
className={classNames("lang-select-action", {
|
||||
"form-control custom-select": !this.props.iconVersion,
|
||||
"btn btn-sm text-muted": this.props.iconVersion,
|
||||
})}
|
||||
id={this.id}
|
||||
onChange={linkEvent(this, this.handleLanguageChange)}
|
||||
aria-label="action"
|
||||
multiple={this.props.multiple}
|
||||
>
|
||||
{filteredLangs.map(l => (
|
||||
<option
|
||||
key={l.id}
|
||||
value={l.id}
|
||||
selected={selectedLangs.unwrapOr([]).includes(l.id)}
|
||||
>
|
||||
{l.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
|
||||
handleLanguageChange(i: LanguageSelect, event: any) {
|
||||
let options: HTMLOptionElement[] = Array.from(event.target.options);
|
||||
let selected: number[] = options
|
||||
|
|
|
@ -165,19 +165,6 @@ export class MarkdownTextArea extends Component<
|
|||
{i18n.t("body")}
|
||||
</label>
|
||||
</div>
|
||||
{this.props.showLanguage && (
|
||||
<div className="row justify-content-end">
|
||||
<div className="col-sm-8">
|
||||
<LanguageSelect
|
||||
allLanguages={this.props.allLanguages}
|
||||
selectedLanguageIds={this.state.languageId.map(Array.of)}
|
||||
siteLanguages={this.props.siteLanguages}
|
||||
multiple={false}
|
||||
onChange={this.handleLanguageChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="row">
|
||||
<div className="col-sm-12 d-flex flex-wrap">
|
||||
{this.props.buttonTitle.match({
|
||||
|
@ -217,6 +204,17 @@ export class MarkdownTextArea extends Component<
|
|||
)}
|
||||
{/* A flex expander */}
|
||||
<div className="flex-grow-1"></div>
|
||||
|
||||
{this.props.showLanguage && (
|
||||
<LanguageSelect
|
||||
iconVersion
|
||||
allLanguages={this.props.allLanguages}
|
||||
selectedLanguageIds={this.state.languageId.map(Array.of)}
|
||||
siteLanguages={this.props.siteLanguages}
|
||||
multiple={false}
|
||||
onChange={this.handleLanguageChange}
|
||||
/>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-sm text-muted"
|
||||
data-tippy-content={i18n.t("bold")}
|
||||
|
|
|
@ -579,10 +579,12 @@ export class Community extends Component<any, State> {
|
|||
op == UserOperation.DeleteCommunity ||
|
||||
op == UserOperation.RemoveCommunity
|
||||
) {
|
||||
// TODO this also needs to update the discussion_languages live
|
||||
let data = wsJsonToRes<CommunityResponse>(msg, CommunityResponse);
|
||||
this.state.communityRes.match({
|
||||
some: res => (res.community_view = data.community_view),
|
||||
some: res => {
|
||||
res.community_view = data.community_view;
|
||||
res.discussion_languages = data.discussion_languages;
|
||||
},
|
||||
none: void 0,
|
||||
});
|
||||
this.setState(this.state);
|
||||
|
|
73
yarn.lock
73
yarn.lock
|
@ -2655,7 +2655,7 @@ cssesc@^3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
|
||||
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
|
||||
|
||||
csstype@^3.1.0:
|
||||
csstype@^3.1.0, csstype@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.1.tgz#841b532c45c758ee546a11d5bd7b7b473c8c30b9"
|
||||
integrity sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==
|
||||
|
@ -4304,6 +4304,13 @@ inferno-create-element@^8.0.3:
|
|||
dependencies:
|
||||
inferno "8.0.3"
|
||||
|
||||
inferno-create-element@^8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/inferno-create-element/-/inferno-create-element-8.0.5.tgz#e5ee57926d05b8eafd52039163a18253e8d6a812"
|
||||
integrity sha512-Ad3ptKXyEgvQMwd3YkCd83Arw7MihJtAbfp7Mlu2c2RtJoHY0ZnGs9RWSPKweDFeKjGgYyTlmrGj1hibpooiGA==
|
||||
dependencies:
|
||||
inferno "8.0.5"
|
||||
|
||||
inferno-helmet@^5.2.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/inferno-helmet/-/inferno-helmet-5.2.1.tgz#3717f325760aa14abeae82a78af7213f9055a3dc"
|
||||
|
@ -4313,12 +4320,12 @@ inferno-helmet@^5.2.1:
|
|||
inferno-side-effect "^1.1.5"
|
||||
object-assign "^4.1.1"
|
||||
|
||||
inferno-hydrate@^8.0.3:
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inferno-hydrate/-/inferno-hydrate-8.0.3.tgz#75c3c53300a7b7b550dfa93f363956201d86f71f"
|
||||
integrity sha512-7q1BDuVIy3XCmyKlAJhe+s1CLJhl3+gfFcBpjCq9iA7J/Z3kwo/6xjwJQbcQHNrCr/XZvTM+2uVwfxiX6wgYCQ==
|
||||
inferno-hydrate@^8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/inferno-hydrate/-/inferno-hydrate-8.0.5.tgz#c73adb903122e7030f935b1cf189734583acdce5"
|
||||
integrity sha512-eLbBjstgPhwDSJ+7hcPXbT2nIZQCfesCR3yAu/7AICkXamn2v0f5Zq/5+UlvyHsiuU9BYSOYh95H8hTwHm5zVw==
|
||||
dependencies:
|
||||
inferno "8.0.3"
|
||||
inferno "8.0.5"
|
||||
|
||||
inferno-i18next-dess@0.0.2:
|
||||
version "0.0.2"
|
||||
|
@ -4332,22 +4339,22 @@ inferno-i18next-dess@0.0.2:
|
|||
inferno-shared "^8.0.3"
|
||||
inferno-vnode-flags "^8.0.3"
|
||||
|
||||
inferno-router@^8.0.3:
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inferno-router/-/inferno-router-8.0.3.tgz#ef08da8b0cb158b8920147b260a4f84c64bc3877"
|
||||
integrity sha512-bWkrFfIBDued0LfS/x6Bot3+J3VwGImH3ukSdIFe/GLFPBljDbvayc1JotriJtNFKA1E+1T/OZyw1E6UqIcDaA==
|
||||
inferno-router@^8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/inferno-router/-/inferno-router-8.0.5.tgz#6cf2d4774f1d858ede65a5f61649796c0866e972"
|
||||
integrity sha512-c1hmVDNsjtG9v7dmArIsYHqX8vR2Z0sNtq6fsW+DHkz7y6VtjM2Po6MheRHBfIn2RSltiIn7+Vew0rtgfPYd8g==
|
||||
dependencies:
|
||||
history "^5.3.0"
|
||||
hoist-non-inferno-statics "^1.1.3"
|
||||
inferno "8.0.3"
|
||||
inferno "8.0.5"
|
||||
path-to-regexp-es6 "1.7.0"
|
||||
|
||||
inferno-server@^8.0.3:
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inferno-server/-/inferno-server-8.0.3.tgz#4030ac5f20d9ddf191163daa10d3ef4e8b0c4593"
|
||||
integrity sha512-YG9f9e0KsVGV6qByWCkFoGI80SckqIptHtTHMoVHsAbw3krzX414zxwA5H9OTnkubJJsSHBjVtFxaq6hHT/YcA==
|
||||
inferno-server@^8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/inferno-server/-/inferno-server-8.0.5.tgz#e2f659caba0419080e018567744af8d505030095"
|
||||
integrity sha512-I0suUf8o8ftGH3xSPoBpRrDXMPhrj4UN8o1qDz3WDTYuecTqF7JGtSeu8OP9/kMBlRqTN34Mn+xJV/DGGhnCLQ==
|
||||
dependencies:
|
||||
inferno "8.0.3"
|
||||
inferno "8.0.5"
|
||||
|
||||
inferno-shared@^8.0.3:
|
||||
version "8.0.3"
|
||||
|
@ -4368,6 +4375,11 @@ inferno-vnode-flags@8.0.3, inferno-vnode-flags@^8.0.3:
|
|||
resolved "https://registry.yarnpkg.com/inferno-vnode-flags/-/inferno-vnode-flags-8.0.3.tgz#1bd78745033719596211155ae673bd648b266a78"
|
||||
integrity sha512-r+wJZNliJWvtcwBd66L3fMSp+M0rinHLilZeLiAX87+ZVPoXKiTDLVmTRI+1j8dm1XmC3IuAHijVfwELnEmoCQ==
|
||||
|
||||
inferno-vnode-flags@8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/inferno-vnode-flags/-/inferno-vnode-flags-8.0.5.tgz#328767cadcd4270d7e70268e8fec93331dc57e27"
|
||||
integrity sha512-HF/frYUEV/tcCxM73FXwJYgaxKfHZD1fl1UaEwpoFils52ce/1O02GtbGKyd2ts93hZ592W7yu5jKDTM6k/shA==
|
||||
|
||||
inferno@8.0.3, inferno@^8.0.3:
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inferno/-/inferno-8.0.3.tgz#99124f050a9c60995dbdeef8ac258a936df7e62e"
|
||||
|
@ -4377,6 +4389,15 @@ inferno@8.0.3, inferno@^8.0.3:
|
|||
inferno-vnode-flags "8.0.3"
|
||||
opencollective-postinstall "^2.0.3"
|
||||
|
||||
inferno@8.0.5, inferno@^8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/inferno/-/inferno-8.0.5.tgz#6c480b92eae6acdf2eba9d4986f98b2b71349977"
|
||||
integrity sha512-dg+h9wdQOR34lTSh9KLhV+62wdnWXI58e7nam9YxXof45IBzgWsKkVuGL0Rp0DkioPNA47bT3v7MvbsGgL58Tg==
|
||||
dependencies:
|
||||
csstype "^3.1.1"
|
||||
inferno-vnode-flags "8.0.5"
|
||||
opencollective-postinstall "^2.0.3"
|
||||
|
||||
inflight@^1.0.4, inflight@~1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
|
@ -4909,10 +4930,15 @@ lcid@^1.0.0:
|
|||
dependencies:
|
||||
invert-kv "^1.0.0"
|
||||
|
||||
lemmy-js-client@0.17.0-rc.55:
|
||||
version "0.17.0-rc.55"
|
||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.55.tgz#7e0ab84838e7b09010285169b6be2ca4d23e18fa"
|
||||
integrity sha512-UAhOq8Jtgu+Rzk7ow1Kx/afQzkWxxjxFjZANDxWN9ozxpBJ0qR+VtKaDY+sEyBF3hU1XPcgTqjq6xPFA9CUr4A==
|
||||
lemmy-js-client@0.17.0-rc.57:
|
||||
version "0.17.0-rc.57"
|
||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.57.tgz#f7a243ed53542810e7446b0a28ad162f3e913254"
|
||||
integrity sha512-7kZHi0B+jiKc50itTwngkS5Vxcuvux3LjgD28IXZ049cWQgZDqer6BCmudcbViP+dAoyWs9Fh2SyWkYFhv7bwQ==
|
||||
dependencies:
|
||||
"@sniptt/monads" "^0.5.10"
|
||||
class-transformer "^0.5.1"
|
||||
node-fetch "2.6.6"
|
||||
reflect-metadata "^0.1.13"
|
||||
|
||||
levn@^0.4.1:
|
||||
version "0.4.1"
|
||||
|
@ -5580,6 +5606,13 @@ node-fetch-npm@^2.0.2:
|
|||
json-parse-better-errors "^1.0.0"
|
||||
safe-buffer "^5.1.1"
|
||||
|
||||
node-fetch@2.6.6:
|
||||
version "2.6.6"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
|
||||
integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
|
||||
dependencies:
|
||||
whatwg-url "^5.0.0"
|
||||
|
||||
node-fetch@^2.6.1:
|
||||
version "2.6.7"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
||||
|
|
Loading…
Reference in a new issue