mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Fix search bar navigation and disclaimer modal behavior
This commit is contained in:
@@ -37,13 +37,10 @@ const useDisclaimerModalStore = create<DisclaimerModalState>((set) => ({
|
||||
// Check if user has already accepted the disclaimer
|
||||
if (hasAcceptedDisclaimer()) {
|
||||
// If there's a valid board path, navigate directly
|
||||
if (boardPath) {
|
||||
navigate(`/${boardPath}`);
|
||||
return;
|
||||
const path = boardPath || address;
|
||||
if (path) {
|
||||
navigate(`/${path}`);
|
||||
}
|
||||
// If no board path (placeholder), don't navigate - we'll handle this separately
|
||||
// Don't show disclaimer modal either since it's already accepted
|
||||
// Caller should handle showing directory modal or other UI
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ import useSubplebbitsStats from '../../hooks/use-subplebbits-stats';
|
||||
import PopularThreadsBox from './popular-threads-box';
|
||||
import BoardsList from './boards-list';
|
||||
import Version from '../../components/version';
|
||||
import useDisclaimerModalStore from '../../stores/use-disclaimer-modal-store';
|
||||
import useDirectoryModalStore from '../../stores/use-directory-modal-store';
|
||||
import DisclaimerModal from '../../components/disclaimer-modal';
|
||||
import DirectoryModal from '../../components/directory-modal';
|
||||
import { getBoardPath } from '../../lib/utils/route-utils';
|
||||
import _ from 'lodash';
|
||||
|
||||
// https://github.com/plebbit/lists/blob/master/5chan-multisub.json
|
||||
@@ -20,13 +20,14 @@ const SearchBar = () => {
|
||||
const searchInputRef = useRef<HTMLInputElement>(null);
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const { showDisclaimerModal } = useDisclaimerModalStore();
|
||||
const defaultSubplebbits = useDefaultSubplebbits();
|
||||
|
||||
const handleSearchSubmit = (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
const searchInput = searchInputRef.current?.value;
|
||||
if (searchInput) {
|
||||
showDisclaimerModal(searchInput, navigate);
|
||||
const boardPath = getBoardPath(searchInput, defaultSubplebbits);
|
||||
navigate(`/${boardPath}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user