diff --git a/src/client/index.tsx b/src/client/index.tsx index 2bdd948f..e007e644 100644 --- a/src/client/index.tsx +++ b/src/client/index.tsx @@ -6,6 +6,7 @@ import { HistoryService, UserService } from "../shared/services"; import "bootstrap/js/dist/collapse"; import "bootstrap/js/dist/dropdown"; +import "bootstrap/js/dist/modal"; async function startClient() { initializeSite(window.isoData.site_res); diff --git a/src/shared/components/community/sidebar.tsx b/src/shared/components/community/sidebar.tsx index 9f7eff2a..be9311ab 100644 --- a/src/shared/components/community/sidebar.tsx +++ b/src/shared/components/community/sidebar.tsx @@ -1,6 +1,7 @@ import { myAuthRequired } from "@utils/app"; import { getUnixTime, hostname } from "@utils/helpers"; import { amAdmin, amMod, amTopMod } from "@utils/roles"; +import { NoOptionI18nKeys } from "i18next"; import { Component, InfernoNode, linkEvent } from "inferno"; import { T } from "inferno-i18next-dess"; import { Link } from "inferno-router"; @@ -131,7 +132,7 @@ export class Sidebar extends Component {
{this.communityTitle()} {this.props.editable && this.adminButtons()} - {myUSerInfo && this.subscribe()} + {this.subscribeButton} {this.canPost && this.createPost()} {myUSerInfo && this.blockCommunity()} {!myUSerInfo && ( @@ -160,6 +161,7 @@ export class Sidebar extends Component {
+ {this.remoteFetchModal} ); } @@ -230,56 +232,117 @@ export class Sidebar extends Component { ); } - subscribe() { + get subscribeButton() { const community_view = this.props.community_view; - if (community_view.subscribed === "NotSubscribed") { + let i18key: NoOptionI18nKeys; + + switch (community_view.subscribed) { + case "NotSubscribed": { + i18key = "subscribe"; + + break; + } + case "Subscribed": { + i18key = "joined"; + + break; + } + case "Pending": { + i18key = "subscribe_pending"; + + break; + } + } + + if (!UserService.Instance.myUserInfo) { return ( ); } - if (community_view.subscribed === "Subscribed") { - return ( - - ); - } + )} + {I18NextService.i18n.t(i18key)} + + )} + + ); + } - if (community_view.subscribed === "Pending") { - return ( - - ); - } + get remoteFetchModal() { + return ( +
+
+
+
+

+ Subscribe from Remote Instance +

+
+
+
+ + +
+ +
+
+ ); } blockCommunity() {