-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add menu item for opening dedicated window (#1589)
Part of #728. This PR adds an item to the “View” menu, which is labelled “Dedicated Window”, and which opens the remote screen in “standalone” view mode in a popup window. https://github.com/tiny-pilot/tinypilot/assets/83721279/f6bdbdf5-5387-4f6a-8401-9b33f92fb5cb ## Notes - As discussed in [this issue comment](#728 (comment)), we decided to use a rather pragmatic and slightly unconventional approach for hiding the remote screen from the main (parent) window, by issuing an external redirect to a separate page. A “clean” and proper teardown mechanism, which would allow us to stay on the main page, would probably be rather complex to build, and also brittle to maintain. - I’ve debated whether to use an `btn-action` (blue) or a `btn-success` (green) for the “Refresh Page” button. I eventually went with the former, since the action is optional, and the button is only a convenience. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1589"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a>
- Loading branch information
1 parent
c0d8e10
commit fe10492
Showing
4 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<script> | ||
// Reset the actual URL path of this page to `/`, to make it look and feel | ||
// as if the user was still on the main app page. The fact that we issued | ||
// an external redirect should be kept away from the user as good as | ||
// possible, so e.g. the real path of this page also shouldn’t appear in | ||
// the browser history. As an additional benefit, the user is able to | ||
// restore the main app UI by simply triggering a page refresh. | ||
// In order to avoid initial flickering in the address bar, the URL | ||
// replacement operation has to happen as first thing while the browser | ||
// parses this HTML document (in any event prior to fetching assets). | ||
window.history.replaceState(null, null, "/"); | ||
</script> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>{{ page_title_prefix }}TinyPilot</title> | ||
<link rel="stylesheet" type="text/css" href="/css/style.css" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<style> | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100vw; | ||
height: 100vh; | ||
text-align: center; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
body { | ||
color: var(--brand-creme-light); | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
{% include 'custom-elements/menu-bar.html' %} | ||
|
||
<div class="header-bar"> | ||
<!-- Display a non-interactive, stripped down version of the menu bar, | ||
to make the page look like the main app UI. --> | ||
<menu-bar id="menu-bar" logo-only></menu-bar> | ||
</div> | ||
|
||
<p> | ||
The remote screen is displaying in another browser window.<br /> | ||
To restore the remote screen in this window, please refresh the page. | ||
</p> | ||
<button class="btn-action" onclick="window.location.reload()"> | ||
Refresh Page | ||
</button> | ||
</body> | ||
</html> |
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