From 7e16f500cb7bc0cfd8bafbf6bb1555704f771231 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 29 Apr 2022 12:13:34 +0200
Subject: chore: remove old pages, components, helpers and types

Since I'm using new components, I will also rewrite the GraphQL queries
so it is easier to start from scratch.
---
 src/components/CommentsList/CommentsList.tsx | 69 ----------------------------
 1 file changed, 69 deletions(-)
 delete mode 100644 src/components/CommentsList/CommentsList.tsx

(limited to 'src/components/CommentsList/CommentsList.tsx')

diff --git a/src/components/CommentsList/CommentsList.tsx b/src/components/CommentsList/CommentsList.tsx
deleted file mode 100644
index 0eaac17..0000000
--- a/src/components/CommentsList/CommentsList.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import Comment from '@components/Comment/Comment';
-import Spinner from '@components/Spinner/Spinner';
-import { getCommentsByPostId } from '@services/graphql/queries';
-import { Comment as CommentData } from '@ts/types/comments';
-import { useIntl } from 'react-intl';
-import useSWR from 'swr';
-import styles from './CommentsList.module.scss';
-
-const CommentsList = ({
-  articleId,
-  comments,
-}: {
-  articleId: number;
-  comments: CommentData[];
-}) => {
-  const intl = useIntl();
-  const { data, error } = useSWR<CommentData[]>(
-    '/api/comments',
-    () => getCommentsByPostId(articleId),
-    { fallbackData: comments }
-  );
-
-  const getCommentsList = () => {
-    if (error) {
-      return intl.formatMessage({
-        defaultMessage: 'Failed to load.',
-        description: 'CommentsList: failed to load',
-        id: 'Zlkww3',
-      });
-    }
-
-    if (!data) return <Spinner />;
-
-    return data.map((comment) => {
-      return (
-        <Comment
-          key={comment.databaseId}
-          articleId={articleId}
-          comment={comment}
-        />
-      );
-    });
-  };
-
-  return (
-    <>
-      <h2 className={styles.title}>
-        {intl.formatMessage({
-          defaultMessage: 'Comments',
-          description: 'CommentsList: Comments section title',
-          id: 'Ns8CFb',
-        })}
-      </h2>
-      {data && data.length > 0 ? (
-        <ol className={styles.list}>{getCommentsList()}</ol>
-      ) : (
-        <p className={styles['no-comments']}>
-          {intl.formatMessage({
-            defaultMessage: 'No comments yet.',
-            description: 'CommentsList: No comment message',
-            id: 'e9L59q',
-          })}
-        </p>
-      )}
-    </>
-  );
-};
-
-export default CommentsList;
-- 
cgit v1.2.3

