diff --git a/webui/package.json b/webui/package.json index a6fd4a58..902ed1db 100644 --- a/webui/package.json +++ b/webui/package.json @@ -49,7 +49,8 @@ "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "generate": "graphql-codegen", - "lint": "eslint src --ext .ts --ext .tsx --ext .js --ext .jsx --ext .graphql" + "lint": "eslint src --ext .ts --ext .tsx --ext .js --ext .jsx --ext .graphql", + "clean": "rimraf src/**.generated.* src/schema.json src/gqlTypes.* src/fragmentTypes.*" }, "proxy": "http://localhost:3001", "browserslist": [ diff --git a/webui/src/Label.graphql b/webui/src/Label.graphql deleted file mode 100644 index 22522ada..00000000 --- a/webui/src/Label.graphql +++ /dev/null @@ -1,8 +0,0 @@ -fragment Label on Label { - name - color { - R - G - B - } -} diff --git a/webui/src/bug/Bug.graphql b/webui/src/bug/Bug.graphql index 112024aa..498242c0 100644 --- a/webui/src/bug/Bug.graphql +++ b/webui/src/bug/Bug.graphql @@ -1,5 +1,4 @@ -#import "../Label.graphql" -#import "../Author.graphql" +#import "../components/fragments.graphql" fragment Bug on Bug { id diff --git a/webui/src/bug/Bug.tsx b/webui/src/bug/Bug.tsx index 114cb8e0..0e53e447 100644 --- a/webui/src/bug/Bug.tsx +++ b/webui/src/bug/Bug.tsx @@ -2,9 +2,9 @@ import Typography from '@material-ui/core/Typography/Typography'; import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; -import Author from '../Author'; -import Date from '../Date'; -import Label from '../Label'; +import Author from '../components/Author'; +import Date from '../components/Date'; +import Label from '../components/Label'; import { BugFragment } from './Bug.generated'; import CommentForm from './CommentForm'; diff --git a/webui/src/bug/CommentForm.tsx b/webui/src/bug/CommentForm.tsx index 3aa52b19..a915ecf0 100644 --- a/webui/src/bug/CommentForm.tsx +++ b/webui/src/bug/CommentForm.tsx @@ -6,7 +6,7 @@ import TextField from '@material-ui/core/TextField'; import { makeStyles, Theme } from '@material-ui/core/styles'; import React, { useState, useRef } from 'react'; -import Content from '../Content'; +import Content from '../components/Content'; import { useAddCommentMutation } from './CommentForm.generated'; import { TimelineDocument } from './TimelineQuery.generated'; diff --git a/webui/src/bug/LabelChange.tsx b/webui/src/bug/LabelChange.tsx index 572579bd..a3950524 100644 --- a/webui/src/bug/LabelChange.tsx +++ b/webui/src/bug/LabelChange.tsx @@ -1,9 +1,9 @@ import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; -import Author from '../Author'; -import Date from '../Date'; -import Label from '../Label'; +import Author from '../components/Author'; +import Date from '../components/Date'; +import Label from '../components/Label'; import { LabelChangeFragment } from './LabelChangeFragment.generated'; diff --git a/webui/src/bug/LabelChangeFragment.graphql b/webui/src/bug/LabelChangeFragment.graphql index 631de70c..01b94a98 100644 --- a/webui/src/bug/LabelChangeFragment.graphql +++ b/webui/src/bug/LabelChangeFragment.graphql @@ -1,5 +1,4 @@ -#import "../Author.graphql" -#import "../Label.graphql" +#import "../components/fragments.graphql" fragment LabelChange on LabelChangeTimelineItem { date diff --git a/webui/src/bug/Message.tsx b/webui/src/bug/Message.tsx index c8d0710d..a61ed3f2 100644 --- a/webui/src/bug/Message.tsx +++ b/webui/src/bug/Message.tsx @@ -2,10 +2,9 @@ import Paper from '@material-ui/core/Paper'; import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; -import Author from '../Author'; -import { Avatar } from '../Author'; -import Content from '../Content'; -import Date from '../Date'; +import Author, { Avatar } from '../components/Author'; +import Date from '../components/Date'; +import Content from '../components/Content'; import { AddCommentFragment } from './MessageCommentFragment.generated'; import { CreateFragment } from './MessageCreateFragment.generated'; diff --git a/webui/src/bug/MessageCommentFragment.graphql b/webui/src/bug/MessageCommentFragment.graphql index 38d626d0..61156fee 100644 --- a/webui/src/bug/MessageCommentFragment.graphql +++ b/webui/src/bug/MessageCommentFragment.graphql @@ -1,4 +1,4 @@ -#import "../Author.graphql" +#import "../components/fragments.graphql" fragment AddComment on AddCommentTimelineItem { createdAt diff --git a/webui/src/bug/MessageCreateFragment.graphql b/webui/src/bug/MessageCreateFragment.graphql index 08477470..e371b9dc 100644 --- a/webui/src/bug/MessageCreateFragment.graphql +++ b/webui/src/bug/MessageCreateFragment.graphql @@ -1,4 +1,4 @@ -#import "../Author.graphql" +#import "../components/fragments.graphql" fragment Create on CreateTimelineItem { createdAt diff --git a/webui/src/bug/SetStatus.tsx b/webui/src/bug/SetStatus.tsx index 3e1a7989..86105c8a 100644 --- a/webui/src/bug/SetStatus.tsx +++ b/webui/src/bug/SetStatus.tsx @@ -1,8 +1,8 @@ import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; -import Author from '../Author'; -import Date from '../Date'; +import Author from '../components/Author'; +import Date from '../components/Date'; import { SetStatusFragment } from './SetStatusFragment.generated'; diff --git a/webui/src/bug/SetStatusFragment.graphql b/webui/src/bug/SetStatusFragment.graphql index 0fdea01b..5a3986d0 100644 --- a/webui/src/bug/SetStatusFragment.graphql +++ b/webui/src/bug/SetStatusFragment.graphql @@ -1,4 +1,4 @@ -#import "../Author.graphql" +#import "../components/fragments.graphql" fragment SetStatus on SetStatusTimelineItem { date diff --git a/webui/src/bug/SetTitle.tsx b/webui/src/bug/SetTitle.tsx index 0b088e0b..e57aaafb 100644 --- a/webui/src/bug/SetTitle.tsx +++ b/webui/src/bug/SetTitle.tsx @@ -1,8 +1,8 @@ import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; -import Author from '../Author'; -import Date from '../Date'; +import Author from '../components/Author'; +import Date from '../components/Date'; import { SetTitleFragment } from './SetTitleFragment.generated'; diff --git a/webui/src/bug/SetTitleFragment.graphql b/webui/src/bug/SetTitleFragment.graphql index 432c4449..22d2185c 100644 --- a/webui/src/bug/SetTitleFragment.graphql +++ b/webui/src/bug/SetTitleFragment.graphql @@ -1,4 +1,4 @@ -#import "../Author.graphql" +#import "../components/fragments.graphql" fragment SetTitle on SetTitleTimelineItem { date diff --git a/webui/src/Author.tsx b/webui/src/components/Author.tsx similarity index 92% rename from webui/src/Author.tsx rename to webui/src/components/Author.tsx index 852cd2b7..43fd108e 100644 --- a/webui/src/Author.tsx +++ b/webui/src/components/Author.tsx @@ -2,7 +2,7 @@ import MAvatar from '@material-ui/core/Avatar'; import Tooltip from '@material-ui/core/Tooltip/Tooltip'; import React from 'react'; -import { AuthoredFragment } from './Author.generated'; +import { AuthoredFragment } from './fragments.generated'; type Props = AuthoredFragment & { className?: string; diff --git a/webui/src/tag/ImageTag.tsx b/webui/src/components/Content/ImageTag.tsx similarity index 100% rename from webui/src/tag/ImageTag.tsx rename to webui/src/components/Content/ImageTag.tsx diff --git a/webui/src/tag/PreTag.tsx b/webui/src/components/Content/PreTag.tsx similarity index 100% rename from webui/src/tag/PreTag.tsx rename to webui/src/components/Content/PreTag.tsx diff --git a/webui/src/Content.tsx b/webui/src/components/Content/index.tsx similarity index 88% rename from webui/src/Content.tsx rename to webui/src/components/Content/index.tsx index 3a7af2f8..56e52e1e 100644 --- a/webui/src/Content.tsx +++ b/webui/src/components/Content/index.tsx @@ -4,8 +4,8 @@ import parse from 'remark-parse'; import remark2react from 'remark-react'; import unified from 'unified'; -import ImageTag from './tag/ImageTag'; -import PreTag from './tag/PreTag'; +import ImageTag from './ImageTag'; +import PreTag from './PreTag'; type Props = { markdown: string }; const Content: React.FC = ({ markdown }: Props) => { diff --git a/webui/src/Date.tsx b/webui/src/components/Date.tsx similarity index 100% rename from webui/src/Date.tsx rename to webui/src/components/Date.tsx diff --git a/webui/src/Label.tsx b/webui/src/components/Label.tsx similarity index 94% rename from webui/src/Label.tsx rename to webui/src/components/Label.tsx index a33b4c2c..48c20096 100644 --- a/webui/src/Label.tsx +++ b/webui/src/components/Label.tsx @@ -6,8 +6,8 @@ import { } from '@material-ui/core/styles/colorManipulator'; import React from 'react'; -import { LabelFragment } from './Label.generated'; -import { Color } from './gqlTypes'; +import { LabelFragment } from './fragments.generated'; +import { Color } from '../gqlTypes'; // Minimum contrast between the background and the text color const contrastThreshold = 2.5; diff --git a/webui/src/Author.graphql b/webui/src/components/fragments.graphql similarity index 51% rename from webui/src/Author.graphql rename to webui/src/components/fragments.graphql index 76d66b91..03a235f9 100644 --- a/webui/src/Author.graphql +++ b/webui/src/components/fragments.graphql @@ -1,3 +1,14 @@ +# Label.tsx +fragment Label on Label { + name + color { + R + G + B + } +} + +# Author.tsx fragment authored on Authored { author { name diff --git a/webui/src/list/BugRow.graphql b/webui/src/list/BugRow.graphql index 3f9a1ef6..c2966f10 100644 --- a/webui/src/list/BugRow.graphql +++ b/webui/src/list/BugRow.graphql @@ -1,5 +1,4 @@ -#import "../Author.graphql" -#import "../Label.graphql" +#import "../components/fragments.graphql" fragment BugRow on Bug { id diff --git a/webui/src/list/BugRow.tsx b/webui/src/list/BugRow.tsx index f94538a7..181aec2e 100644 --- a/webui/src/list/BugRow.tsx +++ b/webui/src/list/BugRow.tsx @@ -7,8 +7,8 @@ import ErrorOutline from '@material-ui/icons/ErrorOutline'; import React from 'react'; import { Link } from 'react-router-dom'; -import Date from '../Date'; -import Label from '../Label'; +import Date from '../components/Date'; +import Label from '../components/Label'; import { Status } from '../gqlTypes'; import { BugRowFragment } from './BugRow.generated';