Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit a0e026c
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 11:09:16 2024 -0700

    updated Root

commit 1d41478
Merge: fbfc805 3a37c2a
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 11:03:51 2024 -0700

    Merge branch 'main' into dashboard-react

commit fbfc805
Merge: c5bcfc1 134491e
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 11:02:39 2024 -0700

    Merge branch 'main' into dashboard-react

commit c5bcfc1
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 11:00:12 2024 -0700

    cleaning up after fixing banner

commit 288f4b8
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 10:43:29 2024 -0700

    Fix banners

commit 5c1820e
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 09:21:23 2024 -0700

    Some minor flow fixes

commit b9530c7
Author: David Wertheimer <[email protected]>
Date:   Wed May 15 09:01:02 2024 -0700

    Fix JSON errors

commit da7abfe
Author: David Wertheimer <[email protected]>
Date:   Tue May 14 22:16:19 2024 -0700

    2.0.0.a19

commit cedf631
Author: David Wertheimer <[email protected]>
Date:   Tue May 14 16:50:30 2024 -0700

    fix tooltips on buttons

commit 2c97acc
Merge: a10bd13 2a03d80
Author: David Wertheimer <[email protected]>
Date:   Tue May 14 16:47:16 2024 -0700

    Merge branch 'dashboard-react' of https://github.com/NotePlan/plugins into dashboard-react

commit a10bd13
Author: David Wertheimer <[email protected]>
Date:   Tue May 14 16:43:13 2024 -0700

    fix tooltips

commit 43757b7
Author: David Wertheimer <[email protected]>
Date:   Tue May 14 16:43:04 2024 -0700

    add feature flag handling and some tooltip componentry

commit 2a03d80
Author: Jonathan Clark <[email protected]>
Date:   Tue May 14 23:59:26 2024 +0100

    2.0.0.a18

commit a5b997b
Author: David Wertheimer <[email protected]>
Date:   Tue May 14 10:24:45 2024 -0700

    Make sure that all switches work/refresh not just sections

commit d9319bb
Author: jgclark <[email protected]>
Date:   Mon May 13 06:02:02 2024 +0100

    2.0.0.a17

commit 594facd
Author: jgclark <[email protected]>
Date:   Mon May 13 05:44:48 2024 +0100

    turn down logging

commit 5710b4b
Author: David Wertheimer <[email protected]>
Date:   Sun May 12 00:03:50 2024 -0700

    reduce logs

commit ca68479
Author: David Wertheimer <[email protected]>
Date:   Sun May 12 00:02:28 2024 -0700

    remove some logging

commit 8978cee
Author: David Wertheimer <[email protected]>
Date:   Sat May 11 23:19:07 2024 -0700

    2.0.0.a16

commit 3b35795
Merge: 461ea1f 368988e
Author: David Wertheimer <[email protected]>
Date:   Sat May 11 04:47:50 2024 -0700

    Merge branch 'dashboard-react' of https://github.com/NotePlan/plugins into dashboard-react

commit 461ea1f
Author: David Wertheimer <[email protected]>
Date:   Sat May 11 04:40:16 2024 -0700

    WIP on showing status of refreshSomeSections

commit 368988e
Author: jgclark <[email protected]>
Date:   Sat May 11 07:17:00 2024 +0100

    Further a15 work

commit 0aed459
Author: jgclark <[email protected]>
Date:   Sat May 11 00:29:35 2024 +0100

    2.0.0.a15

commit c5f70e5
Author: David Wertheimer <[email protected]>
Date:   Thu May 9 22:05:23 2024 -0700

    Fix flash in Dialog appear useAnimationEffect

commit 9ef5351
Author: David Wertheimer <[email protected]>
Date:   Thu May 9 15:41:51 2024 -0700

    2.0.0.a14

commit 8c666f8
Author: David Wertheimer <[email protected]>
Date:   Wed May 8 20:35:20 2024 -0700

    Adding feature flags to turn off WIP for future releases

commit 9ff5688
Author: David Wertheimer <[email protected]>
Date:   Wed May 8 20:27:19 2024 -0700

    2.0.0.a13

commit 6ee3bba
Merge: 66fb294 9528c96
Author: David Wertheimer <[email protected]>
Date:   Wed May 8 11:24:49 2024 -0700

    Merge branch 'dashboard-react' into dashboard-react-2.1

commit 9528c96
Merge: 8c6673c bcac6b0
Author: David Wertheimer <[email protected]>
Date:   Wed May 8 11:02:00 2024 -0700

    Merge branch 'main' into dashboard-react

commit 66fb294
Merge: ea3b134 bcac6b0
Author: David Wertheimer <[email protected]>
Date:   Wed May 8 11:01:42 2024 -0700

    Merge branch 'main' into dashboard-react-2.1

commit ea3b134
Author: David Wertheimer <[email protected]>
Date:   Wed May 8 11:00:07 2024 -0700

    wip the data objects don't seem to match

commit 9d9f838
Merge: 39134ce 8c6673c
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 23:20:47 2024 -0700

    Merge branch 'dashboard-react' into dashboard-react-2.1

commit 8c6673c
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 23:17:36 2024 -0700

    conditional refresh on load is back in refreshSomeSections()

commit e394949
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 23:12:54 2024 -0700

    allow for single section refresh on switch-on

commit 39134ce
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 19:58:43 2024 -0700

    animation

commit a2649e8
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 13:59:57 2024 -0700

    Overdue loop is basically working. Need to clean up logs.

commit 1ff18d5
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 09:47:45 2024 -0700

    moved files from shared

commit ff6f83f
Author: David Wertheimer <[email protected]>
Date:   Tue May 7 08:16:16 2024 -0700

    Renamed getSharedSettings to getCombinedSettings

commit fcda2a6
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 23:55:42 2024 -0700

    2.0.0.a11 see changelog

commit ca39771
Merge: b23c823 10f1f28
Author: jgclark <[email protected]>
Date:   Mon May 6 23:33:48 2024 +0100

    Merge branch 'dashboard-react' of https://github.com/NotePlan/plugins into dashboard-react

commit b23c823
Author: jgclark <[email protected]>
Date:   Mon May 6 23:33:08 2024 +0100

    2.0.0.a10

commit 10f1f28
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 14:42:23 2024 -0700

    Start testing against v.20+22

commit d9262c3
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 14:27:29 2024 -0700

    Fix rollup test after plugin addition

commit 07eab03
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 14:27:08 2024 -0700

    upgrade CI to Node v.20

commit ec32739
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 13:21:47 2024 -0700

    no double checking on react properties

commit 27d609a
Merge: 86ec050 05bd22d
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 13:19:16 2024 -0700

    Merge branch 'main' into dashboard-react

commit 86ec050
Author: David Wertheimer <[email protected]>
Date:   Mon May 6 00:14:31 2024 -0700

    Fix a bug in the sectionSearch algo

commit db1b716
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 23:59:19 2024 -0700

    Added note about installing new deps

commit 24e124f
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 23:57:25 2024 -0700

    reduced logging

commit 8326a41
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 23:57:08 2024 -0700

    2.0.0-a9 see changelog

commit 4db2f10
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 15:02:08 2024 -0700

    Revert wrong change (lastUpdated)

commit e26817a
Merge: 8182b95 34e5082
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 14:28:18 2024 -0700

    Merge branch 'dashboard-react' of https://github.com/NotePlan/plugins into dashboard-react

commit 34e5082
Author: Jonathan Clark <[email protected]>
Date:   Sun May 5 22:01:26 2024 +0100

    2.0.0-a8 for @dw

commit 8182b95
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 12:35:58 2024 -0700

    Basic calendar picker functionality

commit 679f59c
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 12:22:47 2024 -0700

    add react-day-picker and css rollups

commit 64d4dfa
Author: David Wertheimer <[email protected]>
Date:   Sun May 5 12:22:26 2024 -0700

    allow CSS files to be imported directly into react components

commit 86397a9
Merge: f5690dd e4efe4b
Author: David Wertheimer <[email protected]>
Date:   Sat May 4 14:58:18 2024 -0700

    Merge branch 'main' into dashboard-react

commit f5690dd
Author: David Wertheimer <[email protected]>
Date:   Sat May 4 10:24:07 2024 -0700

    A little extra code to make sure we don't save reactSettings when we shouldn't

commit 039da49
Author: David Wertheimer <[email protected]>
Date:   Sat May 4 10:08:43 2024 -0700

    Bring sticky header back

commit 3ac1310
Author: David Wertheimer <[email protected]>
Date:   Sat May 4 10:04:14 2024 -0700

    Hide duplicates is working

commit 051dc52
Author: David Wertheimer <[email protected]>
Date:   Sat May 4 08:14:27 2024 -0700

    color the switch to match the theme

commit bb4b648
Author: David Wertheimer <[email protected]>
Date:   Fri May 3 22:17:39 2024 -0700

    Basic reactSettings loading/saving in Datastore.settings (React side done)

commit b0857fb
Author: David Wertheimer <[email protected]>
Date:   Fri May 3 18:48:40 2024 -0700

    css tweak

commit 39f493f
Author: David Wertheimer <[email protected]>
Date:   Fri May 3 18:41:04 2024 -0700

    fix header and add expandable dropdown for settings

commit 4b7b56f
Author: Jonathan Clark <[email protected]>
Date:   Fri May 3 13:07:15 2024 +0100

    a7a to discuss with DW

commit 8d3935d
Author: David Wertheimer <[email protected]>
Date:   Wed May 1 23:16:33 2024 -0700

    wip started to move handlers to new clickHandlers file

commit a20d1df
Author: Jonathan Clark <[email protected]>
Date:   Wed May 1 17:00:55 2024 +0100

    Rename ItemIcon

commit 3b1e2e9
Author: David Wertheimer <[email protected]>
Date:   Tue Apr 30 22:41:21 2024 -0700

    get icon click working again and clean up some logs

commit e823a4a
Author: Jonathan Clark <[email protected]>
Date:   Wed May 1 00:17:09 2024 +0100

    a6 WIP

commit fee8242
Author: David Wertheimer <[email protected]>
Date:   Tue Apr 30 10:28:56 2024 -0700

    Merged SirTristram code

commit 504788c
Merge: 0e24e33 2b84584
Author: David Wertheimer <[email protected]>
Date:   Tue Apr 30 10:27:56 2024 -0700

    Merge branch 'main' into dashboard-react

commit 0e24e33
Author: David Wertheimer <[email protected]>
Date:   Tue Apr 30 10:09:00 2024 -0700

    auto refresh timer, dialog positioning etc.

commit c5dc0e6
Author: David Wertheimer <[email protected]>
Date:   Mon Apr 29 19:54:19 2024 -0700

    bring header z-index up to float above all elements

commit 32d9b7a
Author: David Wertheimer <[email protected]>
Date:   Mon Apr 29 10:57:46 2024 -0700

    Beginnings of fade out

commit d924c62
Author: David Wertheimer <[email protected]>
Date:   Mon Apr 29 10:33:47 2024 -0700

    Clicked item now disappears immediately, then refreshes in background

commit f0fac9b
Author: David Wertheimer <[email protected]>
Date:   Mon Apr 29 10:16:37 2024 -0700

    status icon click working. code needs cleaning

commit ea41028
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 22:03:51 2024 -0700

    tweak css

commit 5438b55
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 22:01:50 2024 -0700

    Refresh button spacing

commit f666fc1
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 21:44:25 2024 -0700

    Adding "refreshing" message during 5s timer

commit 1150b92
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 19:05:38 2024 -0700

    adding changelog notes to jgclark

commit ba8d6f4
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 19:03:07 2024 -0700

    Refresh button works, sized and styled

commit 5f434c3
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 18:38:48 2024 -0700

    refresh button working

commit 88a80ea
Author: David Wertheimer <[email protected]>
Date:   Sun Apr 28 18:03:45 2024 -0700

    working single content update

commit e92a7a8
Merge: 0d015b3 ef0d967
Author: Jonathan Clark <[email protected]>
Date:   Sat Apr 27 23:26:25 2024 +0100

    Merge branch 'dashboard-react' of https://github.com/NotePlan/plugins into dashboard-react

commit ef0d967
Author: David Wertheimer <[email protected]>
Date:   Sat Apr 27 13:44:35 2024 -0700

    moved reactDev to new @helpers/react

commit 98d7c62
Merge: 69ed507 70ea210
Author: David Wertheimer <[email protected]>
Date:   Sat Apr 27 10:47:51 2024 -0700

    Merge branch 'main' into dashboard-react

commit 69ed507
Author: David Wertheimer <[email protected]>
Date:   Sat Apr 27 02:49:58 2024 -0400

    Dialog mostly working
  • Loading branch information
dwertheimer committed May 15, 2024
1 parent 3a37c2a commit 87ccfd5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 39 deletions.
2 changes: 1 addition & 1 deletion np.Shared/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"noteplan.minAppVersion": "3.8.0",
"plugin.id": "np.Shared",
"plugin.name": "🤝 Shared Resources",
"plugin.version": "0.5.10",
"plugin.version": "0.5.11",
"plugin.description": "Shared resources for NotePlan plugins. (There are no commands for users to run directly.)",
"plugin.author": "jgclark + dwertheimer",
"plugin.dependencies": [],
Expand Down
96 changes: 59 additions & 37 deletions np.Shared/requiredFiles/react.c.Root.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,35 +342,6 @@ var RootBundle = (function (exports, React$1) {
return log(pluginInfo, message, 'DEBUG');
}

/**
* Error objects in React are not JSON stringifiable. This function makes them JSON stringifiable.
* It also removes the redundant file path from the stack trace.
* @param {Error} error
* @param {string} cs - (optional) component stack
* @returns {any} - a simple JS Object with the errror details: name, message, inComponent, line, column, componentStack
*/
const formatReactError = (error, cs = '') => {
return {
name: error.name,
message: error.message,
inComponent: cs.split('@file', 1)[0]?.replace('\n', ''),
line: error.line || '',
column: error.column,
componentStack: cs.split('\n').map(s => s.replace(/\@file.*$/, '')).filter(s => s.trim() !== 'div' && s.trim() !== '' && s.trim() !== 'Root' && s.trim() !== 'ErrorBoundary').join(' < ')
};
};

const ErrorFallback = props => {
clo(props);
const {
error
} = props;
const formatted = formatReactError(error);
return /*#__PURE__*/React.createElement("div", {
role: "alert"
}, /*#__PURE__*/React.createElement("h1", null, "Something went wrong in React:"), /*#__PURE__*/React.createElement("pre", null, formatted.name, ": ", formatted.message), /*#__PURE__*/React.createElement("p", null), /*#__PURE__*/React.createElement("p", null, "See more detail in the console"));
};

// Functions which can be imported into any React Component

/****************************************************************************************************************************
Expand Down Expand Up @@ -442,7 +413,36 @@ var RootBundle = (function (exports, React$1) {
* @returns {void}
*/
const logDebug = (componentName, detail, ...args) => console.log(`${window.webkit ? `${componentName}${detail ? `: ${detail} ` : ''}` : `%c${componentName}${detail ? `: ${detail} ` : ''}`}`, `${window.webkit ? '' : `color: #000; background: ${stringToColor(componentName)}`}`, ...args);
// Deep copy so we don't mutate the original pluginData

/**
* Error objects in React are not JSON stringifiable. This function makes them JSON stringifiable.
* It also removes the redundant file path from the stack trace.
* @param {Error} error
* @param {string} cs - (optional) component stack
* @returns {any} - a simple JS Object with the errror details: name, message, inComponent, line, column, componentStack
*/

const formatReactError = (error, cs = '') => {
return {
name: error.name,
message: error.message,
inComponent: cs.split('@file', 1)[0]?.replace('\n', ''),
line: error.line || '',
column: error.column,
componentStack: cs.split('\n').map(s => s.replace(/\@file.*$/, '')).filter(s => s.trim() !== 'div' && s.trim() !== '' && s.trim() !== 'Root' && s.trim() !== 'ErrorBoundary').join(' < ')
};
};

const ErrorFallback = props => {
clo(props);
const {
error
} = props;
const formatted = formatReactError(error);
return /*#__PURE__*/React.createElement("div", {
role: "alert"
}, /*#__PURE__*/React.createElement("h1", null, "Something went wrong in React:"), /*#__PURE__*/React.createElement("pre", null, formatted.name, ": ", formatted.message), /*#__PURE__*/React.createElement("p", null), /*#__PURE__*/React.createElement("p", null, "See more detail in the console"));
};

/****************************************************************************************************************************
* ROOT COMPONENT
Expand Down Expand Up @@ -480,11 +480,12 @@ var RootBundle = (function (exports, React$1) {
warn: false,
msg: '',
color: 'w3-pale-red',
border: ''
border: 'w3-border-red'
});
// const [setMessageFromPlugin] = useState({})
const [history, setHistory] = React$1.useState([lastUpdated]);
const tempSavedClicksRef = React__default["default"].useRef([]); //temporarily store the clicks in the webview
// $FlowFixMe
const tempSavedClicksRef = React$1.useRef([]); // temporarily store the clicks in the webview

/****************************************************************************************************************************
* VARIABLES
Expand Down Expand Up @@ -522,7 +523,7 @@ var RootBundle = (function (exports, React$1) {
// eslint-disable-next-line no-unused-vars
const dispatch = (action, data, actionDescriptionForLog) => {
// const desc = `${action}${actionDescriptionForLog ? `: ${actionDescriptionForLog}` : ''}`
// console.log(`Root: Received dispatch request: "${desc}", data=${JSON.stringify(data, null, 2)}`)
// logDebug(`Root`,`Received dispatch request: "${desc}", data=${JSON.stringify(data, null, 2)}`)
// data.lastUpdated = { msg: desc, date: new Date().toLocaleString() }
const event = new MessageEvent('message', {
data: {
Expand Down Expand Up @@ -571,10 +572,20 @@ var RootBundle = (function (exports, React$1) {
if (!type) throw `onMessageReceived: event.data.type is undefined`, event.data;
if (!payload) throw `onMessageReceived: event.data.payload is undefined`, event.data;
if (type && payload) {
logDebug(`Root`, ` onMessageReceived: ${type}`);
// logDebug(`Root`, ` onMessageReceived: ${type}`)
// logDebug(`Root`, ` onMessageReceived: payload:${JSON.stringify(payload, null, 2)}`)
if (!payload.lastUpdated) payload.lastUpdated = {
msg: '(no msg)'
};
// Spread existing state into new object to keep it immutable
// TODO: ideally, you would use a reducer here
if (type === 'SHOW_BANNER') payload.lastUpdated.msg += `: ${payload.msg}`;
if (type === 'SHOW_BANNER') {
if (payload.lastUpdated?.msg) {
payload.lastUpdated.msg += `: ${payload.msg}`;
} else {
logDebug(`Root`, ` onMessageReceived: payload.lastUpdated.msg is undefined: payload.lastUpdated:${payload.lastUpdated} payload.lastUpdated.msg:${payload.lastUpdated.msg}`);
}
}
setHistory(prevData => [...prevData, ...tempSavedClicksRef.current, payload.lastUpdated]);
tempSavedClicksRef.current = [];
switch (type) {
Expand All @@ -594,6 +605,16 @@ var RootBundle = (function (exports, React$1) {
};
break;
case 'SHOW_BANNER':
if (npData.passThroughVars.lastWindowScrollTop) {
logDebug(`Root`, ` onMessageReceived: Showing banner, so we need to scroll the page up to the top so user sees it.`);
setNPData(prevData => {
prevData.passThroughVars.lastWindowScrollTop = 0;
return {
...prevData,
...payload
};
});
}
showBanner(payload.msg, payload.color, payload.border);
break;
case 'SEND_TO_PLUGIN':
Expand All @@ -610,7 +631,7 @@ var RootBundle = (function (exports, React$1) {
logDebug(`Root`, ` onMessageReceived: called but event.data.type and/or event.data.payload is undefined`, event);
}
} catch (error) {
logDebug(`Root`, ` onMessageReceived: error=${JSON.stringify(error)}error=${JSON.stringify(error)}`);
logDebug(`Root`, ` onMessageReceived: error=${JSP(formatReactError(error))}`);
}
}
};
Expand Down Expand Up @@ -664,7 +685,8 @@ var RootBundle = (function (exports, React$1) {
setWarning({
warn: false,
msg: '',
color: 'w3-pale-red'
color: 'w3-pale-red',
border: 'w3-border-red'
});
};

Expand Down
Loading

0 comments on commit 87ccfd5

Please sign in to comment.