From d582323c438fc07a972177a1c6e5b4f2303e2e3e Mon Sep 17 00:00:00 2001 From: Scott Hallock Date: Sat, 8 Apr 2023 15:02:54 -0400 Subject: [PATCH 1/3] move ReviewStatus files to new folder --- components/ChallengeMaterial/ChallengeMaterial.tsx | 2 +- components/ReviewCard/ReviewCard.tsx | 2 +- components/{ => ReviewStatus}/ReviewStatus.test.js | 4 ++-- components/{ => ReviewStatus}/ReviewStatus.tsx | 10 ++++++---- components/ReviewStatus/index.tsx | 1 + .../ReviewStatus/reviewStatus.module.scss | 0 stories/components/ReviewStatus.stories.tsx | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) rename components/{ => ReviewStatus}/ReviewStatus.test.js (96%) rename components/{ => ReviewStatus}/ReviewStatus.tsx (89%) create mode 100644 components/ReviewStatus/index.tsx rename scss/reviewerComment.module.scss => components/ReviewStatus/reviewStatus.module.scss (100%) diff --git a/components/ChallengeMaterial/ChallengeMaterial.tsx b/components/ChallengeMaterial/ChallengeMaterial.tsx index 102aebe0d7..342b74f7e8 100644 --- a/components/ChallengeMaterial/ChallengeMaterial.tsx +++ b/components/ChallengeMaterial/ChallengeMaterial.tsx @@ -28,7 +28,7 @@ import { GlobalContext } from '../../helpers/globalContext' import { SubmissionComments } from '../SubmissionComments' import { SelectIteration } from '../SelectIteration' import Error, { StatusCode } from '../Error' -import { ReviewStatus } from '../ReviewStatus' +import ReviewStatus from '../ReviewStatus' import useBreakpoint from '../../helpers/useBreakpoint' import MDXcomponents from '../../helpers/mdxComponents' dayjs.extend(relativeTime) diff --git a/components/ReviewCard/ReviewCard.tsx b/components/ReviewCard/ReviewCard.tsx index 03051f9607..0cd4237053 100644 --- a/components/ReviewCard/ReviewCard.tsx +++ b/components/ReviewCard/ReviewCard.tsx @@ -24,7 +24,7 @@ import DiffView from '../DiffView' import { updateCache } from '../../helpers/updateCache' import { SelectIteration } from '../SelectIteration' import Error, { StatusCode } from '../Error' -import { ReviewStatus } from '../ReviewStatus' +import ReviewStatus from '../ReviewStatus' import styles from './reviewCard.module.scss' dayjs.extend(relativeTime) diff --git a/components/ReviewStatus.test.js b/components/ReviewStatus/ReviewStatus.test.js similarity index 96% rename from components/ReviewStatus.test.js rename to components/ReviewStatus/ReviewStatus.test.js index 36674ad042..40fe2ee720 100644 --- a/components/ReviewStatus.test.js +++ b/components/ReviewStatus/ReviewStatus.test.js @@ -1,8 +1,8 @@ import React from 'react' import { render, screen } from '@testing-library/react' import '@testing-library/jest-dom' -import { ReviewStatus } from './ReviewStatus' -import { SubmissionStatus } from '../graphql' +import ReviewStatus from './ReviewStatus' +import { SubmissionStatus } from '../../graphql' describe('ReviewComment component', () => { const data = { diff --git a/components/ReviewStatus.tsx b/components/ReviewStatus/ReviewStatus.tsx similarity index 89% rename from components/ReviewStatus.tsx rename to components/ReviewStatus/ReviewStatus.tsx index 7acfcbf021..b07ac1a7b8 100644 --- a/components/ReviewStatus.tsx +++ b/components/ReviewStatus/ReviewStatus.tsx @@ -1,13 +1,13 @@ import React from 'react' import dayjs from 'dayjs' import LocalizedFormat from 'dayjs/plugin/localizedFormat' -import { SubmissionStatus } from '../graphql/index' -import styles from '../scss/reviewerComment.module.scss' -import ReviewerProfile from './ReviewerProfile' +import { SubmissionStatus } from '../../graphql/index' +import styles from './reviewStatus.module.scss' +import ReviewerProfile from '../ReviewerProfile' import Markdown from 'markdown-to-jsx' dayjs.extend(LocalizedFormat) -export const ReviewStatus: React.FC<{ +const ReviewStatus: React.FC<{ username?: string name?: string comment?: string | null @@ -60,3 +60,5 @@ export const ReviewStatus: React.FC<{ ) } + +export default ReviewStatus diff --git a/components/ReviewStatus/index.tsx b/components/ReviewStatus/index.tsx new file mode 100644 index 0000000000..48039bfcd9 --- /dev/null +++ b/components/ReviewStatus/index.tsx @@ -0,0 +1 @@ +export { default } from './ReviewStatus' diff --git a/scss/reviewerComment.module.scss b/components/ReviewStatus/reviewStatus.module.scss similarity index 100% rename from scss/reviewerComment.module.scss rename to components/ReviewStatus/reviewStatus.module.scss diff --git a/stories/components/ReviewStatus.stories.tsx b/stories/components/ReviewStatus.stories.tsx index 6988436878..751acde329 100644 --- a/stories/components/ReviewStatus.stories.tsx +++ b/stories/components/ReviewStatus.stories.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { ReviewStatus } from '../../components/ReviewStatus' +import ReviewStatus from '../../components/ReviewStatus' import { SubmissionStatus } from '../../graphql' export default { From 4a60ea5f45118f9050e189b7dcadb7609e42a9a3 Mon Sep 17 00:00:00 2001 From: Scott Hallock Date: Sat, 8 Apr 2023 15:06:33 -0400 Subject: [PATCH 2/3] move ScrollTopArrow files to new folder --- components/{ => ScrollTopArrow}/ScrollTopArrow.test.js | 0 components/{ => ScrollTopArrow}/ScrollTopArrow.tsx | 2 +- components/ScrollTopArrow/index.tsx | 1 + {scss => components/ScrollTopArrow}/scrollTopArrow.module.scss | 0 4 files changed, 2 insertions(+), 1 deletion(-) rename components/{ => ScrollTopArrow}/ScrollTopArrow.test.js (100%) rename components/{ => ScrollTopArrow}/ScrollTopArrow.tsx (93%) create mode 100644 components/ScrollTopArrow/index.tsx rename {scss => components/ScrollTopArrow}/scrollTopArrow.module.scss (100%) diff --git a/components/ScrollTopArrow.test.js b/components/ScrollTopArrow/ScrollTopArrow.test.js similarity index 100% rename from components/ScrollTopArrow.test.js rename to components/ScrollTopArrow/ScrollTopArrow.test.js diff --git a/components/ScrollTopArrow.tsx b/components/ScrollTopArrow/ScrollTopArrow.tsx similarity index 93% rename from components/ScrollTopArrow.tsx rename to components/ScrollTopArrow/ScrollTopArrow.tsx index 905bda5573..4cbe33b13c 100644 --- a/components/ScrollTopArrow.tsx +++ b/components/ScrollTopArrow/ScrollTopArrow.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import styles from '../scss/scrollTopArrow.module.scss' +import styles from './scrollTopArrow.module.scss' import throttle from 'lodash/throttle' import Image from 'next/image' diff --git a/components/ScrollTopArrow/index.tsx b/components/ScrollTopArrow/index.tsx new file mode 100644 index 0000000000..c5bac4362d --- /dev/null +++ b/components/ScrollTopArrow/index.tsx @@ -0,0 +1 @@ +export { default } from './ScrollTopArrow' diff --git a/scss/scrollTopArrow.module.scss b/components/ScrollTopArrow/scrollTopArrow.module.scss similarity index 100% rename from scss/scrollTopArrow.module.scss rename to components/ScrollTopArrow/scrollTopArrow.module.scss From f2212f622b118dd65883b78c6768daf2f912becb Mon Sep 17 00:00:00 2001 From: Scott Hallock Date: Sat, 8 Apr 2023 15:16:03 -0400 Subject: [PATCH 3/3] move SelectIteration files to new folder, update imports --- components/ChallengeMaterial/ChallengeMaterial.tsx | 2 +- components/ReviewCard/ReviewCard.tsx | 2 +- components/{ => SelectIteration}/SelectIteration.test.js | 2 +- components/{ => SelectIteration}/SelectIteration.tsx | 8 +++++--- .../__snapshots__/SelectIteration.test.js.snap | 0 components/SelectIteration/index.tsx | 1 + .../SelectIteration}/selectIteration.module.scss | 0 stories/components/SelectIteration.stories.tsx | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) rename components/{ => SelectIteration}/SelectIteration.test.js (99%) rename components/{ => SelectIteration}/SelectIteration.tsx (95%) rename components/{ => SelectIteration}/__snapshots__/SelectIteration.test.js.snap (100%) create mode 100644 components/SelectIteration/index.tsx rename {scss => components/SelectIteration}/selectIteration.module.scss (100%) diff --git a/components/ChallengeMaterial/ChallengeMaterial.tsx b/components/ChallengeMaterial/ChallengeMaterial.tsx index 342b74f7e8..abcc604783 100644 --- a/components/ChallengeMaterial/ChallengeMaterial.tsx +++ b/components/ChallengeMaterial/ChallengeMaterial.tsx @@ -26,7 +26,7 @@ import MdInput from '../MdInput' import { updateCache } from '../../helpers/updateCache' import { GlobalContext } from '../../helpers/globalContext' import { SubmissionComments } from '../SubmissionComments' -import { SelectIteration } from '../SelectIteration' +import SelectIteration from '../SelectIteration' import Error, { StatusCode } from '../Error' import ReviewStatus from '../ReviewStatus' import useBreakpoint from '../../helpers/useBreakpoint' diff --git a/components/ReviewCard/ReviewCard.tsx b/components/ReviewCard/ReviewCard.tsx index 0cd4237053..34fc0e1aa0 100644 --- a/components/ReviewCard/ReviewCard.tsx +++ b/components/ReviewCard/ReviewCard.tsx @@ -22,7 +22,7 @@ import Markdown from 'markdown-to-jsx' import MdInput from '../MdInput' import DiffView from '../DiffView' import { updateCache } from '../../helpers/updateCache' -import { SelectIteration } from '../SelectIteration' +import SelectIteration from '../SelectIteration' import Error, { StatusCode } from '../Error' import ReviewStatus from '../ReviewStatus' import styles from './reviewCard.module.scss' diff --git a/components/SelectIteration.test.js b/components/SelectIteration/SelectIteration.test.js similarity index 99% rename from components/SelectIteration.test.js rename to components/SelectIteration/SelectIteration.test.js index b891f881fd..ab6fdb6fa7 100644 --- a/components/SelectIteration.test.js +++ b/components/SelectIteration/SelectIteration.test.js @@ -1,5 +1,5 @@ import React from 'react' -import { SelectIteration } from './SelectIteration' +import SelectIteration from './SelectIteration' import { render, screen } from '@testing-library/react' import '@testing-library/jest-dom' import userEvent from '@testing-library/user-event' diff --git a/components/SelectIteration.tsx b/components/SelectIteration/SelectIteration.tsx similarity index 95% rename from components/SelectIteration.tsx rename to components/SelectIteration/SelectIteration.tsx index 420d1951ac..ba32bfcfba 100644 --- a/components/SelectIteration.tsx +++ b/components/SelectIteration/SelectIteration.tsx @@ -1,11 +1,11 @@ import React from 'react' -import styles from '../scss/selectIteration.module.scss' +import styles from './selectIteration.module.scss' import { ApolloError } from '@apollo/client' import { Submission, GetPreviousSubmissionsQuery, SubmissionStatus -} from '../graphql' +} from '../../graphql' import { Badge, Button } from 'react-bootstrap' type IterationLink = { @@ -101,7 +101,7 @@ const SelectDisplay: React.FC> = ({ return <> } -export const SelectIteration: React.FC = ({ +const SelectIteration: React.FC = ({ loading, error, data, @@ -132,3 +132,5 @@ export const SelectIteration: React.FC = ({ ) } + +export default SelectIteration diff --git a/components/__snapshots__/SelectIteration.test.js.snap b/components/SelectIteration/__snapshots__/SelectIteration.test.js.snap similarity index 100% rename from components/__snapshots__/SelectIteration.test.js.snap rename to components/SelectIteration/__snapshots__/SelectIteration.test.js.snap diff --git a/components/SelectIteration/index.tsx b/components/SelectIteration/index.tsx new file mode 100644 index 0000000000..8db9339126 --- /dev/null +++ b/components/SelectIteration/index.tsx @@ -0,0 +1 @@ +export { default } from './SelectIteration' diff --git a/scss/selectIteration.module.scss b/components/SelectIteration/selectIteration.module.scss similarity index 100% rename from scss/selectIteration.module.scss rename to components/SelectIteration/selectIteration.module.scss diff --git a/stories/components/SelectIteration.stories.tsx b/stories/components/SelectIteration.stories.tsx index e28097e94e..ad72cad9d2 100644 --- a/stories/components/SelectIteration.stories.tsx +++ b/stories/components/SelectIteration.stories.tsx @@ -1,6 +1,6 @@ import { ApolloError } from '@apollo/client' import React from 'react' -import { SelectIteration } from '../../components/SelectIteration' +import SelectIteration from '../../components/SelectIteration' import { GetPreviousSubmissionsQuery } from '../../graphql' export default {