feat: pagination in nav

This commit is contained in:
Wentao Lyu 2023-03-15 04:05:14 +08:00
parent 71fc86b9a6
commit 8289558d94
8 changed files with 84 additions and 46 deletions

View file

@ -7,7 +7,7 @@ import { setText } from '~/store/textSlice';
export default function MobileNav({ setNavVisible }) {
const dispatch = useDispatch();
const { conversationId, convos } = useSelector((state) => state.convo);
const { conversationId, convos, title } = useSelector((state) => state.convo);
const toggleNavVisible = () => {
setNavVisible((prev) => {
@ -22,8 +22,6 @@ export default function MobileNav({ setNavVisible }) {
dispatch(setSubmission({}));
}
const title = convos?.find(element => element?.conversationId == conversationId)?.title || 'New Chat';
return (
<div className="sticky top-0 z-10 flex items-center border-b border-white/20 bg-gray-800 pl-1 pt-1 text-gray-200 sm:pl-3 md:hidden">
<button
@ -64,7 +62,7 @@ export default function MobileNav({ setNavVisible }) {
/>
</svg>
</button>
<h1 className="flex-1 text-center text-base font-normal">{title}</h1>
<h1 className="flex-1 text-center text-base font-normal">{title || 'New Chat'}</h1>
<button
type="button"
className="px-3"