From 0f204157e3dc0c6f2627cc8582eb11319a83e041 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 7 Jan 2022 15:04:49 +0800 Subject: [PATCH 01/12] Some files in git --- .idea/.gitignore | 8 ++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/sketch-sh.iml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 36 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/sketch-sh.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..73f69e09 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..039e6a73 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..d798aa98 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sketch-sh.iml b/.idea/sketch-sh.iml new file mode 100644 index 00000000..c956989b --- /dev/null +++ b/.idea/sketch-sh.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 831195d06cccdcc61376dfde6a5e6eec8ad6ccd0 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 7 Jan 2022 17:02:16 +0800 Subject: [PATCH 02/12] Failed attempt to refactor UI_NoSketches to jsx3 --- client/src/components/UI_NoSketches.re | 41 ++++++++++++++++---------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/client/src/components/UI_NoSketches.re b/client/src/components/UI_NoSketches.re index 42bd3552..c5b27785 100644 --- a/client/src/components/UI_NoSketches.re +++ b/client/src/components/UI_NoSketches.re @@ -1,20 +1,29 @@ -Modules.require("./UI_NoSketches.css"); +[@bs.config {jsx: 3}]; open Utils; -let component = ReasonReact.statelessComponent("UI_NoSketches"); +Modules.require("./UI_NoSketches.css"); + +[@react.component] +let make = (~className=?) => { +
+ + "Your sketches will show up here"->str + + + "Create New Sketch"->str + +
; +}; -let make = (~className=?, _children) => { - ...component, - render: _self => -
- - "Your sketches will show up here"->str - - - "Create New Sketch"->str - -
, +module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className=?) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className?, ()), + ); + }; }; From a2e18e3d2b3cd8de444bb0b012344a523c1dac24 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 7 Jan 2022 17:38:22 +0800 Subject: [PATCH 03/12] Failed attempt to refactor UI_SketchOwnerInfo to jsx3 --- client/src/components/UI_SketchOwnerInfo.re | 74 ++++++++++++--------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/client/src/components/UI_SketchOwnerInfo.re b/client/src/components/UI_SketchOwnerInfo.re index 24954e83..0a198eed 100644 --- a/client/src/components/UI_SketchOwnerInfo.re +++ b/client/src/components/UI_SketchOwnerInfo.re @@ -1,37 +1,47 @@ -Modules.require("./UI_SketchOwnerInfo.css"); +[@bs.config {jsx: 3}]; open Utils; -let component = ReasonReact.statelessComponent("Edit_NoteOwnerInfo"); -let make = (~owner, ~noteLastEdited=?, ~className=?, _children) => { - ...component, - render: _self => -
- - {owner##avatar - =>> ( - avatar => - {owner##username - )} - - {owner##username->str} - - - {noteLastEdited +Modules.require("./UI_SketchOwnerInfo.css"); + +[@react.component] +let make = (~owner, ~noteLastEdited=?, ~className=?) => { +
+ + {owner##avatar =>> ( - noteLastEdited => - - "last edited"->str - - + avatar => + {owner##username )} -
, + + {owner##username->str} + + + {noteLastEdited + =>> ( + noteLastEdited => + + "last edited"->str + + + )} +
; +}; + +module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~owner, ~noteLastEdited=?, ~className=?) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~owner, ~noteLastEdited?, ~className?, ()), + ); + }; }; From 3c60329c3aa7ed43728b3bb70cbb7e10d680eb72 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 7 Jan 2022 19:48:17 +0800 Subject: [PATCH 04/12] Refactor UI_DateTime to jsx3 --- client/src/components/UI_DateTime.re | 35 +++++----- client/src/components/UI_NoSketches.re | 41 +++++------- client/src/components/UI_SketchList.re | 2 +- client/src/components/UI_SketchOwnerInfo.re | 74 +++++++++------------ client/src_editor/Editor_Links.re | 2 +- 5 files changed, 68 insertions(+), 86 deletions(-) diff --git a/client/src/components/UI_DateTime.re b/client/src/components/UI_DateTime.re index 4ab74459..cf5c5643 100644 --- a/client/src/components/UI_DateTime.re +++ b/client/src/components/UI_DateTime.re @@ -1,3 +1,4 @@ +[@bs.config {jsx: 3}]; open Utils; module Transformer: { @@ -19,22 +20,22 @@ module Transformer: { }; }; -let component = ReasonReact.statelessComponent("DateDisplay"); +[@react.component] +let make = (~date: Js.Json.t, ~transformer=Transformer.relative, ~className=?) => { + let date = date |> Js.Json.decodeString; + switch (date) { + | None => ReasonReact.null + | Some(date) => + + }; +}; -let make = - ( - ~date: Js.Json.t, - ~transformer=Transformer.relative, - ~className=?, - _children, - ) => { - ...component, - render: _self => { - let date = date |> Js.Json.decodeString; - switch (date) { - | None => ReasonReact.null - | Some(date) => - - }; - }, +module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~date: Js.Json.t, ~transformer=?, ~className=?) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~date, ~transformer?, ~className?, ()), + ); + }; }; diff --git a/client/src/components/UI_NoSketches.re b/client/src/components/UI_NoSketches.re index c5b27785..42bd3552 100644 --- a/client/src/components/UI_NoSketches.re +++ b/client/src/components/UI_NoSketches.re @@ -1,29 +1,20 @@ -[@bs.config {jsx: 3}]; -open Utils; - Modules.require("./UI_NoSketches.css"); +open Utils; -[@react.component] -let make = (~className=?) => { -
- - "Your sketches will show up here"->str - - - "Create New Sketch"->str - -
; -}; +let component = ReasonReact.statelessComponent("UI_NoSketches"); -module Jsx2 = { - let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className=?) => { - ReasonReactCompat.wrapReactForReasonReact( - make, - makeProps(~className?, ()), - ); - }; +let make = (~className=?, _children) => { + ...component, + render: _self => +
+ + "Your sketches will show up here"->str + + + "Create New Sketch"->str + +
, }; diff --git a/client/src/components/UI_SketchList.re b/client/src/components/UI_SketchList.re index 8d3d7987..e9c1ca74 100644 --- a/client/src/components/UI_SketchList.re +++ b/client/src/components/UI_SketchList.re @@ -53,7 +53,7 @@ let make =
"last edited"->str - diff --git a/client/src/components/UI_SketchOwnerInfo.re b/client/src/components/UI_SketchOwnerInfo.re index 0a198eed..0cc382df 100644 --- a/client/src/components/UI_SketchOwnerInfo.re +++ b/client/src/components/UI_SketchOwnerInfo.re @@ -1,47 +1,37 @@ -[@bs.config {jsx: 3}]; -open Utils; - Modules.require("./UI_SketchOwnerInfo.css"); +open Utils; +let component = ReasonReact.statelessComponent("Edit_NoteOwnerInfo"); -[@react.component] -let make = (~owner, ~noteLastEdited=?, ~className=?) => { -
- - {owner##avatar +let make = (~owner, ~noteLastEdited=?, ~className=?, _children) => { + ...component, + render: _self => +
+ + {owner##avatar + =>> ( + avatar => + {owner##username + )} + + {owner##username->str} + + + {noteLastEdited =>> ( - avatar => - {owner##username + noteLastEdited => + + "last edited"->str + + )} - - {owner##username->str} - - - {noteLastEdited - =>> ( - noteLastEdited => - - "last edited"->str - - - )} -
; -}; - -module Jsx2 = { - let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~owner, ~noteLastEdited=?, ~className=?) => { - ReasonReactCompat.wrapReactForReasonReact( - make, - makeProps(~owner, ~noteLastEdited?, ~className?, ()), - ); - }; +
, }; diff --git a/client/src_editor/Editor_Links.re b/client/src_editor/Editor_Links.re index c145d930..e375b44a 100644 --- a/client/src_editor/Editor_Links.re +++ b/client/src_editor/Editor_Links.re @@ -169,7 +169,7 @@ module SingleLink = { "Revision from "->str - + }} From d09962d54e2b1a581ebb273be0900e9b68f6dab4 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 7 Jan 2022 21:11:20 +0800 Subject: [PATCH 05/12] Refactor Fi.re to jsx3 (failed) --- client/shared/Fi.re | 724 ++++++++++++++++++++++++++++++++------------ 1 file changed, 534 insertions(+), 190 deletions(-) diff --git a/client/shared/Fi.re b/client/shared/Fi.re index dd2357fb..ec3c04f4 100644 --- a/client/shared/Fi.re +++ b/client/shared/Fi.re @@ -1,3 +1,5 @@ +[@bs.config {jsx: 3}]; + /* react-icons: feather icon */ module IconContext = { [@bs.deriving abstract] @@ -18,231 +20,573 @@ module IconContext = { ); }; }; - +/* + module Save = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiSave"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Save = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiSave"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiSave"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Loader = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiLoader"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Loader = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiLoader"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiLoader"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Home = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiHome"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Home = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiHome"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiHome"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Github = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiGithub"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Github = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiGithub"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "Github"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module GitBranch = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiGitBranch"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module GitBranch = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiGitBranch"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiGitBranch"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Terminal = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiTerminal"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Terminal = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiTerminal"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiTerminal"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module PlusCircle = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiPlusCircle"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module PlusCircle = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPlusCircle"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiPlusCircle"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module FilePlus = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiFilePlus"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module FilePlus = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiFilePlus"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiFilePlus"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Plus = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiPlus"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Plus = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPlus"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiPlus"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Code = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiCode"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Code = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiCode"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiCode"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Edit2 = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiEdit2"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Edit2 = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiEdit2"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiEdit2"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Trash2 = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiTrash2"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Trash2 = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiTrash2"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiTrash2"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module RefreshCw = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiRefreshCw"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module RefreshCw = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiRefreshCw"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiRefreshCw"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Package = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiPackage"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Package = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPackage"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiPackage"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Play = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiPlay"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Play = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPlay"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiPlay"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module Link = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiLink"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module Link = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiLink"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiLink"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module RefreshCCW = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiRefreshCcw"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module RefreshCCW = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiRefreshCcw"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiRefreshCcw"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module FiXCircle = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiXCircle"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module FiXCircle = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiXCircle"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiXCircle"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; - +/* + module FiRefreshCw = { + [@bs.module "react-icons/fi"] + external reactClass: ReasonReact.reactClass = "FiRefreshCw"; + + let make = (~className="", children) => + ReasonReact.wrapJsForReason( + ~reactClass, + ~props={"className": className}, + children, + ); + }; + */ module FiRefreshCw = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiRefreshCw"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); + [@bs.module "react-icons/fi"] [@react.component] + external make: + (~className: string=?, ~children: React.element) => React.element = + "FiRefreshCw"; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~className: string=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~className, ()), + children, + ); + }; + }; }; From f5226284363260b190f738ecf01ded8d29c47fa9 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Sat, 8 Jan 2022 02:43:24 +0800 Subject: [PATCH 06/12] Refactor Fi.re to jsx3 --- client/shared/ButterToast.re | 4 +- client/shared/Fi.re | 456 ++++---------------- client/shared/{React.re => ReactOld.re} | 0 client/src/Note.re | 4 +- client/src/Router.re | 5 +- client/src/Router.rei | 11 +- client/src/components/FontFaceObserver.re | 2 +- client/src/components/UI_NoSketches.re | 4 +- client/src/components/UI_Topbar.re | 4 +- client/src_editor/Editor_Blocks.re | 18 +- client/src_editor/Editor_Blocks.rei | 2 +- client/src_editor/Editor_Links.re | 20 +- client/src_editor/Editor_Note.re | 8 +- client/src_editor/Editor_Note_ForkButton.re | 6 +- client/src_editor/Editor_Note_SaveButton.re | 6 +- client/src_embed/Embed.re | 2 +- 16 files changed, 126 insertions(+), 426 deletions(-) rename client/shared/{React.re => ReactOld.re} (100%) diff --git a/client/shared/ButterToast.re b/client/shared/ButterToast.re index 181c99d3..fe477642 100644 --- a/client/shared/ButterToast.re +++ b/client/shared/ButterToast.re @@ -69,7 +69,7 @@ module ToastOption = { [@bs.deriving abstract] type t = { - content: contentArgs => React.reactElement, + content: contentArgs => ReactOld.reactElement, [@bs.optional] dismissOnClick: bool, [@bs.optional] @@ -87,7 +87,7 @@ module ToastOption = { ~name=?, ~toastTimeout=?, content: - (~toastId: string, ~dismiss: unit => unit) => React.reactElement, + (~toastId: string, ~dismiss: unit => unit) => ReactOld.reactElement, ) => t( ~content= diff --git a/client/shared/Fi.re b/client/shared/Fi.re index ec3c04f4..37372a7f 100644 --- a/client/shared/Fi.re +++ b/client/shared/Fi.re @@ -1,591 +1,285 @@ [@bs.config {jsx: 3}]; -/* react-icons: feather icon */ -module IconContext = { - [@bs.deriving abstract] - type iconContext = { - [@bs.as "Provider"] - provider: ReasonReact.reactClass, - }; - [@bs.module "react-icons"] external iconContext: iconContext = "IconContext"; - - module Provider = { - let reactClass = providerGet(iconContext); - - let make = (~value, children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"value": value}, - children, - ); - }; -}; -/* - module Save = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiSave"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ module Save = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiSave"; + external make: (~className: string=?) => React.element = "FiSave"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Loader = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiLoader"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Loader = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiLoader"; + external make: (~className: string=?) => React.element = "FiLoader"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Home = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiHome"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Home = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiHome"; + external make: (~className: string=?) => React.element = "FiHome"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Github = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiGithub"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Github = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "Github"; + external make: (~className: string=?) => React.element = "FiGithub"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module GitBranch = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiGitBranch"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module GitBranch = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiGitBranch"; + external make: (~className: string=?) => React.element = "FiGitBranch"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Terminal = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiTerminal"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Terminal = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiTerminal"; + external make: (~className: string=?) => React.element = "FiTerminal"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module PlusCircle = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPlusCircle"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module PlusCircle = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiPlusCircle"; + external make: (~className: string=?) => React.element = "FiPlusCircle"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module FilePlus = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiFilePlus"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module FilePlus = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiFilePlus"; + external make: (~className: string=?) => React.element = "FiFilePlus"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Plus = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPlus"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Plus = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiPlus"; + external make: (~className: string=?) => React.element = "FiPlus"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Code = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiCode"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Code = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiCode"; + external make: (~className: string=?) => React.element = "FiCode"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Edit2 = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiEdit2"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Edit2 = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiEdit2"; + external make: (~className: string=?) => React.element = "FiEdit2"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Trash2 = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiTrash2"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Trash2 = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiTrash2"; + external make: (~className: string=?) => React.element = "FiTrash2"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module RefreshCw = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiRefreshCw"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module RefreshCw = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiRefreshCw"; + external make: (~className: string=?) => React.element = "FiRefreshCw"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Package = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPackage"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Package = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiPackage"; + external make: (~className: string=?) => React.element = "FiPackage"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Play = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiPlay"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Play = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiPlay"; + external make: (~className: string=?) => React.element = "FiPlay"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module Link = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiLink"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module Link = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiLink"; + external make: (~className: string=?) => React.element = "FiLink"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module RefreshCCW = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiRefreshCcw"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module RefreshCCW = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiRefreshCcw"; + external make: (~className: string=?) => React.element = "FiRefreshCcw"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module FiXCircle = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiXCircle"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module FiXCircle = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiXCircle"; + external make: (~className: string=?) => React.element = "FiXCircle"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; }; -/* - module FiRefreshCw = { - [@bs.module "react-icons/fi"] - external reactClass: ReasonReact.reactClass = "FiRefreshCw"; - - let make = (~className="", children) => - ReasonReact.wrapJsForReason( - ~reactClass, - ~props={"className": className}, - children, - ); - }; - */ + module FiRefreshCw = { [@bs.module "react-icons/fi"] [@react.component] - external make: - (~className: string=?, ~children: React.element) => React.element = - "FiRefreshCw"; + external make: (~className: string=?) => React.element = "FiRefreshCw"; module Jsx2 = { let component = ReasonReact.statelessComponent(__MODULE__); - let make = (~className: string=?, children) => { + let make = (~className=?) => { ReasonReactCompat.wrapReactForReasonReact( make, - makeProps(~className, ()), - children, + makeProps(~className?, ()), ); }; }; diff --git a/client/shared/React.re b/client/shared/ReactOld.re similarity index 100% rename from client/shared/React.re rename to client/shared/ReactOld.re diff --git a/client/src/Note.re b/client/src/Note.re index d2fed8b6..8d01f066 100644 --- a/client/src/Note.re +++ b/client/src/Note.re @@ -9,7 +9,7 @@ open Editor_Types; module RedirectSketchURL = { let component = ReasonReact.reducerComponent("Note_RedirectSketchURL"); - let make = (~noteId, children): React.component(unit, 'a, unit) => { + let make = (~noteId, children): ReactOld.component(unit, 'a, unit) => { ...component, didMount: _ => Router.replaceSilent(Route.Note({noteId, data: None})), render: _send => children, @@ -18,7 +18,7 @@ module RedirectSketchURL = { let component = ReasonReact.statelessComponent("Note"); -let make = (~noteInfo: Route.noteRouteConfig, _children: React.childless) => { +let make = (~noteInfo: Route.noteRouteConfig, _children: ReactOld.childless) => { ...component, render: _self => { let noteId = noteInfo.noteId; diff --git a/client/src/Router.re b/client/src/Router.re index 8250426d..8ca2dacb 100644 --- a/client/src/Router.re +++ b/client/src/Router.re @@ -40,7 +40,8 @@ module Unload = { module Provider = { let component = ReasonReact.reducerComponent("Router_UnloadProvider"); - let make = (_children: React.childless): React.component(unit, 'a, unit) => { + let make = + (_children: ReactOld.childless): ReactOld.component(unit, 'a, unit) => { ...component, didMount: _self => window->onbeforeunloadSet((. event) => @@ -51,7 +52,7 @@ module Unload = { Js.Nullable.return(message); } ), - render: _self => React.null, + render: _self => ReactOld.null, }; }; }; diff --git a/client/src/Router.rei b/client/src/Router.rei index a030d500..10e93da3 100644 --- a/client/src/Router.rei +++ b/client/src/Router.rei @@ -23,7 +23,8 @@ module Unload: { */ module Provider: { let make: - React.childless => React.component(unit, React.noRetainedProps, unit); + ReactOld.childless => + ReactOld.component(unit, ReactOld.noRetainedProps, unit); }; }; @@ -41,7 +42,11 @@ module Link: { ~className: string=?, ~popup: bool=?, ~role: string=?, - array(React.reactElement) + array(ReactOld.reactElement) ) => - React.component(React.stateless, React.noRetainedProps, React.actionless); + ReactOld.component( + ReactOld.stateless, + ReactOld.noRetainedProps, + ReactOld.actionless, + ); }; diff --git a/client/src/components/FontFaceObserver.re b/client/src/components/FontFaceObserver.re index fa94ba2d..32c0e5d4 100644 --- a/client/src/components/FontFaceObserver.re +++ b/client/src/components/FontFaceObserver.re @@ -33,7 +33,7 @@ module Provider = { let component = ReasonReact.reducerComponent("FontFaceObserver_Provider"); let make: - (~className: string=?, ~font: string=?, React.childless) => + (~className: string=?, ~font: string=?, ReactOld.childless) => ReasonReact.component(unit, 'a, unit) = (~className="fira-code", ~font="Fira Code", _children) => { ...component, diff --git a/client/src/components/UI_NoSketches.re b/client/src/components/UI_NoSketches.re index 42bd3552..e365ca03 100644 --- a/client/src/components/UI_NoSketches.re +++ b/client/src/components/UI_NoSketches.re @@ -7,13 +7,13 @@ let make = (~className=?, _children) => { ...component, render: _self =>
- + "Your sketches will show up here"->str - + "Create New Sketch"->str
, diff --git a/client/src/components/UI_Topbar.re b/client/src/components/UI_Topbar.re index 5cb72d2e..de59dc0f 100644 --- a/client/src/components/UI_Topbar.re +++ b/client/src/components/UI_Topbar.re @@ -8,7 +8,7 @@ let loginButton = className="btn btn-primary Topbar__login" popup=true route=Route.AuthGithub> - + "Login with Github"->str ; @@ -32,7 +32,7 @@ let make = _children => { route={Route.NoteNew(RE)} className="Topbar__action Topbar__action--highlight" title="Create new Sketch"> - + "New Sketch"->str diff --git a/client/src_editor/Editor_Blocks.re b/client/src_editor/Editor_Blocks.re index ea4162c8..44f80094 100644 --- a/client/src_editor/Editor_Blocks.re +++ b/client/src_editor/Editor_Blocks.re @@ -578,7 +578,7 @@ let blockControlsButtons = (blockId, isDeleted, send) => className="block__controls--button" ariaLabel="Add code block" onClick={_ => send(Block_Add(blockId, BTyp_Code))}> - + "+"->str @@ -587,7 +587,7 @@ let blockControlsButtons = (blockId, isDeleted, send) => className="block__controls--button" ariaLabel="Add text block" onClick={_ => send(Block_Add(blockId, BTyp_Text))}> - + "+"->str @@ -597,7 +597,7 @@ let blockControlsButtons = (blockId, isDeleted, send) => className="block__controls--button block__controls--danger" ariaLabel="Delete block" onClick={_ => send(Block_QueueDelete(blockId))}> - + "-"->str @@ -606,7 +606,7 @@ let blockControlsButtons = (blockId, isDeleted, send) => className="block__controls--button" ariaLabel="Restore block" onClick={_ => send(Block_Restore(blockId))}> - + "+"->str } @@ -624,7 +624,7 @@ let make = ~onExecute, ~registerExecuteCallback=?, ~registerShortcut: option(Shortcut.subscribeFun)=?, - _children: React.childless, + _children: ReactOld.childless, ) => { let makeInitialState = () => { lang, @@ -805,14 +805,14 @@ let make = className="block__deleted--button restore" onClick={_ => send(Block_Restore(b_id))} ariaLabel="Restore block"> - + "Restore"->str
@@ -851,7 +851,7 @@ let make =
{readOnly - ? React.null + ? ReactOld.null : blockControlsButtons(b_id, b_deleted, send)}
@@ -878,7 +878,7 @@ let make = /> {readOnly - ? React.null + ? ReactOld.null :
{blockControlsButtons(b_id, b_deleted, send)}
} diff --git a/client/src_editor/Editor_Blocks.rei b/client/src_editor/Editor_Blocks.rei index 9745559b..55b8a179 100644 --- a/client/src_editor/Editor_Blocks.rei +++ b/client/src_editor/Editor_Blocks.rei @@ -39,6 +39,6 @@ let make: ~onExecute: bool => 'a, ~registerExecuteCallback: (unit => unit) => unit=?, ~registerShortcut: Shortcut.subscribeFun=?, - React.childless + ReactOld.childless ) => ReasonReact.component(state, ReasonReact.noRetainedProps, action); diff --git a/client/src_editor/Editor_Links.re b/client/src_editor/Editor_Links.re index e375b44a..6acccd55 100644 --- a/client/src_editor/Editor_Links.re +++ b/client/src_editor/Editor_Links.re @@ -112,7 +112,7 @@ module SingleLink = { }} {switch (onRefresh) { @@ -123,9 +123,9 @@ module SingleLink = { ? - : } + : } {!state.isLinkRefreshing ? ReasonReact.null : { @@ -236,17 +236,17 @@ module EmptyLink = { } disabled={status == Loading}> {switch (status, state.dirty) { - | (NotAsked, _) => - | (Loading, _) => + | (NotAsked, _) => + | (Loading, _) => | (Error(message), false) => <> - + {(" " ++ message)->str} - | (Error(_), true) => - | (Fetched, _) => + | (Error(_), true) => + | (Fetched, _) => }} @@ -378,7 +378,7 @@ let make = (~currentSketchId, ~links, ~onUpdate, _children) => { ...
@@ -394,7 +394,7 @@ let make = (~currentSketchId, ~links, ~onUpdate, _children) => {

{str("Linkings")}

diff --git a/client/src_editor/Editor_Note.re b/client/src_editor/Editor_Note.re index 90b32e53..2155ba81 100644 --- a/client/src_editor/Editor_Note.re +++ b/client/src_editor/Editor_Note.re @@ -211,10 +211,10 @@ module Editor_Note = { loading={state.isExecuting} delayMs=500> ...{loading => loading - ? - : + : } "Run"->str @@ -316,7 +316,7 @@ module Editor_Note = { ...{ fun - | None => React.null + | None => ReactOld.null | Some((user: Js.t('a))) => ClassNames.ifTrue("EditorNote__linkMenu--open"), ])} onClick={_ => send(ToggleLinkMenu)}> - + diff --git a/client/src_editor/Editor_Note_ForkButton.re b/client/src_editor/Editor_Note_ForkButton.re index 53aaf5bf..9438299c 100644 --- a/client/src_editor/Editor_Note_ForkButton.re +++ b/client/src_editor/Editor_Note_ForkButton.re @@ -38,8 +38,8 @@ module ForkButton = { ...{loading => loading - ? - : + ? + : } "Fork"->str @@ -263,7 +263,7 @@ let make = ...component, render: _self => switch (noteState) { - | NoteState_New => React.null + | NoteState_New => ReactOld.null | NoteState_Old => ...( diff --git a/client/src_editor/Editor_Note_SaveButton.re b/client/src_editor/Editor_Note_SaveButton.re index 2b3695d4..f44af31d 100644 --- a/client/src_editor/Editor_Note_SaveButton.re +++ b/client/src_editor/Editor_Note_SaveButton.re @@ -17,7 +17,7 @@ module SaveButton = { ~registerShortcut: Shortcut.subscribeFun, _children, ) - : React.component(unit, 'a, action) => { + : ReactOld.component(unit, 'a, action) => { ...component, didMount: ({send, onUnmount}) => registerShortcut( @@ -70,8 +70,8 @@ module SaveButton = { ...{loading => loading - ? - : + ? + : } "Save"->str diff --git a/client/src_embed/Embed.re b/client/src_embed/Embed.re index 2c35c603..25c4babf 100644 --- a/client/src_embed/Embed.re +++ b/client/src_embed/Embed.re @@ -216,7 +216,7 @@ let make = _children => { }} From 347f811e54090412f295eac5cb696b1d2cae5f5e Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 4 Feb 2022 11:15:55 +0800 Subject: [PATCH 07/12] Add comment to ReactOld.re --- client/shared/ReactOld.re | 1 + 1 file changed, 1 insertion(+) diff --git a/client/shared/ReactOld.re b/client/shared/ReactOld.re index b1ad183b..e37a7920 100644 --- a/client/shared/ReactOld.re +++ b/client/shared/ReactOld.re @@ -1,3 +1,4 @@ +/* This component is deprecated and will be deleted once JSX2 to JSX3 migration is completed */ include ReasonReact; type nothing; From 4aaa6961469345e8aa4f32d5e8f5a66dfef4de45 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 4 Feb 2022 11:22:17 +0800 Subject: [PATCH 08/12] Exclude .idea folder from GIT --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 39e3b332..abe8bc16 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ client/src/*.js .env .env.* !.env.example +.idea \ No newline at end of file From 401c26235f0d2cbdc1f2ea39c34314e329190d54 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 4 Feb 2022 11:27:29 +0800 Subject: [PATCH 09/12] Remove .idea files --- .idea/.gitignore | 8 -------- .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/sketch-sh.iml | 8 -------- .idea/vcs.xml | 6 ------ 5 files changed, 36 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/sketch-sh.iml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 73f69e09..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 039e6a73..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index d798aa98..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/sketch-sh.iml b/.idea/sketch-sh.iml deleted file mode 100644 index c956989b..00000000 --- a/.idea/sketch-sh.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 93a6c4e16a4c8ec258d17b377524f34ad6841a65 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 4 Feb 2022 12:57:01 +0800 Subject: [PATCH 10/12] Add comment with failed JSX3 version Shortcut.Consumer --- client/src/Shortcut.re | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client/src/Shortcut.re b/client/src/Shortcut.re index 6fdeabe6..2f895cf5 100644 --- a/client/src/Shortcut.re +++ b/client/src/Shortcut.re @@ -74,3 +74,19 @@ module Consumer = { render: _self => children(Store.subscribe), }; }; +/* JSX3 + module Consumer = { + [@react.component] + let make = (~children) => {children(Store.subscribe);}; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~children, ()), + ); + }; + }; + }; + */ From a32534107bcb5db363b9d9960fcda4f197a8d7fe Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 4 Feb 2022 13:35:13 +0800 Subject: [PATCH 11/12] Add comment with failed JSX3 version Layout_WithTopbar.re --- client/src/components/Layout_WithTopbar.re | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client/src/components/Layout_WithTopbar.re b/client/src/components/Layout_WithTopbar.re index a6c31ed6..e1368eb5 100644 --- a/client/src/components/Layout_WithTopbar.re +++ b/client/src/components/Layout_WithTopbar.re @@ -1,3 +1,19 @@ +/* + [@bs.config {jsx: 3}]; + + [@react.component] + let make = (~children) => {<> children }; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~children, ()), + ); + }; + }; + */ let component = ReasonReact.statelessComponent("Layout_WithTopbar"); let make = children => { From 9fd49178c6b8073d6328407952af63043d8c1a11 Mon Sep 17 00:00:00 2001 From: Antiukhov Andrii Date: Fri, 4 Feb 2022 14:06:42 +0800 Subject: [PATCH 12/12] Add comment with failed JSX3 version of modules in Router.re --- client/src/Router.re | 68 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/client/src/Router.re b/client/src/Router.re index 8ca2dacb..37459eb8 100644 --- a/client/src/Router.re +++ b/client/src/Router.re @@ -103,17 +103,55 @@ let replaceSilentUnsafe = path => }; let replaceSilent = route => replaceSilentUnsafe(Route.routeToUrl(route)); - +/* + module LinkUnsafe = { + [@bs.config {jsx: 3}]; + + [@react.component] + let make = (~href, ~id=?, ~title=?, ~className=?, ~popup, ~role=?, ~children) => { + + if (!event->ReactEvent.Mouse.ctrlKey && event->ReactEvent.Mouse.button != 1) { + event->ReactEvent.Mouse.preventDefault; + if (popup) { + Popup.openPopup(href); + } else { + pushUnsafe(href); + }; + } + ) + }> + children + + }; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~href, ~id=?, ~title=?, ~className=?, ~popup, ~role=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~href, ~id?, ~title?, ~className?, ~popup, ~role?, ~children, ()), + ); + }; + }; + }; + */ module LinkUnsafe = { let component = ReasonReact.statelessComponent("LinkUnsafe"); - let make = (~href, ~id=?, ~className=?, ~title=?, ~popup, ~role=?, children) => { + let make = (~href, ~id=?, ~title=?, ~className=?, ~popup, ~role=?, children) => { ...component, render: self => , }; }; - +/* + module Link = { + [@bs.config {jsx: 3}]; + + [@react.component] + let make = (~route: Route.t, ~id=?, ~title=?, ~className=?, ~popup=false, ~role=?, ~children) => { + let href = Route.routeToUrl(route); + + children + ; + }; + + module Jsx2 = { + let component = ReasonReact.statelessComponent(__MODULE__); + let make = (~route: Route.t, ~id=?, ~title=?, ~className=?, ~popup=false, ~role=?, children) => { + ReasonReactCompat.wrapReactForReasonReact( + make, + makeProps(~route?, ~id?, ~title?, ~className?, ~popup?, ~role?, ~children, ()), + ); + }; + }; + }; + */ module Link = { let component = ReasonReact.statelessComponent("LinkSafe");