From 3f6149b520a8d4ba83f3e1e423f36dd78b70de14 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson Date: Sun, 30 Jan 2022 11:36:46 -0600 Subject: [PATCH] handling for more errors, new favicon --- _config.yml | 1 - src/App.js | 1 - src/features/discussion/Discussion.js | 8 ++------ src/features/sidebar/Sidebar.js | 12 +++++------- src/features/sidebar/SidebarItem.js | 10 +++++----- 5 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 _config.yml diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 2f7efbe..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-minimal \ No newline at end of file diff --git a/src/App.js b/src/App.js index 6c4b11d..bc93506 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,6 @@ import React from 'react'; import './App.css'; import Navbar from './features/navbar/Navbar'; -import Post from './features/posts/Post'; import Feed from './features/posts/Feed'; function App() { diff --git a/src/features/discussion/Discussion.js b/src/features/discussion/Discussion.js index bf20eee..b2dc6e2 100644 --- a/src/features/discussion/Discussion.js +++ b/src/features/discussion/Discussion.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import { useDispatch, /* useSelector */ } from 'react-redux'; import { unwrapResult } from '@reduxjs/toolkit'; -import { fetchComments, isPending } from '../posts/postsSlice'; +import { fetchComments } from '../posts/postsSlice'; import { v4 } from 'uuid'; export default function Discussion({permalink, isVisible}) { @@ -9,12 +9,8 @@ export default function Discussion({permalink, isVisible}) { const [data, setData] = useState(null); const dispatch = useDispatch(); - const isLoading = useSelector(isPending); - const formattedLink = permalink.substring(0,(permalink.length-1)); - let deps = [isVisible, data, setData, thread, setThread, formattedLink, dispatch]; - useEffect(() => { let isActive = true; if (isActive) { diff --git a/src/features/sidebar/Sidebar.js b/src/features/sidebar/Sidebar.js index 491ce2b..b64c2c2 100644 --- a/src/features/sidebar/Sidebar.js +++ b/src/features/sidebar/Sidebar.js @@ -1,18 +1,16 @@ import React, { useRef, useState } from "react"; -import { useSelector, useDispatch } from "react-redux"; +import { useSelector, /* useDispatch */ } from "react-redux"; import { selectAllSubs } from "../reddit/redditSlice"; import { v4 } from 'uuid'; import SidebarItem from "./SidebarItem"; import './Sidebar.css'; export default function Sidebar({isCollapsed}) { - const dispatch = useDispatch(); - const allSubs = useSelector(selectAllSubs); let arrayOfSubs = Object.keys(allSubs); - const [subs, setSubs] = useState(arrayOfSubs); - const [searchSubs, setSearchSubs] = useState(''); + // const [subs, setSubs] = useState(arrayOfSubs); // this piece of state to be used to modify state based on a dispatched action + const [searchSubs, setSearchSubs] = useState(''); // from sidebaritems when the visibility of a sub is toggled on/off const searchWindowStyle = useRef('search-inactive'); // this ref allows us to access and modify the class of the search window container from another part of the render function @@ -31,8 +29,8 @@ export default function Sidebar({isCollapsed}) { <> {/* isCollapsed is passed from the parent component, and is mutable within the navbar */}
- { - subs.map((sub) => { // Maps each sub to its own line within the sidebar, along with a button that toggles its "isSelected" property + { // arrayOfSubs will become subs from useState on implementation of useState + arrayOfSubs.map((sub) => { // Maps each sub to its own line within the sidebar, along with a button that toggles its "isSelected" property return ( ) diff --git a/src/features/sidebar/SidebarItem.js b/src/features/sidebar/SidebarItem.js index a9658c5..5454eb6 100644 --- a/src/features/sidebar/SidebarItem.js +++ b/src/features/sidebar/SidebarItem.js @@ -1,10 +1,10 @@ -import React, { useEffect, useState } from "react"; -import { useDispatch } from "react-redux"; -import { updateSubVisibility } from "../reddit/redditSlice"; +import React, { useState } from "react"; +// import { useDispatch } from "react-redux"; +// import { updateSubVisibility } from "../reddit/redditSlice"; export default function SidebarItem({sub}) { - const [visible, setVisible] = useState('hide'); - const dispatch = useDispatch(); + const [visible, setVisible] = useState('hide'); // dispatch will be used to dispatch updateSubVisibility on change in state + // const dispatch = useDispatch(); // this will likely be within a useEffect hook const handleClick = () => { if (visible === 'hide') {