Skip to content
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
1 change: 1 addition & 0 deletions apps/gateway/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const Root = ({ id, initialSeriesIndex, target, token }: RootProps) => {
</header>
<main className="container flex min-h-0 max-w-3xl grow flex-col pb-16 pt-32 xl:max-w-5xl">
<InstrumentRenderer
disableSummaryActions
beforeBegin={<CapWidget onSolve={(token) => void handleSolve(token)} />}
className="min-h-full w-full"
disableBegin={!verified}
Expand Down
2 changes: 1 addition & 1 deletion apps/gateway/src/routers/cap.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const router = Router();
router.post('/challenge', (_, res) => {
res.status(200).json(
cap.createChallenge({
challengeDifficulty: 5,
challengeDifficulty: 4,
expiresMs: 60_000 * 5
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ export default defineInstrument({
{
title: 'String',
fields: {
stringCombobox: {
kind: 'string',
label: 'String (Combobox)',
options: {
a: 'A',
b: 'B',
c: 'C'
},
variant: 'combobox'
},
stringInput: {
kind: 'string',
label: 'String (Input)',
Expand Down Expand Up @@ -230,6 +240,7 @@ export default defineInstrument({
});
}
}),
stringCombobox: z.enum(['a', 'b', 'c']),
stringRadio: z.enum(['a', 'b', 'c']),
stringSelect: z.enum(['a', 'b', 'c']),
stringTextArea: z.string(),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opendatacapture",
"type": "module",
"version": "2.0.0",
"version": "2.1.0",
"private": true,
"packageManager": "pnpm@10.34.3",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/instrument-bundler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opendatacapture/instrument-bundler",
"type": "module",
"version": "2.0.0",
"version": "2.1.0",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/instrument-guidelines/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opendatacapture/instrument-guidelines",
"type": "module",
"version": "2.0.0",
"version": "2.1.0",
"description": "Guidelines for authoring Open Data Capture instruments, intended to be read by an AI agent (e.g. Claude Code).",
"license": "Apache-2.0",
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/instrument-utils/src/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ function translateScalarField(
options: field.options?.[language]
}))
.with(
{ kind: 'number', variant: P.union('radio', 'select') },
{ kind: 'number', variant: P.union('combobox', 'radio', 'select') },
{ kind: 'set' },
{ kind: 'string', variant: P.union('radio', 'select') },
{ kind: 'string', variant: P.union('combobox', 'radio', 'select') },
(field) => ({
...field,
...base,
Expand Down
2 changes: 1 addition & 1 deletion packages/playground-url/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opendatacapture/playground-url",
"type": "module",
"version": "2.0.0",
"version": "2.1.0",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type InstrumentRendererProps = {
className?: string;
/** When true, the "Begin" button on the overview screen is disabled. */
disableBegin?: boolean;
/** Whether to disable copy, download, print in the final summary */
disableSummaryActions?: boolean;
initialSeriesIndex?: number;
NavigationBlocker?: NavigationBlockerComponent;
onSubmit: InstrumentSubmitHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export type ScalarInstrumentRendererProps = {
className?: string;
/** When true, the "Begin" button on the overview screen is disabled. */
disableBegin?: boolean;
/** Whether to disable copy, download, print in the final summary */
disableSummaryActions?: boolean;
NavigationBlocker?: NavigationBlockerComponent;
/** @deprecated */
onCompileError?: (error: Error) => void;
Expand All @@ -42,6 +44,7 @@ export const ScalarInstrumentRenderer = ({
beforeBegin,
className,
disableBegin,
disableSummaryActions,
NavigationBlocker,
onCompileError,
onSubmit,
Expand Down Expand Up @@ -120,7 +123,13 @@ export const ScalarInstrumentRenderer = ({
);
})
.with({ index: 2 }, () => (
<InstrumentSummary data={data} instrument={instrument} subject={subject} timeCollected={Date.now()} />
<InstrumentSummary
data={data}
disableActions={disableSummaryActions}
instrument={instrument}
subject={subject}
timeCollected={Date.now()}
/>
))
.otherwise(() => null)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { SubjectDisplayInfo } from '../../types';

export type InstrumentSummaryProps = {
data: any;
disableActions?: boolean;
displayAllMeasures?: boolean;
instrument: AnyUnilingualInstrument;
subject?: SubjectDisplayInfo;
Expand All @@ -22,6 +23,7 @@ export type InstrumentSummaryProps = {

export const InstrumentSummary = ({
data,
disableActions,
displayAllMeasures,
instrument,
subject,
Expand Down Expand Up @@ -102,15 +104,17 @@ export const InstrumentSummary = ({
})}
</p>
</div>
<div className="hidden sm:flex sm:items-center sm:gap-1 print:hidden">
<CopyButton text={copyText} variant="ghost" />
<Button size="icon" type="button" variant="ghost" onClick={handleDownload}>
<DownloadIcon />
</Button>
<Button size="icon" type="button" variant="ghost" onClick={print}>
<PrinterIcon />
</Button>
</div>
{!disableActions && (
<div className="hidden sm:flex sm:items-center sm:gap-1 print:hidden">
<CopyButton text={copyText} variant="ghost" />
<Button size="icon" type="button" variant="ghost" onClick={handleDownload}>
<DownloadIcon />
</Button>
<Button size="icon" type="button" variant="ghost" onClick={print}>
<PrinterIcon />
</Button>
</div>
)}
</div>
<Separator />
{subject && (
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/src/instrument/instrument.form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const $$FormInstrumentStringField = <TLanguage extends InstrumentLanguage>(langu
$$FormInstrumentBaseField(language).extend({
kind: z.literal('string'),
options: $$InstrumentUIOption(z.record(z.string(), z.string().min(1)), language),
variant: z.enum(['radio', 'select'])
variant: z.enum(['combobox', 'radio', 'select'])
}),
$$FormInstrumentBaseField(language).extend({
kind: z.literal('string'),
Expand Down
2 changes: 1 addition & 1 deletion packages/serve-instrument/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opendatacapture/serve-instrument",
"type": "module",
"version": "2.0.0",
"version": "2.1.0",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
Expand Down
Loading
Loading