-
Notifications
You must be signed in to change notification settings - Fork 165
workspace overlays #1662
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
Merged
workspace overlays #1662
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,194 @@ | ||
| import svg from '../../../resources/svg' | ||
| import styled, { createGlobalStyle } from 'styled-components' | ||
| import link from '../../../resources/link' | ||
| import useStore from '../../../resources/Hooks/useStore.js' | ||
| import { useState, useEffect } from 'react' | ||
|
|
||
| const GlobalStyle = createGlobalStyle` | ||
| body { | ||
| width: 100%; | ||
| height: 100%; | ||
| margin: 0; | ||
| padding: 0px; | ||
| font-family: 'MainFont'; | ||
| font-weight: 400; | ||
| color: var(--outerspace); | ||
| } | ||
| ` | ||
|
|
||
| const Dock = styled.div` | ||
| border-radius: 16px; | ||
| background: var(--ghostA); | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| padding: 12px 0px 12px 12px; | ||
| ` | ||
|
|
||
| const DappRow = styled.div` | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| ` | ||
|
|
||
| const DappIcon = styled.div` | ||
| width: 42px; | ||
| height: 42px; | ||
| margin-right: 12px; | ||
| /* margin: 0px 2px 2px 12px; */ | ||
| border-radius: 16px; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| cursor: pointer; | ||
| background: var(--ghostB); | ||
| border-radius: 8px; | ||
|
|
||
| * { | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| &:hover { | ||
| background: var(--ghostC); | ||
| transform: scale(1.2); | ||
| transition: transform 0.2s ease-in-out; | ||
| } | ||
| ` | ||
|
|
||
| const DappIconBreak = styled.div` | ||
| width: 3px; | ||
| height: 42px; | ||
| background: var(--ghostZ); | ||
| border-radius: 1.5px; | ||
| margin: 0px 12px 0px 8px; | ||
| ` | ||
| const DockWrap = styled.div` | ||
| position: fixed; | ||
| top: 0; | ||
| left: 0; | ||
| right: 0; | ||
| bottom: 0; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| transform: ${({ hide }) => (hide ? 'translateY(100px)' : 'translateY(0)')}; | ||
| transition: transform 0.4s ease-in-out; | ||
| ` | ||
|
|
||
| const Wrap = styled.div` | ||
| position: fixed; | ||
| top: 0; | ||
| left: 0; | ||
| right: 0; | ||
| bottom: 0; | ||
| ` | ||
|
|
||
| const DockHandle = styled.div` | ||
| position: absolute; | ||
| left: 50%; | ||
| bottom: 2px; | ||
| height: 4px; | ||
| width: 32px; | ||
| margin-left: -16px; | ||
| border-radius: 2px; | ||
| background: var(--outerspace); | ||
| display: none; | ||
| ` | ||
|
|
||
| const RoundedElement = styled.div` | ||
| position: absolute; | ||
| left: 8px; | ||
| bottom: 8px; | ||
|
|
||
| width: 5px; | ||
| height: 5px; | ||
| background-color: var(--ghostAZ); /* Your actual background color */ | ||
|
|
||
| /* The mask */ | ||
| -webkit-mask-box-image: radial-gradient(circle at top right, transparent 0% 5px, black 5px); | ||
| mask-box-image: radial-gradient(circle at top right, transparent 0% 5px, black 5px); | ||
| ` | ||
|
|
||
| const RoundedElementRight = styled.div` | ||
| position: absolute; | ||
| right: 8px; | ||
| bottom: 8px; | ||
|
|
||
| width: 5px; | ||
| height: 5px; | ||
| background-color: var(--ghostAZ); /* Your actual background color */ | ||
|
|
||
| /* The mask */ | ||
| -webkit-mask-box-image: radial-gradient(circle at top left, transparent 0% 5px, black 5px); | ||
| mask-box-image: radial-gradient(circle at top left, transparent 0% 5px, black 5px); | ||
| ` | ||
| let hideTimeout | ||
| export default () => { | ||
| const frameState = useStore('windows.workspaces', window.frameId) | ||
| const nav = frameState?.nav[0] || { space: 'command', data: {} } | ||
| if (!nav || !nav.space) return null | ||
|
|
||
| const [hideDockWrap, setHideDockWrap] = useState(false) | ||
|
|
||
| const setHide = () => { | ||
| setHideDockWrap(true) | ||
| clearTimeout(hideTimeout) | ||
| hideTimeout = setTimeout(() => { | ||
| link.send('workspace:nav:update:data', window.frameId, { hidden: true }) | ||
| }, 500) | ||
| } | ||
|
|
||
| const setShow = () => { | ||
| clearTimeout(hideTimeout) | ||
| setHideDockWrap(false) | ||
| link.send('workspace:nav:update:data', window.frameId, { hidden: false }) | ||
| } | ||
|
|
||
| const hidden = (nav.space === 'dapp' && hideDockWrap) || (nav.space !== 'dapp' && nav.space !== 'command') | ||
|
|
||
| return ( | ||
| <Wrap onMouseEnter={() => setShow()}> | ||
| <GlobalStyle /> | ||
| <RoundedElement /> | ||
| <RoundedElementRight /> | ||
| <DockHandle /> | ||
| <DockWrap | ||
| hide={hidden} | ||
| onMouseLeave={() => { | ||
| setHide() | ||
| }} | ||
| > | ||
| <Dock> | ||
| <DappIcon | ||
| onClick={() => { | ||
| link.send('workspace:nav', window.frameId, 'command', { station: 'command' }) | ||
| }} | ||
| > | ||
| {'C'} | ||
| </DappIcon> | ||
| <DappIcon | ||
| onClick={() => { | ||
| link.send('workspace:nav', window.frameId, 'command', { station: 'dashboard' }) | ||
| }} | ||
| > | ||
| {'D'} | ||
| </DappIcon> | ||
| <DappIconBreak /> | ||
| <DappIcon | ||
| onClick={() => { | ||
| // link.send('workspace:nav:update:data', window.frameId, { station: 'dapp' }) | ||
| link.send('workspace:run', 'dapp', {}, ['send.frame.eth']) | ||
| }} | ||
| > | ||
| {svg.send(15)} | ||
| </DappIcon> | ||
| <DappIcon>{'-'}</DappIcon> | ||
| <DappIcon>{'-'}</DappIcon> | ||
| <DappIcon>{'-'}</DappIcon> | ||
| <DappIcon>{'-'}</DappIcon> | ||
| <DappIcon>{'-'}</DappIcon> | ||
| </Dock> | ||
| </DockWrap> | ||
| </Wrap> | ||
| ) | ||
| } |
This file contains hidden or 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,23 @@ | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta | ||
| http-equiv="Content-Security-Policy" | ||
| content=" | ||
| script-src 'strict-dynamic' 'nonce-8c7d2664-ae99-42c2-ae12-3304e9168f71' http://localhost:1234 'unsafe-eval'; | ||
| base-uri 'self'; | ||
| connect-src *; | ||
| img-src blob: http://localhost:8421; | ||
| frame-src 'none'; | ||
| style-src 'self' http://localhost:1234 'unsafe-inline'; | ||
| object-src 'none'; | ||
| " | ||
| /> | ||
| <title>Dock</title> | ||
| <link rel="stylesheet" href="../../resources/base.styl" type="text/css" /> | ||
| </head> | ||
| <body> | ||
| <div id="dock"></div> | ||
| <script type="module" src="./index.js" nonce="8c7d2664-ae99-42c2-ae12-3304e9168f71"></script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or 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,24 @@ | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta | ||
Check warningCode scanning / Electronegativity One or more CSP directives detected are vulnerable
One or more CSP directives detected are vulnerable
|
||
| http-equiv="Content-Security-Policy" | ||
| content=" | ||
| script-src 'strict-dynamic' 'nonce-2f0d956b-0d9c-4f1e-874a-57a1ec828872'; | ||
| base-uri 'self'; | ||
| connect-src *; | ||
| img-src blob: http://localhost:8421; | ||
| frame-src 'none'; | ||
| style-src 'self' 'unsafe-inline'; | ||
| object-src 'none'; | ||
| require-trusted-types-for 'script'; | ||
| " | ||
| /> | ||
| <title>Dock</title> | ||
| <link rel="stylesheet" href="../../resources/base.styl" type="text/css" /> | ||
| </head> | ||
| <body> | ||
| <div id="dock"></div> | ||
| <script type="module" src="./index.js" nonce="2f0d956b-0d9c-4f1e-874a-57a1ec828872"></script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or 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,44 @@ | ||
| import * as Sentry from '@sentry/electron' | ||
| import { createRoot } from 'react-dom/client' | ||
|
|
||
| import link from '../../resources/link' | ||
| import restore from '../store' | ||
|
|
||
| import { StoreContext } from '../../resources/Hooks/useStore' | ||
|
|
||
| import Dock from './Dock' | ||
|
|
||
| Sentry.init({ dsn: 'https://7b09a85b26924609bef5882387e2c4dc@o1204372.ingest.sentry.io/6331069' }) | ||
|
|
||
| document.addEventListener('dragover', (e) => e.preventDefault()) | ||
| document.addEventListener('drop', (e) => e.preventDefault()) | ||
|
|
||
| if (process.env.NODE_ENV !== 'development') { | ||
| window.eval = global.eval = () => { | ||
| throw new Error(`This app does not support window.eval()`) | ||
| } // eslint-disable-line | ||
| } | ||
|
|
||
| link.rpc('getFrameId', (err, frameId) => { | ||
| if (err) return console.error('Could not get frameId from main', err) | ||
| window.frameId = frameId | ||
| link.rpc('getState', (err, state) => { | ||
| if (err) return console.error('Could not get initial state from main') | ||
| const store = restore(state) | ||
| store.observer(() => { | ||
| document.body.classList.remove('dark', 'light') | ||
| document.body.classList.add('clip', store('main.colorway')) | ||
| setTimeout(() => { | ||
| document.body.classList.remove('clip') | ||
| }, 100) | ||
| }) | ||
| const root = createRoot(document.getElementById('dock')) | ||
| root.render( | ||
| <StoreContext.Provider value={store}> | ||
| <Dock frameId={frameId} /> | ||
| </StoreContext.Provider> | ||
| ) | ||
| }) | ||
| }) | ||
|
|
||
| document.addEventListener('contextmenu', (e) => link.send('*:contextmenu', e.clientX, e.clientY)) |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / Electronegativity
One or more CSP directives detected are vulnerable