session state simplification

This commit is contained in:
2026-01-12 09:24:58 -05:00
parent ed16b277f7
commit f68f1f462a
32 changed files with 132 additions and 381 deletions

View File

@@ -10,7 +10,7 @@ export interface Tag {
export interface PostSortingProps {
posts: PostCardData[];
tags: Tag[];
privilegeLevel: "anonymous" | "admin" | "user";
isAdmin: boolean;
filters?: string;
sort?: string;
include?: string;
@@ -36,7 +36,7 @@ export default function PostSorting(props: PostSortingProps) {
const filteredPosts = createMemo(() => {
let filtered = props.posts;
if (props.privilegeLevel === "admin" && props.status) {
if (props.isAdmin && props.status) {
if (props.status === "published") {
filtered = filtered.filter((post) => post.published === 1);
} else if (props.status === "unpublished") {
@@ -141,11 +141,7 @@ export default function PostSorting(props: PostSortingProps) {
<For each={sortedPosts()}>
{(post, index) => (
<div class="my-4">
<Card
post={post}
privilegeLevel={props.privilegeLevel}
index={index()}
/>
<Card post={post} isAdmin={props.isAdmin} index={index()} />
</div>
)}
</For>