-
Notifications
You must be signed in to change notification settings - Fork 82
/
home.tsx.ejs
126 lines (110 loc) · 5.2 KB
/
home.tsx.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<%#
Copyright 2013-2020 the original author or authors from the JHipster project.
This file is part of the JHipster project, see https://www.jhipster.tech/
for more information.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-%>
import './home.<%= styleSheetExt %>';
import React from 'react';
import { Link } from 'react-router-dom';
import { Translate } from 'react-jhipster';
import { connect } from 'react-redux';
import { Row, Col, Alert } from 'reactstrap';
import { IRootState } from 'app/shared/reducers';
<%_ if (authenticationType === 'oauth2') { _%>
import { getLoginUrl } from 'app/shared/util/url-utils';
<%_ } _%>
export type IHomeProp = StateProps;
export const Home = (props: IHomeProp) => {
const { account } = props;
return (
<Row>
<Col md="9">
<h2><Translate contentKey="home.title">Welcome, Node Hipster Official Blueprint!</Translate></h2>
<p className="lead"><Translate contentKey="home.subtitle">This is your homepage</Translate></p>
{
(account && account.login) ? (
<div>
<Alert color="success">
<Translate contentKey="home.logged.message" interpolate={{ username: account.login }}>You are logged in as user {account.login}.</Translate>
</Alert>
</div>
) : (
<div>
<Alert color="warning">
<Translate contentKey="global.messages.info.authenticated.prefix">If you want to </Translate>
<%_ if (authenticationType === 'oauth2') { _%>
<Link to={getLoginUrl()} className="alert-link"><Translate contentKey="global.messages.info.authenticated.link"> sign in</Translate></Link>
<%_ } else { _%>
<Link to="/login" className="alert-link"><Translate contentKey="global.messages.info.authenticated.link"> sign in</Translate></Link>
<%_ } _%>
<Translate contentKey="global.messages.info.authenticated.suffix">, you can try the default accounts:
<br />- Administrator (login="admin" and password="admin")
<br />- User (login="user" and password="user").
</Translate>
</Alert>
<%_ if (!skipUserManagement) { _%>
<Alert color="warning">
<Translate contentKey="global.messages.info.register.noaccount">You do not have an account yet?</Translate>
<Link to="/account/register" className="alert-link"><Translate contentKey="global.messages.info.register.link">Register a new account</Translate></Link>
</Alert>
<%_ } _%>
</div>
)
}
<p>
<Translate contentKey="home.question">If you have any question on JHipster or NHipster:</Translate>
</p>
<ul>
<li>
<a href="https://www.jhipster.tech/" target="_blank" rel="noopener noreferrer">
<Translate contentKey="home.link.homepage">JHipster homepage</Translate>
</a>
</li>
<li>
<a href="http://stackoverflow.com/tags/jhipster/info" target="_blank" rel="noopener noreferrer">
<Translate contentKey="home.link.stackoverflow">JHipster on Stack Overflow</Translate>
</a>
</li>
<li>
<a href="https://github.com/jhipster/generator-jhipster-nodejs/issues?state=open" target="_blank" rel="noopener noreferrer">
<Translate contentKey="home.link.bugtracker">NHipster bug tracker</Translate>
</a>
</li>
<li>
<a href="https://gitter.im/jhipster/generator-jhipster-nodejs" target="_blank" rel="noopener noreferrer">
<Translate contentKey="home.link.chat">NHipster public chat room</Translate>
</a>
</li>
<li>
<a href="https://twitter.com/java_hipster" target="_blank" rel="noopener noreferrer">
<Translate contentKey="home.link.follow">follow @java_hipster on Twitter</Translate>
</a>
</li>
</ul>
<p>
<Translate contentKey="home.like">If you like NHipster, do not forget to give us a star on</Translate>
{' '}
<a href="https://github.com/jhipster/generator-jhipster-nodejs" target="_blank" rel="noopener noreferrer">Github</a>!
</p>
</Col>
<Col md="3" className="pad">
<span className="hipster rounded" />
</Col>
</Row>
);
};
const mapStateToProps = storeState => ({
account: storeState.authentication.account,
isAuthenticated: storeState.authentication.isAuthenticated
});
type StateProps = ReturnType<typeof mapStateToProps>;
export default connect(mapStateToProps)(Home);