• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / gui / 1113439055

19 Dec 2023 09:01PM UTC coverage: 82.752% (-17.2%) from 99.964%
1113439055

Pull #4258

gitlab-ci

mender-test-bot
chore: Types update

Signed-off-by: Mender Test Bot <mender@northern.tech>
Pull Request #4258: chore: Types update

4326 of 6319 branches covered (0.0%)

8348 of 10088 relevant lines covered (82.75%)

189.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/js/components/settings/planselection.js
1
// Copyright 2021 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import React from 'react';
15

16
import { makeStyles } from 'tss-react/mui';
17

18
import { PLANS } from '../../constants/appConstants';
19
import { isDarkMode } from '../../helpers.js';
20
import InfoText from '../common/infotext';
21

22
export const useStyles = makeStyles()(theme => ({
6✔
23
  planNote: { marginBottom: -11, fontSize: 'smaller' },
24
  planPanel: {
25
    borderColor: theme.palette.background.lightgrey,
26
    ['&.active,&:hover']: {
27
      borderColor: theme.palette.grey[50],
28
      boxShadow: '0 1px 6px rgba(0, 0, 0, 0.15)'
29
    },
30
    ['&.active']: {
31
      backgroundColor: isDarkMode(theme.palette.mode) ? theme.palette.grey[50] : theme.palette.grey[400]
4!
32
    },
33
    '&.addon': {
34
      alignItems: 'center',
35
      columnGap: 10,
36
      display: 'grid',
37
      gridTemplateColumns: 'max-content minmax(150px, min-content) 1fr max-content',
38
      height: 'initial',
39
      marginTop: 10,
40
      minWidth: 550,
41
      width: 'initial'
42
    },
43
    '&.addon.upgrade': {
44
      gridTemplateColumns: 'max-content minmax(120px, min-content) minmax(120px, min-content) 1fr max-content'
45
    }
46
  },
47
  price: { fontSize: '1rem' }
48
}));
49

50
export const PlanSelection = ({ currentPlan = PLANS.os.id, isTrial, offerValid, offerTag, setUpdatedPlan, updatedPlan }) => {
6✔
51
  const { classes } = useStyles();
3✔
52
  const canUpgrade = plan => Object.keys(PLANS).indexOf(plan) >= Object.keys(PLANS).indexOf(currentPlan);
18✔
53
  const onPlanSelect = plan => (isTrial || canUpgrade(plan) ? setUpdatedPlan(plan) : undefined);
3!
54
  return (
3✔
55
    <>
56
      <h3 className="margin-top">{isTrial ? '1. Choose a plan' : 'Plans'}</h3>
3!
57
      <div className="flexbox space-between" style={{ paddingBottom: 15 }}>
58
        {Object.values(PLANS).map(item => (
59
          <div
9✔
60
            key={item.id}
61
            className={`planPanel ${classes.planPanel} ${updatedPlan === item.id ? 'active' : ''} ${isTrial || canUpgrade(item.id) ? '' : 'muted'}`}
36!
62
            onClick={() => onPlanSelect(item.id)}
×
63
          >
64
            {!isTrial && canUpgrade(item.id) && (
27✔
65
              <div className={`uppercased align-center muted ${classes.planNote}`}>{item.id === currentPlan ? 'current plan' : 'upgrade'}</div>
9✔
66
            )}
67
            <h4>
68
              {item.name} {item.offer && isTrial && offerValid ? offerTag : null}
24!
69
            </h4>
70
            <div>
71
              {item.offer && isTrial && offerValid ? (
24!
72
                <>
73
                  <div className={`link-color bold ${classes.price}`}>{item.offerprice}</div>
74
                  <div className="pre-line">{item.price2}</div>
75
                </>
76
              ) : (
77
                <>
78
                  <div className={`link-color bold ${classes.price}`}>{item.price}</div>
79
                  <div>{item.deviceCount}</div>
80
                </>
81
              )}
82
            </div>
83
            <ul className="unstyled">
84
              {item.features.map((feature, index) => (
85
                <li key={`${item.id}-feature-${index}`}>
15✔
86
                  <InfoText variant="dense">{feature}</InfoText>
87
                </li>
88
              ))}
89
            </ul>
90
          </div>
91
        ))}
92
      </div>
93
    </>
94
  );
95
};
96

97
export default PlanSelection;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc