@bitcoin-os/bridge
Version:
Reusable Bitcoin OS components for seamless app integration
579 lines (578 loc) • 22.3 kB
JavaScript
export function createDefaultMenus(context) {
const { appName, exchangeUrl, customMenuItems = [] } = context;
const baseMenus = [
{
label: appName || 'Bitcoin App',
items: [
{
label: 'Home',
shortcut: '⌘⇧H',
action: () => window.location.href = '/'
},
{ divider: true },
{
label: `About ${appName || 'This App'}`,
action: () => alert(`${appName || 'Bitcoin App'}\n\nBuilt with Bitcoin OS v1.0\n\nThe Operating System for Bitcoin\n\n© 2025 The Bitcoin Corporation LTD\nRegistered in England and Wales • Company No. 16735102`)
},
{ divider: true },
{
label: 'Preferences...',
shortcut: '⌘,',
action: () => window.location.href = '/settings'
},
{ divider: true },
{
label: `Hide ${appName || 'App'}`,
shortcut: '⌘H',
action: () => console.log(`Hide ${appName}`)
},
{
label: 'Hide Others',
shortcut: '⌥⌘H',
action: () => console.log('Hide Others')
},
{ divider: true },
{
label: 'Lock Screen',
shortcut: '⌘L',
action: () => console.log('Lock Screen')
},
{
label: 'Log Out',
action: () => console.log('Log Out')
},
{
label: 'Shut Down',
action: () => console.log('Shut Down')
},
]
},
{
label: 'File',
items: [
{
label: 'New Window',
shortcut: '⌘N',
action: () => window.open('/', '_blank')
},
{
label: 'New App',
shortcut: '⇧⌘N',
action: () => window.open('https://www.npmjs.com/package/@bitcoin-os/bapps', '_blank')
},
{
label: 'New Folder',
action: () => console.log('New Folder')
},
{ divider: true },
{
label: 'Open...',
shortcut: '⌘O',
action: () => console.log('Open')
},
{
label: 'Open Location...',
shortcut: '⇧⌘G',
action: () => {
const url = prompt('Enter URL:');
if (url)
window.open(url, '_blank');
}
},
{ divider: true },
{
label: 'Import...',
action: () => console.log('Import')
},
{
label: 'Export...',
action: () => console.log('Export')
},
{ divider: true },
{
label: 'Save',
shortcut: '⌘S',
action: () => console.log('Save')
},
{
label: 'Save As...',
shortcut: '⇧⌘S',
action: () => console.log('Save As')
},
{ divider: true },
{
label: 'Recent Apps',
action: () => console.log('Recent Apps')
},
{ divider: true },
{
label: 'Close Window',
shortcut: '⌘W',
action: () => window.close()
}
]
},
{
label: 'Edit',
items: [
{
label: 'Undo',
shortcut: '⌘Z',
action: () => document.execCommand('undo')
},
{
label: 'Redo',
shortcut: '⇧⌘Z',
action: () => document.execCommand('redo')
},
{ divider: true },
{
label: 'Cut',
shortcut: '⌘X',
action: () => document.execCommand('cut')
},
{
label: 'Copy',
shortcut: '⌘C',
action: () => document.execCommand('copy')
},
{
label: 'Paste',
shortcut: '⌘V',
action: () => document.execCommand('paste')
},
{
label: 'Paste and Match Style',
shortcut: '⌥⇧⌘V',
action: () => console.log('Paste and Match Style')
},
{ divider: true },
{
label: 'Select All',
shortcut: '⌘A',
action: () => document.execCommand('selectAll')
},
{
label: 'Find...',
shortcut: '⌘F',
action: () => console.log('Find')
},
{
label: 'Find and Replace...',
shortcut: '⌥⌘F',
action: () => console.log('Find and Replace')
},
{
label: 'Find Next',
shortcut: '⌘G',
action: () => console.log('Find Next')
},
{
label: 'Find Previous',
shortcut: '⇧⌘G',
action: () => console.log('Find Previous')
}
]
},
{
label: 'View',
items: [
{
label: 'Show Bitcoin OS Desktop',
action: () => window.open('https://bitcoin-os.vercel.app', '_blank')
},
{
label: 'Show All Windows',
action: () => console.log('Show All Windows')
},
{ divider: true },
{
label: 'Toggle Developer Sidebar',
shortcut: '⌘D',
action: () => {
const event = new KeyboardEvent('keydown', { metaKey: true, key: 'd' });
document.dispatchEvent(event);
}
},
{
label: 'Enter Full Screen',
shortcut: '⌃⌘F',
action: () => document.documentElement.requestFullscreen()
},
{ divider: true },
{
label: 'Actual Size',
shortcut: '⌘0',
action: () => document.body.style.zoom = '100%'
},
{
label: 'Zoom In',
shortcut: '⌘+',
action: () => document.body.style.zoom = '110%'
},
{
label: 'Zoom Out',
shortcut: '⌘-',
action: () => document.body.style.zoom = '90%'
}
]
},
{
label: 'Tools',
items: [
{
label: 'Bitcoin Apps Store',
action: () => window.open('https://www.bitcoinapps.store/', '_blank')
},
{
label: 'Create New App',
icon: '🚀',
action: () => window.open('https://www.npmjs.com/package/@bitcoin-os/bapps', '_blank')
},
{ divider: true },
{
label: 'System Monitor',
action: () => console.log('System Monitor')
},
{
label: 'Activity Monitor',
action: () => console.log('Activity Monitor')
},
{
label: 'Resource Manager',
action: () => console.log('Resource Manager')
},
{
label: 'Performance Monitor',
action: () => console.log('Performance Monitor')
},
{ divider: true },
{
label: 'Compute Exchange',
icon: '⚡',
action: () => window.open('/exchange', '_blank')
},
{
label: 'GPU Thread Pool',
action: () => console.log('GPU Thread Pool')
},
{
label: 'HPC Scheduler',
action: () => console.log('HPC Scheduler')
},
{
label: 'Parallel Processing',
action: () => console.log('Parallel Processing')
},
{ divider: true },
{
label: 'Blockchain Tools',
action: () => console.log('Blockchain Tools')
},
{
label: 'Encryption Tools',
action: () => console.log('Encryption Tools')
},
{
label: 'Backup & Sync',
action: () => console.log('Backup & Sync')
},
{ divider: true },
{
label: 'Terminal',
shortcut: '⌘T',
action: () => console.log('Terminal')
},
{
label: 'Console',
action: () => console.log('Console')
},
{
label: 'Script Editor',
action: () => console.log('Script Editor')
},
...(exchangeUrl ? [
{ divider: true },
{
label: 'Custom Exchange',
action: () => window.open(exchangeUrl, '_blank')
}
] : [])
]
},
{
label: 'System',
items: [
{
label: 'About This Bitcoin OS',
action: () => alert('Bitcoin OS v1.0\n\nThe Operating System for Bitcoin\n\n© 2025 The Bitcoin Corporation LTD\nRegistered in England and Wales • Company No. 16735102')
},
{
label: 'System Information',
action: () => console.log('System Information')
},
{
label: 'Storage Management',
action: () => console.log('Storage Management')
},
{ divider: true },
{
label: 'User & Groups',
action: () => console.log('User & Groups')
},
{
label: 'Security & Privacy',
action: () => console.log('Security & Privacy')
},
{
label: 'Network Settings',
action: () => console.log('Network Settings')
},
{ divider: true },
{
label: 'Bitcoin Node Status',
action: () => console.log('Bitcoin Node Status')
},
{
label: 'Blockchain Sync',
action: () => console.log('Blockchain Sync')
},
{
label: 'Mining Pool',
action: () => console.log('Mining Pool')
},
{ divider: true },
{
label: 'System Preferences',
shortcut: '⌘,',
action: () => window.open('/settings', '_blank')
},
{
label: 'Reset Bitcoin OS',
action: () => confirm('Are you sure you want to reset Bitcoin OS?') && console.log('Reset OS')
}
]
},
{
label: 'Apps',
items: [
{
label: 'Bitcoin Writer',
action: () => window.open('https://bitcoin-writer.vercel.app', '_blank')
},
{
label: 'Bitcoin Email',
action: () => window.open('https://bitcoin-email.vercel.app', '_blank')
},
{
label: 'Bitcoin Drive',
action: () => window.open('https://bitcoin-drive.vercel.app', '_blank')
},
{
label: 'Bitcoin Calendar',
action: () => window.open('https://bitcoin-calendar.vercel.app', '_blank')
},
{
label: 'Bitcoin Search',
action: () => window.open('https://bitcoin-search.vercel.app', '_blank')
},
{
label: 'Bitcoin Music',
action: () => window.open('https://bitcoin-music.vercel.app', '_blank')
},
{
label: 'Bitcoin Spreadsheet',
action: () => window.open('https://bitcoin-spreadsheet.vercel.app', '_blank')
},
{ divider: true },
{
label: 'Bitcoin Wallet',
action: () => window.open('https://bitcoin-wallet-sable.vercel.app', '_blank')
},
{
label: 'Bitcoin Exchange',
action: () => window.open('https://bitcoin-exchange.vercel.app', '_blank')
},
{
label: 'Bitcoin Jobs',
action: () => window.open('https://bitcoin-jobs.vercel.app', '_blank')
},
{ divider: true },
{
label: 'Recently Used',
action: () => console.log('Recently Used')
},
{
label: 'App Store',
action: () => window.open('https://www.bitcoinapps.store/', '_blank')
}
]
},
{
label: 'Window',
items: [
{
label: 'App Mode: Fullscreen URLs',
action: () => {
localStorage.setItem('appMode', 'fullscreen');
alert('Apps will now open in fullscreen mode');
}
},
{
label: 'App Mode: Windowed Apps',
action: () => {
localStorage.setItem('appMode', 'windowed');
alert('Apps will now open in draggable windows');
}
},
{ divider: true },
{
label: 'Minimize',
shortcut: '⌘M',
action: () => console.log('Minimize')
},
{
label: 'Zoom',
action: () => console.log('Zoom')
},
{
label: 'Close',
shortcut: '⌘W',
action: () => window.close()
},
{ divider: true },
{
label: 'Bring All to Front',
action: () => console.log('Bring All to Front')
},
{
label: 'Arrange in Front',
action: () => console.log('Arrange in Front')
},
{ divider: true },
{
label: 'Split View',
action: () => console.log('Split View')
},
{
label: 'Picture in Picture',
action: () => console.log('Picture in Picture')
},
{
label: 'Mission Control',
shortcut: 'F3',
action: () => console.log('Mission Control')
},
{ divider: true },
{
label: 'Documentation',
action: () => window.open('/docs', '_blank')
},
{
label: 'Tasks',
action: () => window.open('/tasks', '_blank')
},
{
label: 'Contracts',
action: () => window.open('/contracts', '_blank')
},
{
label: 'Token',
action: () => window.open('/token', '_blank')
},
{
label: 'Compute Exchange',
action: () => window.open('/exchange', '_blank')
}
]
},
{
label: 'Help',
items: [
{
label: `${appName} Help`,
shortcut: '⌘?',
action: () => alert(`${appName}\n\nBuilt with Bitcoin OS v1.0\n\nThe Operating System for Bitcoin\n\nBuilt for decentralized computing and Bitcoin applications`)
},
{
label: 'Quick Start Guide',
action: () => window.open('/docs/quick-start', '_blank')
},
{
label: 'Keyboard Shortcuts',
action: () => alert('Bitcoin OS Shortcuts:\n\n⌘N - New Window\n⌘T - Terminal\n⌘D - Toggle Sidebar\n⌘? - Help\n⌘, - Preferences')
},
{ divider: true },
{
label: 'Documentation',
action: () => window.open('/docs', '_blank')
},
{
label: 'Developer Guide',
action: () => window.open('https://www.npmjs.com/package/@bitcoin-os/bapps', '_blank')
},
{
label: 'API Reference',
action: () => window.open('/docs/api', '_blank')
},
{ divider: true },
{
label: 'Community Forum',
href: 'https://github.com/bitcoin-apps-suite/bitcoin-OS/discussions',
external: true
},
{
label: 'GitHub Repository',
href: 'https://github.com/bitcoin-apps-suite/bitcoin-OS',
external: true
},
{
label: 'NPM Packages',
href: 'https://www.npmjs.com/settings/bitcoin-os/packages',
external: true
},
{ divider: true },
{
label: 'Report an Issue',
href: 'https://github.com/bitcoin-apps-suite/bitcoin-OS/issues',
external: true
},
{
label: 'Request Feature',
href: 'https://github.com/bitcoin-apps-suite/bitcoin-OS/issues/new?template=feature_request.md',
external: true
},
{ divider: true },
{
label: 'About The Bitcoin Corporation',
action: () => alert('The Bitcoin Corporation LTD\nRegistered in England and Wales\nCompany No. 16735102\n\nBuilding the future of Bitcoin computing')
}
]
}
];
// Merge with custom menu items
return [...baseMenus, ...customMenuItems];
}
export function getBitcoinApps() {
return [
{ name: 'Bitcoin Auth', color: '#ef4444', url: '#' },
{ name: 'Bitcoin Calendar', color: '#d946ef', url: 'https://bitcoin-calendar.vercel.app' },
{ name: 'Bitcoin Chat', color: '#ff6500', url: '#' },
{ name: 'Bitcoin Domains', color: '#eab308', url: '#' },
{ name: 'Bitcoin Draw', color: '#10b981', url: '#' },
{ name: 'Bitcoin Drive', color: '#22c55e', url: 'https://bitcoin-drive.vercel.app' },
{ name: 'Bitcoin Email', color: '#06b6d4', url: 'https://bitcoin-email.vercel.app' },
{ name: 'Bitcoin Exchange', color: '#3b82f6', url: 'https://bitcoin-exchange.vercel.app' },
{ name: 'Bitcoin Jobs', color: '#6b7280', url: 'https://bitcoin-jobs.vercel.app' },
{ name: 'Bitcoin Music', color: '#8b5cf6', url: 'https://bitcoin-music.vercel.app' },
{ name: 'Bitcoin Paint', color: '#a855f7', url: '#' },
{ name: 'Bitcoin Pics', color: '#ec4899', url: '#' },
{ name: 'Bitcoin Registry', color: '#f43f5e', url: '#' },
{ name: 'Bitcoin Search', color: '#3b82f6', url: 'https://bitcoin-search.vercel.app' },
{ name: 'Bitcoin Shares', color: '#f43f5e', url: 'https://bitcoin-shares.vercel.app' },
{ name: 'Bitcoin Spreadsheets', color: '#3b82f6', url: 'https://bitcoin-spreadsheet.vercel.app' },
{ name: 'Bitcoin Video', color: '#65a30d', url: '#' },
{ name: 'Bitcoin Wallet', color: '#f59e0b', url: 'https://bitcoin-wallet-sable.vercel.app' },
{ name: 'Bitcoin Writer', color: '#ff9500', url: 'https://bitcoin-writer.vercel.app' }
];
}