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
19 changes: 15 additions & 4 deletions packages/client/src/pages/contribute/ContributeLanding.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { Typography, Box, Stack, Button } from '@mui/material';
import { useNavigate } from 'react-router-dom';
import { useStudy } from '../../context/Study.context';
import { TagProvider, useTag } from '../../context/Tag.context';

export const ContributeLanding: React.FC = () => {
const ContributeLandingInternal: React.FC = () => {
const navigate = useNavigate();
const { study } = useStudy();
const { tag } = useTag();

const enterTagging = () => {
navigate('/contribute/tagging');
};

// TODO: Add in check for training completion

return (
<>
{study && (
Expand All @@ -22,13 +25,21 @@ export const ContributeLanding: React.FC = () => {
<Typography variant="body2">Study: {study.name}</Typography>
<Typography variant="body2">Description: {study.description}</Typography>
<Typography variant="body2">Instructions: {study.instructions}</Typography>
<Button variant="outlined" onClick={enterTagging}>
Enter tagging
</Button>
</Stack>
</Box>
<Button variant="outlined" onClick={enterTagging} disabled={tag == undefined}>
{tag ? 'Enter tagging' : 'No tagging left'}
</Button>
</Box>
)}
</>
);
};

export const ContributeLanding: React.FC = () => {
return (
<TagProvider>
<ContributeLandingInternal />
</TagProvider>
);
};
19 changes: 8 additions & 11 deletions packages/client/src/pages/contribute/TaggingInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@ import { TagForm } from '../../components/contribute/TagForm.component';
import { useStudy } from '../../context/Study.context';
import { useEffect, useState } from 'react';
import { useCompleteTagMutation } from '../../graphql/tag/tag';
import { NoTagNotification } from '../../components/contribute/NoTagNotification.component';
import { Study } from '../../graphql/graphql';
import { TagProvider, useTag } from '../../context/Tag.context';
import { NoTagNotification } from '../../components/contribute/NoTagNotification.component';

export const TaggingInterface: React.FC = () => {
const { study } = useStudy();

// TODO: View for when there is no study vs when there is no tag
return (
<>
<TagProvider>
{study && (
<>
<MainView study={study} />
</>
)}
</TagProvider>
</>
<TagProvider>
{study && (
<>
<MainView study={study} />
</>
)}
</TagProvider>
);
};

Expand Down