Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chg: flag off jack in and sound (#286)

teo36a7c36fdbd5
diff --git a/js/app/packages/app/component/dock/Dock.tsx b/js/app/packages/app/component/dock/Dock.tsx
index 8d11440986..e09069eb7b 100644
--- a/js/app/packages/app/component/dock/Dock.tsx
+++ b/js/app/packages/app/component/dock/Dock.tsx
@@ -2,7 +2,7 @@ import { setSettingsOpen, useSettingsState } from '@core/constant/SettingsState'
import { GlobalNotificationBell } from '@core/component/GlobalNotificationBell';
import { createMemo, createSignal, onCleanup, onMount, Show } from 'solid-js';
import { isRightPanelOpen, useToggleRightPanel } from '@core/signal/layout';
-import { ENABLE_DOCK_NOTITIFCATIONS } from '@core/constant/featureFlags';
+import { ENABLE_DOCK_NOTITIFCATIONS, ENABLE_JACK_IN } from '@core/constant/featureFlags';
import { activeScope, hotkeyScopeTree } from '@core/hotkey/state';
import SplitIcon from '@icon/regular/square-split-horizontal.svg';
import { useGlobalNotificationSource } from '../GlobalAppState';
@@ -21,7 +21,7 @@ import IconLogo from '@macro-icons/macro-logo.svg';
import { BasicTierLimit } from './BasicTierLimit';
import { setKonsoleOpen } from '../command/state';
import { runCommand } from '@core/hotkey/hotkeys';
-import { Hotkey } from '@core/component/Hotkey';
+import { Hotkey } from '@core/component/Hotkey';
import { setCreateMenuOpen } from '../Launcher';
import { useHasPaidAccess } from '@core/auth';
import { TOKENS } from '@core/hotkey/tokens';
@@ -31,7 +31,7 @@ import { QuickAccess } from './QuickAccess';
// import { Debug } from './Debug';
import Hints from './Hints';
-export function Dock(){
+export function Dock() {
const activeSplitId = createMemo(() => globalSplitManager()?.activeSplitId());
const [showGlitchEffect, setShowGlitchEffect] = createSignal(false);
const [isPresentMode, setIsPresentMode] = createSignal(false);
@@ -45,78 +45,78 @@ export function Dock(){
const isSoupActive = createMemo(() => {
const splitId = globalSplitManager()?.activeSplitId();
- if(!splitId){return false};
+ if (!splitId) { return false };
const split = globalSplitManager()?.getSplit(splitId);
- if(!split){return false};
+ if (!split) { return false };
return split.content().id === 'unified-list';
});
// This method of opening the correct help drawer is disgusting,
// but it works and doesn't require changing anything else.
- function activeSoupDrawerCommand(){
+ function activeSoupDrawerCommand() {
const currentActiveScope = activeScope();
- if(!currentActiveScope){return undefined};
+ if (!currentActiveScope) { return undefined };
let activeScopeNode = hotkeyScopeTree.get(currentActiveScope);
- if(!activeScopeNode){return undefined};
- if(activeScopeNode?.type !== 'dom'){return};
+ if (!activeScopeNode) { return undefined };
+ if (activeScopeNode?.type !== 'dom') { return };
const dom = activeScopeNode.element;
const closestSplitScope = dom.closest('[data-hotkey-scope^="split"]');
- if(!closestSplitScope || !(closestSplitScope instanceof HTMLElement)){return};
+ if (!closestSplitScope || !(closestSplitScope instanceof HTMLElement)) { return };
const scopeId = closestSplitScope.dataset.hotkeyScope;
- if(!scopeId){return undefined};
+ if (!scopeId) { return undefined };
const splitNode = hotkeyScopeTree.get(scopeId);
- if(!splitNode){return undefined};
+ if (!splitNode) { return undefined };
return splitNode.hotkeyCommands.get('shift+/');
};
- async function enterPresentMode(){
- try{
+ async function enterPresentMode() {
+ try {
playSound('Stab_Destruct');
const element = document.documentElement;
- if(element.requestFullscreen){await element.requestFullscreen()}
- else if((element as any).webkitRequestFullscreen){await (element as any).webkitRequestFullscreen()}// Safari
- else if((element as any).mozRequestFullScreen){await (element as any).mozRequestFullScreen()}// Firefox
- else if((element as any).msRequestFullscreen){await (element as any).msRequestFullscreen()}// IE/Edge
+ if (element.requestFullscreen) { await element.requestFullscreen() }
+ else if ((element as any).webkitRequestFullscreen) { await (element as any).webkitRequestFullscreen() }// Safari
+ else if ((element as any).mozRequestFullScreen) { await (element as any).mozRequestFullScreen() }// Firefox
+ else if ((element as any).msRequestFullscreen) { await (element as any).msRequestFullscreen() }// IE/Edge
focusActiveSplit();
}
- catch(error){
+ catch (error) {
console.error('Error entering present mode:', error);
}
};
- async function exitPresentMode(){
- try{
- if(document.exitFullscreen){await document.exitFullscreen()}
- else if((document as any).webkitExitFullscreen){await (document as any).webkitExitFullscreen()}// Safari
- else if((document as any).mozCancelFullScreen){await (document as any).mozCancelFullScreen()}// Firefox
- else if((document as any).msExitFullscreen){await (document as any).msExitFullscreen()}// IE/Edge
+ async function exitPresentMode() {
+ try {
+ if (document.exitFullscreen) { await document.exitFullscreen() }
+ else if ((document as any).webkitExitFullscreen) { await (document as any).webkitExitFullscreen() }// Safari
+ else if ((document as any).mozCancelFullScreen) { await (document as any).mozCancelFullScreen() }// Firefox
+ else if ((document as any).msExitFullscreen) { await (document as any).msExitFullscreen() }// IE/Edge
focusActiveSplit();
}
- catch(error){
+ catch (error) {
console.error('Error exiting present mode:', error);
}
};
- async function focusActiveSplit(){
+ async function focusActiveSplit() {
const id = activeSplitId();
if (!id) return null;
const splitEl = document.querySelector(`[data-split-id="${id}"]`) as HTMLElement;
splitEl?.focus();
};
- function togglePresentMode(){
- if(isPresentMode()){
+ function togglePresentMode() {
+ if (isPresentMode()) {
exitPresentMode();
setShowGlitchEffect(false);
}
- else{
+ else {
setShowGlitchEffect(true); // Show glitch effect before entering fullscreen
- setTimeout(() => {enterPresentMode()}, 200); // Enter fullscreen after a brief delay to let glitch start
+ setTimeout(() => { enterPresentMode() }, 200); // Enter fullscreen after a brief delay to let glitch start
}
};
// Check if we're in fullscreen
- function checkFullscreen(){
+ function checkFullscreen() {
const isFullscreen = document.fullscreenElement || (document as any).webkitFullscreenElement || (document as any).mozFullScreenElement || (document as any).msFullscreenElement;
setIsPresentMode(!!isFullscreen);
};
@@ -125,17 +125,17 @@ export function Dock(){
onMount(() => {
const events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
- events.forEach((event) => {document.addEventListener(event, checkFullscreen)});
- const handleKeyDown = (e: KeyboardEvent) => {if(e.key === 'Escape' && isPresentMode()){exitPresentMode()}};
+ events.forEach((event) => { document.addEventListener(event, checkFullscreen) });
+ const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape' && isPresentMode()) { exitPresentMode() } };
document.addEventListener('keydown', handleKeyDown);
onCleanup(() => {
- events.forEach((event) => {document.removeEventListener(event, checkFullscreen)});
+ events.forEach((event) => { document.removeEventListener(event, checkFullscreen) });
document.removeEventListener('keydown', handleKeyDown);
});
});
- return(
+ return (
<>
<style>{`
.dock-button-hover{
@@ -160,7 +160,7 @@ export function Dock(){
>
<ClippedPanel bl br>
<div style={{
- 'grid-template-columns':'min-content 1fr min-content',
+ 'grid-template-columns': 'min-content 1fr min-content',
'box-sizing': 'border-box',
'scrollbar-width': 'none',
'align-content': 'center',
@@ -192,7 +192,7 @@ export function Dock(){
'height': '24px',
'gap': '7px'
}}
- onClick={() => {setKonsoleOpen(true)}}
+ onClick={() => { setKonsoleOpen(true) }}
class="dock-button-hover"
>
<IconLogo
@@ -218,7 +218,7 @@ export function Dock(){
'background-color': 'var(--color-edge-muted)',
'height': '38px',
'width': '1px',
- }}/>
+ }} />
<div
style={{
@@ -230,7 +230,7 @@ export function Dock(){
'height': '24px',
'gap': '10px'
}}
- onClick={() => {setCreateMenuOpen(true)}}
+ onClick={() => { setCreateMenuOpen(true) }}
class="dock-button-hover"
>
<MacroCreateIcon
@@ -298,7 +298,7 @@ export function Dock(){
<IconButton
onClick={() => {
const showHelp = activeSoupDrawerCommand();
- if(!showHelp){return};
+ if (!showHelp) { return };
runCommand(showHelp);
}}
tooltip={{
@@ -313,8 +313,8 @@ export function Dock(){
<IconButton
onClick={() => {
- if(isRightPanelCollapsed()){track(TrackingEvents.RIGHTBAR.OPEN)}
- else{track(TrackingEvents.RIGHTBAR.CLOSE)}
+ if (isRightPanelCollapsed()) { track(TrackingEvents.RIGHTBAR.OPEN) }
+ else { track(TrackingEvents.RIGHTBAR.CLOSE) }
toggleRightPanel();
}}
theme={isRightPanelCollapsed() ? 'clear' : 'accent'}
@@ -333,7 +333,7 @@ export function Dock(){
}}
onClick={() => {
const manager = globalSplitManager();
- if(manager){
+ if (manager) {
manager.createNewSplit({
id: 'unified-list',
type: 'component',
@@ -345,15 +345,17 @@ export function Dock(){
size="sm"
/>
- <IconButton
- tooltip={{
- label: isPresentMode() ? 'Exit Present Mode' : 'Enter Present Mode'
- }}
- theme={isPresentMode() ? 'accent' : 'clear'}
- onClick={togglePresentMode}
- icon={IconPower}
- size="sm"
- />
+ <Show when={ENABLE_JACK_IN}>
+ <IconButton
+ tooltip={{
+ label: isPresentMode() ? 'Exit Present Mode' : 'Enter Present Mode'
+ }}
+ theme={isPresentMode() ? 'accent' : 'clear'}
+ onClick={togglePresentMode}
+ icon={IconPower}
+ size="sm"
+ />
+ </Show>
<IconButton
tooltip={{
@@ -361,7 +363,7 @@ export function Dock(){
hotkeyToken: TOKENS.global.toggleSettings,
}}
theme={settingsOpen() ? 'accent' : 'clear'}
- onDeepClick={() => {setSettingsOpen(true)}}
+ onDeepClick={() => { setSettingsOpen(true) }}
icon={IconGear}
size="sm"
/>
@@ -370,10 +372,13 @@ export function Dock(){
</ClippedPanel>
</div>
- <PresentModeGlitch
- show={showGlitchEffect()}
- onComplete={() => setShowGlitchEffect(false)}
- />
+ <Show when={ENABLE_JACK_IN}>
+
+ <PresentModeGlitch
+ show={showGlitchEffect()}
+ onComplete={() => setShowGlitchEffect(false)}
+ />
+ </Show>
{/*<Show when={DEV_MODE_ENV}>
<Debug/>
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsx
index f4641c06b0..4ff09de185 100644
--- a/js/app/packages/app/component/settings/Appearance.tsx
+++ b/js/app/packages/app/component/settings/Appearance.tsx
@@ -2,7 +2,7 @@
import { ToggleSwitch } from '@core/component/FormControls/ToggleSwitch';
import { TabContent } from '@core/component/TabContent';
-import { ENABLE_CUSTOM_CURSOR } from '@core/constant/featureFlags';
+import { ENABLE_CUSTOM_CURSOR, ENABLE_SOUND } from '@core/constant/featureFlags';
import { isMobileWidth } from '@core/mobile/mobileWidth';
import { createEffect, createSignal, Show } from 'solid-js';
import { ThemeEditorAdvanced } from '../../../block-theme/components/ThemeEditorAdvanced';
@@ -107,69 +107,72 @@ export function Appearance() {
'font-size': '14px',
}}
>
- <div
- style={{
- display: 'flex',
- 'align-items': 'center',
- 'justify-content': 'space-between',
- }}
- >
- <span>Sound effects</span>
- <ToggleSwitch
- checked={soundEnabled()}
- onChange={(enabled) => setSoundEnabled(enabled)}
- />
- </div>
- <div
- style={{
- display: 'flex',
- 'align-items': 'center',
- gap: '12px',
- }}
- >
- <span style={{ 'min-width': '60px' }}>Volume</span>
+
+ <Show when={ENABLE_SOUND}>
<div
style={{
- position: 'relative',
- flex: 1,
- height: '18px',
display: 'flex',
'align-items': 'center',
+ 'justify-content': 'space-between',
}}
>
- <input
- type="range"
- min="0"
- max="1"
- step="0.01"
- value={soundVolume()}
- onInput={(e) => {
- const value = parseFloat(
- (e.target as HTMLInputElement).value
- );
- setSoundVolume(value);
- }}
+ <span>Sound effects</span>
+ <ToggleSwitch
+ checked={soundEnabled()}
+ onChange={(enabled) => setSoundEnabled(enabled)}
+ />
+ </div>
+ <div
+ style={{
+ display: 'flex',
+ 'align-items': 'center',
+ gap: '12px',
+ }}
+ >
+ <span style={{ 'min-width': '60px' }}>Volume</span>
+ <div
style={{
- '-webkit-appearance': 'none',
- width: '100%',
- 'box-sizing': 'border-box',
- 'border-radius': '0px',
- position: 'absolute',
- background: 'transparent',
- appearance: 'none',
- cursor: 'pointer',
- outline: 'none',
- height: '100%',
- margin: 0,
- padding: 0,
+ position: 'relative',
+ flex: 1,
+ height: '18px',
+ display: 'flex',
+ 'align-items': 'center',
}}
- class="sound-volume-slider"
- />
+ >
+ <input
+ type="range"
+ min="0"
+ max="1"
+ step="0.01"
+ value={soundVolume()}
+ onInput={(e) => {
+ const value = parseFloat(
+ (e.target as HTMLInputElement).value
+ );
+ setSoundVolume(value);
+ }}
+ style={{
+ '-webkit-appearance': 'none',
+ width: '100%',
+ 'box-sizing': 'border-box',
+ 'border-radius': '0px',
+ position: 'absolute',
+ background: 'transparent',
+ appearance: 'none',
+ cursor: 'pointer',
+ outline: 'none',
+ height: '100%',
+ margin: 0,
+ padding: 0,
+ }}
+ class="sound-volume-slider"
+ />
+ </div>
+ <span style={{ 'min-width': '40px', 'text-align': 'right' }}>
+ {Math.round(soundVolume() * 100)}%
+ </span>
</div>
- <span style={{ 'min-width': '40px', 'text-align': 'right' }}>
- {Math.round(soundVolume() * 100)}%
- </span>
- </div>
+ </Show>
<style>{`
.sound-volume-slider::-webkit-slider-thumb {
-webkit-appearance: none;
diff --git a/js/app/packages/app/util/soundSettings.ts b/js/app/packages/app/util/soundSettings.ts
index 297bf50e6b..374a9a7d82 100644
--- a/js/app/packages/app/util/soundSettings.ts
+++ b/js/app/packages/app/util/soundSettings.ts
@@ -1,3 +1,5 @@
+import { ENABLE_SOUND } from '@core/constant/featureFlags';
+
const SOUND_ENABLED_KEY = 'sound-effects-enabled';
const SOUND_VOLUME_KEY = 'sound-effects-volume';
@@ -5,6 +7,7 @@ const DEFAULT_ENABLED = true;
const DEFAULT_VOLUME = 0.5; // 50%
export function getSoundEffectsEnabled(): boolean {
+ if (!ENABLE_SOUND) return false;
const stored = localStorage.getItem(SOUND_ENABLED_KEY);
return stored === null ? DEFAULT_ENABLED : stored === 'true';
}
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 768d2ec361..c2abd79908 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -125,3 +125,7 @@ export const ENABLE_DOCK_NOTITIFCATIONS = DEV_MODE_ENV;
export const ENABLE_TTFT = DEV_MODE_ENV;
export const ENABLE_CUSTOM_CURSOR = false;
+
+export const ENABLE_SOUND = false;
+
+export const ENABLE_JACK_IN = false;