UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

143 lines (142 loc) 4.49 kB
import { jsxs as i, jsx as o, Fragment as v } from "react/jsx-runtime"; import "../../synapse-client/SynapseClient.js"; import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode"; import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse"; import "@sage-bionetworks/synapse-client/util/SynapseClientError"; import { SubscriptionObjectType as c, DiscussionFilter as h } from "@sage-bionetworks/synapse-types"; import "../../utils/functions/EntityTypeUtils.js"; import "../../utils/SynapseConstants.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../utils/PermissionLevelToAccessType.js"; import { useState as e } from "react"; import "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import { Button as a, Typography as C } from "@mui/material"; import "../../utils/hooks/useCookiePreferences.js"; import "../../utils/hooks/useSourceAppConfigs.js"; import "universal-cookie"; import "../../utils/AppUtils/session/ApplicationSessionContext.js"; import "../../utils/context/FullContextProvider.js"; import "../../utils/context/DocumentMetadataContext.js"; import '../../style/components/_spinner.css';/* empty css */ import "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import "react-router"; import "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useGetCurrentUserProfile as U } from "../../synapse-queries/user/useUserBundle.js"; import { useGetModerators as _ } from "../../synapse-queries/forum/useForum.js"; import { useSubscription as L } from "../../synapse-queries/subscription/useSubscription.js"; import { displayToast as j } from "../ToastMessage/ToastMessage.js"; import { ForumTable as u } from "./ForumTable.js"; import { ForumThreadEditor as B } from "./ForumThreadEditor.js"; import { SubscribersModal as O } from "./SubscribersModal.js"; import { SignInRequiredModal as R } from "../SignInRequiredModal/SignInRequiredModal.js"; const x = "You will need to sign in for access to that resource"; function Do({ forumId: r, limit: s, onClickLink: n }) { const [f, l] = e(!1), [T, m] = e(!1), [t, b] = e(!1), [w, S] = e(!1), { subscription: d, isLoading: M, toggleSubscribed: g } = L( r, c.FORUM ); function D() { try { g(); } catch (N) { j(N.reason, "danger"); } } const { data: y } = _(r), { data: p } = U(), F = y?.includes( p?.ownerId ?? "" ), E = () => { p?.userName == "anonymous" ? m(!0) : l(!0); }; return /* @__PURE__ */ i("div", { className: "ForumTable", children: [ /* @__PURE__ */ i("div", { className: "ForumTable__top-level-control", children: [ /* @__PURE__ */ o( O, { id: r, objectType: c.FORUM, showModal: w, handleModal: S } ), /* @__PURE__ */ o( a, { variant: d ? "outlined" : "contained", color: "primary", onClick: () => D(), disabled: M, children: d ? "Unfollow" : "Follow" } ), /* @__PURE__ */ o( a, { variant: "contained", color: "primary", onClick: () => E(), children: "New Thread" } ), F && /* @__PURE__ */ o( a, { variant: "contained", color: "primary", onClick: () => b(!t), children: t ? "Hide Deleted Threads" : "Show Deleted Threads" } ) ] }), t && /* @__PURE__ */ i(v, { children: [ /* @__PURE__ */ o(C, { variant: "h4", children: "Deleted Threads" }), /* @__PURE__ */ o( u, { onClickLink: n, forumId: r, limit: s, filter: h.DELETED_ONLY } ) ] }), /* @__PURE__ */ o( u, { onClickLink: n, forumId: r, limit: s, filter: h.EXCLUDE_DELETED } ), /* @__PURE__ */ o( B, { isReply: !1, id: r, onClose: () => l(!1), isDialog: !0, openDialog: f } ), /* @__PURE__ */ o( R, { open: T, content: x, hasCancelButton: !1, onHide: () => m(!1) } ) ] }); } export { Do as ForumPage }; //# sourceMappingURL=ForumPage.js.map