|
1 | 1 | (ns codes.clj.docs.frontend.components.query
|
2 |
| - (:require ["@mantine/core" :refer [Alert Anchor Avatar Grid Group Indicator |
3 |
| - LoadingOverlay SimpleGrid Text Title |
4 |
| - Tooltip]] |
| 2 | + (:require ["@mantine/core" :refer [Alert Anchor Avatar Box Grid Group |
| 3 | + Indicator LoadingOverlay SimpleGrid Text |
| 4 | + Title Tooltip]] |
5 | 5 | ["@tabler/icons-react" :refer [IconInfoCircle]]
|
| 6 | + [clojure.string :as str] |
6 | 7 | [codes.clj.docs.frontend.infra.helix :refer [defnc]]
|
7 |
| - [helix.core :refer [$]] |
8 |
| - [helix.dom :as dom])) |
| 8 | + [codes.clj.docs.frontend.adapters.time :as adapters.time] |
| 9 | + [helix.core :refer [$]])) |
9 | 10 |
|
10 | 11 | (defnc latest-interactions [{:keys [value loading? error]}]
|
11 | 12 | ($ SimpleGrid {:cols 1}
|
|
15 | 16 | ($ Alert {:variant "light" :color "red" :radius "md" :title "Error" :icon ($ IconInfoCircle)}
|
16 | 17 | (str error))
|
17 | 18 |
|
18 |
| - ($ Group {:pos "relative" :grow true} |
19 |
| - ($ LoadingOverlay {:visible loading? :zIndex 1000 :overlayProps #js {:radius "sm" :blur 2}}) |
| 19 | + ($ Box {:pos "relative"} |
| 20 | + ($ LoadingOverlay {:visible loading? :zIndex 1000 |
| 21 | + :loaderProps #js {:type "dots"} |
| 22 | + :overlayProps #js {:radius "sm" :blur 2}}) |
20 | 23 | ($ SimpleGrid {:cols 2}
|
21 | 24 | (map
|
22 |
| - (fn [{:keys [author]}] |
23 |
| - (let [{:keys [author-id login account-source avatar-url]} author] |
24 |
| - ($ Group {:key (str "latest" author-id) :grow true} |
| 25 | + (fn [{:keys [note-id example-id see-also-id definition-id author created-at]}] |
| 26 | + (let [id (str "latest" (or note-id example-id see-also-id)) |
| 27 | + action (cond |
| 28 | + note-id " authored a note for " |
| 29 | + example-id " authored an example for " |
| 30 | + see-also-id " added a see also on ") |
| 31 | + definition (str/replace definition-id #"/0$" "") |
| 32 | + ago (adapters.time/time-since created-at (.now js/Date)) |
| 33 | + {:keys [login account-source avatar-url]} author] |
| 34 | + ($ Group {:key id :wrap "nowrap"} |
25 | 35 | ($ Anchor {:href (str "/author/" login "/" account-source)}
|
26 |
| - ($ Avatar {:size "md" :src avatar-url})) |
27 |
| - |
28 |
| - (dom/div |
29 |
| - ($ Text "banana"))))) |
30 |
| - |
| 36 | + ($ Avatar {:src avatar-url})) |
| 37 | + ($ Text {:size "sm"} login |
| 38 | + ($ Text {:component "span"} |
| 39 | + action " " |
| 40 | + ($ Anchor {:href definition-id} definition) |
| 41 | + " " ago "."))))) |
31 | 42 | value))))))
|
32 | 43 |
|
33 |
| - ; <UnstyledButton className={classes.user}> |
34 |
| - ; <Group> |
35 |
| - ; <Avatar |
36 |
| - ; src="https://raw.githubusercontent.com/mantinedev/mantine/master/.demo/avatars/avatar-8.png" |
37 |
| - ; radius="xl" |
38 |
| - ; /> |
39 |
| - ; |
40 |
| - ; <div style={{ flex: 1 }}> |
41 |
| - ; <Text size="sm" fw={500}> |
42 |
| - ; Harriette Spoonlicker |
43 |
| - ; </Text> |
44 |
| - ; |
45 |
| - ; <Text c="dimmed" size="xs"> |
46 |
| - |
47 |
| - ; </Text> |
48 |
| - ; </div> |
49 |
| - ; |
50 |
| - ; <IconChevronRight style={{ width: rem(14), height: rem(14) }} stroke={1.5} /> |
51 |
| - ; </Group> |
52 |
| - ; </UnstyledButton> |
53 |
| - |
54 | 44 | (defnc top-author [{:keys [value loading? error]}]
|
55 | 45 | ($ SimpleGrid {:cols 1}
|
56 | 46 | ($ Title {:order 1} "Top Authors")
|
|
60 | 50 | (str error))
|
61 | 51 |
|
62 | 52 | ($ Group {:pos "relative"}
|
63 |
| - ($ LoadingOverlay {:visible loading? :zIndex 1000 :overlayProps #js {:radius "sm" :blur 2}}) |
| 53 | + ($ LoadingOverlay {:visible loading? :zIndex 1000 |
| 54 | + :loaderProps #js {:type "dots"} |
| 55 | + :overlayProps #js {:radius "sm" :blur 2}}) |
64 | 56 | ($ Grid {:grow false :gutter "lg"}
|
65 | 57 | (map
|
66 | 58 | (fn [{:keys [author-id login account-source interactions avatar-url]}]
|
|
0 commit comments