From 84b0ff0b6f1d09d5c98626d5edcaa8fcb5fa3211 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sun, 3 Apr 2022 21:10:27 -0400 Subject: [PATCH 01/29] rfct: reworking linked ref styles --- src/cljs/athens/views/pages/node_page.cljs | 216 +++++++++------------ src/cljs/athens/views/references.cljs | 10 +- src/js/components/Icons/Icons.tsx | 16 ++ src/js/components/Layout/Layout.tsx | 125 +++++++++++- src/js/components/Page/Page.tsx | 1 - src/js/theme/theme.js | 17 +- 6 files changed, 255 insertions(+), 130 deletions(-) diff --git a/src/cljs/athens/views/pages/node_page.cljs b/src/cljs/athens/views/pages/node_page.cljs index 973d6d460b..bf49b2cd84 100644 --- a/src/cljs/athens/views/pages/node_page.cljs +++ b/src/cljs/athens/views/pages/node_page.cljs @@ -2,8 +2,9 @@ (:require ["/components/Block/components/Anchor" :refer [Anchor]] ["/components/Confirmation/Confirmation" :refer [Confirmation]] + ["/components/Layout/Layout" :refer [PageReferences ReferenceBlock ReferenceGroup]] ["/components/Page/Page" :refer [PageHeader PageBody PageFooter EditableTitleContainer]] - ["@chakra-ui/react" :refer [Text Box Button Portal IconButton AccordionIcon AccordionItem AccordionPanel MenuDivider MenuButton Menu MenuList MenuItem Accordion AccordionButton Breadcrumb BreadcrumbItem BreadcrumbLink VStack]] + ["@chakra-ui/react" :refer [Collapse HStack Text Box Button Portal IconButton AccordionIcon AccordionItem AccordionPanel MenuDivider MenuButton Menu MenuList MenuItem Accordion AccordionButton Breadcrumb BreadcrumbItem BreadcrumbLink VStack]] ["@material-ui/icons/Bookmark" :default Bookmark] ["@material-ui/icons/BookmarkBorder" :default BookmarkBorder] ["@material-ui/icons/BubbleChart" :default BubbleChart] @@ -269,16 +270,16 @@ (fn [_] (let [{:keys [block parents embed-id]} @state block (reactive/get-reactive-block-document (:db/id block))] - [:<> - [:> Breadcrumb {:fontSize "0.7em" :pl 6 :opacity 0.75} + [:> VStack {:spacing 0 :align "stretch"} + [:> Breadcrumb {:fontSize "sm" :pl 4 :variant "strict" :color "foreground.secondary"} (doall - (for [{:keys [node/title block/string block/uid]} parents] - [:> BreadcrumbItem {:key (str "breadcrumb-" uid)} - [:> BreadcrumbLink - {:onClick #(let [new-B (db/get-block [:block/uid uid]) - new-P (drop-last parents)] - (swap! state assoc :block new-B :parents new-P))} - [parse-and-render (or title string) uid]]]))] + (for [{:keys [node/title block/string block/uid]} parents] + [:> BreadcrumbItem {:key (str "breadcrumb-" uid)} + [:> BreadcrumbLink + {:onClick #(let [new-B (db/get-block [:block/uid uid]) + new-P (drop-last parents)] + (swap! state assoc :block new-B :parents new-P))} + [parse-and-render (or title string) uid]]]))] [:> Box {:class "block-embed"} [blocks/block-el (recursively-modify-block-for-embed block embed-id) @@ -287,119 +288,95 @@ (defn linked-ref-el - [state daily-notes? title] + [state title] (let [linked? "Linked References" linked-refs (wrap-span-no-new-tx "get-reactive-linked-references" (reactive/get-reactive-linked-references [:node/title title]))] - (when (or (and daily-notes? (not-empty linked-refs)) - (not daily-notes?)) - [:> Accordion {:index (if (get @state linked?) 0 nil)} - [:> AccordionItem - [:h2 - [:> AccordionButton {:onClick (fn [] (swap! state update linked? not))} - [:> AccordionIcon] - linked? - [:> Text {:ml "auto" - :fontWeight "medium" - :color "foreground.secondary" - :borderRadius "full"} - (count linked-refs)]]] - [:> AccordionPanel {:p 0} - [:> VStack {:spacing 6 - :pl 9 - :align "stretch"} - (doall - (for [[group-title group] linked-refs] - [reference-group {:key (str "group-" group-title) - :title group-title - :on-click-title (fn [e] - (let [shift? (.-shiftKey e) - parsed-title (parse-renderer/parse-title group-title)] - (rf/dispatch [:reporting/navigation {:source :main-page-linked-refs ; NOTE: this might be also used in right-pane situation - :target :page - :pane (if shift? - :right-pane - :main-pane)}]) - (router/navigate-page parsed-title e)))} - (doall - (for [block group] - [reference-block {:key (str "ref-" (:block/uid block))} - [ref-comp block]]))]))]]]]))) + (when (not-empty linked-refs) + [:> PageReferences {:count (count linked-refs) + :title "Linked References" + :onOpen (fn [] (swap! state update linked? not)) + :onClose (fn [] (swap! state update linked? not)) + :defaultIsOpen (get @state linked?)} + (doall + (for [[group-title group] linked-refs] + [:> ReferenceGroup {:key (str "group-" group-title) + :title group-title + :onClickTitle (fn [e] + (let [shift? (.-shiftKey e) + parsed-title (parse-renderer/parse-title group-title)] + (rf/dispatch [:reporting/navigation {:source :main-page-linked-refs ; NOTE: this might be also used in right-pane situation + :target :page + :pane (if shift? + :right-pane + :main-pane)}]) + (router/navigate-page parsed-title e)))} + (doall + (for [block group] + [:> ReferenceBlock {:key (str "ref-" (:block/uid block))} + [ref-comp block]]))]))]))) (defn unlinked-ref-el - [state daily-notes? unlinked-refs title] - (let [unlinked? "Unlinked References"] - (when (not daily-notes?) - [:> Accordion {:index (if (get @state unlinked?) 0 nil)} - [:> AccordionItem {:isDisabled (empty @unlinked-refs)} - [:> Box {:as "h2" :position "relative"} - [:> AccordionButton {:onClick (fn [] - (if (get @state unlinked?) - (swap! state assoc unlinked? false) - (let [un-refs (get-unlinked-references (escape-str title))] - (swap! state assoc unlinked? true) - (reset! unlinked-refs un-refs))))} - [:> AccordionIcon] - unlinked? - [:> Text {:ml "auto" - :fontWeight "medium" - :color "foreground.secondary" - :borderRadius "full"} - (count @unlinked-refs)]] - (when (and unlinked? (not-empty @unlinked-refs)) - [:> Button {:position "absolute" - :size "xs" - :top 1 - :right 1 - :onClick (fn [] - (let [unlinked-str-ids (->> @unlinked-refs - (mapcat second) - (map #(select-keys % [:block/string :block/uid])))] ; to remove the unnecessary data before dispatching the event - (dispatch [:unlinked-references/link-all unlinked-str-ids title])) - - (swap! state assoc unlinked? false) - - (reset! unlinked-refs []))} - "Link All"])] - [:> AccordionPanel {:p 0} - [:> VStack {:spacing 6 - :pl 1 - :align "stretch"} - (doall - (for [[[group-title] group] @unlinked-refs] - [reference-group - {:title group-title - :on-click-title (fn [e] - (let [shift? (.-shiftKey e) - parsed-title (parse-renderer/parse-title group-title)] - (rf/dispatch [:reporting/navigation {:source :main-unlinked-refs ; NOTE: this isn't always `:main-unlinked-refs` it can also be `:right-pane-unlinked-refs` - :target :page - :pane (if shift? - :right-pane - :main-pane)}]) - (router/navigate-page parsed-title e)))} - (doall - (for [block group] - [reference-block - {:key (str "ref-" (:block/uid block)) - :actions (when unlinked? - [:> Button {:marginTop "1.5em" - :size "xs" - :flex "0 0" - :float "right" - :variant "link" - :onClick (fn [] - (let [hm (into (hash-map) @unlinked-refs) - new-unlinked-refs (->> (update-in hm [group-title] #(filter (fn [{:keys [block/uid]}] - (= uid (:block/uid block))) - %)) - seq)] + [state unlinked-refs title] + (let [unlinked? "Unlinked References" + link-all-unlinked (fn [] + (let [unlinked-str-ids + (->> @unlinked-refs + (mapcat second) + (map #(select-keys % [:block/string :block/uid])))] ; to remove the unnecessary data before dispatching the event + (dispatch [:unlinked-references/link-all unlinked-str-ids title])) + (swap! state assoc unlinked? false) + (reset! unlinked-refs []))] + [:> PageReferences {:defaultIsOpen false + :count (count @unlinked-refs) + :showIfEmpty true + :refs @unlinked-refs + :title "Unlinked References" + :extras (r/as-element [:> Button {:variant "link" + :flexShrink 0 + :onClick link-all-unlinked} + "Link all"]) + :onOpen #(let [un-refs (get-unlinked-references (escape-str title))] + (swap! state assoc unlinked? true) + (reset! unlinked-refs un-refs)) + :onClose #(swap! state assoc unlinked? false)} + (doall + (for [[[group-title] group] @unlinked-refs] + [:> ReferenceGroup + {:title group-title + :onClickTitle (fn [e] + (let [shift? (.-shiftKey e) + parsed-title (parse-renderer/parse-title group-title)] + (rf/dispatch [:reporting/navigation {:source :main-unlinked-refs ; NOTE: this isn't always `:main-unlinked-refs` it can also be `:right-pane-unlinked-refs` + :target :page + :pane (if shift? + :right-pane + :main-pane)}]) + (router/navigate-page parsed-title e)))} + (doall + (for [block group] + [:> ReferenceBlock + {:key (str "ref-" (:block/uid block)) + #_ :actions #_ (when unlinked? + [:> Button {:marginTop "1.5em" + :size "xs" + :flex "0 0" + :float "right" + :variant "link" + :onClick (fn [] + (let [hm (into (hash-map) @unlinked-refs) + new-unlinked-refs (->> (update-in hm [group-title] #(filter (fn [{:keys [block/uid]}] + (= uid (:block/uid block))) + %)) + seq)] ;; ctrl-z doesn't work though, because Unlinked Refs aren't reactive to datascript. - (reset! unlinked-refs new-unlinked-refs) - (dispatch [:unlinked-references/link block title])))} - "Link"])} - [ref-comp block]]))]))]]]]))) + (reset! unlinked-refs new-unlinked-refs) + (dispatch [:unlinked-references/link block title])))} + "Link"])} + [ref-comp block]]))]))])) + + ;; TODO: where to put page-level link filters? @@ -474,9 +451,10 @@ ;; References [:> PageFooter [perf-mon/hoc-perfmon-no-new-tx {:span-name "linked-ref-el"} - [linked-ref-el state on-daily-notes? title]] - [perf-mon/hoc-perfmon-no-new-tx {:span-name "unlinked-ref-el"} - [unlinked-ref-el state on-daily-notes? unlinked-refs title]]]])))) + [linked-ref-el state title]] + (when-not on-daily-notes? + [perf-mon/hoc-perfmon-no-new-tx {:span-name "unlinked-ref-el"} + [unlinked-ref-el state unlinked-refs title]])]])))) (defn page diff --git a/src/cljs/athens/views/references.cljs b/src/cljs/athens/views/references.cljs index 8dc8bc756e..0f902c7044 100644 --- a/src/cljs/athens/views/references.cljs +++ b/src/cljs/athens/views/references.cljs @@ -1,6 +1,6 @@ (ns athens.views.references (:require - ["@chakra-ui/react" :refer [Box Button Heading VStack]])) + ["@chakra-ui/react" :refer [Box Button Heading VStack]])) (defn reference-header @@ -29,16 +29,16 @@ (defn reference-group ([props children] (let [{:keys [on-click-title title]} props] - [:> VStack {:spacing 2 :align "stretch"} - [reference-header {:on-click on-click-title - :title title}] + [:> VStack {:spacing 0 :align "stretch"} + (when title [reference-header {:on-click on-click-title + :title title}]) children]))) (defn reference-block ([props children] (let [{:keys [actions]} props] - [:> Box + [:> Box children actions]))) diff --git a/src/js/components/Icons/Icons.tsx b/src/js/components/Icons/Icons.tsx index a11e314272..b3b88b80cb 100644 --- a/src/js/components/Icons/Icons.tsx +++ b/src/js/components/Icons/Icons.tsx @@ -26,6 +26,22 @@ export const XmarkIcon = createIcon({ ), }) +export const LinkedIcon = createIcon({ + displayName: 'LinkedIcon', + viewBox: '0 0 24 24', + path: ( + + ), +}) + +export const UnlinkedIcon = createIcon({ + displayName: 'UnlinkedIcon', + viewBox: '0 0 24 24', + path: ( + + ) +}) + export const DailyNotesIcon = createIcon({ displayName: 'DailyNotesIcon', viewBox: '0 0 24 24', diff --git a/src/js/components/Layout/Layout.tsx b/src/js/components/Layout/Layout.tsx index b12d3ef3a5..33e87a41a6 100644 --- a/src/js/components/Layout/Layout.tsx +++ b/src/js/components/Layout/Layout.tsx @@ -1,6 +1,7 @@ -import { Button, IconButton, Box, useDisclosure, Collapse, VStack } from '@chakra-ui/react'; +import { Heading, Button, IconButton, Box, useDisclosure, Collapse, Text, VStack, Divider, HStack } from '@chakra-ui/react'; import { AnimatePresence, motion } from 'framer-motion'; -import { XmarkIcon, ChevronUpIcon } from '@/Icons/Icons'; +import { XmarkIcon, ChevronUpIcon, LinkedIcon, UnlinkedIcon } from '@/Icons/Icons'; +import { withErrorBoundary } from 'react-error-boundary'; const Container = motion(Box) @@ -119,4 +120,122 @@ export const SidebarItem = ({ title, defaultIsOpen, onRemove, onClose, children {children} ) -} \ No newline at end of file +} + +export const PageReference = ({ children }) => { + return ( + + {children} + + ) +} + +interface PageReferences { + children: React.ReactNode, + extras: React.ReactNode, + showIfEmpty: boolean, + count: number, + title: string, + defaultIsOpen: boolean, + onOpen: () => void, + onClose: () => void, +} + +export const ReferenceHeader = ({ onClick, title }) => { + return + + +} + +export const ReferenceGroup = ({ title, onClickTitle, children }) => { + return ( + + {title && } + {children} + + ) +} + +export const ReferenceBlock = ({ children, actions }) => { + return {children} {actions} +} + +const EmptyReferencesNotice = ({ title }: { title: string }) => { + return ( + No {title.toLowerCase()} + ) +} + +export const PageReferences = withErrorBoundary(({ children, count, title, defaultIsOpen, onOpen, onClose, extras }: PageReferences) => { + + const { isOpen, onToggle } = useDisclosure({ + defaultIsOpen: defaultIsOpen, + onClose: onClose, + onOpen: onOpen + }); + + return ( + + + + {extras} + + + + + {children} + + + ) +}, + { fallback: Error displaying references }) \ No newline at end of file diff --git a/src/js/components/Page/Page.tsx b/src/js/components/Page/Page.tsx index a09e008f7f..9cf239be1a 100644 --- a/src/js/components/Page/Page.tsx +++ b/src/js/components/Page/Page.tsx @@ -32,7 +32,6 @@ export const PageContainer = ({ children, uid, type }) => {children} export const HeaderImage = ({ src }) => Date: Sat, 9 Apr 2022 18:49:29 -0400 Subject: [PATCH 02/29] fix: centered daily notes --- src/cljs/athens/views/pages/daily_notes.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cljs/athens/views/pages/daily_notes.cljs b/src/cljs/athens/views/pages/daily_notes.cljs index 87222c3373..6e7a6a93ef 100644 --- a/src/cljs/athens/views/pages/daily_notes.cljs +++ b/src/cljs/athens/views/pages/daily_notes.cljs @@ -33,7 +33,7 @@ :gap "1.5rem" :py "6rem" :px "2rem" - :alignItems "stretch" + :alignItems "center" :flex "1 1 100%" :flexDirection "column"} (doall From 2184c10cdafe26350a9d89bf5f1f5edf7a61b223 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sat, 9 Apr 2022 19:06:49 -0400 Subject: [PATCH 03/29] rfct: retire stylefy and garden --- deps.edn | 3 --- resources/public/index.html | 2 -- src/cljs/athens/style.cljs | 9 +++------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/deps.edn b/deps.edn index 38900323c1..b1658af9f1 100644 --- a/deps.edn +++ b/deps.edn @@ -17,9 +17,6 @@ metosin/komponentit #:mvn{:version "0.3.10"} instaparse/instaparse #:mvn{:version "1.4.10"} borkdude/sci #:mvn{:version "0.2.5"} - garden/garden #:mvn{:version "1.3.10"} - stylefy/stylefy #:mvn{:version "3.0.0"} - stylefy/reagent #:mvn{:version "3.0.0"} tick/tick #:mvn{:version "0.4.26-alpha"} cljc.java-time/cljc.java-time #:mvn{:version "0.1.9"} com.rpl/specter #:mvn{:version "1.1.3"} diff --git a/resources/public/index.html b/resources/public/index.html index 3a4ef9fb8c..9fea1a6c4f 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -5,8 +5,6 @@ - - diff --git a/src/cljs/athens/style.cljs b/src/cljs/athens/style.cljs index a1bf274ee1..a05b51b449 100644 --- a/src/cljs/athens/style.cljs +++ b/src/cljs/athens/style.cljs @@ -1,10 +1,8 @@ (ns athens.style (:require - [athens.config :as config] - [athens.util :as util] - [re-frame.core :refer [reg-sub subscribe]] - [stylefy.core :as stylefy] - [stylefy.reagent :as stylefy-reagent])) + [athens.config :as config] + [athens.util :as util] + [re-frame.core :refer [reg-sub subscribe]])) (reg-sub @@ -58,7 +56,6 @@ (defn init [] - (stylefy/init {:dom (stylefy-reagent/init)}) ;; hide re-frame-10x by default (when config/debug? (util/hide-10x))) From b9b92d617005627d527069ec780ad2a2576e1754 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sat, 9 Apr 2022 20:14:35 -0400 Subject: [PATCH 04/29] fix: correct chevron direction in references --- src/js/components/Layout/Layout.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/components/Layout/Layout.tsx b/src/js/components/Layout/Layout.tsx index f20f4431fb..3499c60734 100644 --- a/src/js/components/Layout/Layout.tsx +++ b/src/js/components/Layout/Layout.tsx @@ -1,5 +1,5 @@ import { AnimatePresence, motion } from 'framer-motion'; -import { XmarkIcon, ChevronRightIcon } from '@/Icons/Icons'; +import { XmarkIcon, ChevronUpIcon } from '@/Icons/Icons'; import { Heading, Button, IconButton, Box, useDisclosure, Collapse, Text, VStack, HStack } from '@chakra-ui/react'; import { withErrorBoundary } from 'react-error-boundary'; @@ -82,7 +82,7 @@ export const SidebarItem = ({ title, type, isOpen, onToggle, onRemove, children whiteSpace="nowrap" sx={{ maskImage: "linear-gradient(to right, black, black calc(100% - 1rem), transparent calc(100%))" }} > - @@ -224,7 +224,7 @@ export const PageReferences = withErrorBoundary(({ children, count, title, defau overflow="hidden" whiteSpace="nowrap" leftIcon={ - Date: Sat, 9 Apr 2022 20:37:53 -0400 Subject: [PATCH 05/29] improvement: clearer references section --- src/js/components/Layout/Layout.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/js/components/Layout/Layout.tsx b/src/js/components/Layout/Layout.tsx index 3499c60734..9bbcdde8e5 100644 --- a/src/js/components/Layout/Layout.tsx +++ b/src/js/components/Layout/Layout.tsx @@ -210,11 +210,9 @@ export const PageReferences = withErrorBoundary(({ children, count, title, defau position="relative" spacing={0} p={2} - px={2} > } @@ -175,12 +174,12 @@ export const ReferenceGroup = ({ title, onClickTitle, children }) => { {title && } {children} @@ -192,7 +191,7 @@ export const ReferenceBlock = ({ children, actions }) => { if (actions) { return ({children} {actions}) } else { - return children + return {children} } } From 8ab86367b581890bfc816cb7c00a3c4b73de5eb9 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sun, 10 Apr 2022 13:34:20 -0400 Subject: [PATCH 26/29] rfct: chakra window icons --- .../AppToolbar/components/WindowButtons.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/js/components/AppToolbar/components/WindowButtons.tsx b/src/js/components/AppToolbar/components/WindowButtons.tsx index 5ea5b09528..5f62e15c16 100644 --- a/src/js/components/AppToolbar/components/WindowButtons.tsx +++ b/src/js/components/AppToolbar/components/WindowButtons.tsx @@ -1,4 +1,4 @@ -import { Box } from '@chakra-ui/react'; +import { Box, Icon } from '@chakra-ui/react'; import { SvgIcon } from '@material-ui/core'; const Wrapper = ({ children }) => - + - + {isWinFullscreen ? ( ) : ( @@ -182,9 +182,9 @@ export const WindowButtons = ({ onClick={handlePressClose} className="close" > - + - + ) } From cc1bfd578417d01f7d2c353ff172c03f157066b4 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sun, 10 Apr 2022 13:59:18 -0400 Subject: [PATCH 27/29] rfct: replace material icons on node page --- src/cljs/athens/views/pages/node_page.cljs | 26 +++++++------- src/js/components/AppToolbar/AppToolbar.tsx | 13 +++---- .../AppToolbar/components/WindowButtons.tsx | 1 - src/js/components/Icons/Icons.tsx | 35 +++++++++++++++++++ 4 files changed, 52 insertions(+), 23 deletions(-) diff --git a/src/cljs/athens/views/pages/node_page.cljs b/src/cljs/athens/views/pages/node_page.cljs index 50a0554637..85b6c6dc91 100644 --- a/src/cljs/athens/views/pages/node_page.cljs +++ b/src/cljs/athens/views/pages/node_page.cljs @@ -2,14 +2,10 @@ (:require ["/components/Block/components/Anchor" :refer [Anchor]] ["/components/Confirmation/Confirmation" :refer [Confirmation]] + ["/components/Icons/Icons" :refer [EllipsisHorizontalIcon GraphIcon BookmarkIcon BookmarkFillIcon TrashIcon]] ["/components/Layout/Layout" :refer [PageReferences ReferenceBlock ReferenceGroup]] ["/components/Page/Page" :refer [PageHeader PageBody PageFooter TitleContainer]] ["@chakra-ui/react" :refer [Box Button Portal IconButton MenuDivider MenuButton Menu MenuList MenuItem Breadcrumb BreadcrumbItem BreadcrumbLink VStack]] - ["@material-ui/icons/Bookmark" :default Bookmark] - ["@material-ui/icons/BookmarkBorder" :default BookmarkBorder] - ["@material-ui/icons/BubbleChart" :default BubbleChart] - ["@material-ui/icons/Delete" :default Delete] - ["@material-ui/icons/MoreHoriz" :default MoreHoriz] [athens.common-db :as common-db] [athens.common.sentry :refer-macros [wrap-span-no-new-tx]] [athens.common.utils :as utils] @@ -217,6 +213,7 @@ "aria-label" "Page menu" :gridArea "menu" :justifySelf "flex-end" + :size "md" :alignSelf "center" :bg "transparent" :width "2.25em" @@ -224,22 +221,23 @@ :borderRadius "full" :sx {"span" {:display "contents"} "button svg:first-of-type" {:marginRight "0.25rem"}}} - [:> MoreHoriz]] + [:> EllipsisHorizontalIcon]] [:> Portal [:> MenuList {:sx {"button svg:first-of-type" {:marginRight "0.25rem"}}} [:<> (if sidebar - [:> MenuItem {:onClick #(dispatch [:left-sidebar/remove-shortcut title])} - [:> BookmarkBorder] + [:> MenuItem {:onClick #(dispatch [:left-sidebar/remove-shortcut title]) + :icon (r/as-element [:> BookmarkFillIcon])} "Remove Shortcut"] - [:> MenuItem {:onClick #(dispatch [:left-sidebar/add-shortcut title])} - [:> Bookmark] + [:> MenuItem {:onClick #(dispatch [:left-sidebar/add-shortcut title]) + :icon (r/as-element [:> BookmarkIcon])} [:span "Add Shortcut"]]) - [:> MenuItem {:onClick #(dispatch [:right-sidebar/open-item uid true])} - [:> BubbleChart] + [:> MenuItem {:onClick #(dispatch [:right-sidebar/open-item uid true]) + :icon (r/as-element [:> GraphIcon])} "Show Local Graph"]] [:> MenuDivider] - [:> MenuItem {:onClick (fn [] + [:> MenuItem {:icon (r/as-element [:> TrashIcon]) + :onClick (fn [] ;; if page being deleted is in right sidebar, remove from right sidebar (when (contains? @(subscribe [:right-sidebar/items]) uid) (dispatch [:right-sidebar/close-item uid])) @@ -254,7 +252,7 @@ (if daily-note? (dispatch [:daily-note/delete uid title]) (dispatch [:page/delete title])))} - [:> Delete] "Delete Page"]]]])) + "Delete Page"]]]])) (defn ref-comp diff --git a/src/js/components/AppToolbar/AppToolbar.tsx b/src/js/components/AppToolbar/AppToolbar.tsx index 7541aa6fa9..89f215c6fa 100644 --- a/src/js/components/AppToolbar/AppToolbar.tsx +++ b/src/js/components/AppToolbar/AppToolbar.tsx @@ -10,14 +10,11 @@ import { AllPagesIcon, SettingsIcon, ContrastIcon, - DailyNotesIcon + DailyNotesIcon, + GraphIcon, + EllipsisHorizontalIcon } from '@/Icons/Icons'; -import { - BubbleChart, - MoreHoriz, -} from '@material-ui/icons'; - import { HTMLChakraProps, Portal, @@ -228,7 +225,7 @@ const SecondaryToolbarItems = (items) => { const SecondaryToolbarOverflowMenu = (items) => { return {({ isOpen }) => <> - + {items.map((item) => ( { aria-label="Graph" isActive={route === 'graph'} onClick={handlePressGraph}> - + + ), +}); + +export const BookmarkFillIcon = createIcon({ + displayName: 'BookmarkFillIcon', + viewBox: '0 0 24 24', + path: ( + <> + + + + ), +}); + export const LinkedIcon = createIcon({ displayName: 'LinkedIcon', viewBox: '0 0 24 24', @@ -136,6 +155,14 @@ export const ContrastIcon = createIcon({ ), }); +export const EllipsisHorizontalIcon = createIcon({ + displayName: 'EllipsisHorizontalIcon', + viewBox: '0 0 24 24', + path: ( + + ), +}); + export const GraphIcon = createIcon({ displayName: 'GraphIcon', viewBox: '0 0 24 24', @@ -248,6 +275,14 @@ export const TimeNow = createIcon({ ), }); +export const TrashIcon = createIcon({ + displayName: 'TrashIcon', + viewBox: '0 0 24 24', + path: ( + + ), +}); + export const YoutubeIcon = createIcon({ displayName: 'YoutubeIcon', viewBox: '0 0 24 24', From 95dc4bb75a0d66ace8f9983d9ae099149fca8e43 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sun, 10 Apr 2022 14:07:42 -0400 Subject: [PATCH 28/29] rfct: replace and remove material-ui --- package.json | 2 - .../electron/db_menu/status_indicator.cljs | 9 +- src/cljs/athens/views/devtool.cljs | 11 +- src/js/components/Icons/Icons.tsx | 16 ++ yarn.lock | 218 +----------------- 5 files changed, 28 insertions(+), 228 deletions(-) diff --git a/package.json b/package.json index 921e705b33..ad5a5c9138 100644 --- a/package.json +++ b/package.json @@ -107,8 +107,6 @@ "@js-joda/core": "1.12.0", "@js-joda/locale_en-us": "3.1.1", "@js-joda/timezone": "2.2.0", - "@material-ui/core": "^4.10.1", - "@material-ui/icons": "^4.9.1", "@sentry/integrations": "^6.17.3", "@sentry/react": "^6.17.3", "@sentry/tracing": "^6.17.3", diff --git a/src/cljs/athens/electron/db_menu/status_indicator.cljs b/src/cljs/athens/electron/db_menu/status_indicator.cljs index 084a11b01c..544ded260f 100644 --- a/src/cljs/athens/electron/db_menu/status_indicator.cljs +++ b/src/cljs/athens/electron/db_menu/status_indicator.cljs @@ -1,8 +1,7 @@ (ns athens.electron.db-menu.status-indicator (:require - ["@chakra-ui/react" :refer [Box Tooltip Spinner]] - ["@material-ui/icons/CheckCircle" :default CheckCircle] - ["@material-ui/icons/Error" :default Error])) + ["/components/Icons/Icons" :refer [CheckmarkCircleFillIcon ExclamationCircleFillIcon]] + ["@chakra-ui/react" :refer [Box Tooltip Spinner]])) (defn status-indicator @@ -27,10 +26,10 @@ (cond (= status :closed) [:> Tooltip {:label "Disconnected"} - [:> Error]] + [:> ExclamationCircleFillIcon]] (= status :running) [:> Tooltip {:label "Synced"} - [:> CheckCircle]] + [:> CheckmarkCircleFillIcon]] :else [:> Tooltip {:label "Synchronizing..."} [:> Spinner {:emptyColor "background.vibrancy" :speed "2s" :size "xs"}]])]) diff --git a/src/cljs/athens/views/devtool.cljs b/src/cljs/athens/views/devtool.cljs index 41ee5291b3..4c7e7bb0c4 100644 --- a/src/cljs/athens/views/devtool.cljs +++ b/src/cljs/athens/views/devtool.cljs @@ -1,8 +1,7 @@ (ns athens.views.devtool (:require - ["@chakra-ui/react" :refer [Box Button Table Thead Tbody Th Tr Td Input ButtonGroup]] - ["@material-ui/icons/ChevronLeft" :default ChevronLeft] - ["@material-ui/icons/Clear" :default Clear] + ["/components/Icons/Icons" :refer [XmarkIcon ChevronLeftIcon]] + ["@chakra-ui/react" :refer [Box IconButton Button Table Thead Tbody Th Tr Td Input ButtonGroup]] [athens.config :as config] [athens.db :as db :refer [dsdb]] [cljs.pprint :as pp] @@ -231,7 +230,7 @@ (-> s (update :navs subvec 0 i) (dissoc :viewer))))} - [:<> [:> ChevronLeft] [:span (first nav)]]]))) + [:<> [:> ChevronLeftIcon] [:span (first nav)]]]))) [:h3 (pr-str (type navved-data))] [:div [:span "View as "] @@ -353,8 +352,8 @@ (defn devtool-close-el [] - [:> Button {:onClick #(dispatch [:devtool/toggle])} - [:> Clear]]) + [:> IconButton {:onClick #(dispatch [:devtool/toggle])} + [:> XmarkIcon]]) (defn devtool-el diff --git a/src/js/components/Icons/Icons.tsx b/src/js/components/Icons/Icons.tsx index bee94d04a3..b2d7b40093 100644 --- a/src/js/components/Icons/Icons.tsx +++ b/src/js/components/Icons/Icons.tsx @@ -115,6 +115,14 @@ export const CheckmarkIcon = createIcon({ ), }); +export const CheckmarkCircleFillIcon = createIcon({ + displayName: 'CheckmarkCircleFillIcon', + viewBox: '0 0 24 24', + path: ( + + ), +}); + export const ChevronDownIcon = createIcon({ displayName: 'ChevronDownIcon', viewBox: '0 0 24 24', @@ -163,6 +171,14 @@ export const EllipsisHorizontalIcon = createIcon({ ), }); +export const ExclamationCircleFillIcon = createIcon({ + displayName: 'ExclamationCircleFillIcon', + viewBox: '0 0 24 24', + path: ( + + ), +}); + export const GraphIcon = createIcon({ displayName: 'GraphIcon', viewBox: '0 0 24 24', diff --git a/yarn.lock b/yarn.lock index 61f0debd28..688a3aa12c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1679,7 +1679,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7": +"@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5": version "7.14.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.0.tgz#46794bc20b612c5f75e62dd071e24dfd95f1cbe6" integrity sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA== @@ -2692,77 +2692,6 @@ lodash "^4.17.15" tmp-promise "^3.0.2" -"@material-ui/core@^4.10.1": - version "4.11.4" - resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.11.4.tgz#4fb9fe5dec5dcf780b687e3a40cff78b2b9640a4" - integrity sha512-oqb+lJ2Dl9HXI9orc6/aN8ZIAMkeThufA5iZELf2LQeBn2NtjVilF5D2w7e9RpntAzDb4jK5DsVhkfOvFY/8fg== - dependencies: - "@babel/runtime" "^7.4.4" - "@material-ui/styles" "^4.11.4" - "@material-ui/system" "^4.11.3" - "@material-ui/types" "5.1.0" - "@material-ui/utils" "^4.11.2" - "@types/react-transition-group" "^4.2.0" - clsx "^1.0.4" - hoist-non-react-statics "^3.3.2" - popper.js "1.16.1-lts" - prop-types "^15.7.2" - react-is "^16.8.0 || ^17.0.0" - react-transition-group "^4.4.0" - -"@material-ui/icons@^4.9.1": - version "4.11.2" - resolved "https://registry.yarnpkg.com/@material-ui/icons/-/icons-4.11.2.tgz#b3a7353266519cd743b6461ae9fdfcb1b25eb4c5" - integrity sha512-fQNsKX2TxBmqIGJCSi3tGTO/gZ+eJgWmMJkgDiOfyNaunNaxcklJQFaFogYcFl0qFuaEz1qaXYXboa/bUXVSOQ== - dependencies: - "@babel/runtime" "^7.4.4" - -"@material-ui/styles@^4.11.4": - version "4.11.4" - resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.11.4.tgz#eb9dfccfcc2d208243d986457dff025497afa00d" - integrity sha512-KNTIZcnj/zprG5LW0Sao7zw+yG3O35pviHzejMdcSGCdWbiO8qzRgOYL8JAxAsWBKOKYwVZxXtHWaB5T2Kvxew== - dependencies: - "@babel/runtime" "^7.4.4" - "@emotion/hash" "^0.8.0" - "@material-ui/types" "5.1.0" - "@material-ui/utils" "^4.11.2" - clsx "^1.0.4" - csstype "^2.5.2" - hoist-non-react-statics "^3.3.2" - jss "^10.5.1" - jss-plugin-camel-case "^10.5.1" - jss-plugin-default-unit "^10.5.1" - jss-plugin-global "^10.5.1" - jss-plugin-nested "^10.5.1" - jss-plugin-props-sort "^10.5.1" - jss-plugin-rule-value-function "^10.5.1" - jss-plugin-vendor-prefixer "^10.5.1" - prop-types "^15.7.2" - -"@material-ui/system@^4.11.3": - version "4.11.3" - resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.11.3.tgz#466bc14c9986798fd325665927c963eb47cc4143" - integrity sha512-SY7otguNGol41Mu2Sg6KbBP1ZRFIbFLHGK81y4KYbsV2yIcaEPOmsCK6zwWlp+2yTV3J/VwT6oSBARtGIVdXPw== - dependencies: - "@babel/runtime" "^7.4.4" - "@material-ui/utils" "^4.11.2" - csstype "^2.5.2" - prop-types "^15.7.2" - -"@material-ui/types@5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@material-ui/types/-/types-5.1.0.tgz#efa1c7a0b0eaa4c7c87ac0390445f0f88b0d88f2" - integrity sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A== - -"@material-ui/utils@^4.11.2": - version "4.11.2" - resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-4.11.2.tgz#f1aefa7e7dff2ebcb97d31de51aecab1bb57540a" - integrity sha512-Uul8w38u+PICe2Fg2pDKCaIG7kOyhowZ9vjiC1FsVwPABTW8vPPKfF6OvxRq3IiBaI1faOJmgdvMG7rMJARBhA== - dependencies: - "@babel/runtime" "^7.4.4" - prop-types "^15.7.2" - react-is "^16.8.0 || ^17.0.0" - "@mdx-js/loader@^1.6.22": version "1.6.22" resolved "https://registry.yarnpkg.com/@mdx-js/loader/-/loader-1.6.22.tgz#d9e8fe7f8185ff13c9c8639c048b123e30d322c4" @@ -4330,13 +4259,6 @@ dependencies: "@types/react" "*" -"@types/react-transition-group@^4.2.0": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.1.tgz#e1a3cb278df7f47f17b5082b1b3da17170bd44b1" - integrity sha512-vIo69qKKcYoJ8wKCJjwSgCTM+z3chw3g18dkrDfVX665tMH7tmbDxEAnPdey4gTlwZz5QuHGzd+hul0OVZDqqQ== - dependencies: - "@types/react" "*" - "@types/react@*": version "17.0.8" resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.8.tgz#fe76e3ba0fbb5602704110fd1e3035cf394778e3" @@ -6098,11 +6020,6 @@ clone-response@^1.0.2: dependencies: mimic-response "^1.0.0" -clsx@^1.0.4: - version "1.1.1" - resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.1.1.tgz#98b3134f9abbdf23b2663491ace13c5c03a73188" - integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA== - code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" @@ -6826,14 +6743,6 @@ css-to-react-native@^3.0.0: css-color-keywords "^1.0.0" postcss-value-parser "^4.0.2" -css-vendor@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/css-vendor/-/css-vendor-2.0.8.tgz#e47f91d3bd3117d49180a3c935e62e3d9f7f449d" - integrity sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ== - dependencies: - "@babel/runtime" "^7.8.3" - is-in-browser "^1.0.2" - css-what@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.0.1.tgz#3efa820131f4669a8ac2408f9c32e7c7de9f4cad" @@ -6844,7 +6753,7 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -csstype@^2.5.2, csstype@^2.5.7: +csstype@^2.5.7: version "2.6.17" resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.17.tgz#4cf30eb87e1d1a005d8b6510f95292413f6a1c0e" integrity sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A== @@ -7298,14 +7207,6 @@ dom-converter@^0.2.0: dependencies: utila "~0.4" -dom-helpers@^5.0.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.2.1.tgz#d9400536b2bf8225ad98fe052e029451ac40e902" - integrity sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA== - dependencies: - "@babel/runtime" "^7.8.7" - csstype "^3.0.2" - dom-serialize@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b" @@ -9278,11 +9179,6 @@ humanize-url@^1.0.0: normalize-url "^1.0.0" strip-url-auth "^1.0.0" -hyphenate-style-name@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d" - integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ== - iconv-corefoundation@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz#31065e6ab2c9272154c8b0821151e2c88f1b002a" @@ -9360,13 +9256,6 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= -indefinite-observable@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/indefinite-observable/-/indefinite-observable-2.0.1.tgz#574af29bfbc17eb5947793797bddc94c9d859400" - integrity sha512-G8vgmork+6H9S8lUAg1gtXEj2JxIQTo0g2PbFiYOdjkziSI0F7UYBiVwhZRuixhBCNGczAls34+5HJPyZysvxQ== - dependencies: - symbol-observable "1.2.0" - indent-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" @@ -9698,11 +9587,6 @@ is-hexadecimal@^1.0.0: resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz#cc35c97588da4bd49a8eedd6bc4082d44dcb23a7" integrity sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw== -is-in-browser@^1.0.2, is-in-browser@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-in-browser/-/is-in-browser-1.1.3.tgz#56ff4db683a078c6082eb95dad7dc62e1d04f835" - integrity sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU= - is-installed-globally@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.3.2.tgz#fd3efa79ee670d1187233182d5b0a1dd00313141" @@ -10221,77 +10105,6 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= -jss-plugin-camel-case@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.6.0.tgz#93d2cd704bf0c4af70cc40fb52d74b8a2554b170" - integrity sha512-JdLpA3aI/npwj3nDMKk308pvnhoSzkW3PXlbgHAzfx0yHWnPPVUjPhXFtLJzgKZge8lsfkUxvYSQ3X2OYIFU6A== - dependencies: - "@babel/runtime" "^7.3.1" - hyphenate-style-name "^1.0.3" - jss "10.6.0" - -jss-plugin-default-unit@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.6.0.tgz#af47972486819b375f0f3a9e0213403a84b5ef3b" - integrity sha512-7y4cAScMHAxvslBK2JRK37ES9UT0YfTIXWgzUWD5euvR+JR3q+o8sQKzBw7GmkQRfZijrRJKNTiSt1PBsLI9/w== - dependencies: - "@babel/runtime" "^7.3.1" - jss "10.6.0" - -jss-plugin-global@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.6.0.tgz#3e8011f760f399cbadcca7f10a485b729c50e3ed" - integrity sha512-I3w7ji/UXPi3VuWrTCbHG9rVCgB4yoBQLehGDTmsnDfXQb3r1l3WIdcO8JFp9m0YMmyy2CU7UOV6oPI7/Tmu+w== - dependencies: - "@babel/runtime" "^7.3.1" - jss "10.6.0" - -jss-plugin-nested@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.6.0.tgz#5f83c5c337d3b38004834e8426957715a0251641" - integrity sha512-fOFQWgd98H89E6aJSNkEh2fAXquC9aZcAVjSw4q4RoQ9gU++emg18encR4AT4OOIFl4lQwt5nEyBBRn9V1Rk8g== - dependencies: - "@babel/runtime" "^7.3.1" - jss "10.6.0" - tiny-warning "^1.0.2" - -jss-plugin-props-sort@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.6.0.tgz#297879f35f9fe21196448579fee37bcde28ce6bc" - integrity sha512-oMCe7hgho2FllNc60d9VAfdtMrZPo9n1Iu6RNa+3p9n0Bkvnv/XX5San8fTPujrTBScPqv9mOE0nWVvIaohNuw== - dependencies: - "@babel/runtime" "^7.3.1" - jss "10.6.0" - -jss-plugin-rule-value-function@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.6.0.tgz#3c1a557236a139d0151e70a82c810ccce1c1c5ea" - integrity sha512-TKFqhRTDHN1QrPTMYRlIQUOC2FFQb271+AbnetURKlGvRl/eWLswcgHQajwuxI464uZk91sPiTtdGi7r7XaWfA== - dependencies: - "@babel/runtime" "^7.3.1" - jss "10.6.0" - tiny-warning "^1.0.2" - -jss-plugin-vendor-prefixer@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.6.0.tgz#e1fcd499352846890c38085b11dbd7aa1c4f2c78" - integrity sha512-doJ7MouBXT1lypLLctCwb4nJ6lDYqrTfVS3LtXgox42Xz0gXusXIIDboeh6UwnSmox90QpVnub7au8ybrb0krQ== - dependencies: - "@babel/runtime" "^7.3.1" - css-vendor "^2.0.8" - jss "10.6.0" - -jss@10.6.0, jss@^10.5.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/jss/-/jss-10.6.0.tgz#d92ff9d0f214f65ca1718591b68e107be4774149" - integrity sha512-n7SHdCozmxnzYGXBHe0NsO0eUf9TvsHVq2MXvi4JmTn3x5raynodDVE/9VQmBdWFyyj9HpHZ2B4xNZ7MMy7lkw== - dependencies: - "@babel/runtime" "^7.3.1" - csstype "^3.0.2" - indefinite-observable "^2.0.1" - is-in-browser "^1.1.3" - tiny-warning "^1.0.2" - junk@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1" @@ -11930,11 +11743,6 @@ popmotion@11.0.3: style-value-types "5.0.0" tslib "^2.1.0" -popper.js@1.16.1-lts: - version "1.16.1-lts" - resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1-lts.tgz#cf6847b807da3799d80ee3d6d2f90df8a3f50b05" - integrity sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA== - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -12540,7 +12348,7 @@ react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -"react-is@^16.8.0 || ^17.0.0", react-is@^17.0.1, react-is@^17.0.2: +react-is@^17.0.1, react-is@^17.0.2: version "17.0.2" resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== @@ -12638,16 +12446,6 @@ react-textarea-autosize@^8.3.0: use-composed-ref "^1.0.0" use-latest "^1.0.0" -react-transition-group@^4.4.0: - version "4.4.1" - resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.1.tgz#63868f9325a38ea5ee9535d828327f85773345c9" - integrity sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw== - dependencies: - "@babel/runtime" "^7.5.5" - dom-helpers "^5.0.1" - loose-envify "^1.4.0" - prop-types "^15.6.2" - react@17.0.1: version "17.0.1" resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127" @@ -14074,11 +13872,6 @@ supports-color@^8.1.0: dependencies: has-flag "^4.0.0" -symbol-observable@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" - integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== - symbol.prototype.description@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/symbol.prototype.description/-/symbol.prototype.description-1.0.5.tgz#d30e01263b6020fbbd2d2884a6276ce4d49ab568" @@ -14242,11 +14035,6 @@ tiny-invariant@^1.0.6: resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.2.0.tgz#a1141f86b672a9148c72e978a19a73b9b94a15a9" integrity sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg== -tiny-warning@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" - integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== - tinycolor2@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.2.tgz#3f6a4d1071ad07676d7fa472e1fac40a719d8803" From 6dc37710a98c4b6b2f000965799044a2fcfb38a6 Mon Sep 17 00:00:00 2001 From: Stuart Hanberg Date: Sun, 10 Apr 2022 14:10:49 -0400 Subject: [PATCH 29/29] chore: linting fixes --- .../electron/db_menu/status_indicator.cljs | 4 +- src/cljs/athens/style.cljs | 6 +- src/cljs/athens/views/blocks/core.cljs | 7 +- src/cljs/athens/views/pages/all_pages.cljs | 4 +- src/cljs/athens/views/pages/graph.cljs | 8 +- src/cljs/athens/views/pages/node_page.cljs | 144 +++++++++--------- src/cljs/athens/views/references.cljs | 4 +- 7 files changed, 88 insertions(+), 89 deletions(-) diff --git a/src/cljs/athens/electron/db_menu/status_indicator.cljs b/src/cljs/athens/electron/db_menu/status_indicator.cljs index 544ded260f..c265a81c33 100644 --- a/src/cljs/athens/electron/db_menu/status_indicator.cljs +++ b/src/cljs/athens/electron/db_menu/status_indicator.cljs @@ -1,7 +1,7 @@ (ns athens.electron.db-menu.status-indicator (:require - ["/components/Icons/Icons" :refer [CheckmarkCircleFillIcon ExclamationCircleFillIcon]] - ["@chakra-ui/react" :refer [Box Tooltip Spinner]])) + ["/components/Icons/Icons" :refer [CheckmarkCircleFillIcon ExclamationCircleFillIcon]] + ["@chakra-ui/react" :refer [Box Tooltip Spinner]])) (defn status-indicator diff --git a/src/cljs/athens/style.cljs b/src/cljs/athens/style.cljs index a05b51b449..83d17f2cfc 100644 --- a/src/cljs/athens/style.cljs +++ b/src/cljs/athens/style.cljs @@ -1,8 +1,8 @@ (ns athens.style (:require - [athens.config :as config] - [athens.util :as util] - [re-frame.core :refer [reg-sub subscribe]])) + [athens.config :as config] + [athens.util :as util] + [re-frame.core :refer [reg-sub subscribe]])) (reg-sub diff --git a/src/cljs/athens/views/blocks/core.cljs b/src/cljs/athens/views/blocks/core.cljs index 57c04e5812..664395a4d7 100644 --- a/src/cljs/athens/views/blocks/core.cljs +++ b/src/cljs/athens/views/blocks/core.cljs @@ -28,7 +28,6 @@ [reagent.core :as r])) - ;; Inline refs ;; block-el depends on inline-linked-refs-el, which in turn depends on block-el @@ -45,8 +44,8 @@ parents (cond-> (:block/parents block) ;; If the ref has children, move it to breadcrumbs and show children. has-children? (conj block)) - ;; Reset state on parent each time the component is created. - ;; To clear state, open/close the inline refs. + ;; Reset state on parent each time the component is created. + ;; To clear state, open/close the inline refs. _ (reset! state {:block block :embed-id (random-uuid) :open? true @@ -118,7 +117,7 @@ (doall (for [[group-title group] refs] [:> ReferenceGroup {:title group-title - :key (str "group-" group-title)} + :key (str "group-" group-title)} (doall (for [block' group] [:> ReferenceBlock {:key (str "ref-" (:block/uid block'))} diff --git a/src/cljs/athens/views/pages/all_pages.cljs b/src/cljs/athens/views/pages/all_pages.cljs index b24196435d..05de0ca749 100644 --- a/src/cljs/athens/views/pages/all_pages.cljs +++ b/src/cljs/athens/views/pages/all_pages.cljs @@ -7,8 +7,8 @@ [athens.db :as db] [athens.router :as router] [clojure.string :refer [lower-case]] - [reagent.core :as r] - [re-frame.core :as rf])) + [re-frame.core :as rf] + [reagent.core :as r])) ;; Sort state and logic diff --git a/src/cljs/athens/views/pages/graph.cljs b/src/cljs/athens/views/pages/graph.cljs index 54ff9e07da..ef892959da 100644 --- a/src/cljs/athens/views/pages/graph.cljs +++ b/src/cljs/athens/views/pages/graph.cljs @@ -199,7 +199,7 @@ "Daily notes"]]]]) [:> AccordionItem [:> AccordionButton {:borderRadius "sm"} - "Forces"] + "Forces"] [:> AccordionPanel [:> VStack {:align "stretch"} [:> FormControl @@ -209,7 +209,8 @@ :min 5 :max 95 :step 10 - :onChange (fn [e] ((and graph-ref (.. graph-ref (d3Force "link") (distance (.. e -target -value))))) + :onChange (fn [e] + ((and graph-ref (.. graph-ref (d3Force "link") (distance (.. e -target -value))))) (.d3ReheatSimulation graph-ref))}]] [:> FormControl [:> FormLabel "Attraction force"] @@ -218,7 +219,8 @@ :min -30 :max 0 :step 5 - :onChange (fn [e] ((and graph-ref (.. graph-ref (d3Force "charge") (distance (.. e -target -value))))) + :onChange (fn [e] + ((and graph-ref (.. graph-ref (d3Force "charge") (distance (.. e -target -value))))) (.d3ReheatSimulation graph-ref))}]]]]] (when local-node-eid [:> AccordionItem diff --git a/src/cljs/athens/views/pages/node_page.cljs b/src/cljs/athens/views/pages/node_page.cljs index 85b6c6dc91..d2a3b40deb 100644 --- a/src/cljs/athens/views/pages/node_page.cljs +++ b/src/cljs/athens/views/pages/node_page.cljs @@ -270,13 +270,13 @@ [:> VStack {:spacing 0 :align "stretch"} [:> Breadcrumb {:fontSize "sm" :pl 4 :variant "strict" :color "foreground.secondary"} (doall - (for [{:keys [node/title block/string block/uid]} parents] - [:> BreadcrumbItem {:key (str "breadcrumb-" uid)} - [:> BreadcrumbLink - {:onClick #(let [new-B (db/get-block [:block/uid uid]) - new-P (drop-last parents)] - (swap! state assoc :block new-B :parents new-P))} - [parse-and-render (or title string) uid]]]))] + (for [{:keys [node/title block/string block/uid]} parents] + [:> BreadcrumbItem {:key (str "breadcrumb-" uid)} + [:> BreadcrumbLink + {:onClick #(let [new-B (db/get-block [:block/uid uid]) + new-P (drop-last parents)] + (swap! state assoc :block new-B :parents new-P))} + [parse-and-render (or title string) uid]]]))] [:> Box {:class "block-embed"} [blocks/block-el (recursively-modify-block-for-embed block embed-id) @@ -296,22 +296,22 @@ :onClose (fn [] (swap! state update linked? not)) :defaultIsOpen (get @state linked?)} (doall - (for [[group-title group] linked-refs] - [:> ReferenceGroup {:key (str "group-" group-title) - :title group-title - :onClickTitle (fn [e] - (let [shift? (.-shiftKey e) - parsed-title (parse-renderer/parse-title group-title)] - (rf/dispatch [:reporting/navigation {:source :main-page-linked-refs ; NOTE: this might be also used in right-pane situation - :target :page - :pane (if shift? - :right-pane - :main-pane)}]) - (router/navigate-page parsed-title e)))} - (doall - (for [block group] - [:> ReferenceBlock {:key (str "ref-" (:block/uid block))} - [ref-comp block]]))]))]))) + (for [[group-title group] linked-refs] + [:> ReferenceGroup {:key (str "group-" group-title) + :title group-title + :onClickTitle (fn [e] + (let [shift? (.-shiftKey e) + parsed-title (parse-renderer/parse-title group-title)] + (rf/dispatch [:reporting/navigation {:source :main-page-linked-refs ; NOTE: this might be also used in right-pane situation + :target :page + :pane (if shift? + :right-pane + :main-pane)}]) + (router/navigate-page parsed-title e)))} + (doall + (for [block group] + [:> ReferenceBlock {:key (str "ref-" (:block/uid block))} + [ref-comp block]]))]))]))) (defn unlinked-ref-el @@ -325,56 +325,54 @@ (dispatch [:unlinked-references/link-all unlinked-str-ids title])) (swap! state assoc unlinked? false) (reset! unlinked-refs []))] - [:> PageReferences {:defaultIsOpen false - :count (count @unlinked-refs) - :showIfEmpty true - :refs @unlinked-refs - :title "Unlinked References" - :extras (r/as-element [:> Button {:variant "link" - :size "sm" - :flexShrink 0 - :onClick link-all-unlinked} - "Link all"]) - :onOpen #(let [un-refs (get-unlinked-references (escape-str title))] - (swap! state assoc unlinked? true) - (reset! unlinked-refs un-refs)) - :onClose #(swap! state assoc unlinked? false)} - (doall - (for [[[group-title] group] @unlinked-refs] - [:> ReferenceGroup - {:title group-title - :onClickTitle (fn [e] - (let [shift? (.-shiftKey e) - parsed-title (parse-renderer/parse-title group-title)] - (rf/dispatch [:reporting/navigation {:source :main-unlinked-refs ; NOTE: this isn't always `:main-unlinked-refs` it can also be `:right-pane-unlinked-refs` - :target :page - :pane (if shift? - :right-pane - :main-pane)}]) - (router/navigate-page parsed-title e)))} - (doall - (for [block group] - [:> ReferenceBlock - {:key (str "ref-" (:block/uid block)) - :actions (when unlinked? - (r/as-element [:> Button {:marginTop "1.5em" - :size "xs" - :flex "0 0" - :float "right" - :variant "link" - :onClick (fn [] - (let [hm (into (hash-map) @unlinked-refs) - new-unlinked-refs (->> (update-in hm [group-title] #(filter (fn [{:keys [block/uid]}] - (= uid (:block/uid block))) - %)) - seq)] - ;; ctrl-z doesn't work though, because Unlinked Refs aren't reactive to datascript. - (reset! unlinked-refs new-unlinked-refs) - (dispatch [:unlinked-references/link block title])))} - "Link"]))} - [ref-comp block]]))]))])) - - + [:> PageReferences {:defaultIsOpen false + :count (count @unlinked-refs) + :showIfEmpty true + :refs @unlinked-refs + :title "Unlinked References" + :extras (r/as-element [:> Button {:variant "link" + :size "sm" + :flexShrink 0 + :onClick link-all-unlinked} + "Link all"]) + :onOpen #(let [un-refs (get-unlinked-references (escape-str title))] + (swap! state assoc unlinked? true) + (reset! unlinked-refs un-refs)) + :onClose #(swap! state assoc unlinked? false)} + (doall + (for [[[group-title] group] @unlinked-refs] + [:> ReferenceGroup + {:title group-title + :onClickTitle (fn [e] + (let [shift? (.-shiftKey e) + parsed-title (parse-renderer/parse-title group-title)] + (rf/dispatch [:reporting/navigation {:source :main-unlinked-refs ; NOTE: this isn't always `:main-unlinked-refs` it can also be `:right-pane-unlinked-refs` + :target :page + :pane (if shift? + :right-pane + :main-pane)}]) + (router/navigate-page parsed-title e)))} + (doall + (for [block group] + [:> ReferenceBlock + {:key (str "ref-" (:block/uid block)) + :actions (when unlinked? + (r/as-element [:> Button {:marginTop "1.5em" + :size "xs" + :flex "0 0" + :float "right" + :variant "link" + :onClick (fn [] + (let [hm (into (hash-map) @unlinked-refs) + new-unlinked-refs (->> (update-in hm [group-title] #(filter (fn [{:keys [block/uid]}] + (= uid (:block/uid block))) + %)) + seq)] + ;; ctrl-z doesn't work though, because Unlinked Refs aren't reactive to datascript. + (reset! unlinked-refs new-unlinked-refs) + (dispatch [:unlinked-references/link block title])))} + "Link"]))} + [ref-comp block]]))]))])) ;; TODO: where to put page-level link filters? diff --git a/src/cljs/athens/views/references.cljs b/src/cljs/athens/views/references.cljs index 0f902c7044..5a773a9f18 100644 --- a/src/cljs/athens/views/references.cljs +++ b/src/cljs/athens/views/references.cljs @@ -1,6 +1,6 @@ (ns athens.views.references (:require - ["@chakra-ui/react" :refer [Box Button Heading VStack]])) + ["@chakra-ui/react" :refer [Box Button Heading VStack]])) (defn reference-header @@ -38,7 +38,7 @@ (defn reference-block ([props children] (let [{:keys [actions]} props] - [:> Box + [:> Box children actions])))