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

prompt activation frontend #12626

Open
wants to merge 76 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
44ebfe8
add type to table and color code it
emilia-friedberg Oct 14, 2024
ebf3272
finish updates to activities index page
emilia-friedberg Oct 14, 2024
f1428a7
possible to create a new activity with an ai type
emilia-friedberg Oct 14, 2024
2b0c837
nav updates
emilia-friedberg Oct 15, 2024
2e3f258
snapshot updates
emilia-friedberg Oct 15, 2024
620504b
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Oct 16, 2024
174bfe3
wip
emilia-friedberg Oct 17, 2024
f04d8fa
merge
emilia-friedberg Oct 17, 2024
d2e6849
wip before i mess up further
emilia-friedberg Oct 17, 2024
f2d56b9
wip -- actually saving working
emilia-friedberg Oct 18, 2024
0e47182
saving works and they populate correctly too!
emilia-friedberg Oct 18, 2024
cca177d
clean up
emilia-friedberg Oct 18, 2024
48b80fd
get invalid relevant texts populated on the activity form
emilia-friedberg Oct 18, 2024
97f63d7
small edits
emilia-friedberg Oct 18, 2024
71b1d87
tests
emilia-friedberg Oct 18, 2024
1cafc53
fix lint errors
emilia-friedberg Oct 18, 2024
795b881
remove trailing whitespace
emilia-friedberg Oct 18, 2024
7e6ccf3
clean up
emilia-friedberg Oct 18, 2024
04a90ba
fixes
emilia-friedberg Oct 18, 2024
3096028
fix test
emilia-friedberg Oct 18, 2024
c44829c
all refactors except service object
emilia-friedberg Oct 22, 2024
7357347
refactor gen ai stuff into a service object; tests still pass
emilia-friedberg Oct 22, 2024
308ac85
finish specs
emilia-friedberg Oct 22, 2024
db51f9e
fix lint errors
emilia-friedberg Oct 22, 2024
699a3cd
jamie's requested revisions
emilia-friedberg Oct 23, 2024
4fd2be9
other refactors
emilia-friedberg Oct 23, 2024
47b7528
merge develop
emilia-friedberg Oct 23, 2024
09575f3
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Oct 23, 2024
0b3dee0
thomas' revisions
emilia-friedberg Oct 23, 2024
f68e980
fixes
emilia-friedberg Oct 23, 2024
86bc644
try again
emilia-friedberg Oct 23, 2024
57ce9e2
datasets pages (#12473)
emilia-friedberg Oct 24, 2024
6e25b66
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Oct 24, 2024
65d43d7
Merge branch 'feat/update-evidence-cms-to-support-activity-types' of …
emilia-friedberg Oct 24, 2024
ef875f7
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Oct 28, 2024
46458be
individual dataset page (#12486)
emilia-friedberg Oct 30, 2024
e9005af
trial runner page pt 1 (#12503)
emilia-friedberg Nov 1, 2024
6409cd8
merge develop
emilia-friedberg Nov 1, 2024
3bed97a
trial runner page pt 2 (#12517)
emilia-friedberg Nov 7, 2024
29f87f5
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Nov 7, 2024
4a16f97
individual trial page part one (#12528)
emilia-friedberg Nov 13, 2024
bf15322
merge develop
emilia-friedberg Nov 13, 2024
df72855
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Nov 18, 2024
9448bd5
trial comparisons page (#12543)
emilia-friedberg Nov 18, 2024
8559859
some qa updates for evidence cms (#12569)
emilia-friedberg Nov 20, 2024
0f7ecef
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Nov 20, 2024
3b4d798
llm prompt templates page (#12582)
emilia-friedberg Nov 21, 2024
3196482
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Nov 22, 2024
5a4af03
Merge branch 'feat/update-evidence-cms-to-support-activity-types' of …
emilia-friedberg Nov 22, 2024
f955144
wip - now trying to reduce space
emilia-friedberg Nov 22, 2024
122ed5a
wip
emilia-friedberg Nov 26, 2024
853cda2
Merge branch 'develop' of https://github.com/empirical-org/Empirical-…
emilia-friedberg Nov 26, 2024
bf41ae6
Merge branch 'feat/update-evidence-cms-to-support-activity-types' of …
emilia-friedberg Nov 26, 2024
bfdbd32
favorite stuff is working
emilia-friedberg Nov 26, 2024
bbd92ea
wip
emilia-friedberg Dec 3, 2024
51a10cb
move some stuff around and allow for reactivation
emilia-friedberg Dec 3, 2024
0a787fc
always show textarea
emilia-friedberg Dec 3, 2024
2d8e61e
wip
emilia-friedberg Dec 3, 2024
13cdf9b
get modal working
emilia-friedberg Dec 3, 2024
b087db9
clean-up, i think
emilia-friedberg Dec 3, 2024
e71643d
merge
emilia-friedberg Dec 4, 2024
808d82c
adjust checkbox scss
emilia-friedberg Dec 4, 2024
a195e1d
Merge branch 'feat/update-evidence-cms-to-support-activity-types' of …
emilia-friedberg Dec 4, 2024
36d1e4f
looking good on the frontend
emilia-friedberg Dec 4, 2024
f2b6845
lint fixes
emilia-friedberg Dec 4, 2024
43ccdfd
negated matchers
emilia-friedberg Dec 4, 2024
b76eedc
Merge branch 'feat/update-evidence-cms-to-support-activity-types' of …
emilia-friedberg Dec 4, 2024
aee56b9
fix test failures
emilia-friedberg Dec 4, 2024
8c1a8a3
fix lint error
emilia-friedberg Dec 4, 2024
a16996c
backend tests
emilia-friedberg Dec 4, 2024
6561521
minor fixes
emilia-friedberg Dec 4, 2024
bf1490b
clean up
emilia-friedberg Dec 4, 2024
a20b3af
merge develop
emilia-friedberg Dec 5, 2024
ef281de
thomas' suggestions
emilia-friedberg Dec 5, 2024
edb58be
remove extra whitespace
emilia-friedberg Dec 5, 2024
cda38d9
brendan suggestion
emilia-friedberg Dec 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ exports[`CanvasIntegrationForm when there is an existing integration it should r
scope="col"
>
<button
aria-checked="true"
class="quill-checkbox selected"
role="checkbox"
type="button"
>
<img
Expand Down Expand Up @@ -243,8 +245,10 @@ exports[`CanvasIntegrationForm when there is not an existing integration it shou
scope="col"
>
<button
aria-checked="false"
aria-label="Unchecked checkbox"
class="quill-checkbox unselected"
role="checkbox"
type="button"
/>
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ exports[`CanvasIntegrationModal it should render when there is an existing integ
scope="col"
>
<button
aria-checked="true"
class="quill-checkbox selected"
role="checkbox"
type="button"
>
<img
Expand Down Expand Up @@ -263,8 +265,10 @@ exports[`CanvasIntegrationModal it should render when there is not an existing i
scope="col"
>
<button
aria-checked="false"
aria-label="Unchecked checkbox"
class="quill-checkbox unselected"
role="checkbox"
type="button"
/>
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ exports[`SchoolSelector it should render when all school ids are selected 1`] =
scope="col"
>
<button
aria-checked="true"
class="quill-checkbox selected"
role="checkbox"
type="button"
>
<img
Expand Down Expand Up @@ -98,8 +100,10 @@ exports[`SchoolSelector it should render when there are no selected school ids 1
scope="col"
>
<button
aria-checked="false"
aria-label="Unchecked checkbox"
class="quill-checkbox unselected"
role="checkbox"
type="button"
/>
</th>
Expand Down Expand Up @@ -170,7 +174,9 @@ exports[`SchoolSelector it should render when there is one selected school id 1`
scope="col"
>
<button
aria-checked="true"
class="quill-checkbox selected"
role="checkbox"
type="button"
>
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function clearInput(user, name) {

function topLevelCheckbox(user) {
const row = screen.getByRole('row', { name: /schools/i });
return within(row).getByRole('button', { name: /checkbox/i })
return within(row).getByRole('checkbox', { name: /checkbox/i })
}

function clickTopLevelCheckbox(user) {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('CanvasIntegrationForm', () => {
expect(getInputValue(user, /client id/i)).toBe(clientId)

const row = screen.getByRole('row', { name: /schools/i });
expect(within(row).getByRole('button', { name: /checked checkbox/i })).toBeTruthy()
expect(within(row).getByRole('checkbox', { name: /checked checkbox/i })).toBeTruthy()
})

it('calls close if cancel is clicked and there is a close prop', async () => {
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('CanvasIntegrationForm', () => {
expect(getInputValue(user, /client id/i)).toBe('')

const row = screen.getByRole('row', { name: /schools/i });
expect(within(row).getByRole('button', { name: /unchecked checkbox/i })).toBeTruthy()
expect(within(row).getByRole('checkbox', { name: /unchecked checkbox/i })).toBeTruthy()
})

it('calls close if cancel is clicked and there is a close prop', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports[`Checkbox it should render 1`] = `
<button
aria-checked="true"
class="quill-checkbox selected light focus-on-light"
id="test label"
role="checkbox"
type="button"
>
Expand All @@ -16,11 +17,12 @@ exports[`Checkbox it should render 1`] = `
src="https://assets.quill.org/images/icons/xs/check-small-white.svg"
/>
</button>
<span
<label
class=" light"
for="test label"
>
test label
</span>
</label>
</div>
</DocumentFragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ exports[`List it should render checkbox style as expected 1`] = `
<button
aria-checked="false"
class="quill-checkbox unselected light focus-on-light"
id="checkbox 1"
role="checkbox"
type="button"
/>
<span
<label
class=" light"
for="checkbox 1"
>
checkbox 1
</span>
</label>
</div>
</li>
<li>
Expand All @@ -29,14 +31,16 @@ exports[`List it should render checkbox style as expected 1`] = `
<button
aria-checked="false"
class="quill-checkbox unselected light focus-on-light"
id="checkbox 2"
role="checkbox"
type="button"
/>
<span
<label
class=" light"
for="checkbox 2"
>
checkbox 2
</span>
</label>
</div>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ exports[`RadioButton it should render 1`] = `
<button
aria-checked="true"
class="quill-radio-button interactive-wrapper selected light focus-on-light"
role="checkbox"
id="test label"
role="radio"
type="button"
>
<div
class="button-fill"
/>
</button>
<span
<label
class=" light focus-on-light"
for="test label"
>
test label
</span>
</label>
</div>
</DocumentFragment>
`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import { ACTIVE, DISABLED, INDETERMINATE } from '../../utils/constants';

const indeterminateBlackSrc = 'https://assets.quill.org/images/icons/xs/dash-black.svg'
Expand All @@ -10,14 +11,16 @@ const DARK = 'dark'
const LIGHT = 'light'

interface checkboxProps {
label: string;
label?: string;
mode?: string;
onClick?: () => void;
state?: string;
selected: boolean;
id?: string;
}

export const Checkbox = ({ label, mode=LIGHT, onClick, state, selected }: checkboxProps) => {
export const Checkbox = ({ label, mode=LIGHT, onClick, state, selected, id, }: checkboxProps) => {
const checkboxId = id || label
const labelClass = `${state === DISABLED ? DISABLED : ''} ${mode}`
const modeClass = mode === LIGHT ? `${mode} focus-on-light` : `${mode} focus-on-dark`

Expand All @@ -28,20 +31,27 @@ export const Checkbox = ({ label, mode=LIGHT, onClick, state, selected }: checkb
}

function renderCheckbox() {
let checkbox = (<button aria-checked={selected} className={`quill-checkbox unselected ${modeClass}`} onClick={onClick} role="checkbox" type="button">
const sharedProps = {
'aria-checked': selected,
id: checkboxId,
onClick,
role: 'checkbox'
}

let checkbox = (<button {...sharedProps} className={`quill-checkbox unselected ${modeClass}`} type="button">
{renderCheck()}
</button>)
if (state === INDETERMINATE) {
checkbox = (<button aria-checked={selected} className={`quill-checkbox indeterminate ${modeClass}`} onClick={onClick} role="checkbox" type="button">
checkbox = (<button {...sharedProps} className={`quill-checkbox indeterminate ${modeClass}`} type="button">
{renderCheck()}
</button>)

} else if (state === DISABLED) {
checkbox = (<button aria-checked={selected} className={`quill-checkbox ${selected ? 'selected' : 'unselected'} ${modeClass} disabled`} role="checkbox" type="button">
checkbox = (<button {...sharedProps} className={`quill-checkbox ${selected ? 'selected' : 'unselected'} ${modeClass} disabled`} disabled={true} type="button">
{renderCheck()}
</button>)
} else if (selected) {
checkbox = (<button aria-checked={selected} className={`quill-checkbox selected ${modeClass}`} onClick={onClick} role="checkbox" type="button">
checkbox = (<button {...sharedProps} className={`quill-checkbox selected ${modeClass}`} type="button">
{renderCheck()}
</button>)
}
Expand All @@ -51,7 +61,7 @@ export const Checkbox = ({ label, mode=LIGHT, onClick, state, selected }: checkb
return (
<div className="checkbox-container">
{renderCheckbox()}
<span className={labelClass}>{label}</span>
{label ? <label className={labelClass} htmlFor={checkboxId}>{label}</label> : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is purely stylistic, and I don't even know if it's better, but thoughts on using

{label && <label className={labelClass} htmlFor={checkboxId}>{label}</label>}

instead of a ternary? That may not actually do exactly the same thing, but I feel like I've seen us use that pattern in a couple of places, and I personally find it slightly more readable. But, again, it's just a style thing, so not a big deal either way.

</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class DataTable extends React.Component<DataTableProps, DataTableState> {
if (allChecked) {
return (
<th className={dataTableHeaderClassName} scope="col">
<button className="quill-checkbox selected" onClick={uncheckAllRows} type="button">
<button aria-checked={true} className="quill-checkbox selected" onClick={uncheckAllRows} role="checkbox" type="button">
<img alt="Checked checkbox" src={smallWhiteCheckSrc} />
</button>
</th>
Expand All @@ -206,7 +206,7 @@ export class DataTable extends React.Component<DataTableProps, DataTableState> {
if (anyChecked) {
return (
<th className={dataTableHeaderClassName} scope="col">
<button className="quill-checkbox selected" onClick={uncheckAllRows} type="button">
<button aria-checked={true} className="quill-checkbox selected" onClick={uncheckAllRows} role="checkbox" type="button">
<img alt="Checked checkbox" src={indeterminateSrc} />
</button>
</th>
Expand All @@ -215,7 +215,7 @@ export class DataTable extends React.Component<DataTableProps, DataTableState> {

return (
<th className={dataTableHeaderClassName} scope="col">
<button aria-label="Unchecked checkbox" className="quill-checkbox unselected" onClick={checkAllRows} type="button" />
<button aria-checked={false} aria-label="Unchecked checkbox" className="quill-checkbox unselected" onClick={checkAllRows} role="checkbox" type="button" />
</th>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@ import { DISABLED } from '../../utils/constants';
const LIGHT = 'light'

interface radioButtonProps {
label: string;
selected: boolean;
label?: string;
mode?: string;
onClick?: () => void;
state?: string;
selected: boolean;
value?: any;
id?: any;
ariaLabel?: string;
}

export const RadioButton = ({ label, mode = LIGHT, onClick, state, selected, value }: radioButtonProps) => {
export const RadioButton = ({ label, mode = LIGHT, onClick, state, selected, value, id, ariaLabel, }: radioButtonProps) => {
const radioButtonId = id || label

const elementClass = `${state === DISABLED ? DISABLED : ''} ${mode === LIGHT ? `${mode} focus-on-light` : `${mode} focus-on-dark`}`

return (
<div className="quill-radio-button-container">
<button aria-checked={selected} className={`quill-radio-button interactive-wrapper ${selected ? 'selected' : 'unselected'} ${elementClass}`} onClick={onClick} role="checkbox" type="button" value={value} >
<button aria-checked={selected} aria-label={ariaLabel} className={`quill-radio-button interactive-wrapper ${selected ? 'selected' : 'unselected'} ${elementClass}`} id={radioButtonId} onClick={onClick} role="radio" type="button" value={value} >
<div className="button-fill" />
</button>
<span className={elementClass}>{label}</span>
{label && <label className={elementClass} htmlFor={radioButtonId}>{label}</label>}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';

interface InputProps {
timesSubmitted: Number;
label: string;
label?: string;
error?: string;
disabled?: boolean;
className?: string;
Expand Down Expand Up @@ -129,7 +129,7 @@ export class TextArea extends React.Component<InputProps, InputState> {
onClick={this.activateInput}
ref={node => this.node = node}
>
<label>{label}</label>
<label htmlFor={id}>{label}</label>
<textarea
disabled={disabled}
id={id}
Expand All @@ -150,7 +150,7 @@ export class TextArea extends React.Component<InputProps, InputState> {
onClick={this.acknowledgeError}
ref={node => this.node = node}
>
<label>{label}</label>
<label htmlFor={id}>{label}</label>
<textarea
id={id}
maxLength={characterLimit ? characterLimit : 10000}
Expand All @@ -172,7 +172,7 @@ export class TextArea extends React.Component<InputProps, InputState> {
onClick={this.activateInput}
ref={node => this.node = node}
>
<label>{label}</label>
<label htmlFor={id}>{label}</label>
<textarea
defaultValue={value}
disabled={disabled}
Expand All @@ -191,7 +191,7 @@ export class TextArea extends React.Component<InputProps, InputState> {
className={sharedClasses}
ref={node => this.node = node}
>
<label>{label}</label>
<label htmlFor={id}>{label}</label>
<textarea
id={id}
maxLength={characterLimit ? characterLimit : 10000}
Expand All @@ -209,7 +209,7 @@ export class TextArea extends React.Component<InputProps, InputState> {
}

render() {
return <div onClick={this.props.onClick}>{this.renderInput()}</div>
return <div className="textarea-wrapper" onClick={this.props.onClick}>{this.renderInput()}</div>
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,20 @@
background-color: transparent;
}


.checkbox-container {
display: flex;
align-items: center;
padding: 8px;
.quill-checkbox:focus {
outline-offset: 3px;
}
span {
label {
@include display-xs-semibold;
}
span:last-of-type {
label:last-of-type {
margin-left: 8px;
margin-bottom: 0px;
font-weight: inherit;
&.disabled {
color: $quill-grey-30;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,8 @@ table.data-table {
.left-align {
text-align: left !important;
}

.grow-to-fit {
flex: 1;
width: 100%;
}
Loading