-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6002 from beyondessential/dev
merge: update branch with latest dev
- Loading branch information
Showing
26 changed files
with
199 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ase/src/migrations/20241104002014-addPacmossiInsecticideTestEntityType-modifies-schema.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
var dbm; | ||
var type; | ||
var seed; | ||
|
||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function (options, seedLink) { | ||
dbm = options.dbmigrate; | ||
type = dbm.dataType; | ||
seed = seedLink; | ||
}; | ||
|
||
exports.up = function (db) { | ||
return db.runSql( | ||
`ALTER TYPE public.entity_type ADD VALUE IF NOT EXISTS 'pacmossi_insecticide_test'`, | ||
); | ||
}; | ||
|
||
exports.down = function (db) { | ||
return null; | ||
}; | ||
|
||
exports._meta = { | ||
version: 1, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
packages/tupaia-web/src/features/ExportSettings/ExportDescriptionInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2024 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { useExportSettings } from './ExportSettingsContext'; | ||
import { ExportSettingLabel } from './ExportSettingLabel'; | ||
import { TextField, OutlinedTextFieldProps } from '@material-ui/core'; | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
const ExportDescriptionInputArea = styled((props: OutlinedTextFieldProps) => ( | ||
<TextField {...props} /> | ||
))` | ||
margin-block-start: 0.6rem; | ||
.MuiInputBase-root { | ||
border: 1px solid ${({ theme }) => theme.palette.text.secondary}; | ||
border-radius: 5px; | ||
padding: 0.6rem 0.75rem 0.75rem; | ||
background: none; | ||
color: ${({ theme }) => theme.palette.text.primary}; | ||
font-size: 0.875rem; | ||
line-height: 1.4; | ||
&.Mui-error { | ||
border: 1px solid ${({ theme }) => theme.palette.error.main}; | ||
} | ||
&.Mui-focused { | ||
border-color: ${({ theme }) => theme.palette.text.primary}; | ||
} | ||
} | ||
`; | ||
|
||
const ExportDescription = styled.div<{ | ||
error: boolean; | ||
}>` | ||
display: flex; | ||
align-self: end; | ||
justify-content: space-between; | ||
margin-top: 0.3rem; | ||
color: ${({ error, theme }) => (error ? theme.palette.error.main : theme.palette.text.secondary)}; | ||
font-size: 0.75rem; | ||
`; | ||
|
||
const MAX_CHARACTERS = 250; | ||
|
||
export const ExportDescriptionInput = () => { | ||
const { exportDescription, updateExportDescription } = useExportSettings(); | ||
const showMaxCharsWarning = exportDescription.length >= MAX_CHARACTERS; | ||
|
||
return ( | ||
<Wrapper> | ||
<ExportSettingLabel as="legend">Description</ExportSettingLabel> | ||
<ExportDescriptionInputArea | ||
id="description" | ||
multiline | ||
rows={4} | ||
value={exportDescription} | ||
onChange={updateExportDescription} | ||
variant="outlined" | ||
error={showMaxCharsWarning} | ||
inputProps={{ maxLength: MAX_CHARACTERS }} | ||
placeholder="Enter description here" | ||
/> | ||
<ExportDescription error={showMaxCharsWarning}> | ||
{showMaxCharsWarning && 'Character limit reached: '} | ||
{exportDescription.length}/{MAX_CHARACTERS} | ||
</ExportDescription> | ||
</Wrapper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.