Skip to content

Commit

Permalink
fixed lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
times-tools committed Dec 17, 2024
1 parent 2eb8842 commit 1c9ea50
Showing 1 changed file with 6 additions and 34 deletions.
40 changes: 6 additions & 34 deletions packages/article-comments/src/article-comments.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-env browser */

import React, { useEffect, useState } from "react";
import React from "react";
import PropTypes from "prop-types";
import UserState from "@times-components/user-state";
import Comments from "./comments";
import DisabledComments from "./disabled-comments";
import JoinTheConversationDialog from "./join-the-conversation-dialog";
import UserEntitlementState from "./user-entitlement-state";

const ArticleComments = ({
articleId,
Expand All @@ -17,55 +16,28 @@ const ArticleComments = ({
storefrontConfig,
domainSpecificUrl,
hasCommentingEntitlement
}) => {
// const [userEntitlementData, setUserEntitlementData] = useState(undefined);

// useEffect(
// () => {
// const fetchUserEntitlements = async () => {
// const response = await fetch("/api/get-user-entitlements");
// const data = await response.json();
// setUserEntitlementData(data);
// };

// if (typeof window !== "undefined" && isEntitlementFeatureEnabled) {
// fetchUserEntitlements();
// }
// },
// [isEntitlementFeatureEnabled]
// );

console.log('hasCommentingEntitlement%%%%%%%%%%%%%%%', hasCommentingEntitlement);

return isEnabled && isCommentEnabled ? (
}) =>
isEnabled && isCommentEnabled ? (
<>
<UserState state={UserState.showJoinTheConversationDialog}>
<JoinTheConversationDialog storefrontConfig={storefrontConfig} />
</UserState>
{!hasCommentingEntitlement ? (
<p>hasCommentingEntitlement: {hasCommentingEntitlement}</p>
{hasCommentingEntitlement && (
<UserState state={UserState.showCommentingModule}>
<p>hasCommentingEntitlement: {hasCommentingEntitlement}</p>
<Comments
articleId={articleId}
isReadOnly={isReadOnly}
commentingConfig={commentingConfig}
domainSpecificUrl={domainSpecificUrl}
/>
</UserState>
) : (
<UserEntitlementState userEntitlementData={userEntitlementData}>
<Comments
articleId={articleId}
isReadOnly={isReadOnly}
commentingConfig={commentingConfig}
domainSpecificUrl={domainSpecificUrl}
/>
</UserEntitlementState>
)}
</>
) : (
<DisabledComments />
);
};

ArticleComments.propTypes = {
articleId: PropTypes.string.isRequired,
Expand Down

0 comments on commit 1c9ea50

Please sign in to comment.