From fa37321dbdb1201291ee7744ac752492a5c79fdd Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Sat, 22 Jul 2023 21:19:09 -0400 Subject: [PATCH] Bring back remote fetch modal --- src/client/index.tsx | 1 + .../components/common/subscribe-button.tsx | 97 +++++++++++++++++-- src/shared/components/community/sidebar.tsx | 3 +- src/shared/components/remote-fetch.tsx | 2 +- 4 files changed, 90 insertions(+), 13 deletions(-) diff --git a/src/client/index.tsx b/src/client/index.tsx index 6978c9c3..ffe52ce8 100644 --- a/src/client/index.tsx +++ b/src/client/index.tsx @@ -6,6 +6,7 @@ import { 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/common/subscribe-button.tsx b/src/shared/components/common/subscribe-button.tsx index 258a97ae..6e2a1561 100644 --- a/src/shared/components/common/subscribe-button.tsx +++ b/src/shared/components/common/subscribe-button.tsx @@ -1,22 +1,24 @@ +import classNames from "classnames"; import { NoOptionI18nKeys } from "i18next"; -import { MouseEventHandler } from "inferno"; -import { SubscribedType } from "lemmy-js-client"; +import { Component, MouseEventHandler } from "inferno"; +import { CommunityView } from "lemmy-js-client"; import { I18NextService, UserService } from "../../services"; import { Icon, Spinner } from "./icon"; interface SubscribeButtonProps { - subscribed: SubscribedType; + communityView: CommunityView; onFollow: MouseEventHandler; onUnFollow: MouseEventHandler; loading: boolean; } export function SubscribeButton({ - subscribed, + communityView, onFollow, onUnFollow, loading, }: SubscribeButtonProps) { + const { subscribed } = communityView; let i18key: NoOptionI18nKeys; switch (subscribed) { @@ -37,20 +39,31 @@ export function SubscribeButton({ } } + const buttonClass = "btn d-block mb-2 w-100"; + if (!UserService.Instance.myUserInfo) { return ( - + <> + + + ); } return ( ); } + +class RemoteFetchModal extends Component { + constructor(props, context) { + super(props, context); + } + + render() { + return ( +
+
+
+
+

+ Subscribe from Remote Instance +

+
+
+ + +
+
+ + +
+
+
+
+ ); + } +} diff --git a/src/shared/components/community/sidebar.tsx b/src/shared/components/community/sidebar.tsx index 5228a3cd..50266451 100644 --- a/src/shared/components/community/sidebar.tsx +++ b/src/shared/components/community/sidebar.tsx @@ -126,7 +126,6 @@ export class Sidebar extends Component { const myUSerInfo = UserService.Instance.myUserInfo; const { community: { name, actor_id }, - subscribed, } = this.props.community_view; return (