Commit ac0d3629 authored by Hadrien RENAUD's avatar Hadrien RENAUD

💄 add message for empty feed

parent dfbcf00e
Pipeline #6512 passed with stage
in 58 seconds
import React from "react";
import {Container, Feed, Header} from "semantic-ui-react";
import {Container, Feed, Header, Message} from "semantic-ui-react";
import {gql} from "apollo-boost";
import {useQuery} from "@apollo/react-hooks";
import {LoadingMessage} from "../../components/Messages/LoadingMessage";
import GraphQLError from "../../components/Messages/Errors";
import {MessageExtended, messageExtended} from "../../services/apollo/fragments/messageExtended";
import {MessageFeedItem} from "../../components/Message/MessageFeedItem";
import {Link} from "react-router-dom";
import {ROUTES} from "../../constants/routes";
const PRIVATE_POSTS = gql`
query allPrivatePosts {
......@@ -27,11 +29,19 @@ function MessagesPage() {
{<Header as="h2" content="Welcome to Sigma"/>}
{loading && <LoadingMessage/>}
{error && <GraphQLError error={error}/>}
{data && =>
<MessageFeedItem m={m} key={m.mid}/>
{data && data.allPrivatePosts.length > 0
? <Feed>
{data && =>
<MessageFeedItem m={m} key={m.mid}/>
: <Message
header="No message in the feed 😓"
Crée-en un <Link to={ROUTES.CREATE_MESSAGE}>ici</Link>!
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment