Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: frontend refresh #2097

Merged
merged 83 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
0ff1313
feat: progress
shanberg Mar 23, 2022
aa7730a
feat: progress
shanberg Mar 23, 2022
dcb81a2
misc improvements
shanberg Mar 23, 2022
d18c249
feat: improved table
shanberg Mar 23, 2022
e9020c4
improvement: more work everywhere
shanberg Mar 25, 2022
80de5b0
Merge branch 'main' into chakra
shanberg Mar 25, 2022
bd50ec2
feat: improved windwo dragging
shanberg Mar 25, 2022
17c351b
improvement: better settings
shanberg Mar 25, 2022
63a4faf
fix: better borders within athena
shanberg Mar 25, 2022
bde2517
saving progress
shanberg Mar 26, 2022
a2cbce8
chore: lint
shanberg Mar 26, 2022
64632bc
improvements
shanberg Mar 27, 2022
8ca8f05
improvment: misc cleanpu
shanberg Mar 27, 2022
4805316
fix misplaced anchor menu
shanberg Mar 28, 2022
4b257b9
fix incorrect size for presence button
shanberg Mar 28, 2022
8482045
feat: responsive secondary toolbar menu
shanberg Mar 28, 2022
7367508
chore: clean up toggle
shanberg Mar 28, 2022
030694a
improvement: better toast colors
shanberg Mar 28, 2022
78f3624
improvement: misc styles and refactor
shanberg Mar 28, 2022
569e62e
rfct: use better slash menu
shanberg Mar 28, 2022
82da8bc
fix: misc block interaction issues
shanberg Mar 29, 2022
9ad61f7
rfct: completed slash menu
shanberg Mar 29, 2022
ce6aeef
rfct: block in new components for autocomplete searc
shanberg Mar 29, 2022
3c6d05d
imrpovement: saving progress on menus
shanberg Mar 29, 2022
f4a75f8
improvement: misc header polish
shanberg Mar 29, 2022
b8bc5b8
improvement: new toolbar icons
shanberg Mar 29, 2022
c600a51
chore: cleanup
shanberg Mar 29, 2022
ac3b11c
improvement: slicker buttons
shanberg Mar 29, 2022
fd5aeb5
chore: cleanup
shanberg Mar 29, 2022
d0fc6db
fix: misc fixes
shanberg Mar 30, 2022
241e052
rfct: replace most uses of stylefy
shanberg Mar 30, 2022
c5de678
chore: more cleanup
shanberg Mar 30, 2022
99b7fc8
chore: cleanup lint
shanberg Mar 30, 2022
008011b
chore: style cleanup
shanberg Mar 30, 2022
0421032
fix: some athena tests passing
shanberg Mar 31, 2022
d445d5b
test: more tests passing
shanberg Mar 31, 2022
9205337
chore: cleanup minor redundancies
shanberg Mar 31, 2022
cb636c2
test: another test passing
shanberg Mar 31, 2022
a9a9e5a
fix: add missing change
shanberg Mar 31, 2022
1bb6750
improvement: updated page content layout
shanberg Apr 1, 2022
d7780cb
chore: lint
shanberg Apr 1, 2022
ebbdf5d
chore: lint
shanberg Apr 1, 2022
a9cf9fb
Merge branch 'chakra' of https://github.com/shanberg/athens into chakra
shanberg Apr 1, 2022
d38f459
fix: titlebar border transitions nicely
shanberg Apr 1, 2022
1e9a440
rfct: use chakra for block content element
shanberg Apr 1, 2022
f0f3a52
rfct: retire most storybook components
shanberg Apr 1, 2022
486e44a
rfct: remove styled-components
shanberg Apr 1, 2022
0e42aa6
cleanup:remove unused dependencies
shanberg Apr 1, 2022
80cdcc1
chore: formatting cleanup
shanberg Apr 1, 2022
876de3d
fix: solve minor issues with toolbar and all-pages
shanberg Apr 1, 2022
f881023
fix: more tests passing
shanberg Apr 1, 2022
903f040
fix: can edit node page titles again
shanberg Apr 1, 2022
eb35b47
Merge branch 'main' into chakra
shanberg Apr 1, 2022
06b2fe7
fix: can edit title on block page
shanberg Apr 1, 2022
b0ed26c
fix: can close sidebar items again
shanberg Apr 1, 2022
5fcaf9a
fix: right sidebar items open by default
shanberg Apr 2, 2022
1b92c24
improvement: polish to right sidebar items
shanberg Apr 2, 2022
3cf971d
fix: use correct border color in help sections
shanberg Apr 2, 2022
68f5507
fix: fix cursor insertion on first interaction
shanberg Apr 2, 2022
b59e61d
test: update e2e page title selectors
filipesilva Apr 2, 2022
593ebb9
fix: use correct case for Icons.tsx
filipesilva Apr 2, 2022
f1084cc
fix: style
filipesilva Apr 2, 2022
b36184e
build: unbreak storybook
filipesilva Apr 2, 2022
d81213a
fix: add santized block uid to anhor
shanberg Apr 2, 2022
92bc797
fix: partially working inline search menu
shanberg Apr 2, 2022
8233f99
fix: working inline search menu
shanberg Apr 2, 2022
42e299d
chore: lint
shanberg Apr 2, 2022
73f0b6c
chore: cleanup unused
shanberg Apr 2, 2022
f46decc
fix: don't downlevel generators in libraries
filipesilva Apr 2, 2022
dd46a7b
improvement: better pages icon
shanberg Apr 2, 2022
b0911f8
Merge branch 'chakra' of https://github.com/shanberg/athens into chakra
shanberg Apr 2, 2022
79e1bad
improvement: minor fixes to all-pages list
shanberg Apr 2, 2022
1acadee
improvement: no transitions for athena
shanberg Apr 2, 2022
5fbde80
fix: sidebar items open by default
shanberg Apr 2, 2022
8965af8
improvement: show current appearance in pres menu
shanberg Apr 2, 2022
311a9f0
fix: brighter athena in light mode
shanberg Apr 2, 2022
c7d8501
fix: no isEditing error
shanberg Apr 2, 2022
48e0b2b
fix: left sidebar should be reactive
filipesilva Apr 2, 2022
010f9ce
fix: style
filipesilva Apr 2, 2022
9378f72
fix: use SSR friendly selector to remove console error
filipesilva Apr 2, 2022
8012176
build: use same babel preset on main as on app
filipesilva Apr 2, 2022
033b73b
build: remove unused lint rules
filipesilva Apr 2, 2022
5a8e297
fix: remove unused binding
filipesilva Apr 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ module.exports = {
})
);

// Support mjs modules included with Chakra-UI
// https://github.com/storybookjs/storybook/issues/16690#issuecomment-971579785
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
})
// Return the altered config.
return config;
}
}
}
23 changes: 7 additions & 16 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React from 'react';

import { themes } from '@storybook/theming';
import {
OverlayProvider
} from '@react-aria/overlays';
import { NotificationContainer } from '@/Notifications/Notifications';
import { ChakraProvider } from '@chakra-ui/react';

import { classnames } from '../src/js/components/utils/classnames';
import { GlobalStyles } from '../src/js/components/utils/style/style';

import { theme } from '../src/js/theme/theme';
import { badges, Storybook } from '../src/js/components/utils/storybook';

export const parameters = {
Expand Down Expand Up @@ -65,19 +62,13 @@ export const decorators = [
console.log(context);
return (
<>
<GlobalStyles />
<OverlayProvider>
<ChakraProvider>
<Storybook.App
id="app"
className={classnames(
context.globals.hostType === 'electron' ? 'is-electron' : 'is-browser',
context.viewMode === 'docs' ? 'is-storybook-docs' : 'is-storybook-canvas'
)}>
id="app" >
<Story />
<NotificationContainer />
</Storybook.App>
</OverlayProvider>
</ChakraProvider>
</>
)
},
];
];
20 changes: 6 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,15 @@
},
"dependencies": {
"@babel/runtime": "^7.15.4",
"@chakra-ui/react": "^1.8.6",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@geometricpanda/storybook-addon-badges": "^0.0.4",
"@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",
"@react-aria/checkbox": "^3.2.3",
"@react-aria/dialog": "^3.1.4",
"@react-aria/focus": "^3.5.0",
"@react-aria/meter": "^3.1.3",
"@react-aria/overlays": "^3.7.2",
"@react-aria/switch": "^3.1.3",
"@react-aria/tooltip": "^3.1.3",
"@react-aria/visually-hidden": "^3.2.3",
"@react-stately/overlays": "^3.1.3",
"@react-stately/toggle": "^3.2.3",
"@sentry/integrations": "^6.17.3",
"@sentry/react": "^6.17.3",
"@sentry/tracing": "^6.17.3",
Expand All @@ -125,9 +118,8 @@
"electron-updater": "^4.3.4",
"electron-window-state": "^5.0.3",
"emoji-picker-element": "^1.8.2",
"framer-motion": "^6",
"highlight.js": "^11.1.0",
"iconoir": "^1.0.0",
"iconoir-react": "^2.1.0",
"katex": "^0.12.0",
"luxon": "^2.0.2",
"nedb": "^1.8.0",
Expand All @@ -137,11 +129,11 @@
"react-colorful": "^5.4.0",
"react-day-picker": "^7.4.10",
"react-dom": "17.0.1",
"react-error-boundary": "^3.1.4",
"react-focus-lock": "^2.8.1",
"react-force-graph-2d": "^1.19.0",
"react-highlight.js": "1.0.7",
"react-hot-toast": "^2.1.1",
"react-intersection-observer": "^8.32.1",
"styled-components": "^5.3.0",
"tslib": "^2.3.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions playwright.electron.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: PlaywrightTestConfig = {
...baseConfig,
workers: 1,
use: {},
projects: [{
projects: [ {
name: 'chromium',
use: {
browserName: 'chromium',
Expand All @@ -32,7 +32,7 @@ const config: PlaywrightTestConfig = {
mode: 'default',
video: false,
}
}],
} ],
};

export default config;
2 changes: 0 additions & 2 deletions resources/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=IBM+Plex+Sans+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=IBM+Plex+Serif:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<link href="./css/normalize.css" rel="stylesheet" />
<link href="./css/katex.min.css" rel="stylesheet" />
<link rel="stylesheet" href="./css/codemirror.css" type="text/css" />
<style id="_stylefy-constant-styles_"></style>
Expand All @@ -17,7 +16,6 @@
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('qouvHPR2-blOal8-l6CSmFybj8VWojBlv472Ac-ovAI',{api_host:'https://app.posthog.com', persistence:'localStorage'})
</script>
<script type="text/javascript" src="js/lib/codemirror.js"></script>
</head>
<body>
<div id="app">
Expand Down
6 changes: 6 additions & 0 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
:output-dir "resources/public/js/compiled"
:asset-path "js/compiled"
:modules {:app {:init-fn athens.core/init}}
;; Don't try to polyfill for generators, we don't try to support older browsers
;; and it breaks some libraries we use (ForceGraph2D) when other imports change.
;; https://github.com/thheller/shadow-cljs/issues/854
:js-options {:babel-preset-config {:targets {:chrome 80}}}
:compiler-options {:closure-warnings {:global-this :off}
:infer-externs :auto
:closure-defines {re-frame.trace.trace-enabled? true}
Expand All @@ -27,6 +31,7 @@
:output-dir "resources/public/js/compiled"
:asset-path "js/compiled"
:modules {:renderer {:init-fn athens.core/init}}
:js-options {:babel-preset-config {:targets {:chrome 80}}}
:compiler-options {:closure-warnings {:global-this :off}
:infer-externs :auto
:closure-defines {re-frame.trace.trace-enabled? true}
Expand All @@ -45,6 +50,7 @@
:main {:target :node-script
:output-to "resources/main.js"
:main athens.main.core/main
:js-options {:babel-preset-config {:targets {:chrome 80}}}
:compiler-options {:output-feature-set :es-next
:reader-features #{:electron}}}

Expand Down
54 changes: 26 additions & 28 deletions src/cljs/athens/components.cljs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
(ns athens.components
(:require
["@chakra-ui/react" :refer [Checkbox Box Button]]
["@material-ui/icons/Edit" :default Edit]
[athens.db :as db]
[athens.parse-renderer :refer [component]]
[athens.reactive :as reactive]
[athens.style :refer [color]]
[athens.util :refer [recursively-modify-block-for-embed]]
[athens.views.blocks.core :as blocks]
[clojure.string :as str]
[re-frame.core :as rf :refer [dispatch subscribe]]
[reagent.core :as r]
[stylefy.core :as stylefy :refer [use-style]]))
[reagent.core :as r]))


(defn todo-on-click
Expand All @@ -30,25 +29,27 @@
TODO() - might be a good idea to keep an edit icon at top right
for every component."
[children]
[:span {:on-click (fn [e]
(.. e stopPropagation))}
[:span {:style {:display "contents"}
:on-click (fn [e] (.. e stopPropagation))}
children])


(defmethod component :todo
[_content uid]
[span-click-stop
[:input {:type "checkbox"
:checked false
:on-change #(todo-on-click uid #"\{\{\[\[TODO\]\]\}\}" "{{[[DONE]]}}")}]])
[:> Checkbox {:isChecked false
:verticalAlign "middle"
:transform "translateY(-2px)"
:onChange #(todo-on-click uid #"\{\{\[\[TODO\]\]\}\}" "{{[[DONE]]}}")}]])


(defmethod component :done
[_content uid]
[span-click-stop
[:input {:type "checkbox"
:checked true
:on-change #(todo-on-click uid #"\{\{\[\[DONE\]\]\}\}" "{{[[TODO]]}}")}]])
[:> Checkbox {:isChecked true
:verticalAlign "middle"
:transform "translateY(-2px)"
:onChange #(todo-on-click uid #"\{\{\[\[DONE\]\]\}\}" "{{[[TODO]]}}")}]])


(defmethod component :youtube
Expand All @@ -69,25 +70,11 @@
(defmethod component :self
[content _uid]
[span-click-stop
[:button {:style {:color "red"
:font-family "IBM Plex Mono"}}
[:> Button {:variant "link"
:color "red"}
content]])


(def block-embed-adjustments
{:background (color :background-minus-2 :opacity-med)
:position "relative"
::stylefy/manual [[:>.block-container {:margin-left "0"
:padding-right "1.3rem"
::stylefy/manual [[:textarea {:background "transparent"}]]}]
[:>svg {:position "absolute"
:right "5px"
:top "5px"
:font-size "1rem"
:z-index "5"
:cursor "pointer"}]]})


(defmethod component :block-embed
[content uid]
;; bindings are eval only once in with-let
Expand All @@ -97,7 +84,18 @@
;; todo -- not reactive. some cases where delete then ctrl-z doesn't work
(if (db/e-by-av :block/uid block-uid)
(r/with-let [embed-id (random-uuid)]
[:div.block-embed (use-style block-embed-adjustments)
[:> Box {:class "block-embed"
:bg "background.basement"
:position "relative"
:sx {"> .block-container" {:ml 0
:pr "1.3rem"
"textarea" {:background "transparent"}}
"> svg" {:position "absolute"
:right "5px"
:top "5px"
:fontSize "1rem"
:zIndex "5"
:cursor "pointer"}}}
(let [block (reactive/get-reactive-block-document [:block/uid block-uid])]
[:<>
[blocks/block-el
Expand Down
9 changes: 1 addition & 8 deletions src/cljs/athens/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
[goog.dom.selection :refer [setCursorPosition]]
[malli.core :as m]
[malli.error :as me]
[re-frame.core :as rf]
[stylefy.core :as stylefy]))
[re-frame.core :as rf]))


;; Effects
Expand Down Expand Up @@ -133,12 +132,6 @@
100)))


(rf/reg-fx
:stylefy/tag
(fn [[tag properties]]
(stylefy/tag tag properties)))


(rf/reg-fx
:alert/js!
(fn [message]
Expand Down
Loading