Skip to content

Commit

Permalink
Merge pull request #686 from dhis2/next
Browse files Browse the repository at this point in the history
chore(release): merge next to master
  • Loading branch information
Birkbjo authored Sep 22, 2022
2 parents 6869213 + 542c9cd commit 20a0403
Show file tree
Hide file tree
Showing 20 changed files with 1,086 additions and 159 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ env:
GIT_COMMITTER_EMAIL: 'apps@dhis2.org'

jobs:
publish:
release:
runs-on: ubuntu-latest

if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- uses: actions/checkout@v2
with:
token: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}}
- uses: dhis2/action-semantic-release@update-deps
with:
publish-github: true
github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}
publish:
runs-on: ubuntu-latest
needs: [release]
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -104,8 +117,3 @@ jobs:
version_label: app-hub-prod-${{ github.run_id }}_${{ github.run_number}}
region: ${{ env.AWS_REGION }}
deployment_package: deploy.zip

- uses: dhis2/action-semantic-release@master
with:
publish-github: true
github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# [2.31.0](https://github.com/dhis2/app-hub/compare/v2.30.2...v2.31.0) (2022-09-21)


### Bug Fixes

* add missing file ([35caab5](https://github.com/dhis2/app-hub/commit/35caab5d4923b4fc0eafec1003c194890bc12c30))
* add missing markdown icon ([3f36fdf](https://github.com/dhis2/app-hub/commit/3f36fdf95c15923efac128e14bc8ac147e1d7fa1))
* add note about markdown support ([e31443e](https://github.com/dhis2/app-hub/commit/e31443ec5cfb0dc9585fdc04eb63b158d27ddd3f))
* add support for DHIS2 2.39 ([dc6958d](https://github.com/dhis2/app-hub/commit/dc6958d7805af05235cd779cc25cef11f6b5ac9b))
* **appdescription:** css and style cleanup ([0b7758f](https://github.com/dhis2/app-hub/commit/0b7758f68adb5e6ffd348a65c29940c08961266e))
* line-clamp in safari ([b9382bd](https://github.com/dhis2/app-hub/commit/b9382bd87b806390bbdaad1693a2ccf62f083566))
* update markdown-guide url ([fb10680](https://github.com/dhis2/app-hub/commit/fb10680bbbeb9df4aecf4807525ea6123424ea0a))
* **version:** close modal when deleting version ([b17a33f](https://github.com/dhis2/app-hub/commit/b17a33f1bb5a2304382267973279dc2079a5388d))


### Features

* **appupload:** add markdown-preview for description ([c0434fe](https://github.com/dhis2/app-hub/commit/c0434fe5576b67d6dad5b3cde70b5a0c57965980))
* **description:** support for markdown ([11548ee](https://github.com/dhis2/app-hub/commit/11548eed6cea5289a82067512d30d6f87534ee23))
* **editapp:** add preview for markdown ([313fc6e](https://github.com/dhis2/app-hub/commit/313fc6ede1fe16524edcc107481062d6377ab5c6))

## [2.30.2](https://github.com/dhis2/app-hub/compare/v2.30.1...v2.30.2) (2022-05-05)


Expand Down
6 changes: 6 additions & 0 deletions client/assets/icons/markdown_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions client/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
},
ui: {
dhisVersions: [
'2.39',
'2.38',
'2.37',
'2.36',
Expand Down
5 changes: 3 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client",
"version": "2.30.2",
"version": "2.31.0",
"description": "The App Hub Client",
"repository": "https://github.com/dhis2/app-hub",
"author": "Birk Johansson <birk@dhis2.org>",
Expand Down Expand Up @@ -29,6 +29,7 @@
"query-string": "^7.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-markdown": "^8.0.3",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.1",
"redux": "^4.1.1",
Expand All @@ -42,7 +43,7 @@
"use-query-params": "^1.2.3"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/core": "^7.19.1",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/preset-env": "^7.15.0",
Expand Down
30 changes: 19 additions & 11 deletions client/src/components/AppDescription/AppDescription.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import PropTypes from 'prop-types'
import ReactMarkdown from 'react-markdown'
import styles from './AppDescription.module.css'

const AppDescription = ({ description, paragraphClassName }) => {
const lines = description.split('\n')
return lines.map((line, index) => {
if (!line.trim()) {
return <br key={index} />
}
return (
<p key={index} className={paragraphClassName}>
{line}
</p>
)
})
return (
<div className={paragraphClassName}>
<ReactMarkdown
className={styles.markdownDescription}
linkTarget={'_blank'}
>
{description}
</ReactMarkdown>
</div>
)
}

AppDescription.propTypes = {
description: PropTypes.string,
paragraphClassName: PropTypes.string,
}

export default AppDescription
19 changes: 19 additions & 0 deletions client/src/components/AppDescription/AppDescription.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.markdownDescription h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 16px;
font-weight: 500;
}

.markdownDescription a {
color: var(--colors-blue600);
}

.markdownDescription a:hover,
.markdownDescription a:focus {
color: var(--colors-blue700);
text-decoration: underline;
}
29 changes: 29 additions & 0 deletions client/src/components/MarkdownEditor/MarkdownEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ReactFinalForm, TextAreaFieldFF } from '@dhis2/ui'
import styles from './MarkdownEditor.module.css'
import MarkdownIcon from 'assets/icons/markdown_icon.svg'

const MARKDOWN_GUIDE_URL = 'https://www.markdownguide.org/basic-syntax/'

const MarkdownEditor = ({ ...fieldProps }) => {
return (
<div className={styles.markdownFieldWrapper}>
<ReactFinalForm.Field
component={TextAreaFieldFF}
autoGrow
{...fieldProps}
/>
<label className={styles.markdownSupportedText}>
<span>Styling with Markdown is supported.</span>
<a
href={MARKDOWN_GUIDE_URL}
target={'_blank'}
className={styles.markdownLink}
>
<MarkdownIcon />
</a>
</label>
</div>
)
}

export default MarkdownEditor
43 changes: 43 additions & 0 deletions client/src/components/MarkdownEditor/MarkdownEditor.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

.markdownFieldWrapper {
border: 1px solid var(--colors-grey500);
border-radius: 3px;
background-color: var(--colors-grey100);
}

.markdownFieldWrapper :global(textarea) {
border: 0 !important;
border-bottom: 1px dashed var(--colors-grey600) !important;
border-bottom-left-radius: 0 !important;
box-shadow: none !important;
}

/*
TODO: Can remove when UI-library is updated
Fix for status-icon margin
This is fixed in latest UI
https://github.com/dhis2/ui/commit/3f23cc541e52ed02e4846dadb7a8e54baa92aef6 */
.markdownFieldWrapper :global(.status-icon) {
display: none;
}

.markdownSupportedText {
font-size: 12px;
padding: 4px 8px;
background-color: var(--colors-grey100);
color: var(--colors-grey700);
border-top: 1px dashed var(--colors-grey100);
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 3px;
}

.markdownLink {
fill: var(--colors-grey700);
}

.markdownLink:hover,
.markdownLink:focus {
fill: var(--colors-grey900);
}
28 changes: 18 additions & 10 deletions client/src/pages/Apps/AppCards/AppCardItem/AppCardItem.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import PropTypes from 'prop-types'
import React from 'react'
import ReactMarkdown from 'react-markdown'
import { Link } from 'react-router-dom'
import styles from './AppCardItem.module.css'
import config from 'config'
import AppIcon from 'src/components/AppIcon/AppIcon'

const summarise = text => {
const maxLength = 120
if (text.length > maxLength) {
return text.slice(0, maxLength) + '…'
}
return text
}

const AppCardItem = ({ id, name, developer, type, description, images }) => {
const logo = images.find(elem => elem.logo)
const logo = images.find((elem) => elem.logo)

return (
<Link to={`/app/${id}`} className={styles.appCard}>
Expand All @@ -32,12 +25,27 @@ const AppCardItem = ({ id, name, developer, type, description, images }) => {
</header>

<p className={styles.appCardDescription}>
{summarise(description)}
<Summary>
<ReactMarkdown
allowedElements={['p']}
unwrapDisallowed={false}
>
{description}
</ReactMarkdown>
</Summary>
</p>
</Link>
)
}

const Summary = ({ children }) => {
return <div className={styles.summary}>{children}</div>
}

Summary.propTypes = {
children: PropTypes.node,
}

AppCardItem.propTypes = {
developer: PropTypes.shape({
name: PropTypes.string,
Expand Down
12 changes: 12 additions & 0 deletions client/src/pages/Apps/AppCards/AppCardItem/AppCardItem.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@
.coreAppIcon {
width: 25px
}

.summary {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* This is needed for line-clamp to work in Safari */
.summary > p {
display: inline;
}
7 changes: 4 additions & 3 deletions client/src/pages/UserApp/VersionsCard/VersionsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ const DeleteVersionModal = ({ appId, version, mutate, onClose }) => {
setIsSubmitting(true)
try {
await api.deleteVersion(appId, version.id)
mutate(app => ({
mutate((app) => ({
...app,
versions: app.versions.filter(v => v.id != version.id),
versions: app.versions.filter((v) => v.id != version.id),
}))
successAlert.show({
message: `Successfully deleted version ${version.version}`,
})
onClose()
} catch (error) {
errorAlert.show({ error })
}
Expand Down Expand Up @@ -92,7 +93,7 @@ const DeleteVersionButton = ({ appId, version, mutate }) => {

const VersionsCard = ({ app, mutate }) => {
const versions = app.versions.sort((a, b) => b.created - a.created)
const renderDeleteVersionButton = version => (
const renderDeleteVersionButton = (version) => (
<DeleteVersionButton appId={app.id} version={version} mutate={mutate} />
)

Expand Down
Loading

0 comments on commit 20a0403

Please sign in to comment.