search redirections, games in landing image fetch, updated filters behavior in the search page, social nav active button switch #40

Merged
freakoverse merged 8 commits from staging into master 2024-09-23 10:53:18 +00:00
Showing only changes of commit 6a087e659c - Show all commits

View File

@ -51,6 +51,7 @@ interface FilterOptions {
sort: SortByEnum
moderated: ModeratedFilterEnum
searching: SearchingFilterEnum
source: string
}
export const SearchPage = () => {
@ -61,6 +62,7 @@ export const SearchPage = () => {
const [filterOptions, setFilterOptions] = useState<FilterOptions>({
sort: SortByEnum.Latest,
moderated: ModeratedFilterEnum.Moderated,
source: window.location.host,
searching:
(searchParams.get('searching') as SearchingFilterEnum) ||
SearchingFilterEnum.Mods
@ -164,6 +166,7 @@ const Filters = React.memo(
return (
<div className='IBMSecMain'>
<div className='FiltersMain'>
{filterOptions.searching === SearchingFilterEnum.Mods && (
<div className='FiltersMainElement'>
<div className='dropdown dropdownMain'>
<button
@ -193,6 +196,10 @@ const Filters = React.memo(
</div>
</div>
</div>
)}
{(filterOptions.searching === SearchingFilterEnum.Mods ||
filterOptions.searching === SearchingFilterEnum.Users) && (
<div className='FiltersMainElement'>
<div className='dropdown dropdownMain'>
<button
@ -231,6 +238,49 @@ const Filters = React.memo(
</div>
</div>
</div>
)}
{filterOptions.searching === SearchingFilterEnum.Mods && (
<div className='FiltersMainElement'>
<div className='dropdown dropdownMain'>
<button
className='btn dropdown-toggle btnMain btnMainDropdown'
aria-expanded='false'
data-bs-toggle='dropdown'
type='button'
>
{filterOptions.source === window.location.host
? `Show From: ${filterOptions.source}`
: 'Show All'}
</button>
<div className='dropdown-menu dropdownMainMenu'>
<div
className='dropdown-item dropdownMainMenuItem'
onClick={() =>
setFilterOptions((prev) => ({
...prev,
source: window.location.host
}))
}
>
Show From: {window.location.host}
</div>
<div
className='dropdown-item dropdownMainMenuItem'
onClick={() =>
setFilterOptions((prev) => ({
...prev,
source: 'Show All'
}))
}
>
Show All
</div>
</div>
</div>
</div>
)}
<div className='FiltersMainElement'>
<div className='dropdown dropdownMain'>
<button
@ -353,6 +403,11 @@ const ModsResult = ({
const filteredModList = useMemo(() => {
let filtered: ModDetails[] = [...filteredMods]
if (filterOptions.source === window.location.host) {
filtered = filtered.filter((mod) => mod.rTag === window.location.host)
}
const isAdmin = userState.user?.npub === import.meta.env.VITE_REPORTING_NPUB
const isUnmoderatedFully =
filterOptions.moderated === ModeratedFilterEnum.Unmoderated_Fully
@ -386,6 +441,7 @@ const ModsResult = ({
userState.user?.npub,
filterOptions.sort,
filterOptions.moderated,
filterOptions.source,
muteLists
])