From 84ca93ef8ee735b8e7a6722b7704eeae29dee612 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson Date: Fri, 25 Feb 2022 13:51:35 -0600 Subject: [PATCH] cleaned up formatting --- src/App.css | 9 ++---- src/App.js | 15 +-------- src/features/discussion/Discussion.js | 24 +-------------- src/features/posts/Feed.js | 44 +++++++++++++-------------- src/features/searchBar/searchBar.js | 7 ++--- 5 files changed, 28 insertions(+), 71 deletions(-) diff --git a/src/App.css b/src/App.css index 795b920..9563cf1 100644 --- a/src/App.css +++ b/src/App.css @@ -126,17 +126,12 @@ /* Feed */ -.content-container { - display: inline-flex; - position: relative; - top: 5rem; - flex-direction: row; -} - .feed { display: inline-flex; + position: relative; flex-direction: column; align-items: center; + top: 5rem; width: 90vw; } diff --git a/src/App.js b/src/App.js index bc93506..47ef29b 100644 --- a/src/App.js +++ b/src/App.js @@ -7,20 +7,7 @@ function App() { return (
-
- -
- -
- -
- {/* To do: add mutable state to class name for this div, */} - {/* determining whether or not it's active based on the state of */} - {/* The action dispatched from the searchbar slice(?) */} - {/* Do I need a searchbar slice? */} -
- -
+
); } diff --git a/src/features/discussion/Discussion.js b/src/features/discussion/Discussion.js index 89502c2..1eaabd5 100644 --- a/src/features/discussion/Discussion.js +++ b/src/features/discussion/Discussion.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { useDispatch, /* useSelector */ } from 'react-redux'; +import { useDispatch } from 'react-redux'; import { unwrapResult } from '@reduxjs/toolkit'; import { fetchComments } from '../posts/postsSlice'; import { v4 } from 'uuid'; @@ -27,23 +27,6 @@ export default function Discussion({permalink, isVisible}) { }, [dispatch, formattedLink, isVisible, setData]); - // if (data) { - // let commentData = data[1]; - // let commentArray = commentData.data.children; - - // let toExport = []; - // for (let comment of commentArray) { - // toExport.push( - //
- //

{'u/' + comment.data.author}

- //

{comment.data.body}

- //
- // ); - // } - - // setThread(toExport); - // } - useEffect(() => { if (data) { let commentData = data[1]; @@ -51,9 +34,6 @@ export default function Discussion({permalink, isVisible}) { const getReplies = (comment) => { if (comment.data.replies) { - console.log(comment.data.replies.data.children); - console.log(comment.data.replies.data.children[0].data.author) - return (

@@ -69,8 +49,6 @@ export default function Discussion({permalink, isVisible}) { } } - console.log(data); - setThread(comments.map((comment) => { return ( <> diff --git a/src/features/posts/Feed.js b/src/features/posts/Feed.js index 5f13342..a063eda 100644 --- a/src/features/posts/Feed.js +++ b/src/features/posts/Feed.js @@ -79,8 +79,6 @@ export default function Feed() { } let sortedPosts = extractedPosts.sort(comparePosts); // implements sorting function - - // console.log(sortedPosts); let newFeed = sortedPosts.map((post) => { return ( @@ -155,27 +153,29 @@ export default function Feed() { } return ( - <> - {feedPages ? +

-
- -

Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}

- + {feedPages ? + +
+ +

Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}

+ +
+ + : null } + + {feedPages ? feedPages[currentPage] :

Loading cats for you...

} + {feedPages ? + +
+ +

Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}

+ +
+ + : null } +
- - : null } - - {feedPages ? feedPages[currentPage] :

Loading cats for you...

} - {feedPages ? - -
- -

Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}

- -
- - : null } - ); } \ No newline at end of file diff --git a/src/features/searchBar/searchBar.js b/src/features/searchBar/searchBar.js index 1a64c02..f84901b 100644 --- a/src/features/searchBar/searchBar.js +++ b/src/features/searchBar/searchBar.js @@ -1,17 +1,14 @@ import React, { useState, useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; -import { searchByActive, /* selectSearchResults */ } from '../posts/postsSlice'; -import { selectActive, /* selectAllSubs */ } from "../reddit/redditSlice"; +import { searchByActive } from '../posts/postsSlice'; +import { selectActive } from "../reddit/redditSlice"; export default function SearchBar() { const dispatch = useDispatch(); - - // const selectedSubs = useSelector(selectAllSubs); const activeSubs = useSelector(selectActive); const [term, setTerm] = useState(''); const [results, setResults] = useState(null); - // const searchData = useSelector(selectSearchResults); const handleChange = (e) => { e.preventDefault();