From 38eb1669538116e3ed19d8b7870eb9be4dfbf00d Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 17 Mar 2026 21:21:37 +0000 Subject: [PATCH] WeedChat --- frontend/src/menuAside.ts | 10 ++++- frontend/src/pages/timeline.tsx | 72 +++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 frontend/src/pages/timeline.tsx diff --git a/frontend/src/menuAside.ts b/frontend/src/menuAside.ts index d1d6eeb..20aadac 100644 --- a/frontend/src/menuAside.ts +++ b/frontend/src/menuAside.ts @@ -8,6 +8,12 @@ const menuAside: MenuAsideItem[] = [ label: 'Dashboard', }, + { + href: '/timeline', + icon: icon.mdiViewDashboard, + label: 'Timeline', + }, + { href: '/users/users-list', label: 'Users', @@ -42,7 +48,7 @@ const menuAside: MenuAsideItem[] = [ }, { href: '/timeline_posts/timeline_posts-list', - label: 'Timeline posts', + label: 'Timeline posts (Admin)', // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore icon: 'mdiPostOutline' in icon ? icon['mdiPostOutline' as keyof typeof icon] : icon.mdiTable ?? icon.mdiTable, @@ -136,4 +142,4 @@ const menuAside: MenuAsideItem[] = [ }, ] -export default menuAside +export default menuAside \ No newline at end of file diff --git a/frontend/src/pages/timeline.tsx b/frontend/src/pages/timeline.tsx new file mode 100644 index 0000000..523e3fc --- /dev/null +++ b/frontend/src/pages/timeline.tsx @@ -0,0 +1,72 @@ +import { mdiViewDashboard, mdiPlus } from '@mdi/js'; +import Head from 'next/head'; +import React, { ReactElement, useEffect, useState } from 'react'; +import CardBox from '../components/CardBox'; +import LayoutAuthenticated from '../layouts/Authenticated'; +import SectionMain from '../components/SectionMain'; +import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton'; +import FormField from '../components/FormField'; +import BaseButton from '../components/BaseButton'; +import { useAppDispatch, useAppSelector } from '../stores/hooks'; +import { fetch, create } from '../stores/timeline_posts/timeline_postsSlice'; +import { getPageTitle } from '../config'; + +const TimelinePage = () => { + const dispatch = useAppDispatch(); + const { timeline_posts, loading } = useAppSelector((state) => state.timeline_posts); + const [content, setContent] = useState(''); + + useEffect(() => { + dispatch(fetch({})); + }, [dispatch]); + + const handlePost = () => { + if (!content.trim()) return; + dispatch(create({ content })).then(() => { + setContent(''); + dispatch(fetch({})); + }); + }; + + return ( + <> + + {getPageTitle('Timeline')} + + + + + + +