X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fperson%2Fsettings.tsx;h=d024aae222b80081fa9941401443cfdc25353173;hb=b7ec7ae3110c560968e0cb24a32f1fe9166eec29;hp=34303cb2775f56ecd32067b29578451de7f904f4;hpb=93b05d728a69924f6107f241e49accfcdbc8a9f9;p=lemmy-ui.git diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index 34303cb..d024aae 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -1,3 +1,20 @@ +import { + communityToChoice, + fetchCommunities, + fetchThemeList, + fetchUsers, + myAuth, + myAuthRequired, + personToChoice, + setIsoData, + setTheme, + showLocal, + updateCommunityBlock, + updatePersonBlock, +} from "@utils/app"; +import { capitalizeFirstLetter, debounce } from "@utils/helpers"; +import { Choice } from "@utils/types"; +import classNames from "classnames"; import { NoOptionI18nKeys } from "i18next"; import { Component, linkEvent } from "inferno"; import { @@ -11,37 +28,19 @@ import { PersonBlockView, SortType, } from "lemmy-js-client"; -import { i18n, languages } from "../../i18next"; +import { elementUrl, emDash, relTags } from "../../config"; import { UserService } from "../../services"; import { HttpService, RequestState } from "../../services/HttpService"; -import { - Choice, - capitalizeFirstLetter, - communityToChoice, - debounce, - elementUrl, - emDash, - fetchCommunities, - fetchThemeList, - fetchUsers, - myAuth, - myAuthRequired, - personToChoice, - relTags, - setIsoData, - setTheme, - setupTippy, - showLocal, - toast, - updateCommunityBlock, - updatePersonBlock, -} from "../../utils"; +import { I18NextService, languages } from "../../services/I18NextService"; +import { setupTippy } from "../../tippy"; +import { toast } from "../../toast"; import { HtmlTags } from "../common/html-tags"; import { Icon, Spinner } from "../common/icon"; import { ImageUploadForm } from "../common/image-upload-form"; import { LanguageSelect } from "../common/language-select"; import { ListingTypeSelect } from "../common/listing-type-select"; import { MarkdownTextArea } from "../common/markdown-textarea"; +import PasswordInput from "../common/password-input"; import { SearchableSelect } from "../common/searchable-select"; import { SortSelect } from "../common/sort-select"; import Tabs from "../common/tabs"; @@ -110,12 +109,12 @@ const Filter = ({ onChange: (choice: Choice) => void; loading: boolean; }) => ( -
+
{ } get documentTitle(): string { - return i18n.t("settings"); + return I18NextService.i18n.t("settings"); } render() { return ( -
+
{ tabs={[ { key: "settings", - label: i18n.t("settings"), + label: I18NextService.i18n.t("settings"), getNode: this.userSettings, }, { key: "blocks", - label: i18n.t("blocks"), + label: I18NextService.i18n.t("blocks"), getNode: this.blockCards, }, ]} @@ -265,34 +264,50 @@ export class Settings extends Component { ); } - userSettings() { + userSettings(isSelected) { return ( -
-
-
-
{this.saveUserSettingsHtmlForm()}
+
+
+
+
+
{this.saveUserSettingsHtmlForm()}
+
-
-
-
-
{this.changePasswordHtmlForm()}
+
+
+
{this.changePasswordHtmlForm()}
+
); } - blockCards() { + blockCards(isSelected) { return ( -
-
-
-
{this.blockUserCard()}
+
+
+
+
+
{this.blockUserCard()}
+
-
-
-
-
{this.blockCommunityCard()}
+
+
+
{this.blockCommunityCard()}
+
@@ -302,68 +317,42 @@ export class Settings extends Component { changePasswordHtmlForm() { return ( <> -
{i18n.t("change_password")}
+

{I18NextService.i18n.t("change_password")}

-
- -
- -
+
+
-
- -
- -
+
+
-
- -
- -
+
+
-
-
@@ -392,7 +381,7 @@ export class Settings extends Component { blockedUsersList() { return ( <> -
{i18n.t("blocked_users")}
+

{I18NextService.i18n.t("blocked_users")}

    {this.state.personBlocks.map(pb => (
  • @@ -404,7 +393,7 @@ export class Settings extends Component { { ctx: this, recipientId: pb.target.id }, this.handleUnblockPerson )} - data-tippy-content={i18n.t("unblock_user")} + data-tippy-content={I18NextService.i18n.t("unblock_user")} > @@ -436,7 +425,7 @@ export class Settings extends Component { blockedCommunitiesList() { return ( <> -
    {i18n.t("blocked_communities")}
    +

    {I18NextService.i18n.t("blocked_communities")}

      {this.state.communityBlocks.map(cb => (
    • @@ -448,7 +437,9 @@ export class Settings extends Component { { ctx: this, communityId: cb.community.id }, this.handleUnblockCommunity )} - data-tippy-content={i18n.t("unblock_community")} + data-tippy-content={I18NextService.i18n.t( + "unblock_community" + )} > @@ -465,18 +456,18 @@ export class Settings extends Component { return ( <> -
      {i18n.t("settings")}
      +

      {I18NextService.i18n.t("settings")}

      -
      -