"use client"; import PostTable, { PostTableStateProps, } from "@/components/client/admin/PostTable"; import { GetPostsAttributes, PostServerActions, } from "@/app/lib/actions/entitymanagement/post/postActions"; import { EditorState } from "@/components/client/admin/PostEditor"; import { Project } from "@/models"; import { ReactNode, useState } from "react"; import { Attributes } from "@sequelize/core"; import { parseStateHook } from "@/util/state"; export type PostViewProps = { children?: ReactNode; headings: Array; posts: GetPostsAttributes[]; projects: Attributes[]; actions: PostServerActions; }; export function CPostView({ // children, headings, posts, projects, actions, }: PostViewProps) { // Init editor state. Make sure it is not opened by default const initEditorState: EditorState = { isEditorOpen: false, editorPost: posts[0], }; // Set up required state hooks const state: PostTableStateProps = { posts: parseStateHook(useState(posts)), editor: parseStateHook(useState(initEditorState)), }; return ( <> ); }