From ce50269639988e39fe4e27cc8c309a9d5c75c958 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Wed, 16 Feb 2022 10:27:26 +0100 Subject: webui: upgrade most dependencies Also reformat everything with prettier --- webui/src/components/BugTitleForm/SetTitle.graphql | 8 +-- .../src/components/CloseBugButton/CloseBug.graphql | 2 +- .../CloseBugWithComment.graphql | 1 - .../components/CloseBugWithCommentButton/index.tsx | 6 +-- webui/src/components/Content/AnchorTag.tsx | 5 +- webui/src/components/Content/BlockQuoteTag.tsx | 2 +- webui/src/components/Content/ImageTag.tsx | 4 +- webui/src/components/Content/PreTag.tsx | 2 +- webui/src/components/Content/index.tsx | 45 ++++++++++------- .../src/components/ReopenBugButton/OpenBug.graphql | 2 +- .../ReopenBugWithComment.graphql | 1 - .../ReopenBugWithCommentButton/index.tsx | 6 +-- webui/src/pages/bug/CommentForm.graphql | 4 +- webui/src/pages/bug/MessageHistoryDialog.tsx | 10 ++-- webui/src/pages/bug/labels/SetLabel.graphql | 24 +++++---- webui/src/pages/identity/GetBugsByUser.graphql | 20 ++++---- webui/src/pages/identity/GetUserStatistic.graphql | 8 ++- webui/src/pages/list/FilterToolbar.tsx | 58 +++++++++++----------- webui/src/pages/list/ListIdentities.graphql | 20 ++++---- webui/src/pages/list/ListLabels.graphql | 16 +++--- webui/src/pages/list/ListQuery.tsx | 12 ++--- 21 files changed, 140 insertions(+), 116 deletions(-) (limited to 'webui/src') diff --git a/webui/src/components/BugTitleForm/SetTitle.graphql b/webui/src/components/BugTitleForm/SetTitle.graphql index b96af155..9dc2d096 100644 --- a/webui/src/components/BugTitleForm/SetTitle.graphql +++ b/webui/src/components/BugTitleForm/SetTitle.graphql @@ -1,7 +1,7 @@ mutation setTitle($input: SetTitleInput!) { setTitle(input: $input) { - bug { - id - } + bug { + id + } } -} \ No newline at end of file +} diff --git a/webui/src/components/CloseBugButton/CloseBug.graphql b/webui/src/components/CloseBugButton/CloseBug.graphql index e2f4bff2..fc03d1f3 100644 --- a/webui/src/components/CloseBugButton/CloseBug.graphql +++ b/webui/src/components/CloseBugButton/CloseBug.graphql @@ -5,4 +5,4 @@ mutation closeBug($input: CloseBugInput!) { id } } -} \ No newline at end of file +} diff --git a/webui/src/components/CloseBugWithCommentButton/CloseBugWithComment.graphql b/webui/src/components/CloseBugWithCommentButton/CloseBugWithComment.graphql index eb736f53..66c84c35 100644 --- a/webui/src/components/CloseBugWithCommentButton/CloseBugWithComment.graphql +++ b/webui/src/components/CloseBugWithCommentButton/CloseBugWithComment.graphql @@ -8,4 +8,3 @@ mutation AddCommentAndCloseBug($input: AddCommentAndCloseBugInput!) { } } } - diff --git a/webui/src/components/CloseBugWithCommentButton/index.tsx b/webui/src/components/CloseBugWithCommentButton/index.tsx index a0fefa4a..cbf3f757 100644 --- a/webui/src/components/CloseBugWithCommentButton/index.tsx +++ b/webui/src/components/CloseBugWithCommentButton/index.tsx @@ -24,10 +24,8 @@ interface Props { } function CloseBugWithCommentButton({ bug, comment, postClick }: Props) { - const [ - addCommentAndCloseBug, - { loading, error }, - ] = useAddCommentAndCloseBugMutation(); + const [addCommentAndCloseBug, { loading, error }] = + useAddCommentAndCloseBugMutation(); const classes = useStyles(); function addCommentAndCloseBugAction() { diff --git a/webui/src/components/Content/AnchorTag.tsx b/webui/src/components/Content/AnchorTag.tsx index 47d5e2fa..bbd45bc8 100644 --- a/webui/src/components/Content/AnchorTag.tsx +++ b/webui/src/components/Content/AnchorTag.tsx @@ -9,7 +9,10 @@ const useStyles = makeStyles((theme) => ({ }, })); -const AnchorTag = ({ children, href }: React.HTMLProps) => { +const AnchorTag: React.FC = ({ + children, + href, +}: React.HTMLProps) => { const classes = useStyles(); const origin = window.location.origin; const destination = href === undefined ? '' : href; diff --git a/webui/src/components/Content/BlockQuoteTag.tsx b/webui/src/components/Content/BlockQuoteTag.tsx index 18c34d8a..c7c250f5 100644 --- a/webui/src/components/Content/BlockQuoteTag.tsx +++ b/webui/src/components/Content/BlockQuoteTag.tsx @@ -13,7 +13,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -const BlockQuoteTag = (props: React.HTMLProps) => { +const BlockQuoteTag: React.FC> = (props) => { const classes = useStyles(); return
; }; diff --git a/webui/src/components/Content/ImageTag.tsx b/webui/src/components/Content/ImageTag.tsx index 29b01da3..94004f0e 100644 --- a/webui/src/components/Content/ImageTag.tsx +++ b/webui/src/components/Content/ImageTag.tsx @@ -8,10 +8,10 @@ const useStyles = makeStyles({ }, }); -const ImageTag = ({ +const ImageTag: React.FC> = ({ alt, ...props -}: React.ImgHTMLAttributes) => { +}) => { const classes = useStyles(); return ( <> diff --git a/webui/src/components/Content/PreTag.tsx b/webui/src/components/Content/PreTag.tsx index 8e352153..ecb573e0 100644 --- a/webui/src/components/Content/PreTag.tsx +++ b/webui/src/components/Content/PreTag.tsx @@ -9,7 +9,7 @@ const useStyles = makeStyles({ }, }); -const PreTag = (props: React.HTMLProps) => { +const PreTag: React.FC> = (props) => { const classes = useStyles(); return
;
 };
diff --git a/webui/src/components/Content/index.tsx b/webui/src/components/Content/index.tsx
index e4018809..ccb412c1 100644
--- a/webui/src/components/Content/index.tsx
+++ b/webui/src/components/Content/index.tsx
@@ -1,9 +1,10 @@
-import React from 'react';
+import React, { createElement, Fragment, useEffect, useState } from 'react';
+import rehypeReact from 'rehype-react';
 import gemoji from 'remark-gemoji';
 import html from 'remark-html';
 import parse from 'remark-parse';
-import remark2react from 'remark-react';
-import unified from 'unified';
+import remarkRehype from 'remark-rehype';
+import { unified } from 'unified';
 
 import AnchorTag from './AnchorTag';
 import BlockQuoteTag from './BlockQuoteTag';
@@ -12,21 +13,31 @@ import PreTag from './PreTag';
 
 type Props = { markdown: string };
 const Content: React.FC = ({ markdown }: Props) => {
-  const content = unified()
-    .use(parse)
-    .use(gemoji)
-    .use(html)
-    .use(remark2react, {
-      remarkReactComponents: {
-        img: ImageTag,
-        pre: PreTag,
-        a: AnchorTag,
-        blockquote: BlockQuoteTag,
-      },
-    })
-    .processSync(markdown).result;
+  const [Content, setContent] = useState(<>);
 
-  return <>{content};
+  useEffect(() => {
+    unified()
+      .use(parse)
+      .use(gemoji)
+      .use(html)
+      .use(remarkRehype)
+      .use(rehypeReact, {
+        createElement,
+        Fragment,
+        components: {
+          img: ImageTag,
+          pre: PreTag,
+          a: AnchorTag,
+          blockquote: BlockQuoteTag,
+        },
+      })
+      .process(markdown)
+      .then((file) => {
+        setContent(file.result);
+      });
+  }, [markdown]);
+
+  return Content;
 };
 
 export default Content;
diff --git a/webui/src/components/ReopenBugButton/OpenBug.graphql b/webui/src/components/ReopenBugButton/OpenBug.graphql
index cf9e49e5..12673e65 100644
--- a/webui/src/components/ReopenBugButton/OpenBug.graphql
+++ b/webui/src/components/ReopenBugButton/OpenBug.graphql
@@ -4,4 +4,4 @@ mutation openBug($input: OpenBugInput!) {
       id
     }
   }
-}
\ No newline at end of file
+}
diff --git a/webui/src/components/ReopenBugWithCommentButton/ReopenBugWithComment.graphql b/webui/src/components/ReopenBugWithCommentButton/ReopenBugWithComment.graphql
index 4c220208..5258a1aa 100644
--- a/webui/src/components/ReopenBugWithCommentButton/ReopenBugWithComment.graphql
+++ b/webui/src/components/ReopenBugWithCommentButton/ReopenBugWithComment.graphql
@@ -8,4 +8,3 @@ mutation AddCommentAndReopenBug($input: AddCommentAndReopenBugInput!) {
     }
   }
 }
-
diff --git a/webui/src/components/ReopenBugWithCommentButton/index.tsx b/webui/src/components/ReopenBugWithCommentButton/index.tsx
index 0a534f27..817054b8 100644
--- a/webui/src/components/ReopenBugWithCommentButton/index.tsx
+++ b/webui/src/components/ReopenBugWithCommentButton/index.tsx
@@ -15,10 +15,8 @@ interface Props {
 }
 
 function ReopenBugWithCommentButton({ bug, comment, postClick }: Props) {
-  const [
-    addCommentAndReopenBug,
-    { loading, error },
-  ] = useAddCommentAndReopenBugMutation();
+  const [addCommentAndReopenBug, { loading, error }] =
+    useAddCommentAndReopenBugMutation();
 
   function addCommentAndReopenBugAction() {
     addCommentAndReopenBug({
diff --git a/webui/src/pages/bug/CommentForm.graphql b/webui/src/pages/bug/CommentForm.graphql
index 33d21193..f4b61850 100644
--- a/webui/src/pages/bug/CommentForm.graphql
+++ b/webui/src/pages/bug/CommentForm.graphql
@@ -1,5 +1,7 @@
 mutation AddComment($input: AddCommentInput!) {
   addComment(input: $input) {
-    operation { id }
+    operation {
+      id
+    }
   }
 }
diff --git a/webui/src/pages/bug/MessageHistoryDialog.tsx b/webui/src/pages/bug/MessageHistoryDialog.tsx
index df8915d9..84848cce 100644
--- a/webui/src/pages/bug/MessageHistoryDialog.tsx
+++ b/webui/src/pages/bug/MessageHistoryDialog.tsx
@@ -179,12 +179,10 @@ function MessageHistoryDialog({ bugId, commentId, open, onClose }: Props) {
   const history = comment?.history.slice().reverse();
   const editCount = history?.length === undefined ? 0 : history?.length - 1;
 
-  const handleChange = (panel: string) => (
-    event: React.ChangeEvent<{}>,
-    newExpanded: boolean
-  ) => {
-    setExpanded(newExpanded ? panel : false);
-  };
+  const handleChange =
+    (panel: string) => (event: React.ChangeEvent<{}>, newExpanded: boolean) => {
+      setExpanded(newExpanded ? panel : false);
+    };
 
   const getSummary = (index: number, date: Date) => {
     const desc =
diff --git a/webui/src/pages/bug/labels/SetLabel.graphql b/webui/src/pages/bug/labels/SetLabel.graphql
index 44dfae11..6f4ad510 100644
--- a/webui/src/pages/bug/labels/SetLabel.graphql
+++ b/webui/src/pages/bug/labels/SetLabel.graphql
@@ -1,13 +1,19 @@
 mutation SetLabel($input: ChangeLabelInput) {
-    changeLabels(input: $input) {
-        results{
-            status,
-            label{
-                name,
-                color{R},
-                color{G},
-                color{B}
-            }
+  changeLabels(input: $input) {
+    results {
+      status
+      label {
+        name
+        color {
+          R
         }
+        color {
+          G
+        }
+        color {
+          B
+        }
+      }
     }
+  }
 }
diff --git a/webui/src/pages/identity/GetBugsByUser.graphql b/webui/src/pages/identity/GetBugsByUser.graphql
index 0f170dc1..38f139ab 100644
--- a/webui/src/pages/identity/GetBugsByUser.graphql
+++ b/webui/src/pages/identity/GetBugsByUser.graphql
@@ -1,12 +1,12 @@
-query GetBugsByUser ($query: String){
-    repository {
-        allBugs(query: $query) {
-            nodes {
-                id
-                title
-                createdAt
-                lastEdit
-            }
-        }
+query GetBugsByUser($query: String) {
+  repository {
+    allBugs(query: $query) {
+      nodes {
+        id
+        title
+        createdAt
+        lastEdit
+      }
     }
+  }
 }
diff --git a/webui/src/pages/identity/GetUserStatistic.graphql b/webui/src/pages/identity/GetUserStatistic.graphql
index 318b860d..a7598320 100644
--- a/webui/src/pages/identity/GetUserStatistic.graphql
+++ b/webui/src/pages/identity/GetUserStatistic.graphql
@@ -1,8 +1,12 @@
-query GetUserStatistic($authorQuery: String!, $participantQuery: String!, $actionQuery: String!) {
+query GetUserStatistic(
+  $authorQuery: String!
+  $participantQuery: String!
+  $actionQuery: String!
+) {
   repository {
     authored: allBugs(query: $authorQuery) {
       totalCount
-    },
+    }
     participated: allBugs(query: $participantQuery) {
       totalCount
     }
diff --git a/webui/src/pages/list/FilterToolbar.tsx b/webui/src/pages/list/FilterToolbar.tsx
index 4ac579f5..0c7a9e4f 100644
--- a/webui/src/pages/list/FilterToolbar.tsx
+++ b/webui/src/pages/list/FilterToolbar.tsx
@@ -110,36 +110,38 @@ function FilterToolbar({ query, queryLocation }: Props) {
   const containsValue = (key: string, value: string): boolean =>
     hasKey(key) && params[key].indexOf(value) !== -1;
   const loc = pipe(stringify, queryLocation);
-  const replaceParam = (key: string, value: string) => (
-    params: Query
-  ): Query => ({
-    ...params,
-    [key]: [value],
-  });
-  const toggleParam = (key: string, value: string) => (
-    params: Query
-  ): Query => ({
-    ...params,
-    [key]: params[key] && params[key].includes(value) ? [] : [value],
-  });
-  const toggleOrAddParam = (key: string, value: string) => (
-    params: Query
-  ): Query => {
-    const values = params[key];
-    return {
+  const replaceParam =
+    (key: string, value: string) =>
+    (params: Query): Query => ({
+      ...params,
+      [key]: [value],
+    });
+  const toggleParam =
+    (key: string, value: string) =>
+    (params: Query): Query => ({
       ...params,
-      [key]:
-        params[key] && params[key].includes(value)
-          ? values.filter((v) => v !== value)
-          : values
-          ? [...values, value]
-          : [value],
+      [key]: params[key] && params[key].includes(value) ? [] : [value],
+    });
+  const toggleOrAddParam =
+    (key: string, value: string) =>
+    (params: Query): Query => {
+      const values = params[key];
+      return {
+        ...params,
+        [key]:
+          params[key] && params[key].includes(value)
+            ? values.filter((v) => v !== value)
+            : values
+            ? [...values, value]
+            : [value],
+      };
     };
-  };
-  const clearParam = (key: string) => (params: Query): Query => ({
-    ...params,
-    [key]: [],
-  });
+  const clearParam =
+    (key: string) =>
+    (params: Query): Query => ({
+      ...params,
+      [key]: [],
+    });
 
   return (
     
diff --git a/webui/src/pages/list/ListIdentities.graphql b/webui/src/pages/list/ListIdentities.graphql
index 73073ae8..1d909496 100644
--- a/webui/src/pages/list/ListIdentities.graphql
+++ b/webui/src/pages/list/ListIdentities.graphql
@@ -1,13 +1,13 @@
 query ListIdentities {
-    repository {
-        allIdentities {
-            nodes {
-                id
-                humanId
-                name
-                email
-                displayName
-            }
-        }
+  repository {
+    allIdentities {
+      nodes {
+        id
+        humanId
+        name
+        email
+        displayName
+      }
     }
+  }
 }
diff --git a/webui/src/pages/list/ListLabels.graphql b/webui/src/pages/list/ListLabels.graphql
index 8b2f561a..35f25e25 100644
--- a/webui/src/pages/list/ListLabels.graphql
+++ b/webui/src/pages/list/ListLabels.graphql
@@ -1,10 +1,14 @@
 query ListLabels {
-    repository {
-        validLabels {
-            nodes {
-                name,
-                color{R,G,B}
-            }
+  repository {
+    validLabels {
+      nodes {
+        name
+        color {
+          R
+          G
+          B
         }
+      }
     }
+  }
 }
diff --git a/webui/src/pages/list/ListQuery.tsx b/webui/src/pages/list/ListQuery.tsx
index 9aefd02d..c2f71ef0 100644
--- a/webui/src/pages/list/ListQuery.tsx
+++ b/webui/src/pages/list/ListQuery.tsx
@@ -304,12 +304,12 @@ function ListQuery() {
 
   const loc = pipe(stringify, queryLocation);
   const qparams: Query = parse(query);
-  const replaceParam = (key: string, value: string) => (
-    params: Query
-  ): Query => ({
-    ...params,
-    [key]: [value],
-  });
+  const replaceParam =
+    (key: string, value: string) =>
+    (params: Query): Query => ({
+      ...params,
+      [key]: [value],
+    });
 
   return (
     
-- 
cgit