cleaned up formatting
This commit is contained in:
@@ -126,17 +126,12 @@
|
|||||||
|
|
||||||
/* Feed */
|
/* Feed */
|
||||||
|
|
||||||
.content-container {
|
|
||||||
display: inline-flex;
|
|
||||||
position: relative;
|
|
||||||
top: 5rem;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feed {
|
.feed {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
position: relative;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
top: 5rem;
|
||||||
width: 90vw;
|
width: 90vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
src/App.js
15
src/App.js
@@ -7,20 +7,7 @@ function App() {
|
|||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<div className="content-container">
|
<Feed />
|
||||||
|
|
||||||
<div className="feed">
|
|
||||||
<Feed />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="about-the-site">
|
|
||||||
{/* 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? */}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useDispatch, /* useSelector */ } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { unwrapResult } from '@reduxjs/toolkit';
|
import { unwrapResult } from '@reduxjs/toolkit';
|
||||||
import { fetchComments } from '../posts/postsSlice';
|
import { fetchComments } from '../posts/postsSlice';
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
@@ -27,23 +27,6 @@ export default function Discussion({permalink, isVisible}) {
|
|||||||
|
|
||||||
}, [dispatch, formattedLink, isVisible, setData]);
|
}, [dispatch, formattedLink, isVisible, setData]);
|
||||||
|
|
||||||
// if (data) {
|
|
||||||
// let commentData = data[1];
|
|
||||||
// let commentArray = commentData.data.children;
|
|
||||||
|
|
||||||
// let toExport = [];
|
|
||||||
// for (let comment of commentArray) {
|
|
||||||
// toExport.push(
|
|
||||||
// <div className="indiv-comment" key={v4()}>
|
|
||||||
// <p>{'u/' + comment.data.author}</p>
|
|
||||||
// <p>{comment.data.body}</p>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setThread(toExport);
|
|
||||||
// }
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data) {
|
if (data) {
|
||||||
let commentData = data[1];
|
let commentData = data[1];
|
||||||
@@ -51,9 +34,6 @@ export default function Discussion({permalink, isVisible}) {
|
|||||||
|
|
||||||
const getReplies = (comment) => {
|
const getReplies = (comment) => {
|
||||||
if (comment.data.replies) {
|
if (comment.data.replies) {
|
||||||
console.log(comment.data.replies.data.children);
|
|
||||||
console.log(comment.data.replies.data.children[0].data.author)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={comment.data.replies.data.children ? `indiv-comment nested` : "indiv-comment"}>
|
<div className={comment.data.replies.data.children ? `indiv-comment nested` : "indiv-comment"}>
|
||||||
<p className="comment-author">
|
<p className="comment-author">
|
||||||
@@ -69,8 +49,6 @@ export default function Discussion({permalink, isVisible}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
setThread(comments.map((comment) => {
|
setThread(comments.map((comment) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ export default function Feed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let sortedPosts = extractedPosts.sort(comparePosts); // implements sorting function
|
let sortedPosts = extractedPosts.sort(comparePosts); // implements sorting function
|
||||||
|
|
||||||
// console.log(sortedPosts);
|
|
||||||
|
|
||||||
let newFeed = sortedPosts.map((post) => {
|
let newFeed = sortedPosts.map((post) => {
|
||||||
return (
|
return (
|
||||||
@@ -155,27 +153,29 @@ export default function Feed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="feed">
|
||||||
{feedPages ?
|
|
||||||
|
|
||||||
<div className="page-handling" id="top-page-handling">
|
{feedPages ?
|
||||||
<button className="decrement" onClick={handleDecrement}>-</button>
|
|
||||||
<p>Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}</p>
|
<div className="page-handling" id="top-page-handling">
|
||||||
<button className="increment" onClick={handleIncrement}>+</button>
|
<button className="decrement" onClick={handleDecrement}>-</button>
|
||||||
|
<p>Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}</p>
|
||||||
|
<button className="increment" onClick={handleIncrement}>+</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
: null }
|
||||||
|
|
||||||
|
{feedPages ? feedPages[currentPage] : <h1 className="loading-message">Loading cats for you...</h1>}
|
||||||
|
{feedPages ?
|
||||||
|
|
||||||
|
<div className="page-handling" id="bottom-page-handling">
|
||||||
|
<button className="decrement" onClick={handleDecrement}>-</button>
|
||||||
|
<p>Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}</p>
|
||||||
|
<button className="increment" onClick={handleIncrement}>+</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
: null }
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
: null }
|
|
||||||
|
|
||||||
{feedPages ? feedPages[currentPage] : <h1 className="loading-message">Loading cats for you...</h1>}
|
|
||||||
{feedPages ?
|
|
||||||
|
|
||||||
<div className="page-handling" id="bottom-page-handling">
|
|
||||||
<button className="decrement" onClick={handleDecrement}>-</button>
|
|
||||||
<p>Page {currentPage + 1} of {feedPages.length ? (feedPages.length + 1) : 'unknown'}</p>
|
|
||||||
<button className="increment" onClick={handleIncrement}>+</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
: null }
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,14 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { searchByActive, /* selectSearchResults */ } from '../posts/postsSlice';
|
import { searchByActive } from '../posts/postsSlice';
|
||||||
import { selectActive, /* selectAllSubs */ } from "../reddit/redditSlice";
|
import { selectActive } from "../reddit/redditSlice";
|
||||||
|
|
||||||
export default function SearchBar() {
|
export default function SearchBar() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
// const selectedSubs = useSelector(selectAllSubs);
|
|
||||||
const activeSubs = useSelector(selectActive);
|
const activeSubs = useSelector(selectActive);
|
||||||
|
|
||||||
const [term, setTerm] = useState('');
|
const [term, setTerm] = useState('');
|
||||||
const [results, setResults] = useState(null);
|
const [results, setResults] = useState(null);
|
||||||
// const searchData = useSelector(selectSearchResults);
|
|
||||||
|
|
||||||
const handleChange = (e) => {
|
const handleChange = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user