From ec4c434b66490b49a77406176c994c6796c9ad86 Mon Sep 17 00:00:00 2001 From: freakoverse Date: Fri, 20 Sep 2024 22:56:06 +0000 Subject: [PATCH 1/8] added a new classes for comments --- src/styles/comments.css | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/styles/comments.css b/src/styles/comments.css index 430dfce..7aa5628 100644 --- a/src/styles/comments.css +++ b/src/styles/comments.css @@ -497,3 +497,79 @@ hover { padding: 5px 10px; height: 100%; } + +.IBMSMSMBSSCL_CommentRepost { + width: 100%; + display: flex; + flex-direction: row; + grid-gap: 0px; + margin-bottom: -5px; +} + +.IBMSMSMBSSCL_CommentRepostVisual { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 50px; + color: rgba(255,255,255,0.51); +} + +.IBMSMSMBSSCL_CommentRepostText { + display: flex; + flex-direction: row; + grid-gap: 5px; + color: rgba(255,255,255,0.5); + width: 100%; + background: rgba(255,255,255,0.05); + padding: 5px 15px; + border-radius: 5px; +} + +.IBMSMSMBSSCL_CommentRepostText > a { + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + -webkit-line-clamp: 1; + max-width: 200px; +} + +.IBMSMSMBSSCL_CommentWrapper { + display: flex; + flex-direction: column; + grid-gap: 15px; + width: 100%; +} + +.IBMSMSMBSSCL_CommentQP { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15px; + border-radius: 10px; + border: solid 1px rgba(255,255,255,0.1); + background: rgba(0,0,0,0.15); +} + +.IBMSMSMBSSCL_CBExpand { + transition: ease 0.3s; + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + padding: 5px 15px; + background: rgba(255,255,255,0); + border-radius: 5px; + text-align: center; + font-size: 12px; + color: rgba(255,255,255,0.25); + line-height: 1.5; + cursor: pointer; +} + +.IBMSMSMBSSCL_CBExpand:hover { + transition: ease 0.3s; + background: rgba(255,255,255,0.05); + color: rgba(255,255,255,0.25); +} From 64b5c7194f87c0cbbf74510b4dca535af5553f66 Mon Sep 17 00:00:00 2001 From: daniyal Date: Mon, 23 Sep 2024 13:55:18 +0500 Subject: [PATCH 2/8] fix: redirect from mods page to search page on searching --- src/pages/mods.tsx | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/pages/mods.tsx b/src/pages/mods.tsx index 7f9982c..8503802 100644 --- a/src/pages/mods.tsx +++ b/src/pages/mods.tsx @@ -6,14 +6,16 @@ import React, { useCallback, useEffect, useMemo, + useRef, useState } from 'react' +import { createSearchParams, useNavigate } from 'react-router-dom' import { LoadingSpinner } from '../components/LoadingSpinner' import { ModCard } from '../components/ModCard' import { MOD_FILTER_LIMIT } from '../constants' import { MetadataController } from '../controllers' import { useAppSelector, useDidMount, useMuteLists } from '../hooks' -import { getModPageRoute } from '../routes' +import { appRoutes, getModPageRoute } from '../routes' import '../styles/filters.css' import '../styles/pagination.css' import '../styles/search.css' @@ -227,6 +229,27 @@ export const ModsPage = () => { } const PageTitleRow = React.memo(() => { + const navigate = useNavigate() + const searchTermRef = useRef(null) + + const handleSearch = () => { + const value = searchTermRef.current?.value || '' // Access the input value from the ref + if (value !== '') { + const searchParams = createSearchParams({ + searchTerm: value, + searching: 'Mods' + }) + navigate({ pathname: appRoutes.search, search: `?${searchParams}` }) + } + } + + // Handle "Enter" key press inside the input + const handleKeyDown = (event: React.KeyboardEvent) => { + if (event.key === 'Enter') { + handleSearch() + } + } + return (
@@ -236,8 +259,19 @@ const PageTitleRow = React.memo(() => {
- - + {filterOptions.searching === SearchingFilterEnum.Mods && ( +
+
+ -
- {Object.values(SortByEnum).map((item, index) => ( -
- setFilterOptions((prev) => ({ - ...prev, - sort: item - })) - } - > - {item} -
- ))} -
-
-
-
-
- -
- {Object.values(ModeratedFilterEnum).map((item, index) => { - if (item === ModeratedFilterEnum.Unmoderated_Fully) { - const isAdmin = - userState.user?.npub === - import.meta.env.VITE_REPORTING_NPUB - - if (!isAdmin) return null - } - - return ( +
+ {Object.values(SortByEnum).map((item, index) => (
setFilterOptions((prev) => ({ ...prev, - moderated: item + sort: item })) } > {item}
- ) - })} + ))} +
-
+ )} + + {(filterOptions.searching === SearchingFilterEnum.Mods || + filterOptions.searching === SearchingFilterEnum.Users) && ( +
+
+ +
+ {Object.values(ModeratedFilterEnum).map((item, index) => { + if (item === ModeratedFilterEnum.Unmoderated_Fully) { + const isAdmin = + userState.user?.npub === + import.meta.env.VITE_REPORTING_NPUB + + if (!isAdmin) return null + } + + return ( +
+ setFilterOptions((prev) => ({ + ...prev, + moderated: item + })) + } + > + {item} +
+ ) + })} +
+
+
+ )} + + {filterOptions.searching === SearchingFilterEnum.Mods && ( +
+
+ +
+
+ setFilterOptions((prev) => ({ + ...prev, + source: window.location.host + })) + } + > + Show From: {window.location.host} +
+
+ setFilterOptions((prev) => ({ + ...prev, + source: 'Show All' + })) + } + > + Show All +
+
+
+
+ )} +