X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fcommunity%2Fsidebar.tsx;h=592a06ffbef83f1dea4e4c042906bca2e843a9e0;hb=9c37cea106571a492e0b951fa66a182395053b67;hp=2774747b03e1dcc7c062e782d7aa6e5a6662e836;hpb=976ed12d077e89298b6fc574d59f23455c211a15;p=lemmy-ui.git diff --git a/src/shared/components/community/sidebar.tsx b/src/shared/components/community/sidebar.tsx index 2774747..592a06f 100644 --- a/src/shared/components/community/sidebar.tsx +++ b/src/shared/components/community/sidebar.tsx @@ -1,4 +1,5 @@ import { Component, InfernoNode, linkEvent } from "inferno"; +import { T } from "inferno-i18next-dess"; import { Link } from "inferno-router"; import { AddModToCommunity, @@ -38,7 +39,6 @@ interface SidebarProps { allLanguages: Language[]; siteLanguages: number[]; communityLanguages?: number[]; - online: number; enableNsfw?: boolean; showIcon?: boolean; editable?: boolean; @@ -63,7 +63,6 @@ interface SidebarState { removeCommunityLoading: boolean; leaveModTeamLoading: boolean; followCommunityLoading: boolean; - blockCommunityLoading: boolean; purgeCommunityLoading: boolean; } @@ -77,7 +76,6 @@ export class Sidebar extends Component { removeCommunityLoading: false, leaveModTeamLoading: false, followCommunityLoading: false, - blockCommunityLoading: false, purgeCommunityLoading: false, }; @@ -104,7 +102,6 @@ export class Sidebar extends Component { removeCommunityLoading: false, leaveModTeamLoading: false, followCommunityLoading: false, - blockCommunityLoading: false, purgeCommunityLoading: false, }); } @@ -144,10 +141,15 @@ export class Sidebar extends Component { {myUSerInfo && this.blockCommunity()} {!myUSerInfo && (
- {i18n.t("community_not_logged_in_alert", { - community: name, - instance: hostname(actor_id), - })} + + ### +
)} @@ -234,12 +236,6 @@ export class Sidebar extends Component { const counts = community_view.counts; return (
    -
  • - {i18n.t("number_online", { - count: this.props.online, - formattedCount: numToSI(this.props.online), - })} -
  • { } blockCommunity() { - const community_view = this.props.community_view; - const blocked = this.props.community_view.blocked; + const { subscribed, blocked } = this.props.community_view; return (
    - {community_view.subscribed == "NotSubscribed" && - (blocked ? ( - - ) : ( - - ))} + {subscribed == "NotSubscribed" && ( + + )}
    ); } @@ -662,10 +641,11 @@ export class Sidebar extends Component { } handleBlockCommunity(i: Sidebar) { - i.setState({ blockCommunityLoading: true }); + const { community, blocked } = i.props.community_view; + i.props.onBlockCommunity({ - community_id: 0, - block: !i.props.community_view.blocked, + community_id: community.id, + block: !blocked, auth: myAuthRequired(), }); }