|
1 | | -import {Button} from '@material-ui/core'; |
| 1 | +import { Button } from "@material-ui/core"; |
2 | 2 | import Countup from "./../common/Countup"; |
3 | 3 |
|
4 | 4 | import "./index.css"; |
5 | 5 |
|
6 | 6 | export default function Home(props) { |
7 | | - const { users, rooms, onlineUsers, totalMessages } = props.stats; |
8 | | - if(!props.authState.isLoggedIn){ |
9 | | - return ( |
10 | | - <div className="home-wrapper"> |
11 | | - <header> |
12 | | - <h1> |
13 | | - Real-time Collaboration |
14 | | - <br /> |
15 | | - <a href="http://github.com/RocketChat/RC4Community" rel="noreferrer" target="_blank" className="powered-by-title"> |
16 | | - <strong>Powered by RCforCommunities</strong> |
17 | | - </a> |
18 | | - </h1> |
| 7 | + const { users, rooms, onlineUsers, totalMessages } = props.stats; |
19 | 8 |
|
20 | | - <p> |
21 | | - <strong>Monitor</strong> your <strong>workflows</strong>, |
22 | | - <strong>collaborate</strong> and <strong>access data</strong> any |
23 | | - time you need it, all in one{" "} |
24 | | - <strong>productivity-amplifying</strong> full-lifecycle platform |
25 | | - </p> |
26 | | - </header> |
27 | | - <div className="rocket-logo"></div> |
28 | | - <main> |
29 | | - <div className="main-stats-container"> |
30 | | - <div className="stat-container"> |
31 | | - <img |
32 | | - src="https://img.icons8.com/plasticine/80/000000/organization.png" |
33 | | - alt="rooms" |
34 | | - /> |
35 | | - <Countup end={rooms} className="stat-number" /> |
36 | | - <div className="stat-label">Rooms</div> |
37 | | - </div> |
38 | | - <div className="stat-container"> |
39 | | - <img |
40 | | - src="https://img.icons8.com/color/80/000000/circled-user-male-skin-type-7--v2.png" |
41 | | - alt="users" |
42 | | - /> |
43 | | - <Countup end={users} className="stat-number" /> |
44 | | - <div className="stat-label">Users</div> |
45 | | - </div> |
46 | | - <div className="stat-container"> |
47 | | - <img |
48 | | - src="https://img.icons8.com/color/80/000000/filled-chat.png" |
49 | | - alt="messages" |
50 | | - /> |
51 | | - <Countup end={totalMessages} className="stat-number" /> |
52 | | - <div className="stat-label">Messages Exchanged</div> |
53 | | - </div> |
54 | | - <div className="stat-container"> |
55 | | - <img |
56 | | - src="https://img.icons8.com/color/80/000000/online--v1.png" |
57 | | - alt="online-users" |
58 | | - /> |
59 | | - <Countup end={onlineUsers} className="stat-number" /> |
60 | | - <div className="stat-label">Online Users</div> |
61 | | - </div> |
| 9 | + const getGreetings = () => { |
| 10 | + let d = new Date(); |
| 11 | + let time = d.getHours(); |
| 12 | + |
| 13 | + if (time < 12) { |
| 14 | + return "Good morning"; |
| 15 | + } |
| 16 | + if (time <= 17) { |
| 17 | + return "Good afternoon"; |
| 18 | + } |
| 19 | + return "Good evening"; |
| 20 | + }; |
| 21 | + |
| 22 | + if (!props.authState.isLoggedIn) { |
| 23 | + return ( |
| 24 | + <div className="home-wrapper"> |
| 25 | + <header> |
| 26 | + <h1> |
| 27 | + Real-time Collaboration |
| 28 | + <br /> |
| 29 | + <a |
| 30 | + href="http://github.com/RocketChat/RC4Community" |
| 31 | + rel="noreferrer" |
| 32 | + target="_blank" |
| 33 | + className="powered-by-title" |
| 34 | + > |
| 35 | + <strong>Powered by RCforCommunities</strong> |
| 36 | + </a> |
| 37 | + </h1> |
| 38 | + |
| 39 | + <p> |
| 40 | + <strong>Monitor</strong> your <strong>workflows</strong>, |
| 41 | + <strong>collaborate</strong> and <strong>access data</strong> any |
| 42 | + time you need it, all in one{" "} |
| 43 | + <strong>productivity-amplifying</strong> full-lifecycle platform |
| 44 | + </p> |
| 45 | + </header> |
| 46 | + <div className="rocket-logo"></div> |
| 47 | + <main> |
| 48 | + <div className="main-stats-container"> |
| 49 | + <div className="stat-container"> |
| 50 | + <img |
| 51 | + src="https://img.icons8.com/plasticine/80/000000/organization.png" |
| 52 | + alt="rooms" |
| 53 | + /> |
| 54 | + <Countup end={rooms} className="stat-number" /> |
| 55 | + <div className="stat-label">Rooms</div> |
| 56 | + </div> |
| 57 | + <div className="stat-container"> |
| 58 | + <img |
| 59 | + src="https://img.icons8.com/color/80/000000/circled-user-male-skin-type-7--v2.png" |
| 60 | + alt="users" |
| 61 | + /> |
| 62 | + <Countup end={users} className="stat-number" /> |
| 63 | + <div className="stat-label">Users</div> |
62 | 64 | </div> |
63 | | - <div className="button-container"> |
64 | | - <Button variant="contained" color="primary" href="/login"> |
65 | | - JOIN NOW TO EXPLORE MORE |
66 | | - </Button> |
| 65 | + <div className="stat-container"> |
| 66 | + <img |
| 67 | + src="https://img.icons8.com/color/80/000000/filled-chat.png" |
| 68 | + alt="messages" |
| 69 | + /> |
| 70 | + <Countup end={totalMessages} className="stat-number" /> |
| 71 | + <div className="stat-label">Messages Exchanged</div> |
67 | 72 | </div> |
68 | | - </main> |
| 73 | + <div className="stat-container"> |
| 74 | + <img |
| 75 | + src="https://img.icons8.com/color/80/000000/online--v1.png" |
| 76 | + alt="online-users" |
| 77 | + /> |
| 78 | + <Countup end={onlineUsers} className="stat-number" /> |
| 79 | + <div className="stat-label">Online Users</div> |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + <div className="button-container"> |
| 83 | + <Button variant="contained" color="primary" href="/login"> |
| 84 | + JOIN NOW TO EXPLORE MORE |
| 85 | + </Button> |
| 86 | + </div> |
| 87 | + </main> |
| 88 | + </div> |
| 89 | + ); |
| 90 | + } |
| 91 | + return ( |
| 92 | + <div className="home-wrapper"> |
| 93 | + <header class="signed-home-header"> |
| 94 | + <h3> |
| 95 | + {getGreetings()}, {props.authState.user.name} |
| 96 | + </h3> |
| 97 | + <p> |
| 98 | + To help you get started real quick, we have already created a |
| 99 | + community for you. Now create channels for your repositories |
| 100 | + within{" "} |
| 101 | + <strong>{props.authState.user.username.split("_github")}</strong>{" "} |
| 102 | + community. |
| 103 | + <br></br> |
| 104 | + To add channels for a new GitHub organization, start by creating a |
| 105 | + community for it. |
| 106 | + </p> |
| 107 | + </header> |
| 108 | + <div class="signed-home-main"> |
| 109 | + <div> |
| 110 | + <div class="signed-home-shortcut-container"> |
| 111 | + <h5>Start something new</h5> |
| 112 | + <div |
| 113 | + className="signed-home-shortcut" |
| 114 | + onClick={() => { |
| 115 | + document.getElementById("create-community").click(); |
| 116 | + }} |
| 117 | + > |
| 118 | + <img src="/community.png" className="signed-home-shortcut-icon" /> |
| 119 | + Create a community |
| 120 | + </div> |
| 121 | + <div |
| 122 | + className="signed-home-shortcut" |
| 123 | + onClick={() => { |
| 124 | + document.getElementById("create-channel").click(); |
| 125 | + }} |
| 126 | + > |
| 127 | + <img |
| 128 | + src="https://img.icons8.com/plasticine/35/000000/organization.png" |
| 129 | + className="signed-home-shortcut-icon" |
| 130 | + /> |
| 131 | + Create a channel |
| 132 | + </div> |
| 133 | + </div> |
| 134 | + <div className="signed-home-shortcut-container"> |
| 135 | + <h5>Explore more</h5> |
| 136 | + <div |
| 137 | + className="signed-home-shortcut" |
| 138 | + onClick={() => { |
| 139 | + document.getElementById("search").click(); |
| 140 | + }} |
| 141 | + > |
| 142 | + <img |
| 143 | + src="/search-icon.png" |
| 144 | + className="signed-home-shortcut-icon" |
| 145 | + /> |
| 146 | + Discover existing rooms |
| 147 | + </div> |
| 148 | + </div> |
69 | 149 | </div> |
70 | | - ); |
71 | | - } |
72 | | - return <div></div> |
| 150 | + <img src="/community.jpg" className="community-home-img"></img> |
| 151 | + </div> |
| 152 | + </div> |
| 153 | + ); |
73 | 154 | } |
0 commit comments