Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tool drawer for edit and live-reload buttons (#1164)
* feat: tool drawer for edit and live-reload buttons This replaces the *edit pencil* on HTML artifacts served by the admin server with "tool drawer". The tool drawer contains an edit button (which takes the place of the edit pencil), as well as a toggle button that can be used to disable live-reload (see #1027) for the window. If the tool drawer is obscuring part of the HTML page that one would like to look at or click on, the drawer may be dragged vertically to reposition it. It may also be (mostly) hidden off screen to minimize its visual impact. * feat(admin gui): use link for "Return to Website" button Using a real link (`<a href="...">`) instead of a button with onclick handler allows the user to, e.g., open a new window with a live-preview by middle or right clicking on the button. Anyway, since the "button" leads to a new URL outside of the admin app, it's the right thing to do. E.g. see https://css-tricks.com/buttons-vs-links/. * perf: do not use React's StrictMode in production Strict mode causes everything to be rendered twice. (I noticed this because GlobalActions was firing off two request for /previewinfo for every page change.) This is not particularly efficient, and is probably not appropriate for the production build. * revert: remove --no-reload cli option The `--no-reload` option was add in PR #1027 (c38596a). It disables the live-reload feature globally. Since this PR adds the ability to disable live-reload on a per-window basis, the global option no longer seems necessary.
- Loading branch information
Showing
33 changed files
with
1,660 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Compute JSON.stringifiable object containing SVG markup for a | ||
* select subset of font-awesome icons. | ||
* | ||
* We do this at compile time, to reduce our compiled bundle size. | ||
* Using @fortawesome/fontawesome-svg-core at runtime pulls in a large | ||
* chunk of code that more than doubles our bundle size. | ||
*/ | ||
import { icon } from "@fortawesome/fontawesome-svg-core"; | ||
import { fas } from "@fortawesome/free-solid-svg-icons"; | ||
|
||
const iconNames = [ | ||
"faAngleLeft", | ||
"faAngleRight", | ||
"faFilePen", | ||
"faRetweet", | ||
"faThumbtack", | ||
]; | ||
|
||
function svgFor(iconName: string) { | ||
if (iconName in fas) { | ||
return icon(fas[iconName]).html.join(""); | ||
} | ||
throw new Error(`unknown icon name "${iconName}"`); | ||
} | ||
|
||
export default Object.fromEntries( | ||
iconNames.map((name) => [name, svgFor(name)]), | ||
); |
Oops, something went wrong.