Skip to content

Commit d03b4d4

Browse files
authored
Merge pull request #436 from platformatic/add-splashscreen-and-report-list
2 parents 87e81b5 + 0c1d3d5 commit d03b4d4

File tree

90 files changed

+302
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+302
-126
lines changed

index.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
import BorderedBox from './src/components/BorderedBox'
42
import Box from './src/components/Box'
53
import Button from './src/components/Button'

postcss.config.cjs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
module.exports = {
42
plugins: {
53
tailwindcss: {},

src/components/BorderedBox.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useEffect, useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './BorderedBox.module.css'
@@ -7,7 +6,7 @@ import { COLORS_BORDERED_BOX, DARK_BLUE, TRANSPARENT, OPACITIES, OPACITY_100 } f
76
function BorderedBox ({
87
classes = '',
98
color = TRANSPARENT,
10-
children = null,
9+
children,
1110
backgroundColor = DARK_BLUE,
1211
backgroundColorOpacity = OPACITY_100,
1312
borderColorOpacity = OPACITY_100,

src/components/Box.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
import styles from './Box.module.css'
42
import React from 'react'
53
export default function Box ({ justifyCentered, children }) {

src/components/Button.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useEffect, useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './Button.module.css'

src/components/ButtonFullRounded.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import commonStyles from './Common.module.css'

src/components/ButtonOnlyIcon.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useEffect, useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './ButtonOnlyIcon.module.css'

src/components/Checkbox.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './Checkbox.module.css'

src/components/CopyAndPaste.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState } from 'react'
32
import PropTypes from 'prop-types'
43
import { COLORS_ICON, DIRECTION_TOP, MEDIUM, SIZES, POSITIONS, POSITION_CENTER, MAIN_DARK_BLUE } from './constants'

src/components/DetailedMetric.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
import React from 'react'
42
import SimpleMetric from './SimpleMetric'
53
import HorizontalSeparator from './HorizontalSeparator'

src/components/DropDown.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useEffect, useRef, useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './DropDown.module.css'

src/components/HorizontalSeparator.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import commonStyles from './Common.module.css'

src/components/InfoBox.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './InfoBox.module.css'
@@ -7,7 +6,7 @@ import PlatformaticIcon from './PlatformaticIcon'
76
import { COLORS_BUTTON, COLORS_ICON, HOVER_EFFECTS_BUTTONS, MAIN_GREEN } from './constants'
87

98
function InfoBox ({
10-
children = null,
9+
children,
1110
iconName = '',
1211
iconColor = MAIN_GREEN,
1312
helpText = '',

src/components/LoadingSpinnerV2.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './LoadingSpinnerV2.module.css'

src/components/LogoDropDown.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './LogoDropDown.module.css'

src/components/Main.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
import SearchBar from './SearchBar'
42
import TabbedWindow from './TabbedWindow'
53
import Playground from './Playground'

src/components/MetricValue.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import styles from './MetricValue.module.css'
43
import commonStyles from './Common.module.css'

src/components/Modal.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useRef } from 'react'
32
import PropTypes from 'prop-types'
43
import ButtonFullRounded from './ButtonFullRounded'
@@ -34,7 +33,7 @@ function Modal ({
3433
setIsOpen = () => {},
3534
title = '',
3635
layout = MODAL_POPUP,
37-
children = null,
36+
children,
3837
size = SMALL,
3938
profile = '',
4039
backgroundClassName = '',

src/components/ModalDirectional.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState, useEffect } from 'react'
32
import PropTypes from 'prop-types'
43
import useEscapeKey from '../hooks/useEscapeKey'
@@ -10,7 +9,7 @@ import {
109
import PlatformaticIcon from './PlatformaticIcon'
1110

1211
function ModalDirectional ({
13-
children = null,
12+
children,
1413
setIsOpen = () => {},
1514
smallLayout = false,
1615
classNameModalLefty = '',

src/components/ModalStepsForward.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import ButtonFullRounded from './ButtonFullRounded'

src/components/PlatformaticIcon.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState } from 'react'
32
import PropTypes from 'prop-types'
43
import Icons from './icons'

src/components/Playground.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import BorderedBox from './BorderedBox'
43

src/components/Report.jsx

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react'
2+
import Icons from './icons'
3+
import { ERROR_RED, MAIN_GREEN, WARNING_YELLOW } from './constants'
4+
5+
function getIcon (type) {
6+
switch (type) {
7+
case 'success':
8+
return <Icons.CircleCheckMarkIcon color={MAIN_GREEN} />
9+
case 'error':
10+
return <Icons.CircleCheckMarkIcon color={ERROR_RED} />
11+
case 'warning':
12+
return <Icons.AlertIcon color={WARNING_YELLOW} />
13+
}
14+
}
15+
function Step ({
16+
type,
17+
label
18+
}) {
19+
return (
20+
<div className='flex items-center gap-x-2'>
21+
{getIcon(type)}
22+
<span>{label}</span>
23+
</div>
24+
)
25+
}
26+
export default function Report ({
27+
steps = []
28+
}) {
29+
function renderSteps () {
30+
return steps.map((s, idx) => {
31+
return <Step key={`report-step-${idx}`} {...s} />
32+
})
33+
}
34+
return (
35+
<div className='text-white/70 flex flex-col gap-y-2'>
36+
{renderSteps()}
37+
</div>
38+
39+
)
40+
}

src/components/SearchBar.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useRef, useState } from 'react'
32
import styles from './SearchBar.module.css'
43
import commonStyles from './Common.module.css'

src/components/SearchBarV2.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useRef, useState } from 'react'
32
import PropTypes from 'prop-types'
43
import commonStyles from './Common.module.css'

src/components/SimpleMetric.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
import React from 'react'
42
import BorderedBox from './BorderedBox'
53
import styles from './SimpleMetric.module.css'

src/components/SplashScreen.jsx

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React, { useEffect, useState } from 'react'
2+
import styles from './SplashScreen.module.css'
3+
import { ERROR_RED, MAIN_GREEN, RICH_BLACK, WHITE } from './constants'
4+
import Icons from './icons'
5+
import Button from './Button'
6+
export default function SplashScreen ({
7+
success = true,
8+
timeout = 5000,
9+
message = '',
10+
title = 'Operation completed',
11+
blur = false,
12+
children,
13+
onDestroyed = () => {}
14+
}) {
15+
const [destroyed, setDestroyed] = useState(false)
16+
useEffect(() => {
17+
if (destroyed) {
18+
onDestroyed()
19+
}
20+
}, [destroyed])
21+
useEffect(() => {
22+
setTimeout(() => {
23+
setDestroyed(true)
24+
}, timeout)
25+
}, [])
26+
27+
if (destroyed) {
28+
return null
29+
}
30+
31+
function renderIcon () {
32+
if (success) {
33+
return <Icons.CircleCheckMarkIcon color={MAIN_GREEN} />
34+
} else {
35+
return <Icons.AlertIcon color={ERROR_RED} />
36+
}
37+
}
38+
return (
39+
<div className={`${styles.container} ${blur ? 'backdrop-blur-sm bg-rich-black/50' : 'bg-rich-black'}`} onClick={() => setDestroyed(true)}>
40+
<div className={styles.content}>
41+
<div className={styles.icon}>{renderIcon()}</div>
42+
<div className={styles.title}>{title}</div>
43+
<div className={styles.message}>{message}</div>
44+
45+
<div className='mb-4'>
46+
{children}
47+
</div>
48+
49+
<div className={styles.button}>
50+
<Button
51+
color={RICH_BLACK}
52+
backgroundColor={WHITE}
53+
onClick={() => setDestroyed(true)}
54+
label='Dismiss'
55+
paddingClass='px-2 py-1'
56+
textClass='text-[13px]'
57+
/>
58+
</div>
59+
60+
</div>
61+
62+
</div>
63+
)
64+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.container {
2+
@apply fixed inset-0 flex items-center justify-center text-white;
3+
}
4+
5+
.title {
6+
@apply text-[16px];
7+
}
8+
9+
.message {
10+
@apply text-[14px] text-white/70 mb-4;
11+
}
12+
13+
.icon {
14+
@apply mb-4;
15+
}
16+
17+
.content {
18+
@apply flex flex-col gap-y-2 items-center justify-center text-center bg-transparent;
19+
}

src/components/Status.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import PlatformaticIcon from './PlatformaticIcon'

src/components/TabbedWindow.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useEffect, useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './TabbedWindow.module.css'

src/components/Tag.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import commonStyles from './Common.module.css'

src/components/TextWithLabel.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import styles from './TextWithLabel.module.css'
66
function TextWithLabel ({
77
label = '',
88
text = '',
9-
children = null,
9+
children,
1010
color = WHITE,
1111
fontSize = FONT_BASE
1212
}) {

src/components/Tooltip.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import PropTypes from 'prop-types'
32
import styles from './Tooltip.module.css'
43
import { useEffect, useRef, useState } from 'react'
@@ -11,7 +10,7 @@ function Tooltip ({
1110
activeDependsOnVisible = false,
1211
content = null,
1312
delay = 0,
14-
children = null,
13+
children,
1514
tooltipClassName = '',
1615
offset = 0,
1716
position = POSITION_CENTER

src/components/TooltipAbsolute.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import PropTypes from 'prop-types'
32
import styles from './TooltipAbsolute.module.css'
43
import { useEffect, useState } from 'react'
@@ -8,7 +7,7 @@ const TooltipAbsolute = ({
87
direction = DIRECTION_TOP,
98
tooltipClassName = '',
109
delay = 0,
11-
children = null,
10+
children,
1211
content = null,
1312
offset = 0,
1413
position = POSITION_START,

src/components/Versions.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import BorderedBox from './BorderedBox'
43

src/components/VerticalSeparator.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React from 'react'
32
import PropTypes from 'prop-types'
43
import { DARK_GREEN, MAIN_DARK_BLUE, OPACITY_10, OPACITY_20, OPACITY_30, OPACITY_60, OPACITY_100, WHITE } from './constants'

src/components/backgrounds/AppBackgroundIcon.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
const AppBackgroundIcon = () => {
42
return (
53
<svg width='669' height='669' viewBox='0 0 669 669' fill='none' xmlns='http://www.w3.org/2000/svg'>

src/components/backgrounds/LensBackgroundIcon.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
const LensBackgroundIcon = () => {
42
return (
53
<svg width='828' height='828' viewBox='0 0 828 828' fill='none' xmlns='http://www.w3.org/2000/svg'>

src/components/backgrounds/TimerBackgroundIcon.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
const TimerBackgroundIcon = () => {
42
return (
53
<svg width='828' height='828' viewBox='0 0 828 828' fill='none' xmlns='http://www.w3.org/2000/svg'>

src/components/forms/Field.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Field ({
77
title = '',
88
titleColor = MAIN_DARK_BLUE,
99
helper = '',
10-
children = null,
10+
children,
1111
disabled = false,
1212
required = false,
1313
titleClassName = '',

src/components/forms/Input.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './Input.module.css'

src/components/forms/InputFileUpload.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState } from 'react'
32
import PropTypes from 'prop-types'
43
import styles from './InputFileUpload.module.css'

src/components/forms/InputWithSeparator.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
import React, { useState, useEffect } from 'react'
32
import PropTypes from 'prop-types'
43
import inputStyles from './Input.module.css'

0 commit comments

Comments
 (0)