ui(frontend-admin): 💄 Add recent posts widget and enhance post listing table with filters and sorting in admin dashboard
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
5c7257e278
commit
ff87a858bb
2 changed files with 10 additions and 9 deletions
|
|
@ -158,8 +158,8 @@ export const DashboardPage = () => {
|
|||
<Header>
|
||||
<Title>Dashboard</Title>
|
||||
<QuickActions>
|
||||
<Button to="/posts/new">New Post</Button>
|
||||
<Button to="/series">New Series</Button>
|
||||
<Button to="/content/blog/posts/new">New Post</Button>
|
||||
<Button to="/content/blog/series">New Series</Button>
|
||||
</QuickActions>
|
||||
</Header>
|
||||
|
||||
|
|
@ -181,12 +181,12 @@ export const DashboardPage = () => {
|
|||
<Section>
|
||||
<SectionHeader>
|
||||
<SectionTitle>Recent Drafts</SectionTitle>
|
||||
<ViewAllLink to="/posts?status=draft">View all</ViewAllLink>
|
||||
<ViewAllLink to="/content/blog/posts?status=draft">View all drafts</ViewAllLink>
|
||||
</SectionHeader>
|
||||
<PostList>
|
||||
{drafts?.data.length ? (
|
||||
drafts.data.map((post: PostSummary) => (
|
||||
<PostItem key={post.id} to={`/posts/${post.id}/edit`}>
|
||||
<PostItem key={post.id} to={`/content/blog/posts/${post.id}/edit`}>
|
||||
<PostTitle>{post.title}</PostTitle>
|
||||
<PostStatusBadge status={post.status} />
|
||||
<PostDate>{format(new Date(post.updatedAt), 'MMM d, yyyy')}</PostDate>
|
||||
|
|
@ -201,12 +201,12 @@ export const DashboardPage = () => {
|
|||
<Section>
|
||||
<SectionHeader>
|
||||
<SectionTitle>Scheduled Posts</SectionTitle>
|
||||
<ViewAllLink to="/posts?status=scheduled">View all</ViewAllLink>
|
||||
<ViewAllLink to="/content/blog/posts?status=scheduled">View all scheduled</ViewAllLink>
|
||||
</SectionHeader>
|
||||
<PostList>
|
||||
{scheduled?.data.length ? (
|
||||
scheduled.data.map((post: PostSummary) => (
|
||||
<PostItem key={post.id} to={`/posts/${post.id}/edit`}>
|
||||
<PostItem key={post.id} to={`/content/blog/posts/${post.id}/edit`}>
|
||||
<PostTitle>{post.title}</PostTitle>
|
||||
<PostStatusBadge status={post.status} />
|
||||
<PostDate>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useState } from 'react';
|
||||
import { Link, useSearchParams } from '@lilith/ui-router';
|
||||
import { Link, useSearchParams, useNavigate } from '@lilith/ui-router';
|
||||
import styled from '@lilith/ui-styled-components';
|
||||
import { format } from 'date-fns';
|
||||
import { usePosts } from '../api/posts';
|
||||
|
|
@ -219,6 +219,7 @@ const STATUS_TABS: Array<{ label: string; value: PostStatus | 'all' }> = [
|
|||
const DOMAINS = ['all', 'atlilith.com', 'trustedmeet.com', '*'];
|
||||
|
||||
export const PostListPage = () => {
|
||||
const navigate = useNavigate();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [search, setSearch] = useState(searchParams.get('search') || '');
|
||||
|
||||
|
|
@ -269,7 +270,7 @@ export const PostListPage = () => {
|
|||
<Container>
|
||||
<Header>
|
||||
<Title>Posts</Title>
|
||||
<NewPostButton to="/posts/new">New Post</NewPostButton>
|
||||
<NewPostButton to="/content/blog/posts/new">New Post</NewPostButton>
|
||||
</Header>
|
||||
|
||||
<Filters>
|
||||
|
|
@ -333,7 +334,7 @@ export const PostListPage = () => {
|
|||
{data.data.map((post: PostSummary) => {
|
||||
const author = authors?.find((a) => a.id === post.authorId);
|
||||
return (
|
||||
<Tr key={post.id} onClick={() => (window.location.href = `/admin/blog/posts/${post.id}/edit`)}>
|
||||
<Tr key={post.id} onClick={() => navigate(`/content/blog/posts/${post.id}/edit`)}>
|
||||
<PostTitleCell>{post.title}</PostTitleCell>
|
||||
<Td>
|
||||
<PostStatusBadge status={post.status} />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue