├── src ├── cursors │ ├── edit.png │ └── trash.png └── index.ts ├── .gitignore ├── tsconfig.json ├── README.md ├── .github └── workflows │ └── main.yaml ├── package.json └── LICENSE /src/cursors/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvargas92495/roamjs-discourse-graph/HEAD/src/cursors/edit.png -------------------------------------------------------------------------------- /src/cursors/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvargas92495/roamjs-discourse-graph/HEAD/src/cursors/trash.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | dist 4 | out 5 | .env.local 6 | data.js 7 | extension.js 8 | types.js 9 | *.png 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/roamjs-scripts/dist/default.tsconfig", 3 | "include": [ 4 | "src" 5 | ], 6 | "exclude": [ 7 | "node_modules" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecated 2 | 3 | Merged into [Query Builder](https://github.com/roamjs/query-builder) 4 | 5 | # discourse-graph 6 | 7 | A suite of tools for maintaining a discourse graph from Roam! 8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/main.yaml: -------------------------------------------------------------------------------- 1 | name: Publish Extension 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - experimental 7 | paths: 8 | - "src/**" 9 | - "package.json" 10 | - ".github/workflows/main.yaml" 11 | 12 | env: 13 | ROAMJS_DEVELOPER_TOKEN: ${{ secrets.ROAMJS_DEVELOPER_TOKEN }} 14 | ROAMJS_EMAIL: support@roamjs.com 15 | ROAMJS_EXTENSION_ID: discourse-graph 16 | ROAMJS_RELEASE_TOKEN: ${{ secrets.ROAMJS_RELEASE_TOKEN }} 17 | 18 | jobs: 19 | deploy: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: actions/checkout@v2 23 | - name: install 24 | run: npm install 25 | - name: build 26 | run: npx roamjs-scripts build 27 | - name: publish 28 | run: npx roamjs-scripts publish 29 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "discourse-graph", 3 | "version": "1.0.0", 4 | "description": "A suite of tools for maintaining a discourse graph from Roam!", 5 | "main": "./build/main.js", 6 | "scripts": { 7 | "start": "roamjs-scripts dev --depot" 8 | }, 9 | "license": "MIT", 10 | "devDependencies": { 11 | "@types/cytoscape": "^3.19.4", 12 | "@types/react-window": "^1.8.5", 13 | "@types/react-window-infinite-loader": "^1.0.6", 14 | "roamjs-scripts": "^0.21.9" 15 | }, 16 | "dependencies": { 17 | "@samepage/external": "^0.23.1", 18 | "cytoscape": "^3.21.0", 19 | "cytoscape-navigator": "^2.0.1", 20 | "mathjs": "^10.4.2", 21 | "msgpackr": "^1.6.1", 22 | "react-in-viewport": "^1.0.0-alpha.20", 23 | "react-window": "^1.8.7", 24 | "react-window-infinite-loader": "^1.0.8", 25 | "roamjs-components": "^0.74.17" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 David Vargas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import runExtension from "roamjs-components/util/runExtension"; 2 | import addScriptAsDependency from "roamjs-components/dom/addScriptAsDependency"; 3 | import apiPost from "roamjs-components/util/apiPost"; 4 | import getBasicTreeByParentUid from "roamjs-components/queries/getBasicTreeByParentUid"; 5 | import getSubTree from "roamjs-components/util/getSubTree"; 6 | import getPageUidByPageTitle from "roamjs-components/queries/getPageUidByPageTitle"; 7 | import createBlock from "roamjs-components/writes/createBlock"; 8 | import { render as renderToast } from "roamjs-components/components/Toast"; 9 | import { render as renderSimpleAlert } from "roamjs-components/components/SimpleAlert"; 10 | 11 | export default runExtension({ 12 | extensionId: "discourse-graph", 13 | run: async () => { 14 | apiPost({ 15 | path: "graphs", 16 | data: { 17 | extension: "discourse-graph", 18 | graph: window.roamAlphaAPI.graph.name, 19 | }, 20 | }); 21 | 22 | const pageUid = getPageUidByPageTitle("roam/js/discourse-graph"); 23 | const configTree = getBasicTreeByParentUid(pageUid); 24 | const surveyed = getSubTree({ tree: configTree, key: "surveyed" }); 25 | if (!surveyed.uid) { 26 | let dismissed = true; 27 | const closeSurvey = renderToast({ 28 | position: "bottom-right", 29 | content: `👋 Greetings! 👋 30 | 31 | The discourse graph team is trying to understand how people are using the discourse graph extension, or not (as part of the larger research project it is a part of; context [here](https://twitter.com/JoelChan86/status/1570853004458491904?s=20&t=iAC5Tx3PYrMBhqCp9UAYOw)). 32 | 33 | Survey link is here: https://go.umd.edu/discourse-graph-survey 34 | 35 | If you’ve explored/used the discourse graph extension in any capacity, we would be so grateful if you could take a few minutes to contribute to the survey! 36 | 37 | Click on the ⏰ to dismiss and see this message later when you reload Roam. 38 | 39 | Click on the ✖️ to dismiss for good (you won't see this message again).`, 40 | id: "discourse-survey", 41 | timeout: 0, 42 | onDismiss: () => 43 | dismissed && 44 | createBlock({ parentUid: pageUid, node: { text: "surveyed" } }), 45 | action: { 46 | text: "⏰", 47 | onClick: () => { 48 | dismissed = false; 49 | closeSurvey(); 50 | }, 51 | }, 52 | }); 53 | } 54 | 55 | if (window.roamjs.loaded.has("query-builder")) { 56 | renderSimpleAlert({ 57 | content: 58 | "Warning! You must disable the Query Builder extension from Roam Depot in order to use the RoamJS Discourse Graph extension, as it comes with its own copy of Query Builder.\n\nDiscourse Graph will soon be a part of Query Builder once approved by Roam Depot.", 59 | }); 60 | } else if (process.env.NODE_ENV === "production") { 61 | addScriptAsDependency({ 62 | id: "roamjs-query-builder-main", 63 | src: `https://roamjs.com/query-builder/main.js`, 64 | dataAttributes: { source: "discourse-graph" }, 65 | }); 66 | } 67 | }, 68 | }); 69 | --------------------------------------------------------------------------------