diff --git a/packages/app/src/pages/home/components/feed/index.jsx b/packages/app/src/pages/home/components/feed/index.jsx
index 8d72997b..2ba4a117 100644
--- a/packages/app/src/pages/home/components/feed/index.jsx
+++ b/packages/app/src/pages/home/components/feed/index.jsx
@@ -1,10 +1,115 @@
import React from "react"
+import { Skeleton } from "antd"
-import { PostCreator, PostsFeed } from "components"
+import { PostsList, PostCreator } from "components"
+import Post from "models/post"
-export default () => {
- return <>
-
-
- >
+import "./index.less"
+
+const emptyListRender = () => {
+ return
+}
+
+export default class Feed extends React.Component {
+ state = {
+ loading: true,
+ initialLoading: true,
+ hasMorePosts: true,
+ posts: [],
+ }
+
+ wsEvents = {
+ "post.new": async (data) => {
+ this.setState({
+ posts: [data, ...this.state.posts],
+ })
+ },
+ "post.delete": async (data) => {
+ this.setState({
+ posts: this.state.posts.filter((post) => post.id !== data.id),
+ })
+ }
+ }
+
+ loadData = async ({
+ trim,
+ replace = false
+ } = {}) => {
+ await this.setState({
+ loading: true,
+ })
+
+ // get posts from api
+ const result = await Post.getFeed({
+ trim: trim ?? this.state.posts.length,
+ })
+
+ console.log("Loaded data => \n", result)
+
+ if (result) {
+ if (result.length === 0) {
+ await this.setState({
+ hasMorePosts: false,
+ loading: false,
+ initialLoading: false,
+ })
+
+ return false
+ }
+
+ await this.setState({
+ posts: replace ? result : [...this.state.posts, ...result],
+ })
+ }
+
+ await this.setState({
+ loading: false,
+ })
+
+ if (this.state.initialLoading) {
+ await this.setState({
+ initialLoading: false,
+ })
+ }
+ }
+
+ componentDidMount = async () => {
+ await this.loadData()
+
+ Object.keys(this.wsEvents).forEach((event) => {
+ window.app.api.namespaces["main"].listenEvent(event, this.wsEvents[event])
+ })
+ }
+
+ componentWillUnmount = async () => {
+ Object.keys(this.wsEvents).forEach((event) => {
+ window.app.api.namespaces["main"].unlistenEvent(event, this.wsEvents[event])
+ })
+ }
+
+ render() {
+ return
+
+
+ {
+ this.state.initialLoading ?
:
+ }
+
+ }
}
\ No newline at end of file
diff --git a/packages/app/src/pages/home/components/feed/index.less b/packages/app/src/pages/home/components/feed/index.less
new file mode 100644
index 00000000..b6e805e5
--- /dev/null
+++ b/packages/app/src/pages/home/components/feed/index.less
@@ -0,0 +1,33 @@
+.feed {
+ display: flex;
+ flex-direction: column;
+
+ align-items: center;
+ justify-content: center;
+
+ width: 100%;
+
+ .feed_header {
+ display: flex;
+ flex-direction: column;
+
+ align-items: center;
+ justify-content: center;
+
+ width: 100%;
+
+ margin-bottom: 20px;
+ }
+
+ .emptyFeed {
+ display: flex;
+ flex-direction: column;
+
+ align-items: center;
+ justify-content: center;
+
+ width: 100%;
+
+ margin-top: 20px;
+ }
+}
\ No newline at end of file