From dd5187eec4aa8e1a4894a506675f1f0714871238 Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Mon, 2 Sep 2024 17:15:43 -0500 Subject: [PATCH] Styling and url fixes for feeds --- src/components/BottomBar.js | 2 +- src/components/navbar/Navbar.js | 58 ------------------------------- src/components/sidebar/Sidebar.js | 2 +- src/pages/_app.js | 1 + src/pages/feed/index.js | 41 +++++++++++++++++++++- src/styles/custom-theme.css | 16 +++++++++ 6 files changed, 59 insertions(+), 61 deletions(-) create mode 100644 src/styles/custom-theme.css diff --git a/src/components/BottomBar.js b/src/components/BottomBar.js index bc8c68b..05c9d2a 100644 --- a/src/components/BottomBar.js +++ b/src/components/BottomBar.js @@ -17,7 +17,7 @@ const BottomBar = () => {
router.push('/content')} className={`cursor-pointer p-2 rounded-lg ${isActive('/content') ? 'bg-gray-700' : ''}`}>
-
router.push('/feed')} className={`cursor-pointer p-2 rounded-lg ${isActive('/feed') ? 'bg-gray-700' : ''}`}> +
router.push('/feed?channel=global')} className={`cursor-pointer p-2 rounded-lg ${isActive('/feed?channel=global') ? 'bg-gray-700' : ''}`}>
diff --git a/src/components/navbar/Navbar.js b/src/components/navbar/Navbar.js index f736186..e0fa823 100644 --- a/src/components/navbar/Navbar.js +++ b/src/components/navbar/Navbar.js @@ -12,69 +12,11 @@ import 'primeicons/primeicons.css'; const Navbar = () => { const router = useRouter(); - const [visible, setVisible] = useState(false); - const menu = useRef(null); const navbarHeight = '60px'; - const menuItems = [ - { - label: 'Home', - icon: 'pi pi-home', - command: () => { - // Add your edit functionality here - } - }, - { - label: 'Content', - icon: 'pi pi-video', - command: () => { - // Add your delete functionality here - } - }, - { - label: 'Chat', - icon: 'pi pi-comment', - items: [ - { - label: 'General', - icon: 'pi pi-hashtag', - command: () => { - // Add your edit functionality here - } - }, - { - label: 'Nostr', - icon: 'pi pi-hashtag', - command: () => { - // Add your delete functionality here - } - }, - { - label: 'Discord', - icon: 'pi pi-hashtag', - command: () => { - // Add your delete functionality here - } - }, - { - label: 'Stackernews', - icon: 'pi pi-hashtag', - command: () => { - // Add your delete functionality here - } - } - ] - } - ]; - const start = (
- {/*
- menu.current.toggle(e)}> - -
*/}
router.push('/')} className="flex flex-row items-center justify-center cursor-pointer"> logo { }; return ( -
+
router.push('/')} className={`w-full flex flex-row items-center cursor-pointer py-2 my-2 hover:bg-gray-700 rounded-lg ${isActive('/') ? 'bg-gray-700' : ''}`}>

Home

diff --git a/src/pages/_app.js b/src/pages/_app.js index 4bade9e..c83bd5e 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -6,6 +6,7 @@ import { SessionProvider } from "next-auth/react" import Layout from '@/components/Layout'; import '@/styles/globals.css' import 'primereact/resources/themes/lara-dark-blue/theme.css' +import '@/styles/custom-theme.css'; // custom theme import 'primereact/resources/primereact.min.css'; import 'primeicons/primeicons.css'; import "@uiw/react-md-editor/markdown-editor.css"; diff --git a/src/pages/feed/index.js b/src/pages/feed/index.js index 87cada1..32c4d88 100644 --- a/src/pages/feed/index.js +++ b/src/pages/feed/index.js @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import Image from 'next/image'; import { InputText } from 'primereact/inputtext'; import CommunityMenuTab from '@/components/menutab/CommunityMenuTab'; import NostrFeed from './nostr'; @@ -6,9 +7,15 @@ import DiscordFeed from './discord'; import StackerNewsFeed from './stackernews'; import GlobalFeed from './global'; import { useRouter } from 'next/router'; +import { Message } from 'primereact/message'; +import { Tag } from 'primereact/tag'; +import StackerNewsIcon from '../../../public/sn.svg'; +import NostrIcon from '../../../public/nostr.png'; + const Feed = () => { const [selectedTopic, setSelectedTopic] = useState('global'); const [searchQuery, setSearchQuery] = useState(''); + const [title, setTitle] = useState('Community'); const allTopics = ['global', 'nostr', 'discord', 'stackernews']; const router = useRouter(); @@ -18,15 +25,47 @@ const Feed = () => { router.push(`/feed?channel=${topic}`); }; + useEffect(() => { + setTitle(router.query.channel); + }, [router.query.channel]); + // initialize the selected topic to the query parameter useEffect(() => { setSelectedTopic(router.query.channel); }, [router.query.channel]); + const getTagIcon = (topic) => { + switch (topic) { + case 'global': + return 'pi pi-globe'; + case 'nostr': + return Nostr; + case 'discord': + return 'pi pi-discord'; + case 'stackernews': + return StackerNews; + default: + return 'pi pi-globe'; + } + }; + return (
-

Community

+
+

Community

+ +
setSearchQuery(e.target.value)} diff --git a/src/styles/custom-theme.css b/src/styles/custom-theme.css new file mode 100644 index 0000000..1b005ed --- /dev/null +++ b/src/styles/custom-theme.css @@ -0,0 +1,16 @@ +:root { + --green-500: #16a34a; /* Slightly darker green */ + --green-600: #15803d; /* Corresponding darker shade */ + --green-700: #166534; /* Corresponding even darker shade */ + } + +/* tags */ +.p-tag.p-tag-success { + background: var(--green-500); + color: #fff; + } + + .p-tag.p-tag-success:not(a) { + background: var(--green-500); + color: #fff; + }