mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Make "tabs" work for Mentions page in Columns mode
This commit is contained in:
parent
8112f0a9d6
commit
6f28db2532
1 changed files with 19 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
import { useMemo, useRef } from 'preact/hooks';
|
||||
import { useMemo, useRef, useState } from 'preact/hooks';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
|
||||
import Link from '../components/link';
|
||||
|
@ -14,7 +14,8 @@ function Mentions({ columnMode, ...props }) {
|
|||
useTitle('Mentions', '/mentions');
|
||||
const { masto, instance } = api();
|
||||
const [searchParams] = columnMode ? [emptySearchParams] : useSearchParams();
|
||||
const type = props?.type || searchParams.get('type');
|
||||
const [stateType, setStateType] = useState(null);
|
||||
const type = props?.type || searchParams.get('type') || stateType;
|
||||
|
||||
const mentionsIterator = useRef();
|
||||
const latestItem = useRef();
|
||||
|
@ -127,12 +128,27 @@ function Mentions({ columnMode, ...props }) {
|
|||
const TimelineStart = useMemo(() => {
|
||||
return (
|
||||
<div class="filter-bar centered">
|
||||
<Link to="/mentions" class={!type ? 'is-active' : ''}>
|
||||
<Link
|
||||
to="/mentions"
|
||||
class={!type ? 'is-active' : ''}
|
||||
onClick={(e) => {
|
||||
if (columnMode) {
|
||||
e.preventDefault();
|
||||
setStateType(null);
|
||||
}
|
||||
}}
|
||||
>
|
||||
All
|
||||
</Link>
|
||||
<Link
|
||||
to="/mentions?type=private"
|
||||
class={type === 'private' ? 'is-active' : ''}
|
||||
onClick={(e) => {
|
||||
if (columnMode) {
|
||||
e.preventDefault();
|
||||
setStateType('private');
|
||||
}
|
||||
}}
|
||||
>
|
||||
Private
|
||||
</Link>
|
||||
|
|
Loading…
Reference in a new issue