Skip to content

Commit

Permalink
fix: make data entry app support RTL [DHIS2-16779] (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp authored Oct 17, 2024
1 parent c161d8a commit d830626
Show file tree
Hide file tree
Showing 49 changed files with 3,942 additions and 3,140 deletions.
5 changes: 5 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { config } = require('@dhis2/cli-style')

module.exports = {
extends: [config.stylelint],
}
1 change: 1 addition & 0 deletions d2.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const config = {
entryPoints: {
app: './src/app/app-wrapper.js',
},
direction: 'auto',
}

module.exports = config
9 changes: 7 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-10-16T08:10:10.883Z\n"
"PO-Revision-Date: 2024-10-16T08:10:10.883Z\n"
"POT-Creation-Date: 2024-10-17T12:07:03.346Z\n"
"PO-Revision-Date: 2024-10-17T12:07:03.347Z\n"

msgid "Not authorized"
msgstr "Not authorized"
Expand Down Expand Up @@ -572,6 +572,11 @@ msgstr "Type here to filter in this section"
msgid "1 item hidden by filter"
msgstr "1 item hidden by filter"

msgid "{{count}} items hidden by filter"
msgid_plural "{{count}} items hidden by filter"
msgstr[0] "{{count}} items hidden by filter"
msgstr[1] "{{count}} items hidden by filter"

msgid "{{pendingMutations}} change saved locally"
msgstr "{{pendingMutations}} change saved locally"

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
"jgs:start": "BROWSER=none yarn start --proxy https://debug.dhis2.org/dev"
},
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@badeball/cypress-cucumber-preprocessor": "^16.0.0",
"@cypress/webpack-preprocessor": "^5.17.0",
"@dhis2/cli-app-scripts": "^10.4.0",
"@dhis2/cli-style": "10.5.1",
"@dhis2/cli-app-scripts": "^11.7.2",
"@dhis2/cli-style": "^10.7.4",
"@dhis2/cypress-commands": "^10.0.1",
"@dhis2/cypress-plugins": "^10.0.1",
"@dhis2/d2-i18n": "1.1.3",
Expand All @@ -50,7 +51,7 @@
"dependencies": {
"@dhis2/app-runtime": "^3.10.2",
"@dhis2/multi-calendar-dates": "^1.3.1",
"@dhis2/ui": "^9.2.0",
"@dhis2/ui": "^9.11.8",
"@dhis2/ui-forms": "7.16.3",
"@tanstack/react-query": "4.24.10",
"@tanstack/react-query-devtools": "4.24.14",
Expand Down
21 changes: 12 additions & 9 deletions src/app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,35 @@ body {
@media print {
/* This style is needed otherwise Chrome is printing only the visible part of a scrollable div, so we end up with one page of the form printed
https://stackoverflow.com/questions/25187715/css-print-media-query-prints-only-first-page */
* { overflow: visible !important; }
* {
overflow: visible !important;
}
div {
display: block !important; /* This is needed to get around issues with FireFox printing CSS grids: https://tosbourn.com/firefox-printing-issue-for-grid-css/ */
max-width: 100% !important;
max-inline-size: 100% !important;
outline: none !important;
}
.app-shell-adapter > header {
.app-shell-adapter > header {
display: none;
}

.hideForPrint {
display: none !important;
}

table {
max-width: 100% !important;
max-inline-size: 100% !important;
page-break-after: always;
}

table:last-child {
page-break-after: avoid;
}

tr, td {

tr,
td {
break-inside: avoid;
page-break-inside: avoid;;
page-break-inside: avoid;
}

.form-cleared input,
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/layout.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.wrapper {
height: 100%;
block-size: 100%;
display: grid;
grid-template-rows: auto 1fr;
grid-template-columns: 1fr 0;
Expand Down
5 changes: 3 additions & 2 deletions src/app/load-app.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.center {
margin-top: var(--spacers-dp48)
margin-block-start: var(--spacers-dp48);
}

.noticeBoxWrapper {
margin: var(--spacers-dp8) var(--spacers-dp12) var(--spacers-dp8) var(--spacers-dp12);
margin: var(--spacers-dp8) var(--spacers-dp12) var(--spacers-dp8)
var(--spacers-dp12);
}
7 changes: 3 additions & 4 deletions src/bottom-bar/bottom-bar.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.bottomBar {
box-shadow:
0px 0px 1px rgba(33,41,52,0.1),
0px -4px 6px -1px rgba(33,41,52,0.1),
0px -2px 4px -1px rgba(33,41,52,0.06);
box-shadow: 0px 0px 1px rgba(33, 41, 52, 0.1),
0px -4px 6px -1px rgba(33, 41, 52, 0.1),
0px -2px 4px -1px rgba(33, 41, 52, 0.06);
}
4 changes: 2 additions & 2 deletions src/bottom-bar/data-item-bar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
display: flex;
padding: 4px 12px;
align-items: center;
border-bottom: 1px solid var(--colors-grey400);
border-block-end: 1px solid var(--colors-grey400);
}

.name {
display: block;
margin-right: 8px;
margin-inline-end: 8px;
font-size: 13px;
line-height: 15px;
color: var(--colors-grey800);
Expand Down
16 changes: 9 additions & 7 deletions src/bottom-bar/main-tool-bar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,31 @@

.toolbarItem {
display: flex;
margin-right: 12px;
margin-inline-end: 12px;
}

.toolbarItem:last-child {
/*
* This way we avoid a break/overflow when the
* margin would "spill over" otherwise
*/
margin-right: 0;
margin-inline-end: 0;
}

.tooltipToolbarItem {
margin-right: 12px;
margin-inline-end: 12px;
}

.icon {
display: block;
margin-right: 4px;
height: 16px;
width: 16px;
margin-inline-end: 4px;
block-size: 16px;
inline-size: 16px;
}

.goToInvalidValue, .goToErrorValue, .completionSummary {
.goToInvalidValue,
.goToErrorValue,
.completionSummary {
display: flex;
align-items: center;
border: 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.wrapper {
margin-top: 16px;
margin-block-start: 16px;
}
.title {
color: var(--colors-grey900);
Expand All @@ -17,5 +17,5 @@
}

.commentViolationRule {
composes: priorityGroupBox info from "./validation-priority-group.module.css";
}
composes: priorityGroupBox info from './validation-priority-group.module.css';
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
display: inline-block;
}
.priorityGroupBox {
margin-bottom: 12px;
padding-top: 8px;
padding-bottom: 12px;
margin-block-end: 12px;
padding-block: 8px 12px;
padding-inline-start: 12px;
padding-inline-end: 8px;
font-size: 14px;
line-height: 19px;
color: var(--colors-grey900);
}
.formula {
margin-top: 8px;
margin-block-start: 8px;
font-size: 12px;
line-height: 16px;
color: var(--colors-grey700);
Expand All @@ -40,4 +39,4 @@
.info {
background-color: var(--colors-grey050);
border-inline-start: 4px solid var(--colors-grey500);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.wrapper {
padding: var(--spacers-dp16)
padding: var(--spacers-dp16);
}

.buttons {
display: flex;
gap: 4px;
gap: 4px;
}

.title {
Expand Down Expand Up @@ -39,5 +39,5 @@
}

.dataChangedNotice {
margin-bottom: 8px;
}
margin-block-end: 8px;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.formulaValue {
font-style: italic;
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
.summaryBox {
width: 30%;
inline-size: 30%;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 8px;
padding-bottom: 8px;
margin-bottom: 24px;
padding-block: 8px;
margin-block-end: 24px;
}

.summaryBox :global(svg) {
margin-inline-end: 4px;
}

.summaryBox .title {
margin-bottom: 8px;
margin-block-end: 8px;
font-size: 13px;
font-weight: 500;
display: flex;
Expand Down Expand Up @@ -49,4 +48,4 @@
}
.hideCounts .count {
visibility: hidden;
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
.container {
width: 400px;
inline-size: 400px;
padding: 16px;
}

.inputs {
margin-bottom: 32px;
margin-block-end: 32px;
}

.input {
margin-bottom: 16px;
margin-block-end: 16px;
}

.input:last-child {
margin-bottom: 0;
margin-block-end: 0;
}

.noOptionsBox {
margin: var(--spacers-dp8)
}
margin: var(--spacers-dp8);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@media print {
.hideForPrint {
composes: hideForPrint from '../../app/app.css'
}
}
composes: hideForPrint from '../../app/app.css';
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.container {
height: 40px;
block-size: 40px;
display: flex;
align-items: center;
padding: 0 var(--spacers-dp8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
padding: var(--spacers-dp12) 0;
}

.shortcut, .shortcutKey {
.shortcut,
.shortcutKey {
font-family: monospace;
font-size: 13px;
line-height: 16px;
Expand Down
4 changes: 2 additions & 2 deletions src/context-selection/menu-select/menu-select.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.menuSelect {
width: 400px;
max-height: 70vh;
inline-size: 400px;
max-block-size: 70vh;
overflow: hidden;
overflow-y: auto;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.itemContentContainer {
min-width: 400px;
min-height: 280px;
max-height: 70vh;
min-inline-size: 400px;
min-block-size: 280px;
max-block-size: 70vh;
display: flex;
flex-direction: column;
}
Expand All @@ -19,12 +19,12 @@
flex-grow: 1;
overflow: hidden;
overflow-y: auto;
padding-left: var(--spacers-dp8);
padding-inline-start: var(--spacers-dp8);
}

.labelContentContainer {
padding: var(--spacers-dp8);
margin-top: var(--spacers-dp4);
margin-block-start: var(--spacers-dp4);
display: flex;
align-items: center;
color: var(--colors-grey600);
Expand All @@ -33,7 +33,7 @@
.label {
font-size: 13px;
line-height: 16px;
padding-left: var(--spacers-dp4);
padding-inline-start: var(--spacers-dp4);
}

.disabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const IconizedCheckbox = ({
<style jsx>{`
span {
display: inline-block;
margin-right: 4px;
margin-inline-end: 4px;
}
`}</style>
</>
Expand Down
Loading

1 comment on commit d830626

@dhis2-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.