Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Trending Memes Sidebar #112

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Feed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Feed(props) {
const loadMoreRef = useIntersectionObserver(props.onLoadMore);
const triggerPoint = Math.max(0, props.notes.length - 10);
return (
<div className="feed-container bg-white mt-12 mx-auto max-w-xl lg:mr-60">
<div className="feed-container bg-white mt-12 mx-auto max-w-xl">
{props.notes.map((note, index) => (
<div key={note.id}>
<Posts note={note} />
Expand Down
8 changes: 4 additions & 4 deletions src/components/HashtagTool/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function Sidebar() {
: 'flex items-center px-4 py-2 mt-5 text-gray-700 hover:bg-gray-100 rounded-md';
};
return (
<aside className="hidden md:block md:w-64 bg-white p-5 sticky top-0 h-screen overflow-y-auto border-r z-50">
<h1 className="font-bungee px-4 py-2 text-xl">Category</h1>
<nav className="mt-8">
<aside className="hidden md:block md:w-1/5 bg-white p-5 sticky top-0 h-screen overflow-y-auto border-r z-50">
<h1 className="font-bungee px-4 py-2 text-xl ">Category</h1>
<nav className="mt-8 ">
<NavLink to="/" className={getNavLinkClass}>
<HomeSvg />
<span className="ml-3">Home</span>
Expand All @@ -40,7 +40,7 @@ function Sidebar() {
<div className="absolute bottom-0 left-0 w-full px-6 pb-6">
<button
type="button"
className="w-full py-3 text-white bg-gradient-to-r from-blue-500 to-teal-500 hover:from-pink-500 hover:to-yellow-500 focus:outline-none focus:ring-4 font-medium rounded-full text-md px-5 py-2.5 me-2 mb-2 flex items-center justify-center">
className="w-full py-3 text-white bg-gradient-to-r from-blue-500 to-teal-500 hover:from-pink-500 hover:to-yellow-500 focus:outline-none focus:ring-4 font-medium rounded-full text-md px-5 py-2.5 me-2 mb-2 flex items-center justify-center">
Get Started
</button>
</div>
Expand Down
110 changes: 110 additions & 0 deletions src/components/HashtagTool/TrendingSideBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { ReactComponent as SearchSVG } from '../../Icons/SearchIconBlack.svg';

function TrendingSidebar() {
const [searchQuery, setSearchQuery] = useState('');
const suggestions = [
'meme',
'nostr',
'grownstr',
'bitcoin',
'plebchain',
'siamstr',
'btc',
'privacy',
'security',
'memes',
'tunestr',
'music',
'coffeechain',
'press',
'presse',
'memestr',
'photography',
'funny',
'france',
'artstr',
'foodstr',
'news',
'btcprague',
'sats',
'zaps',
'china',
'permaculture',
'inflation',
'primal',
'plebs',
'permies',
'photestr',
'homesteading',
'bible',
'biblestr',
'christian',
'crypto',
'yestr',
'new',
'thainostrich',
'nostrich',
'wisdom',
'hodl',
'us',
'dance',
];
const navigate = useNavigate();
const handleTagClick = suggestions => {
navigate(`/search/${suggestions}`);
};

const handleSearchChange = event => {
setSearchQuery(event.target.value);
};

const handleSearchSubmit = event => {
event.preventDefault();
if (searchQuery.trim().length > 0) {
navigate(`/search/${searchQuery.trim()}`);
setSearchQuery('');
}
};

return (
<aside className="hidden lg:block w-1/3 bg-white p-2 sticky top-0 h-screen overflow-y-auto border-l border-gray-200 z-50 ">
<form
onSubmit={handleSearchSubmit}
className="hidden md:flex items-center w-80 px-2 ">
<div className="relative w-full">
<input
type="search"
className="pl-4 pr-8 py-2 w-full border border-gray-200 bg-slate-50 rounded-full focus:outline-none focus:border-grey-400 transition-shadow"
placeholder="Search..."
value={searchQuery}
onChange={handleSearchChange}
/>
<button
type="submit"
className="absolute right-2 top-1/2 transform -translate-y-1/2 bg-transparent text-gray-600 hover:text-gray-500 focus:text-gray-500 outline-none">
<SearchSVG className="h-6 w-6" />
</button>
</div>
</form>

<h2 className="text-2xl font-bold text-center pt-2 text-gray-900 mb-4 pr-32">
Trending Memes
</h2>

<div className="flex flex-wrap gap-2 p-2 mt-2 overflow-x-auto justify-center pr-32">
{suggestions.map((suggestion, index) => (
<button
key={index}
onClick={() => handleTagClick(suggestion)}
className="bg-gray-200 text-black rounded-full px-4 py-1 text-sm focus:outline-none "
style={{ flex: '0 0 auto' }}>
{suggestion}
</button>
))}
</div>
</aside>
);
}
export default TrendingSidebar;
5 changes: 4 additions & 1 deletion src/components/HashtagTool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { relayInit, SimplePool } from 'nostr-tools';
import Feed from '../Feed';
import PostUpload from '../Post/newPost';
import Spinner from '../Spinner';
import TrendingSidebar from './TrendingSideBar';
import Sidebar from './SideBar';
import { ReactComponent as UploadSvg } from '../../Icons/UploadSvg.svg';

Expand Down Expand Up @@ -298,7 +299,8 @@ export function HashtagTool() {
<button
onClick={showNewPostModal}
title="Upload"
className="hidden md:block fixed bottom-4 right-8 z-49 bg-gradient-to-r from-blue-500 to-teal-500 hover:from-pink-500 hover:to-yellow-500 w-14 h-14 rounded-full flex items-center justify-center text-white drop-shadow-lg hover:drop-shadow-2xl">
style={{ zIndex: 999 }}
className="hidden md:block fixed bottom-4 right-8 bg-gradient-to-r from-blue-500 to-teal-500 hover:from-pink-500 hover:to-yellow-500 w-14 h-14 rounded-full flex items-center justify-center text-white drop-shadow-lg hover:drop-shadow-2xl">
<UploadSvg className="m-auto h-6 w-6" />
</button>

Expand All @@ -309,6 +311,7 @@ export function HashtagTool() {
/>
)}
</main>
<TrendingSidebar />
</div>
</>
);
Expand Down
43 changes: 4 additions & 39 deletions src/components/Login/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import './profile.css';
import { generatePrivateKey, getPublicKey, nip19 } from 'nostr-tools';
import Menu from '../Menu';
import DropdownComponent from '../LoginDropDownComponent/DropDownComponent';
import { ReactComponent as Memestr } from '../../Icons/MemestrLogo.svg';
import { ReactComponent as SearchSVG } from '../../Icons/SearchIconBlack.svg';

export function generateNewKeys() {
const pk = generatePrivateKey();
Expand All @@ -22,20 +20,6 @@ function HeaderBar({ isSearchVisible }) {
const [prevScrollY, setPrevScrollY] = useState(0);
const scrollThreshold = 100;

const navigate = useNavigate();
const [searchQuery, setSearchQuery] = useState('');
const handleSearchChange = event => {
setSearchQuery(event.target.value);
};

const handleSearchSubmit = event => {
event.preventDefault();
if (searchQuery.trim().length > 0) {
navigate(`/search/${searchQuery.trim()}`);
setSearchQuery('');
}
};

useEffect(() => {
const handleScroll = () => {
const scrollY = window.scrollY;
Expand Down Expand Up @@ -73,33 +57,14 @@ function HeaderBar({ isSearchVisible }) {
<Menu />
</div>

<div className="flex basis-1/3 justify-center">
<div className="flex basis-1/3 justify-between items-center pl-20">
<Memestr />
</div>

<div className="flex basis-1/3 justify-end items-center">
<form
onSubmit={handleSearchSubmit}
className="hidden md:flex items-center w-42 px-2 ">
<div className="relative w-full">
<input
type="search"
className="pl-4 pr-8 py-2 w-full border border-gray-200 bg-slate-50 rounded-full focus:outline-none focus:border-grey-400 transition-shadow"
placeholder="Search..."
value={searchQuery}
onChange={handleSearchChange}
/>
<button
type="submit"
className="absolute right-2 top-1/2 transform -translate-y-1/2 bg-transparent text-gray-600 hover:text-gray-500 focus:text-gray-500 outline-none">
<SearchSVG className="h-6 w-6" />
</button>
</div>
</form>
<button className="hidden md:block">
<button className="hidden md:block pr-1">
<DropdownComponent />
</button>
</div>

<div className="flex basis-1/3 justify-end items-center"></div>
</header>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = {
},
colors: {
customBlue: '#09376B',
customGray: '#F7F9F9',
},
},
},
Expand Down
Loading