Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updating details for the plugin and template #131

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/renderer/src/components/plugins/Plugin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Button, ModalDirectional } from '@platformatic/ui-components'
import { useState } from 'react'
import PluginDetail from './PluginDetail'

function Plugin ({ name, onClickCardPlugin, isSelected, description, tags, author, homepage }) {
function Plugin ({ name, onClickCardPlugin, isSelected, description, tags, author, homepage, downloads }) {
const [showModalDetail, setShowModalDetail] = useState(false)
let className = `${commonStyles.smallFlexBlock} ${styles.container} `
className += isSelected ? styles.selected : styles.unSelected
Expand Down Expand Up @@ -59,6 +59,7 @@ function Plugin ({ name, onClickCardPlugin, isSelected, description, tags, autho
tags={tags}
author={author}
homepage={homepage}
downloads={downloads}
onClickSelectPlugin={() => handleClickSelectPluginDetail()}
/>
</ModalDirectional>
Expand Down Expand Up @@ -91,8 +92,14 @@ Plugin.propTypes = {
/**
* homepage
*/
homepage: PropTypes.string

homepage: PropTypes.string,
/**
* downloads
*/
downloads: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
])
}

Plugin.defaultProps = {
Expand All @@ -101,6 +108,7 @@ Plugin.defaultProps = {
description: '',
tags: [],
author: '',
downloads: 0,
homepage: ''
}

Expand Down
23 changes: 22 additions & 1 deletion src/renderer/src/components/plugins/PluginDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Title from '~/components/ui/Title'
import { Button, HorizontalSeparator, Icons, Tag, VerticalSeparator } from '@platformatic/ui-components'
import { MARGIN_0, OPACITY_30, RICH_BLACK, SMALL, TERTIARY_BLUE, WHITE } from '@platformatic/ui-components/src/components/constants'

function PluginDetail ({ name, description, tags, author, homepage, onClickSelectPlugin }) {
function PluginDetail ({ name, description, tags, author, homepage, downloads, onClickSelectPlugin }) {
return (
<div className={styles.container}>
<div className={`${commonStyles.largeFlexBlock} ${commonStyles.fullWidth}`}>
Expand All @@ -20,11 +20,24 @@ function PluginDetail ({ name, description, tags, author, homepage, onClickSelec
/>
<p className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>{description}</p>
<div className={`${commonStyles.mediumFlexRow} ${commonStyles.fullWidth} ${commonStyles.itemsCenter} `}>
<div className={`${commonStyles.smallFlexRow} ${commonStyles.itemsCenter}`}>
<Icons.ComputerIcon color={WHITE} size={SMALL} />
<span className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>{downloads}</span>
</div>

<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} />

<div className={`${commonStyles.smallFlexRow} ${commonStyles.itemsCenter}`}>
<Icons.UserComputerIcon color={WHITE} size={SMALL} />
<span className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>{author}</span>
</div>

<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} />

<div className={`${commonStyles.smallFlexRow} ${commonStyles.itemsCenter}`}>
<span className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>Supported by: {author}</span>
</div>

{homepage && (
<>
<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} />
Expand Down Expand Up @@ -92,6 +105,13 @@ PluginDetail.propTypes = {
* homepage
*/
homepage: PropTypes.string,
/**
* downloads
*/
downloads: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
/**
* onClickSelectPlugin
*/
Expand All @@ -103,6 +123,7 @@ PluginDetail.defaultProps = {
tags: [],
author: '',
homepage: '',
downloads: 0,
onClickSelectPlugin: () => {}
}

Expand Down
10 changes: 10 additions & 0 deletions src/renderer/src/components/templates/Template.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function Template ({
tags,
author,
homepage,
downloads,
onClickCardTemplate
}) {
const [showModalDetail, setShowModalDetail] = useState(false)
Expand Down Expand Up @@ -66,6 +67,7 @@ function Template ({
description={description}
tags={tags}
author={author}
downloads={downloads}
homepage={homepage}
onClickSelectTemplate={() => handleClickSelectTemplateDetail()}
/>
Expand Down Expand Up @@ -105,6 +107,13 @@ Template.propTypes = {
* author
*/
author: PropTypes.string,
/**
* downloads
*/
downloads: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
/**
* homepage
*/
Expand All @@ -118,6 +127,7 @@ Template.defaultProps = {
onClickCardTemplate: () => {},
description: '',
author: '',
downloads: 0,
homepage: '',
tags: []
}
Expand Down
23 changes: 22 additions & 1 deletion src/renderer/src/components/templates/TemplateDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Title from '~/components/ui/Title'
import { Button, HorizontalSeparator, Icons, Tag, VerticalSeparator } from '@platformatic/ui-components'
import { MARGIN_0, OPACITY_30, RICH_BLACK, SMALL, TERTIARY_BLUE, WHITE } from '@platformatic/ui-components/src/components/constants'

function TemplateDetail ({ name, description, tags, author, homepage, onClickSelectTemplate }) {
function TemplateDetail ({ name, description, tags, author, homepage, downloads, onClickSelectTemplate }) {
return (
<div className={styles.container}>
<div className={`${commonStyles.largeFlexBlock} ${commonStyles.fullWidth}`}>
Expand All @@ -20,11 +20,24 @@ function TemplateDetail ({ name, description, tags, author, homepage, onClickSel
/>
<p className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>{description}</p>
<div className={`${commonStyles.mediumFlexRow} ${commonStyles.fullWidth} ${commonStyles.itemsCenter} `}>
<div className={`${commonStyles.smallFlexRow} ${commonStyles.itemsCenter}`}>
<Icons.ComputerIcon color={WHITE} size={SMALL} />
<span className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>{downloads}</span>
</div>

<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} />

<div className={`${commonStyles.smallFlexRow} ${commonStyles.itemsCenter}`}>
<Icons.UserComputerIcon color={WHITE} size={SMALL} />
<span className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>{author}</span>
</div>

<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} />

<div className={`${commonStyles.smallFlexRow} ${commonStyles.itemsCenter}`}>
<span className={`${typographyStyles.desktopBodyLarge} ${typographyStyles.textWhite} ${typographyStyles.opacity70}`}>Supported by: {author}</span>
</div>

{homepage && (
<>
<VerticalSeparator color={WHITE} backgroundColorOpacity={OPACITY_30} />
Expand Down Expand Up @@ -87,6 +100,13 @@ TemplateDetail.propTypes = {
* author
*/
author: PropTypes.string,
/**
* downloads
*/
downloads: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
/**
* onClickSelectTemplate
*/
Expand All @@ -101,6 +121,7 @@ TemplateDetail.defaultProps = {
description: '',
tags: [],
author: '',
downloads: 0,
homepage: '',
onClickSelectTemplate: () => {}
}
Expand Down