aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/about/sonarcloud/Home.tsx
blob: fd78f1cc58022598324a323015517e8893b68082 (plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
/*
 * SonarQube
 * Copyright (C) 2009-2019 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
import * as React from 'react';
import Helmet from 'react-helmet';
import { FixedNavBar, TopNavBar } from './components/NavBars';
import FeaturedProjects from './components/FeaturedProjects';
import Footer from './components/Footer';
import { Languages } from './components/Languages';
import LoginButtons from './components/LoginButtons';
import Statistics from './components/Statistics';
import { requestHomepageData, HomepageData, FeaturedProject } from './utils';
import { addWhitePageClass, removeWhitePageClass } from '../../../helpers/pages';
import { getBaseUrl } from '../../../helpers/urls';
import './new_style.css';

interface State {
  data?: HomepageData;
}

export default class Home extends React.PureComponent<{}, State> {
  state: State = {};

  componentDidMount() {
    addWhitePageClass();
    this.fetchData();
  }

  componentWillUnmount() {
    removeWhitePageClass();
  }

  fetchData = () => {
    requestHomepageData()
      .then(data => this.setState({ data }))
      .catch(() => {
        /* Fail silently */
      });
  };

  render() {
    const { data } = this.state;

    return (
      <div className="global-container">
        <div className="page-wrapper">
          <div className="page-container sc-page">
            <Helmet title="SonarCloud | Clean Code, Rockstar Status">
              <meta
                content="Enhance your workflow with continuous code quality, SonarCloud automatically analyzes and decorates pull requests on GitHub, Bitbucket and Azure DevOps on major languages."
                name="description"
              />
            </Helmet>
            <FixedNavBar />
            <PageBackgroundHeader />
            <TopNavBar />
            <PageTitle />
            <EnhanceWorkflow />
            <Functionality />
            <Languages />
            <Stats data={data} />
            <Projects featuredProjects={(data && data.featuredProjects) || []} />
          </div>
        </div>
        <Footer />
      </div>
    );
  }
}

function PageBackgroundHeader() {
  return (
    <div className="sc-header-background">
      <div className="sc-background-start" />
      <div className="sc-background-end" />
      <div className="sc-background-center">
        <img alt="" height="418px" src={`${getBaseUrl()}/images/sonarcloud/home-header.svg`} />
      </div>
    </div>
  );
}

function PageTitle() {
  return (
    <div className="sc-section sc-columns big-spacer-top">
      <div className="sc-column sc-column-half display-flex-center">
        <div>
          <h1 className="sc-title-orange big-spacer-top">Clean Code</h1>
          <h1 className="sc-spacer-bottom">Rockstar Status</h1>
          <h5 className="sc-big-spacer-bottom sc-regular-weight">
            Eliminate bugs and vulnerabilities.
            <br />
            Champion quality code in your projects.
          </h5>
          <div>
            <h6>Go ahead! Analyze your repo:</h6>
            <LoginButtons />
            <p className="sc-mention sc-regular-weight big-spacer-top">
              Free for Open-Source Projects
            </p>
          </div>
        </div>
      </div>
      <div className="sc-column sc-column-half text-right">
        <img
          alt=""
          src={`${getBaseUrl()}/images/sonarcloud/home-header-people.png`}
          width="430px"
        />
      </div>
    </div>
  );
}

function EnhanceWorkflow() {
  return (
    <div className="sc-section sc-columns">
      <div className="sc-column sc-column-full">
        <h3 className="sc-big-spacer-bottom">
          Enhance Your Workflow
          <br />
          with Continuous Code Quality
        </h3>
        <img
          alt=""
          className="sc-big-spacer-bottom"
          src={`${getBaseUrl()}/images/sonarcloud/home-branch.png`}
          srcSet={`${getBaseUrl()}/images/sonarcloud/home-branch.png 1x, ${getBaseUrl()}/images/sonarcloud/home-branch@2x.png 2x`}
        />
        <h5 className="spacer-bottom">Maximize your throughput and only release clean code</h5>
        <h6 className="sc-big-spacer-bottom sc-regular-weight">
          SonarCloud automatically analyzes branches and decorates pull requests
        </h6>
      </div>
    </div>
  );
}

function Functionality() {
  return (
    <div className="position-relative">
      <div className="sc-functionality-background">
        <div className="sc-background-center">
          <img
            alt=""
            height="300px"
            src={`${getBaseUrl()}/images/sonarcloud/home-grey-background.svg`}
          />
        </div>
      </div>
      <div className="sc-functionality-container">
        <div className="sc-section">
          <h3 className="sc-big-spacer-bottom text-center">
            Functionality
            <br />
            that Fits Your Projects
          </h3>
          <div className="sc-columns">
            <div className="sc-column sc-column-small big-spacer-top">
              <h6 className="sc-regular-weight spacer-bottom">Easy to Use</h6>
              <p>
                With just a few clicks you’re up and running right where your code lives. Immediate
                access to the latest features and enhancements.
              </p>
              <div className="sc-separator" />
              <span className="big-spacer-bottom sc-with-icon">
                <img
                  alt=""
                  className="big-spacer-right"
                  src={`${getBaseUrl()}/images/sonarcloud/scale.svg`}
                />{' '}
                Scale on-demand as your projects grow.
              </span>
              <span className="sc-with-icon">
                <img
                  alt=""
                  className="big-spacer-right"
                  src={`${getBaseUrl()}/images/sonarcloud/stop.svg`}
                />{' '}
                No contracts, stop/start anytime.
              </span>
            </div>
            <div className="sc-column sc-column-big big-spacer-top">
              <img
                alt=""
                className="sc-rounded-img"
                src={`${getBaseUrl()}/images/sonarcloud/home-easy-to-use.png`}
                srcSet={`${getBaseUrl()}/images/sonarcloud/home-easy-to-use.png 1x, ${getBaseUrl()}/images/sonarcloud/home-easy-to-use@2x.png 2x`}
              />
            </div>
          </div>
          <div className="sc-columns">
            <div className="sc-column sc-column-big">
              <img
                alt=""
                className="sc-rounded-img"
                src={`${getBaseUrl()}/images/sonarcloud/home-open-transparent.png`}
                srcSet={`${getBaseUrl()}/images/sonarcloud/home-open-transparent.png 1x, ${getBaseUrl()}/images/sonarcloud/home-open-transparent@2x.png 2x`}
              />
            </div>
            <div className="sc-column sc-column-small">
              <div>
                <h6 className="sc-regular-weight spacer-bottom">Open and Transparent</h6>
                <p className="big-spacer-bottom">
                  Project dashboards keep teams and stakeholders informed on code quality and
                  releasability.
                </p>
                <p>Display project badges and show your communities you’re all about awesome.</p>
                <img
                  alt=""
                  className="big-spacer-top"
                  src={`${getBaseUrl()}/images/project_badges/sonarcloud-black.svg`}
                  width="200px"
                />
              </div>
            </div>
          </div>
          <div className="sc-columns">
            <div className="sc-column sc-column-full big-spacer-bottom">
              <div>
                <h6 className="sc-regular-weight spacer-bottom">Effective Collaboration</h6>

                <p className="sc-with-inline-icon">
                  Use
                  <img
                    alt="SonarCloud"
                    src={`${getBaseUrl()}/images/sonarcloud/sonarcloud-logo-text-only.svg`}
                  />
                  with your team, share best practices and have fun writing quality code!
                </p>
                <br />
                <p className="sc-with-inline-icon">
                  Connect with
                  <img
                    alt="SonarCloud"
                    src={`${getBaseUrl()}/images/sonarcloud/sonarlint-logo.svg`}
                  />
                  and get real-time notifications in your IDE as you work.
                </p>
                <div className="big-spacer-top">
                  <img
                    alt=""
                    className="big-spacer-top huge-spacer-bottom"
                    src={`${getBaseUrl()}/images/sonarcloud/ide.svg`}
                    width="216px"
                  />
                </div>
                <img alt="" src={`${getBaseUrl()}/images/sonarcloud/collab.svg`} width="540px" />
              </div>
            </div>
          </div>
        </div>
      </div>
      <div className="sc-functionality-background sc-functionality-background-bottom">
        <div className="sc-background-center">
          <img
            alt=""
            height="140px"
            src={`${getBaseUrl()}/images/sonarcloud/home-background-grey-bottom.svg`}
          />
        </div>
      </div>
    </div>
  );
}

interface StatsProps {
  data?: HomepageData;
}

function Stats({ data }: StatsProps) {
  return (
    <div className="sc-section sc-columns">
      <div className="sc-column sc-column-full">
        <h3>
          Over 3,000 Projects
          <br />
          Continuously Analyzed
        </h3>
        {data && (
          <Statistics
            statistics={[
              { icon: 'rules', text: 'Static analysis rules checked', value: data.rules },
              { icon: 'locs', text: 'Lines of code analyzed', value: data.publicLoc },
              {
                icon: 'pull-request',
                text: 'Pull Requests decorated/week',
                value: data.newPullRequests7d
              },
              {
                icon: 'open-source',
                text: 'Open-source projects inspected',
                value: data.publicProjects
              }
            ]}
          />
        )}
      </div>
    </div>
  );
}

interface ProjectsProps {
  featuredProjects: FeaturedProject[];
}

function Projects({ featuredProjects }: ProjectsProps) {
  return (
    <div className="sc-section sc-columns">
      <div className="sc-column sc-column-full">
        {featuredProjects.length > 0 && (
          <>
            <h6 className="big-spacer-bottom">
              Transparency makes sense
              <br />
              and that’s why the trend is growing.
            </h6>
            <p>
              Check out these open-source projects showing users
              <br />
              their commitment to quality.
            </p>
            <FeaturedProjects projects={featuredProjects} />
          </>
        )}
        <h6 className="spacer-bottom">
          Come join the fun, it’s entirely free for open-source projects!
        </h6>
        <div className="sc-spacer-bottom">
          <LoginButtons />
        </div>
      </div>
    </div>
  );
}