mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2025-01-08 19:21:27 +00:00
Expose pending 2 (#662)
* Updating translations. * Adding better subscribe type. * Fix extra pending string.
This commit is contained in:
parent
d905c91e1b
commit
46c610990a
6 changed files with 32 additions and 13 deletions
|
@ -77,7 +77,7 @@
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"husky": "^7.0.4",
|
"husky": "^7.0.4",
|
||||||
"import-sort-style-module": "^6.0.0",
|
"import-sort-style-module": "^6.0.0",
|
||||||
"lemmy-js-client": "0.17.0-rc.30",
|
"lemmy-js-client": "0.17.0-rc.31",
|
||||||
"lint-staged": "^12.4.1",
|
"lint-staged": "^12.4.1",
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
"mini-css-extract-plugin": "^2.6.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
CommentReportView,
|
CommentReportView,
|
||||||
CommentView,
|
CommentView,
|
||||||
ResolveCommentReport,
|
ResolveCommentReport,
|
||||||
|
SubscribedType,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { i18n } from "../../i18next";
|
import { i18n } from "../../i18next";
|
||||||
import { CommentNode as CommentNodeI } from "../../interfaces";
|
import { CommentNode as CommentNodeI } from "../../interfaces";
|
||||||
|
@ -40,7 +41,7 @@ export class CommentReport extends Component<CommentReportProps, any> {
|
||||||
community: r.community,
|
community: r.community,
|
||||||
creator_banned_from_community: r.creator_banned_from_community,
|
creator_banned_from_community: r.creator_banned_from_community,
|
||||||
counts: r.counts,
|
counts: r.counts,
|
||||||
subscribed: false,
|
subscribed: SubscribedType.NotSubscribed,
|
||||||
saved: false,
|
saved: false,
|
||||||
creator_blocked: false,
|
creator_blocked: false,
|
||||||
recipient: None,
|
recipient: None,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
ListCommunitiesResponse,
|
ListCommunitiesResponse,
|
||||||
ListingType,
|
ListingType,
|
||||||
SortType,
|
SortType,
|
||||||
|
SubscribedType,
|
||||||
UserOperation,
|
UserOperation,
|
||||||
wsJsonToRes,
|
wsJsonToRes,
|
||||||
wsUserOp,
|
wsUserOp,
|
||||||
|
@ -183,7 +184,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
{numToSI(cv.counts.comments)}
|
{numToSI(cv.counts.comments)}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{cv.subscribed ? (
|
{cv.subscribed == SubscribedType.Subscribed && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-link d-inline-block"
|
class="btn btn-link d-inline-block"
|
||||||
onClick={linkEvent(
|
onClick={linkEvent(
|
||||||
|
@ -193,7 +194,8 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
>
|
>
|
||||||
{i18n.t("unsubscribe")}
|
{i18n.t("unsubscribe")}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
)}
|
||||||
|
{cv.subscribed == SubscribedType.NotSubscribed && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-link d-inline-block"
|
class="btn btn-link d-inline-block"
|
||||||
onClick={linkEvent(
|
onClick={linkEvent(
|
||||||
|
@ -204,6 +206,11 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
{i18n.t("subscribe")}
|
{i18n.t("subscribe")}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{cv.subscribed == SubscribedType.Pending && (
|
||||||
|
<div class="text-warning d-inline-block">
|
||||||
|
{i18n.t("subscribe_pending")}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
FollowCommunity,
|
FollowCommunity,
|
||||||
PersonViewSafe,
|
PersonViewSafe,
|
||||||
RemoveCommunity,
|
RemoveCommunity,
|
||||||
|
SubscribedType,
|
||||||
toUndefined,
|
toUndefined,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { i18n } from "../../i18next";
|
import { i18n } from "../../i18next";
|
||||||
|
@ -111,7 +112,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
<BannerIconHeader icon={community.icon} banner={community.banner} />
|
<BannerIconHeader icon={community.icon} banner={community.banner} />
|
||||||
)}
|
)}
|
||||||
<span class="mr-2">{community.title}</span>
|
<span class="mr-2">{community.title}</span>
|
||||||
{subscribed && (
|
{subscribed == SubscribedType.Subscribed && (
|
||||||
<a
|
<a
|
||||||
class="btn btn-secondary btn-sm mr-2"
|
class="btn btn-secondary btn-sm mr-2"
|
||||||
href="#"
|
href="#"
|
||||||
|
@ -121,6 +122,11 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
{i18n.t("joined")}
|
{i18n.t("joined")}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
{subscribed == SubscribedType.Pending && (
|
||||||
|
<div class="badge badge-warning mr-2">
|
||||||
|
{i18n.t("subscribe_pending")}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{community.removed && (
|
{community.removed && (
|
||||||
<small className="mr-2 text-muted font-italic">
|
<small className="mr-2 text-muted font-italic">
|
||||||
{i18n.t("removed")}
|
{i18n.t("removed")}
|
||||||
|
@ -257,7 +263,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
createPost() {
|
createPost() {
|
||||||
let cv = this.props.community_view;
|
let cv = this.props.community_view;
|
||||||
return (
|
return (
|
||||||
cv.subscribed && (
|
cv.subscribed == SubscribedType.Subscribed && (
|
||||||
<Link
|
<Link
|
||||||
className={`btn btn-secondary btn-block mb-2 ${
|
className={`btn btn-secondary btn-block mb-2 ${
|
||||||
cv.community.deleted || cv.community.removed ? "no-click" : ""
|
cv.community.deleted || cv.community.removed ? "no-click" : ""
|
||||||
|
@ -274,7 +280,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
let community_view = this.props.community_view;
|
let community_view = this.props.community_view;
|
||||||
return (
|
return (
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
{!community_view.subscribed && (
|
{community_view.subscribed == SubscribedType.NotSubscribed && (
|
||||||
<a
|
<a
|
||||||
class="btn btn-secondary btn-block"
|
class="btn btn-secondary btn-block"
|
||||||
href="#"
|
href="#"
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
import { None } from "@sniptt/monads";
|
import { None } from "@sniptt/monads";
|
||||||
import { Component, linkEvent } from "inferno";
|
import { Component, linkEvent } from "inferno";
|
||||||
import { T } from "inferno-i18next-dess";
|
import { T } from "inferno-i18next-dess";
|
||||||
import { PostReportView, PostView, ResolvePostReport } from "lemmy-js-client";
|
import {
|
||||||
|
PostReportView,
|
||||||
|
PostView,
|
||||||
|
ResolvePostReport,
|
||||||
|
SubscribedType,
|
||||||
|
} from "lemmy-js-client";
|
||||||
import { i18n } from "../../i18next";
|
import { i18n } from "../../i18next";
|
||||||
import { WebSocketService } from "../../services";
|
import { WebSocketService } from "../../services";
|
||||||
import { auth, wsClient } from "../../utils";
|
import { auth, wsClient } from "../../utils";
|
||||||
|
@ -35,7 +40,7 @@ export class PostReport extends Component<PostReportProps, any> {
|
||||||
community: r.community,
|
community: r.community,
|
||||||
creator_banned_from_community: r.creator_banned_from_community,
|
creator_banned_from_community: r.creator_banned_from_community,
|
||||||
counts: r.counts,
|
counts: r.counts,
|
||||||
subscribed: false,
|
subscribed: SubscribedType.NotSubscribed,
|
||||||
saved: false,
|
saved: false,
|
||||||
read: false,
|
read: false,
|
||||||
creator_blocked: false,
|
creator_blocked: false,
|
||||||
|
|
|
@ -4948,10 +4948,10 @@ lcid@^1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
invert-kv "^1.0.0"
|
invert-kv "^1.0.0"
|
||||||
|
|
||||||
lemmy-js-client@0.17.0-rc.30:
|
lemmy-js-client@0.17.0-rc.31:
|
||||||
version "0.17.0-rc.30"
|
version "0.17.0-rc.31"
|
||||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.30.tgz#91cc926e662a5cd27f87cd2e6cdfcd210176745a"
|
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.31.tgz#373ad2dcbb1305bd82e7fb13704fbdb8d2f1c438"
|
||||||
integrity sha512-AcG8IZNNTa54BAXEqsL/QNlyPPwLntRLWpIOw9S3u84824d5inL7UCKnyx0UMbQklUuH/D3E2K9WNmZiUdvr3A==
|
integrity sha512-hcjFcOxgplffQullf9HuAGv2ko9wWySrnv+s8FWPPpg4EsixuBjXI+Dh7y0GR/KVs6fRmeXn4YBhR2YdJsBc7A==
|
||||||
|
|
||||||
levn@^0.4.1:
|
levn@^0.4.1:
|
||||||
version "0.4.1"
|
version "0.4.1"
|
||||||
|
|
Loading…
Reference in a new issue