Skip to content

Commit

Permalink
Merge pull request #57 from the-collab-lab/revert-44-ma/view-list-name
Browse files Browse the repository at this point in the history
Revert "Issue #43 Users should be  able to view the list name"
  • Loading branch information
eternalmaha authored Oct 3, 2024
2 parents 36baf23 + 384722e commit cfb98ff
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 245 deletions.
4 changes: 0 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ export function App() {
path="/list"
element={<List data={data} listPath={listPath} />}
/>
<Route
path="/list/:listName"
element={<List data={data} listPath={listPath} />}
/>
<Route
path="/manage-list"
element={<ManageList listPath={listPath} data={data || []} />}
Expand Down
35 changes: 0 additions & 35 deletions src/components/AuthenticatedNavBar 2.css

This file was deleted.

4 changes: 3 additions & 1 deletion src/components/AuthenticatedNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export function AuthenticatedNavBar() {
<NavLink to="/" className="Nav__link" aria-label="Home">
Home
</NavLink>

<NavLink to="/list" className="Nav__link" aria-label="List">
List
</NavLink>
<NavLink
to="/manage-list"
className="Nav__link"
Expand Down
3 changes: 1 addition & 2 deletions src/components/CreateList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export function CreateList({ user, setListPath }: Props) {
toast.success("Success: Your New List is Created!");
// Delay for toast notification before redirecting
setTimeout(() => {
const listName = path.split("/").pop();
navigate(`/list/${listName}`);
navigate("/list");
}, 1500); // 1.5 seconds delay
} catch (error) {
console.error("Error creating list:", error);
Expand Down
15 changes: 0 additions & 15 deletions src/components/ListItem 2.css

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/SingleList 2.css

This file was deleted.

15 changes: 6 additions & 9 deletions src/components/SingleList.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@

import "./SingleList.css";
import * as api from "../api/firebase";
import Button from "react-bootstrap/Button";
import "./SingleList.scss";
import { useNavigate } from "react-router-dom";

export function SingleList({ name }: { name: string }) {
const navigate = useNavigate();

interface Props extends Pick<api.List, "name" | "path"> {
setListPath: (path: string) => void;
}

export function SingleList({ name, path, setListPath }: Props) {
function handleClick() {
setTimeout(() => {
navigate(`/list/${name}`);
}, 200);
setListPath(path);
}

return (
Expand Down
5 changes: 1 addition & 4 deletions src/components/forms/AddItemForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ export function AddItemForm({ listPath, data: unfilteredListItems }: Props) {
}
};
const navigateToListPage = () => {
if (listPath) {
const listName = listPath.split("/").pop();
navigate(`/list/${listName}`);
}
navigate("/list");
};

return (
Expand Down
101 changes: 0 additions & 101 deletions src/index 2.css

This file was deleted.

Empty file removed src/views/Home 2.css
Empty file.
19 changes: 0 additions & 19 deletions src/views/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import React from "react";
import "./Home.css";
import { SingleList, CreateList } from "../components";
import { List, User } from "../api/firebase";

import "./Home.scss";
import { List, User } from "../api";
import { AuthenticatedHome, UnauthenticatedHome } from "../views";
Expand All @@ -16,21 +12,6 @@ interface Props {
export function Home({ data, setListPath, user }: Props) {
return (
<>

<div className="Home">
<p>
Hello from the home (<code>/</code>) page!
</p>
{user && (
<ul>
{data.map((list, index) => (
<SingleList key={index} name={list.name} />
))}

<CreateList user={user} setListPath={setListPath} />
</ul>
)}
</div>
{user ? (
<AuthenticatedHome data={data} setListPath={setListPath} user={user} />
) : (
Expand Down
36 changes: 0 additions & 36 deletions src/views/Layout 2.css

This file was deleted.

10 changes: 1 addition & 9 deletions src/views/authenticated/List.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useParams, useNavigate } from "react-router-dom";
import { useState, useMemo } from "react";
import { ListItemCheckBox } from "../../components/ListItem";
import { FilterListInput } from "../../components/FilterListInput";
import { ListItem, comparePurchaseUrgency } from "../../api";
import { useNavigate } from "react-router-dom";
import Button from "react-bootstrap/Button";

interface Props {
Expand All @@ -12,7 +12,6 @@ interface Props {

export function List({ data: unfilteredListItems, listPath }: Props) {
const navigate = useNavigate();
const { listName } = useParams<{ listName: string }>();
const [searchTerm, setSearchTerm] = useState<string>("");

const filteredListItems = useMemo(() => {
Expand All @@ -39,9 +38,6 @@ export function List({ data: unfilteredListItems, listPath }: Props) {
if (unfilteredListItems.length === 0) {
return (
<>

<h1>{listName}</h1>

<Header />
<section>
<h3>
Expand All @@ -63,9 +59,6 @@ export function List({ data: unfilteredListItems, listPath }: Props) {
// Main content when list is not empty
return (
<>

<h1>{listName}</h1>

<Header />

<section className="sticky-top bg-dark">
Expand All @@ -83,7 +76,6 @@ export function List({ data: unfilteredListItems, listPath }: Props) {
{"Add items"}
</Button>
</section>

<section>
{filteredListItems.map((item) => (
<ListItemCheckBox key={item.id} item={item} listPath={listPath} />
Expand Down

0 comments on commit cfb98ff

Please sign in to comment.