mirror of
https://github.com/strapi/strapi.git
synced 2025-10-24 22:40:15 +00:00
wip
This commit is contained in:
parent
052eebe6b1
commit
b6ab5e58e4
@ -5,10 +5,8 @@
|
||||
*/
|
||||
/* eslint-disable */
|
||||
import React, { memo, useMemo } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage, useIntl } from 'react-intl';
|
||||
import { get, upperFirst } from 'lodash';
|
||||
import { auth, LoadingIndicatorPage } from '@strapi/helper-plugin';
|
||||
import PageTitle from '../../components/PageTitle';
|
||||
import { useModels } from '../../hooks';
|
||||
|
||||
import useFetch from './hooks';
|
||||
@ -16,6 +14,11 @@ import { ALink, Block, Container, LinkWrapper, P, Wave, Separator } from './comp
|
||||
import BlogPost from './BlogPost';
|
||||
import SocialLink from './SocialLink';
|
||||
|
||||
import PageTitle from '../../components/PageTitle';
|
||||
import { auth, LoadingIndicatorPage, SettingsPageTitle } from '@strapi/helper-plugin';
|
||||
import { HeaderLayout, Layout, ContentLayout, ActionLayout } from '@strapi/parts/Layout';
|
||||
import { Main } from '@strapi/parts/Main';
|
||||
|
||||
const FIRST_BLOCK_LINKS = [
|
||||
{
|
||||
link:
|
||||
@ -62,17 +65,18 @@ const SOCIAL_LINKS = [
|
||||
];
|
||||
|
||||
const HomePage = ({ history: { push } }) => {
|
||||
const { error, isLoading, posts } = useFetch();
|
||||
// Temporary until we develop the menu API
|
||||
const { formatMessage } = useIntl();
|
||||
// const { error, isLoading, posts } = useFetch();
|
||||
// // Temporary until we develop the menu API
|
||||
const { collectionTypes, singleTypes, isLoading: isLoadingForModels } = useModels();
|
||||
|
||||
const handleClick = e => {
|
||||
e.preventDefault();
|
||||
// const handleClick = e => {
|
||||
// e.preventDefault();
|
||||
|
||||
push(
|
||||
'/plugins/content-type-builder/content-types/plugins::users-permissions.user?modalType=contentType&kind=collectionType&actionType=create&settingType=base&forTarget=contentType&headerId=content-type-builder.modalForm.contentType.header-create&header_icon_isCustom_1=false&header_icon_name_1=contentType&header_label_1=null'
|
||||
);
|
||||
};
|
||||
// push(
|
||||
// '/plugins/content-type-builder/content-types/plugins::users-permissions.user?modalType=contentType&kind=collectionType&actionType=create&settingType=base&forTarget=contentType&headerId=content-type-builder.modalForm.contentType.header-create&header_icon_isCustom_1=false&header_icon_name_1=contentType&header_label_1=null'
|
||||
// );
|
||||
// };
|
||||
|
||||
const hasAlreadyCreatedContentTypes = useMemo(() => {
|
||||
const filterContentTypes = contentTypes => contentTypes.filter(c => c.isDisplayed);
|
||||
@ -86,153 +90,168 @@ const HomePage = ({ history: { push } }) => {
|
||||
return <LoadingIndicatorPage />;
|
||||
}
|
||||
|
||||
const headerId = hasAlreadyCreatedContentTypes
|
||||
? 'HomePage.greetings'
|
||||
: 'app.components.HomePage.welcome';
|
||||
const username = get(auth.getUserInfo(), 'firstname', '');
|
||||
const linkProps = hasAlreadyCreatedContentTypes
|
||||
? {
|
||||
id: 'app.components.HomePage.button.blog',
|
||||
href: 'https://strapi.io/blog/',
|
||||
onClick: () => {},
|
||||
type: 'blog',
|
||||
target: '_blank',
|
||||
}
|
||||
: {
|
||||
id: 'app.components.HomePage.create',
|
||||
href: '',
|
||||
onClick: handleClick,
|
||||
type: 'documentation',
|
||||
};
|
||||
// const headerId = hasAlreadyCreatedContentTypes
|
||||
// ? 'HomePage.greetings'
|
||||
// : 'app.components.HomePage.welcome';
|
||||
// const username = get(auth.getUserInfo(), 'firstname', '');
|
||||
// const linkProps = hasAlreadyCreatedContentTypes
|
||||
// ? {
|
||||
// id: 'app.components.HomePage.button.blog',
|
||||
// href: 'https://strapi.io/blog/',
|
||||
// onClick: () => {},
|
||||
// type: 'blog',
|
||||
// target: '_blank',
|
||||
// }
|
||||
// : {
|
||||
// id: 'app.components.HomePage.create',
|
||||
// href: '',
|
||||
// onClick: handleClick,
|
||||
// type: 'documentation',
|
||||
// };
|
||||
|
||||
return (
|
||||
<>
|
||||
<Layout>
|
||||
<FormattedMessage id="HomePage.helmet.title">
|
||||
{title => <PageTitle title={title[0]} />}
|
||||
</FormattedMessage>
|
||||
<Container className="container-fluid">
|
||||
<div className="row">
|
||||
<div className="col-lg-8 col-md-12">
|
||||
<Block>
|
||||
<Wave />
|
||||
<FormattedMessage
|
||||
id={headerId}
|
||||
values={{
|
||||
name: upperFirst(username),
|
||||
}}
|
||||
>
|
||||
{msg => <h2 id="mainHeader">{msg}</h2>}
|
||||
</FormattedMessage>
|
||||
{hasAlreadyCreatedContentTypes ? (
|
||||
<FormattedMessage id="app.components.HomePage.welcomeBlock.content.again">
|
||||
{msg => <P>{msg}</P>}
|
||||
</FormattedMessage>
|
||||
<Main labelledBy="homepage">
|
||||
<HeaderLayout
|
||||
as="h1"
|
||||
id="homepage"
|
||||
title={hasAlreadyCreatedContentTypes ? (
|
||||
formatMessage({
|
||||
id: 'app.components.HomePage.welcome.again',
|
||||
defaultMessage: 'Welcome 👋',
|
||||
})
|
||||
) : (
|
||||
<FormattedMessage id="HomePage.welcome.congrats">
|
||||
{congrats => {
|
||||
return (
|
||||
<FormattedMessage id="HomePage.welcome.congrats.content">
|
||||
{content => {
|
||||
return (
|
||||
<FormattedMessage id="HomePage.welcome.congrats.content.bold">
|
||||
{boldContent => {
|
||||
return (
|
||||
<P>
|
||||
<b>{congrats}</b>
|
||||
{content}
|
||||
<b>{boldContent}</b>
|
||||
</P>
|
||||
);
|
||||
}}
|
||||
</FormattedMessage>
|
||||
);
|
||||
}}
|
||||
</FormattedMessage>
|
||||
);
|
||||
}}
|
||||
</FormattedMessage>
|
||||
)}
|
||||
{hasAlreadyCreatedContentTypes && (
|
||||
<div style={{ marginTop: isLoading ? 60 : 50 }}>
|
||||
{posts.map((post, index) => (
|
||||
<BlogPost
|
||||
{...post}
|
||||
key={post.link}
|
||||
isFirst={index === 0}
|
||||
isLoading={isLoading}
|
||||
error={error}
|
||||
formatMessage({
|
||||
id: 'app.components.HomePage.welcome',
|
||||
defaultMessage: 'Welcome on board!',
|
||||
}))}
|
||||
subtitle={!hasAlreadyCreatedContentTypes ? (
|
||||
formatMessage({
|
||||
id: 'app.components.HomePage.welcomeBlock.content.again',
|
||||
defaultMessage: 'Get POST changes notifications.',
|
||||
})
|
||||
) : (formatMessage({
|
||||
id: 'app.components.HomePage.welcomeBlock.content',
|
||||
defaultMessage: 'Get POST changes notifications.',
|
||||
}))}
|
||||
// primaryAction={}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<FormattedMessage id={linkProps.id}>
|
||||
{msg => (
|
||||
<ALink
|
||||
rel="noopener noreferrer"
|
||||
{...linkProps}
|
||||
style={{ verticalAlign: ' bottom', marginBottom: 5 }}
|
||||
>
|
||||
{msg}
|
||||
</ALink>
|
||||
)}
|
||||
</FormattedMessage>
|
||||
<Separator style={{ marginTop: 37, marginBottom: 36 }} />
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
{FIRST_BLOCK_LINKS.map((data, index) => {
|
||||
const type = index === 0 ? 'doc' : 'code';
|
||||
</Main>
|
||||
</Layout>
|
||||
|
||||
return (
|
||||
<LinkWrapper href={data.link} target="_blank" key={data.link} type={type}>
|
||||
<FormattedMessage id={data.titleId}>
|
||||
{title => <p className="bold">{title}</p>}
|
||||
</FormattedMessage>
|
||||
<FormattedMessage id={data.contentId}>
|
||||
{content => <p>{content}</p>}
|
||||
</FormattedMessage>
|
||||
</LinkWrapper>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Block>
|
||||
</div>
|
||||
// {hasAlreadyCreatedContentTypes ? (
|
||||
// <FormattedMessage id="app.components.HomePage.welcomeBlock.content.again">
|
||||
// {msg => <P>{msg}</P>}
|
||||
// </FormattedMessage>
|
||||
// ) : (
|
||||
// <FormattedMessage id="HomePage.welcome.congrats">
|
||||
// {congrats => {
|
||||
// return (
|
||||
// <FormattedMessage id="HomePage.welcome.congrats.content">
|
||||
// {content => {
|
||||
// return (
|
||||
// <FormattedMessage id="HomePage.welcome.congrats.content.bold">
|
||||
// {boldContent => {
|
||||
// return (
|
||||
// <P>
|
||||
// <b>{congrats}</b>
|
||||
// {content}
|
||||
// <b>{boldContent}</b>
|
||||
// </P>
|
||||
// );
|
||||
// }}
|
||||
// </FormattedMessage>
|
||||
// );
|
||||
// }}
|
||||
// </FormattedMessage>
|
||||
// );
|
||||
// }}
|
||||
// </FormattedMessage>
|
||||
// )}
|
||||
// {hasAlreadyCreatedContentTypes && (
|
||||
// <div style={{ marginTop: isLoading ? 60 : 50 }}>
|
||||
// {posts.map((post, index) => (
|
||||
// <BlogPost
|
||||
// {...post}
|
||||
// key={post.link}
|
||||
// isFirst={index === 0}
|
||||
// isLoading={isLoading}
|
||||
// error={error}
|
||||
// />
|
||||
// ))}
|
||||
// </div>
|
||||
// )}
|
||||
// <FormattedMessage id={linkProps.id}>
|
||||
// {msg => (
|
||||
// <ALink
|
||||
// rel="noopener noreferrer"
|
||||
// {...linkProps}
|
||||
// style={{ verticalAlign: ' bottom', marginBottom: 5 }}
|
||||
// >
|
||||
// {msg}
|
||||
// </ALink>
|
||||
// )}
|
||||
// </FormattedMessage>
|
||||
// <Separator style={{ marginTop: 37, marginBottom: 36 }} />
|
||||
// <div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
// {FIRST_BLOCK_LINKS.map((data, index) => {
|
||||
// const type = index === 0 ? 'doc' : 'code';
|
||||
|
||||
<div className="col-md-12 col-lg-4">
|
||||
<Block style={{ paddingRight: 30, paddingBottom: 0 }}>
|
||||
<FormattedMessage id="HomePage.community">{msg => <h2>{msg}</h2>}</FormattedMessage>
|
||||
<FormattedMessage id="app.components.HomePage.community.content">
|
||||
{content => <P style={{ marginTop: 7, marginBottom: 0 }}>{content}</P>}
|
||||
</FormattedMessage>
|
||||
<FormattedMessage id="HomePage.roadmap">
|
||||
{msg => (
|
||||
<ALink
|
||||
rel="noopener noreferrer"
|
||||
href="https://portal.productboard.com/strapi/1-public-roadmap/tabs/2-under-consideration"
|
||||
target="_blank"
|
||||
>
|
||||
{msg}
|
||||
</ALink>
|
||||
)}
|
||||
</FormattedMessage>
|
||||
// return (
|
||||
// <LinkWrapper href={data.link} target="_blank" key={data.link} type={type}>
|
||||
// <FormattedMessage id={data.titleId}>
|
||||
// {title => <p className="bold">{title}</p>}
|
||||
// </FormattedMessage>
|
||||
// <FormattedMessage id={data.contentId}>
|
||||
// {content => <p>{content}</p>}
|
||||
// </FormattedMessage>
|
||||
// </LinkWrapper>
|
||||
// );
|
||||
// })}
|
||||
// </div>
|
||||
// </Block>
|
||||
// </div>
|
||||
|
||||
<Separator style={{ marginTop: 18 }} />
|
||||
<div
|
||||
className="row social-wrapper"
|
||||
style={{
|
||||
display: 'flex',
|
||||
margin: 0,
|
||||
marginTop: 36,
|
||||
marginLeft: -15,
|
||||
}}
|
||||
>
|
||||
{SOCIAL_LINKS.map((value, key) => (
|
||||
<SocialLink key={key} {...value} />
|
||||
))}
|
||||
</div>
|
||||
</Block>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
// <div className="col-md-12 col-lg-4">
|
||||
// <Block style={{ paddingRight: 30, paddingBottom: 0 }}>
|
||||
// <FormattedMessage id="HomePage.community">{msg => <h2>{msg}</h2>}</FormattedMessage>
|
||||
// <FormattedMessage id="app.components.HomePage.community.content">
|
||||
// {content => <P style={{ marginTop: 7, marginBottom: 0 }}>{content}</P>}
|
||||
// </FormattedMessage>
|
||||
// <FormattedMessage id="HomePage.roadmap">
|
||||
// {msg => (
|
||||
// <ALink
|
||||
// rel="noopener noreferrer"
|
||||
// href="https://portal.productboard.com/strapi/1-public-roadmap/tabs/2-under-consideration"
|
||||
// target="_blank"
|
||||
// >
|
||||
// {msg}
|
||||
// </ALink>
|
||||
// )}
|
||||
// </FormattedMessage>
|
||||
|
||||
// <Separator style={{ marginTop: 18 }} />
|
||||
// <div
|
||||
// className="row social-wrapper"
|
||||
// style={{
|
||||
// display: 'flex',
|
||||
// margin: 0,
|
||||
// marginTop: 36,
|
||||
// marginLeft: -15,
|
||||
// }}
|
||||
// >
|
||||
// {SOCIAL_LINKS.map((value, key) => (
|
||||
// <SocialLink key={key} {...value} />
|
||||
// ))}
|
||||
// </div>
|
||||
// </Block>
|
||||
// </div>
|
||||
// </div>
|
||||
// </Container>
|
||||
// </>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -220,10 +220,10 @@
|
||||
"app.components.HomePage.community": "Find the community on the web",
|
||||
"app.components.HomePage.community.content": "Discuss with team members, contributors and developers on different channels.",
|
||||
"app.components.HomePage.create": "Create your first Content-Type",
|
||||
"app.components.HomePage.welcome": "Welcome on board!",
|
||||
"app.components.HomePage.welcome.again": "Welcome ",
|
||||
"app.components.HomePage.welcome": "Welcome on board 👋",
|
||||
"app.components.HomePage.welcome.again": "Welcome 👋",
|
||||
"app.components.HomePage.welcomeBlock.content": "We are happy to have you as part of the community. We are constantly looking for feedback so feel free to send us DM on ",
|
||||
"app.components.HomePage.welcomeBlock.content.again": "We hope you are making progress on your project... Feel free to read the latest news about Strapi. We are giving our best to improve the product based on your feedback.",
|
||||
"app.components.HomePage.welcomeBlock.content.again": "We hope you are making progress on your project! Feel free to read the latest news about Strapi. We are giving our best to improve the product based on your feedback.",
|
||||
"app.components.HomePage.welcomeBlock.content.issues": "issues.",
|
||||
"app.components.HomePage.welcomeBlock.content.raise": " or raise ",
|
||||
"app.components.ImgPreview.hint": "Drag & drop your file into this area or {browse} for a file to upload",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user