Skip to content

Commit

Permalink
Merge pull request #591 from revisit-studies/dev
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
JackWilb authored Jan 23, 2025
2 parents 8321281 + 372efdb commit 99395d5
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report
2 changes: 1 addition & 1 deletion libraryDocGenerator.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ${libraryConfig.reference || libraryConfig.doi || libraryConfig.externalLink ? '
${libraryConfig.reference ? (forDocs ? `:::note[Reference]\n${libraryConfig.reference}\n:::` : `${libraryConfig.reference}`) : ''}
${libraryConfig.doi ? `DOI: [${libraryConfig.doi}](https://doi.org/${libraryConfig.doi})` : ''}
${libraryConfig.doi ? `DOI: [${libraryConfig.doi}](https://dx.doi.org/${libraryConfig.doi})` : ''}
${libraryConfig.externalLink ? `Link: [${libraryConfig.externalLink}](${libraryConfig.externalLink})` : ''}
Expand Down
3 changes: 1 addition & 2 deletions public/demo-survey/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@
"label": "Good",
"value": 100
}
],
"required": false
]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion public/revisitUtilities/revisit-communicate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const id = urlParams.get("id");

const sendMessage = (tag, message) => {
window.top.postMessage(
window.parent.postMessage(
{
error: false,
type: `${PREFIX}/${tag}`,
Expand Down
7 changes: 6 additions & 1 deletion src/components/ConfigSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '@tabler/icons-react';
import { useEffect, useMemo, useState } from 'react';
import { Timestamp } from 'firebase/firestore';
import { useNavigate, useSearchParams } from 'react-router';
import {
GlobalConfig, ParsedConfig, StudyConfig,
} from '../parser/types';
Expand Down Expand Up @@ -205,6 +206,10 @@ export function ConfigSwitcher({
const libraries = configsList.filter((configName) => configName.startsWith('library-'));
const others = configsList.filter((configName) => !configName.startsWith('demo-') && !configName.startsWith('tutorial-') && !configName.startsWith('example-') && !configName.startsWith('test-') && !configName.startsWith('library-'));

const [searchParams] = useSearchParams();
const tab = useMemo(() => searchParams.get('tab') || (others.length > 0 ? 'Others' : 'Demos'), [others.length, searchParams]);
const navigate = useNavigate();

return (
<AppShell.Main>
<Container size="sm" px={0}>
Expand All @@ -216,7 +221,7 @@ export function ConfigSwitcher({
src={`${PREFIX}revisitAssets/revisitLogoSquare.svg`}
alt="reVISit"
/>
<Tabs variant="outline" defaultValue={others.length > 0 ? 'Others' : 'Demos'}>
<Tabs variant="outline" defaultValue={others.length > 0 ? 'Others' : 'Demos'} value={tab} onChange={(value) => navigate(`/?tab=${value}`)}>
<Tabs.List>
{others.length > 0 && (
<Tabs.Tab value="Others">Your Studies</Tabs.Tab>
Expand Down
6 changes: 3 additions & 3 deletions src/components/response/ResponseSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export function ResponseSwitcher({

const [dontKnowCheckbox, setDontKnowCheckbox] = useState(!!storedAnswer?.[`${response.id}-dontKnow`] || false);
useEffect(() => {
form.setFieldValue(`${response.id}-dontKnow`, !!dontKnowCheckbox);
form.setFieldValue(`${response.id}-dontKnow`, dontKnowCheckbox.toString());
// reset answer value if dontKnowCheckbox changes
if (dontKnowCheckbox) {
form.setFieldValue(response.id, '');
if (!dontKnowCheckbox) {
form.setFieldValue(response.id, false.toString());
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dontKnowCheckbox, response.id]);
Expand Down
3 changes: 2 additions & 1 deletion src/components/response/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export const generateInitFields = (responses: Response[], storedAnswer: StoredAn
);
}

initObj = { ...initObj, [response.id]: initField, [`${response.id}-dontKnow`]: '' };
const dontKnowObj = response.withDontKnow ? { [`${response.id}-dontKnow`]: '' } : {};
initObj = { ...initObj, [response.id]: initField, ...dontKnowObj };
}
});

Expand Down
5 changes: 4 additions & 1 deletion src/store/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ export async function studyStoreCreator(
provenanceGraph: undefined,
};
}
state.trialValidation[payload.identifier][payload.location] = { valid: payload.status, values: payload.values };
if (Object.keys(payload.values).length > 0) {
const currentValues = state.trialValidation[payload.identifier][payload.location].values;
state.trialValidation[payload.identifier][payload.location] = { valid: payload.status, values: { ...currentValues, ...payload.values } };
}

if (payload.provenanceGraph) {
state.trialValidation[payload.identifier].provenanceGraph = payload.provenanceGraph;
Expand Down
1 change: 1 addition & 0 deletions typedocReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The different component types:
- [MarkdownComponent](interfaces/MarkdownComponent.md)
- [QuestionnaireComponent](interfaces/QuestionnaireComponent.md)
- [ReactComponent](interfaces/ReactComponent.md)
- [VegaComponent](type-aliases/VegaComponent.md)
- [WebsiteComponent](interfaces/WebsiteComponent.md)

## Responses
Expand Down

0 comments on commit 99395d5

Please sign in to comment.