more refactoring

This commit is contained in:
2024-07-02 09:08:49 +02:00
parent de148eaf19
commit 1971966099
27 changed files with 400 additions and 324 deletions
+14 -14
View File
@@ -4,7 +4,13 @@ import EntityManagementTable from "../EntityManagementTable";
import toast from "react-hot-toast";
import { EditorRenderer, EditorState, PostTableCallbacks } from "./PostEditor";
import { Attributes, InferAttributes } from "@sequelize/core";
import { Project, Post, Bucket, User, PostAttributesWithBuckets } from "@/models";
import {
Project,
Post,
Bucket,
User,
PostAttributesWithBuckets,
} from "@/models";
import { handleActionResult } from "@/app/lib/actions/clientActionHandler";
import {
@@ -13,16 +19,15 @@ import {
PostServerActions,
} from "@/app/lib/actions/entityManagement/post/postActions";
import { PostViewProps } from "@/views/admin/ClientPostView";
import { aifa } from "@/util/Utils";
import { StateHook } from "@/util/state/stateUtils";
import { aifa } from "@/util/utils";
import { StateHook } from "@/util/state";
export type PostTableStateProps = {
posts:StateHook<GetPostsAttributes[]>,
editor:StateHook<EditorState>
}
export type PostTableProps = PostViewProps & {state:PostTableStateProps};
posts: StateHook<GetPostsAttributes[]>;
editor: StateHook<EditorState>;
};
export type PostTableProps = PostViewProps & { state: PostTableStateProps };
export default function PostTable({
children,
@@ -32,8 +37,6 @@ export default function PostTable({
actions,
state,
}: PostTableProps) {
// Define editor controls
const editorControls = {
closeEditor: () => {
@@ -93,10 +96,7 @@ export default function PostTable({
};
return (
<EntityManagementTable
entityName="Post"
headings={headings}
>
<EntityManagementTable entityName="Post" headings={headings}>
{state.posts.state.map((post: GetPostsAttributes) => (
<React.Fragment key={`postrow-${post.id}`}>
<tr>