Spaces:
Running
Running
File size: 59,150 Bytes
6c50c72 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Everything AI - Steps 60-100</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vis-network@9.1.2/dist/vis-network.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js"></script>
<style>
.whiteboard-tool {
@apply p-2 rounded-lg hover:bg-gray-200 transition;
}
.whiteboard-tool.active {
@apply bg-blue-500 text-white;
}
.grid-stack-item {
@apply bg-white rounded-lg shadow-md p-4;
}
.timeline-event {
@apply bg-white p-4 rounded-lg shadow-sm mb-2;
}
.pipeline-node {
@apply bg-white p-3 rounded-lg shadow-md border border-gray-200 cursor-move;
}
.pipeline-node.selected {
@apply border-blue-500 border-2;
}
.pipeline-connection {
@apply absolute bg-blue-500;
height: 2px;
}
.snippet-card {
@apply bg-white p-4 rounded-lg shadow-sm hover:shadow-md transition mb-2;
}
.widget {
@apply bg-white rounded-lg shadow-md p-4 h-full;
}
</style>
</head>
<body class="bg-gray-100">
<div id="root"></div>
<script type="text/babel">
const { useState, useEffect, useRef } = React;
// Main App Component
const App = () => {
const [activeModule, setActiveModule] = useState('whiteboard');
const modules = [
{ id: 'whiteboard', name: 'Virtual Whiteboard' },
{ id: 'screen-recording', name: 'Screen Recording' },
{ id: 'cloud-storage', name: 'Cloud Storage' },
{ id: 'version-control', name: 'Version Control' },
{ id: 'universal-search', name: 'Universal Search' },
{ id: 'document-translation', name: 'Document Translation' },
{ id: 'presentation-coach', name: 'Presentation Coach' },
{ id: 'study-group', name: 'Study Group Chat' },
{ id: 'voice-tasks', name: 'Voice Notes to Tasks' },
{ id: 'email-assistant', name: 'AI Email Assistant' },
{ id: 'credentials-vault', name: 'Credentials Vault' },
{ id: 'notebook', name: 'Notebook Workspace' },
{ id: 'graph-explorer', name: 'Graph Explorer' },
{ id: 'iot-dashboard', name: 'IoT Dashboard' },
{ id: 'blockchain-audit', name: 'Blockchain Audit Logs' },
{ id: 'backup-restore', name: 'Backup & Restore' },
{ id: 'biometric-auth', name: 'Biometric Auth' },
{ id: 'licensing', name: 'Licensing' },
{ id: 'video-streaming', name: 'Video Streaming' },
{ id: 'screen-sharing', name: 'Screen Sharing' },
{ id: 'kubernetes', name: 'Kubernetes Manager' },
{ id: 'ar-overlay', name: 'AR Overlay' },
{ id: 'accessibility', name: 'Accessibility Assistant' },
{ id: 'reports', name: 'Interactive Reports' },
{ id: 'code-linter', name: 'Code Linter' },
{ id: 'multi-device-sync', name: 'Multi-Device Sync' },
{ id: 'handwriting', name: 'Handwriting Recognition' },
{ id: 'document-scanner', name: 'Document Scanner' },
{ id: 'timeline', name: 'Interactive Timeline' },
{ id: 'data-pipeline', name: 'Data Pipeline' },
{ id: 'social-scheduler', name: 'Social Media Scheduler' },
{ id: 'seo-analyzer', name: 'SEO Analyzer' },
{ id: 'business-plan', name: 'Business Plan Generator' },
{ id: 'wellness', name: 'Wellness Coach' },
{ id: 'budget', name: 'Budget Tracker' },
{ id: 'snippets', name: 'Snippet Manager' },
{ id: 'newsletter', name: 'Newsletter Generator' },
{ id: 'pdf-form', name: 'PDF Form Filler' },
{ id: 'conference', name: 'Virtual Conference' },
{ id: 'dashboard', name: 'Custom Dashboard' },
{ id: 'ethics', name: 'Ethics Checker' }
];
return (
<div className="min-h-screen flex">
{/* Sidebar */}
<div className="w-64 bg-gray-800 text-white p-4">
<h1 className="text-xl font-bold mb-6">Everything AI</h1>
<div className="space-y-1">
{modules.map(module => (
<button
key={module.id}
onClick={() => setActiveModule(module.id)}
className={`w-full text-left px-4 py-2 rounded-lg transition ${activeModule === module.id ? 'bg-blue-600' : 'hover:bg-gray-700'}`}
>
{module.name}
</button>
))}
</div>
</div>
{/* Main Content */}
<div className="flex-1 p-8 overflow-auto">
<h2 className="text-2xl font-bold mb-6">
{modules.find(m => m.id === activeModule)?.name || 'Module'}
</h2>
{activeModule === 'whiteboard' && <WhiteboardModule />}
{activeModule === 'screen-recording' && <ScreenRecordingModule />}
{activeModule === 'cloud-storage' && <CloudStorageModule />}
{activeModule === 'version-control' && <VersionControlModule />}
{activeModule === 'universal-search' && <UniversalSearchModule />}
{activeModule === 'document-translation' && <DocumentTranslationModule />}
{activeModule === 'presentation-coach' && <PresentationCoachModule />}
{activeModule === 'study-group' && <StudyGroupModule />}
{activeModule === 'voice-tasks' && <VoiceTasksModule />}
{activeModule === 'email-assistant' && <EmailAssistantModule />}
{activeModule === 'credentials-vault' && <CredentialsVaultModule />}
{activeModule === 'notebook' && <NotebookModule />}
{activeModule === 'graph-explorer' && <GraphExplorerModule />}
{activeModule === 'iot-dashboard' && <IotDashboardModule />}
{activeModule === 'blockchain-audit' && <BlockchainAuditModule />}
{activeModule === 'backup-restore' && <BackupRestoreModule />}
{activeModule === 'biometric-auth' && <BiometricAuthModule />}
{activeModule === 'licensing' && <LicensingModule />}
{activeModule === 'video-streaming' && <VideoStreamingModule />}
{activeModule === 'screen-sharing' && <ScreenSharingModule />}
{activeModule === 'kubernetes' && <KubernetesModule />}
{activeModule === 'ar-overlay' && <ArOverlayModule />}
{activeModule === 'accessibility' && <AccessibilityModule />}
{activeModule === 'reports' && <ReportsModule />}
{activeModule === 'code-linter' && <CodeLinterModule />}
{activeModule === 'multi-device-sync' && <MultiDeviceSyncModule />}
{activeModule === 'handwriting' && <HandwritingModule />}
{activeModule === 'document-scanner' && <DocumentScannerModule />}
{activeModule === 'timeline' && <TimelineModule />}
{activeModule === 'data-pipeline' && <DataPipelineModule />}
{activeModule === 'social-scheduler' && <SocialSchedulerModule />}
{activeModule === 'seo-analyzer' && <SeoAnalyzerModule />}
{activeModule === 'business-plan' && <BusinessPlanModule />}
{activeModule === 'wellness' && <WellnessModule />}
{activeModule === 'budget' && <BudgetModule />}
{activeModule === 'snippets' && <SnippetsModule />}
{activeModule === 'newsletter' && <NewsletterModule />}
{activeModule === 'pdf-form' && <PdfFormModule />}
{activeModule === 'conference' && <ConferenceModule />}
{activeModule === 'dashboard' && <DashboardModule />}
{activeModule === 'ethics' && <EthicsModule />}
</div>
</div>
);
};
// 60. Virtual Whiteboard Collaboration
const WhiteboardModule = () => {
const [activeTool, setActiveTool] = useState('pen');
const [color, setColor] = useState('#000000');
const [brushSize, setBrushSize] = useState(5);
const [isDrawing, setIsDrawing] = useState(false);
const canvasRef = useRef(null);
const contextRef = useRef(null);
useEffect(() => {
const canvas = canvasRef.current;
canvas.width = 800;
canvas.height = 600;
const context = canvas.getContext('2d');
context.lineCap = 'round';
context.strokeStyle = color;
context.lineWidth = brushSize;
contextRef.current = context;
}, []);
const startDrawing = (e) => {
const { offsetX, offsetY } = e.nativeEvent;
contextRef.current.beginPath();
contextRef.current.moveTo(offsetX, offsetY);
setIsDrawing(true);
};
const draw = (e) => {
if (!isDrawing) return;
const { offsetX, offsetY } = e.nativeEvent;
contextRef.current.lineTo(offsetX, offsetY);
contextRef.current.stroke();
};
const stopDrawing = () => {
contextRef.current.closePath();
setIsDrawing(false);
};
const clearCanvas = () => {
contextRef.current.clearRect(0, 0, canvasRef.current.width, canvasRef.current.height);
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<div className="flex mb-4 space-x-2">
<button
onClick={() => setActiveTool('pen')}
className={`whiteboard-tool ${activeTool === 'pen' ? 'active' : ''}`}
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M12.316 3.051a1 1 0 01.633 1.265l-4 12a1 1 0 11-1.898-.632l4-12a1 1 0 011.265-.633zM5.707 6.293a1 1 0 010 1.414L3.414 10l2.293 2.293a1 1 0 11-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0zm8.586 0a1 1 0 011.414 0l3 3a1 1 0 010 1.414l-3 3a1 1 0 11-1.414-1.414L16.586 10l-2.293-2.293a1 1 0 010-1.414z" clipRule="evenodd" />
</svg>
</button>
<button
onClick={() => setActiveTool('eraser')}
className={`whiteboard-tool ${activeTool === 'eraser' ? 'active' : ''}`}
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l7-7a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-7 7zM5 10l4-4 6 6-4 4-6-6z" clipRule="evenodd" />
</svg>
</button>
<button
onClick={() => setActiveTool('text')}
className={`whiteboard-tool ${activeTool === 'text' ? 'active' : ''}`}
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M6 4v16a2 2 0 002 2h8a2 2 0 002-2V4h-2v16H8V4H6zm0-2h8a2 2 0 012 2v16a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2zm4 2h4a1 1 0 110 2h-4a1 1 0 110-2z" clipRule="evenodd" />
</svg>
</button>
<button
onClick={() => setActiveTool('rectangle')}
className={`whiteboard-tool ${activeTool === 'rectangle' ? 'active' : ''}`}
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2H4zm0 2h12v8H4V6z" clipRule="evenodd" />
</svg>
</button>
<button
onClick={() => setActiveTool('circle')}
className={`whiteboard-tool ${activeTool === 'circle' ? 'active' : ''}`}
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM7 9a1 1 0 100-2 1 1 0 000 2zm7-1a1 1 0 11-2 0 1 1 0 012 0zm-.464 5.535a1 1 0 10-1.415-1.414 1 1 0 001.415 1.414z" clipRule="evenodd" />
</svg>
</button>
<input
type="color"
value={color}
onChange={(e) => {
setColor(e.target.value);
contextRef.current.strokeStyle = e.target.value;
}}
className="w-10 h-10 cursor-pointer"
/>
<input
type="range"
min="1"
max="20"
value={brushSize}
onChange={(e) => {
setBrushSize(e.target.value);
contextRef.current.lineWidth = e.target.value;
}}
className="w-24"
/>
<button
onClick={clearCanvas}
className="whiteboard-tool bg-red-500 text-white"
>
Clear
</button>
</div>
<div className="border border-gray-300 rounded-lg overflow-hidden">
<canvas
ref={canvasRef}
onMouseDown={startDrawing}
onMouseMove={draw}
onMouseUp={stopDrawing}
onMouseLeave={stopDrawing}
className="bg-white cursor-crosshair"
/>
</div>
<div className="mt-4 text-sm text-gray-600">
<p>Note: In a real implementation, this would use Yjs over WebRTC for real-time collaboration.</p>
<p>Electron would initialize a Yjs provider and bind the canvas state to a shared document.</p>
</div>
</div>
);
};
// 61. Screen Recording & AI Summarization
const ScreenRecordingModule = () => {
const [isRecording, setIsRecording] = useState(false);
const [recordingStatus, setRecordingStatus] = useState('Ready to record');
const [summary, setSummary] = useState('');
const [showSummaryModal, setShowSummaryModal] = useState(false);
const startRecording = () => {
setIsRecording(true);
setRecordingStatus('Recording in progress...');
// In Electron, this would use desktopCapturer API
// Example:
// ipcRenderer.send('start-recording', { sourceId: selectedSourceId });
};
const stopRecording = () => {
setIsRecording(false);
setRecordingStatus('Processing recording...');
// Simulate AI summarization
setTimeout(() => {
setRecordingStatus('Recording complete');
setSummary("This is a simulated AI-generated summary of the meeting. Key points discussed:\n\n1. Project timeline was reviewed and adjusted\n2. Budget concerns were addressed\n3. Team agreed on new feature priorities");
setShowSummaryModal(true);
}, 2000);
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Screen Recording with AI Summarization</h3>
<div className="flex space-x-4 mb-6">
<button
onClick={startRecording}
disabled={isRecording}
className={`px-4 py-2 rounded-lg ${isRecording ? 'bg-gray-300' : 'bg-red-500 text-white'}`}
>
Start Recording
</button>
<button
onClick={stopRecording}
disabled={!isRecording}
className={`px-4 py-2 rounded-lg ${!isRecording ? 'bg-gray-300' : 'bg-blue-500 text-white'}`}
>
Stop Recording
</button>
</div>
<div className="bg-gray-100 p-4 rounded-lg mb-6">
<p className="font-medium">Status: {recordingStatus}</p>
{isRecording && (
<div className="mt-2 flex items-center">
<div className="w-3 h-3 bg-red-500 rounded-full mr-2 animate-pulse"></div>
<span>Recording</span>
</div>
)}
</div>
<div className="border border-gray-300 rounded-lg p-4 bg-gray-50">
<h4 className="font-medium mb-2">Electron Implementation Notes:</h4>
<ul className="list-disc pl-5 text-sm text-gray-700">
<li>Use <code>desktopCapturer.getSources()</code> to list available screens/windows</li>
<li>Create a MediaRecorder instance with the selected source</li>
<li>Stream recording to a file (MP4 format)</li>
<li>When stopped, send file to OpenAI API with prompt "Summarize this meeting"</li>
<li>Display returned summary in modal</li>
</ul>
</div>
{/* Summary Modal */}
{showSummaryModal && (
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div className="bg-white rounded-lg p-6 max-w-2xl max-h-[80vh] overflow-auto">
<div className="flex justify-between items-center mb-4">
<h3 className="text-xl font-bold">Meeting Summary</h3>
<button
onClick={() => setShowSummaryModal(false)}
className="text-gray-500 hover:text-gray-700"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div className="whitespace-pre-line mb-4">{summary}</div>
<div className="flex space-x-3">
<button className="px-4 py-2 bg-blue-500 text-white rounded-lg">
Copy to Clipboard
</button>
<button className="px-4 py-2 bg-gray-200 rounded-lg">
Export as TXT
</button>
<button className="px-4 py-2 bg-gray-200 rounded-lg">
Save to Notes
</button>
</div>
</div>
</div>
)}
</div>
);
};
// 62. Cloud Storage Integration
const CloudStorageModule = () => {
const [connectedServices, setConnectedServices] = useState([]);
const [files, setFiles] = useState([]);
const [currentFolder, setCurrentFolder] = useState('root');
const connectService = (service) => {
// In Electron, this would use electron-oauth2 for OAuth flow
setConnectedServices([...connectedServices, service]);
// Simulate loading files after connection
setTimeout(() => {
setFiles([
{ id: '1', name: 'Project Proposal.docx', type: 'file', size: '2.4 MB', modified: '2023-05-15' },
{ id: '2', name: 'Meeting Notes', type: 'folder', size: '', modified: '2023-05-10' },
{ id: '3', name: 'Budget.xlsx', type: 'file', size: '1.2 MB', modified: '2023-05-08' },
{ id: '4', name: 'Research Papers', type: 'folder', size: '', modified: '2023-04-28' },
]);
}, 1000);
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Cloud Storage Integration</h3>
<div className="mb-6">
<h4 className="font-medium mb-2">Connect Services:</h4>
<div className="flex space-x-3">
<button
onClick={() => connectService('google-drive')}
disabled={connectedServices.includes('google-drive')}
className={`px-4 py-2 rounded-lg flex items-center ${connectedServices.includes('google-drive') ? 'bg-gray-200' : 'bg-blue-500 text-white'}`}
>
<svg className="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 24 24">
<path d="M7.73 18.39L11.16 12H7.6l-1.3-2.26L3 16.2c-.31.54-.49 1.16-.49 1.8 0 2.21 1.79 4 4 4 1.2 0 2.3-.55 3.03-1.5.14-.18.25-.38.34-.58l-.15-.53H7.73z"/>
<path d="M22 9.24c0-.31-.04-.61-.15-.9l-3.05-5.26c-.36-.62-1.02-1-1.73-1-1.21 0-2.2.99-2.2 2.2 0 .23.04.45.1.67l2.01 3.48h2.97z"/>
<path d="M21.55 20.1c-.56-.69-1.4-1.1-2.32-1.1H12.5l2.33-4.01 2.15-3.7 4.58-7.93c.12-.21.19-.45.19-.7 0-.8-.66-1.46-1.46-1.46-.29 0-.56.09-.8.23l-5.33 3.23-1.66 2.88-3.03 5.25c-.19.33-.3.71-.3 1.11 0 .42.12.81.33 1.15l-1.63 2.83c-.19.32-.29.68-.29 1.06 0 1.18.96 2.14 2.14 2.14h10.71c.76 0 1.45-.34 1.91-.88.24-.28.4-.61.47-.97.06-.35.03-.71-.09-1.04z"/>
</svg>
Google Drive
</button>
<button
onClick={() => connectService('dropbox')}
disabled={connectedServices.includes('dropbox')}
className={`px-4 py-2 rounded-lg flex items-center ${connectedServices.includes('dropbox') ? 'bg-gray-200' : 'bg-blue-600 text-white'}`}
>
<svg className="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 24 24">
<path d="M6 6.002L12 3l6 3.002v5.996l-6 3-6-3V6.002zM6 12l6 3 6-3-6-3-6 3z"/>
<path d="M6 12.002v5.996l6 3 6-3v-5.996l-6 3-6-3z"/>
</svg>
Dropbox
</button>
</div>
</div>
{connectedServices.length > 0 && (
<div className="border border-gray-200 rounded-lg overflow-hidden">
<div className="bg-gray-100 px-4 py-2 flex justify-between items-center">
<div className="flex items-center">
<button
onClick={() => setCurrentFolder('root')}
className="text-blue-500 hover:underline"
>
My Drive
</button>
{currentFolder !== 'root' && (
<span className="mx-2">/ {currentFolder}</span>
)}
</div>
<div className="flex space-x-2">
<button className="p-1 text-gray-600 hover:text-gray-900">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-5L9 3H4zm7 5a1 1 0 10-2 0v1H8a1 1 0 100 2h1v1a1 1 0 102 0v-1h1a1 1 0 100-2h-1V9z" clipRule="evenodd" />
</svg>
</button>
<button className="p-1 text-gray-600 hover:text-gray-900">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clipRule="evenodd" />
</svg>
</button>
</div>
</div>
<div className="divide-y divide-gray-200">
{files.map(file => (
<div key={file.id} className="flex items-center px-4 py-3 hover:bg-gray-50">
<div className="flex-shrink-0 mr-3">
{file.type === 'folder' ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-yellow-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-blue-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
)}
</div>
<div className="flex-1 min-w-0">
<p className="text-sm font-medium text-gray-900 truncate">
{file.name}
</p>
<p className="text-xs text-gray-500">
{file.size && `${file.size} • `}Modified {file.modified}
</p>
</div>
<div className="flex space-x-2">
<button className="p-1 text-gray-500 hover:text-gray-700">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z" />
</svg>
</button>
<button
onClick={() => file.type === 'folder' && setCurrentFolder(file.name)}
className="p-1 text-gray-500 hover:text-gray-700"
>
{file.type === 'folder' ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clipRule="evenodd" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clipRule="evenodd" />
</svg>
)}
</button>
</div>
</div>
))}
</div>
</div>
)}
<div className="mt-4 text-sm text-gray-600">
<p>Implementation notes:</p>
<ul className="list-disc pl-5">
<li>Use <code>electron-oauth2</code> for OAuth flows with Google Drive and Dropbox</li>
<li>Store access tokens securely in encrypted SQLite</li>
<li>Implement conflict detection when syncing local documents with cloud versions</li>
<li>Show diff view when conflicts are detected and let user choose which version to keep</li>
</ul>
</div>
</div>
);
};
// 63. Document Translation
const DocumentTranslationModule = () => {
const [sourceText, setSourceText] = useState('');
const [translatedText, setTranslatedText] = useState('');
const [sourceLanguage, setSourceLanguage] = useState('en');
const [targetLanguage, setTargetLanguage] = useState('es');
const [isTranslating, setIsTranslating] = useState(false);
const languages = [
{ code: 'en', name: 'English' },
{ code: 'es', name: 'Spanish' },
{ code: 'fr', name: 'French' },
{ code: 'de', name: 'German' },
{ code: 'it', name: 'Italian' },
{ code: 'pt', name: 'Portuguese' },
{ code: 'ru', name: 'Russian' },
{ code: 'zh', name: 'Chinese' },
{ code: 'ja', name: 'Japanese' },
{ code: 'ar', name: 'Arabic' },
];
const translateText = () => {
if (!sourceText.trim()) return;
setIsTranslating(true);
// Simulate API call delay
setTimeout(() => {
// In a real app, this would call Google Translate API or OpenAI via Electron IPC
setTranslatedText(`This is a simulated translation from ${sourceLanguage} to ${targetLanguage}.\n\nOriginal text: "${sourceText}"`);
setIsTranslating(false);
}, 1500);
};
const copyToClipboard = (text) => {
navigator.clipboard.writeText(text);
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Document Translation</h3>
<div className="flex mb-4 space-x-4">
<div className="flex-1">
<label className="block text-sm font-medium text-gray-700 mb-1">Source Language</label>
<select
value={sourceLanguage}
onChange={(e) => setSourceLanguage(e.target.value)}
className="w-full p-2 border border-gray-300 rounded-lg"
>
{languages.map(lang => (
<option key={`src-${lang.code}`} value={lang.code}>{lang.name}</option>
))}
</select>
</div>
<div className="flex items-center">
<button
onClick={() => {
const temp = sourceLanguage;
setSourceLanguage(targetLanguage);
setTargetLanguage(temp);
setSourceText(translatedText);
setTranslatedText(sourceText);
}}
className="p-2 bg-gray-200 rounded-lg hover:bg-gray-300"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z" clipRule="evenodd" />
</svg>
</button>
</div>
<div className="flex-1">
<label className="block text-sm font-medium text-gray-700 mb-1">Target Language</label>
<select
value={targetLanguage}
onChange={(e) => setTargetLanguage(e.target.value)}
className="w-full p-2 border border-gray-300 rounded-lg"
>
{languages.map(lang => (
<option key={`tgt-${lang.code}`} value={lang.code}>{lang.name}</option>
))}
</select>
</div>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<div className="flex justify-between items-center mb-1">
<label className="block text-sm font-medium text-gray-700">Original Text</label>
<button
onClick={() => copyToClipboard(sourceText)}
className="text-xs text-blue-500 hover:text-blue-700"
>
Copy
</button>
</div>
<textarea
value={sourceText}
onChange={(e) => setSourceText(e.target.value)}
className="w-full h-64 p-3 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500"
placeholder="Enter text to translate..."
/>
</div>
<div>
<div className="flex justify-between items-center mb-1">
<label className="block text-sm font-medium text-gray-700">Translation</label>
<button
onClick={() => copyToClipboard(translatedText)}
className="text-xs text-blue-500 hover:text-blue-700"
>
Copy
</button>
</div>
<div className="w-full h-64 p-3 border border-gray-300 rounded-lg bg-gray-50 overflow-auto">
{isTranslating ? (
<div className="flex items-center justify-center h-full">
<div className="animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-blue-500"></div>
</div>
) : (
translatedText || <span className="text-gray-400">Translation will appear here</span>
)}
</div>
</div>
</div>
<div className="flex justify-center">
<button
onClick={translateText}
disabled={!sourceText.trim() || isTranslating}
className={`px-6 py-2 rounded-lg text-white ${!sourceText.trim() || isTranslating ? 'bg-gray-400' : 'bg-blue-600 hover:bg-blue-700'}`}
>
{isTranslating ? 'Translating...' : 'Translate'}
</button>
</div>
<div className="mt-4 text-sm text-gray-600">
<p>Implementation notes:</p>
<ul className="list-disc pl-5">
<li>In Electron, implement Google Translate API or OpenAI API calls</li>
<li>For Google Translate: Use <code>@google-cloud/translate</code> with API key</li>
<li>For OpenAI: Send prompt "Translate the following from {source} to {target}: {text}"</li>
<li>Cache translations locally to reduce API calls</li>
</ul>
</div>
</div>
);
};
// 64. Universal Search
const UniversalSearchModule = () => {
const [searchQuery, setSearchQuery] = useState('');
const [searchResults, setSearchResults] = useState([]);
const [isSearching, setIsSearching] = useState(false);
const mockResults = [
{
type: 'note',
title: 'Meeting Notes - May 15',
snippet: 'Discussed project timeline and budget concerns...',
date: '2023-05-15',
module: 'Notes'
},
{
type: 'document',
title: 'Project Proposal.docx',
snippet: 'Contains the full project proposal with milestones...',
date: '2023-05-10',
module: 'Documents'
},
{
type: 'flashcard',
title: 'JavaScript Concepts',
snippet: 'Question: What is closure in JavaScript? Answer: A closure is...',
date: '2023-05-08',
module: 'Flashcards'
},
{
type: 'email',
title: 'RE: Client Feedback',
snippet: 'The client provided positive feedback on the latest...',
date: '2023-05-03',
module: 'Email'
}
];
const performSearch = () => {
if (!searchQuery.trim()) return;
setIsSearching(true);
// Simulate search delay
setTimeout(() => {
// In a real app, this would call Electron IPC to search indexed data
setSearchResults(mockResults.filter(item =>
item.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
item.snippet.toLowerCase().includes(searchQuery.toLowerCase())
));
setIsSearching(false);
}, 800);
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Universal Search</h3>
<div className="relative mb-6">
<input
type="text"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && performSearch()}
placeholder="Search across all modules..."
className="w-full p-4 pl-12 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500"
/>
<div className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</div>
<button
onClick={performSearch}
className="absolute right-3 top-1/2 transform -translate-y-1/2 bg-blue-500 text-white px-4 py-1 rounded-lg hover:bg-blue-600"
>
Search
</button>
</div>
{isSearching ? (
<div className="flex justify-center items-center h-32">
<div className="animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-blue-500"></div>
</div>
) : searchResults.length > 0 ? (
<div className="space-y-4">
{searchResults.map((result, index) => (
<div key={index} className="border border-gray-200 rounded-lg p-4 hover:bg-gray-50">
<div className="flex items-start">
<div className="flex-shrink-0 mr-4">
{result.type === 'note' && (
<div className="bg-yellow-100 p-2 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-yellow-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
)}
{result.type === 'document' && (
<div className="bg-blue-100 p-2 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
)}
{result.type === 'flashcard' && (
<div className="bg-green-100 p-2 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
</svg>
</div>
)}
{result.type === 'email' && (
<div className="bg-red-100 p-2 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-red-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
</div>
)}
</div>
<div className="flex-1 min-w-0">
<h4 className="text-lg font-medium text-gray-900 mb-1">{result.title}</h4>
<p className="text-sm text-gray-600 mb-2">{result.snippet}</p>
<div className="flex items-center text-xs text-gray-500">
<span className="mr-3">{result.module}</span>
<span>{result.date}</span>
</div>
</div>
</div>
</div>
))}
</div>
) : searchQuery ? (
<div className="text-center py-8 text-gray-500">
No results found for "{searchQuery}"
</div>
) : (
<div className="text-center py-8 text-gray-500">
Enter a search term to find content across all modules
</div>
)}
<div className="mt-4 text-sm text-gray-600">
<p>Implementation notes:</p>
<ul className="list-disc pl-5">
<li>Use <code>lunr.js</code> in Electron to index all user data (notes, flashcards, docs)</li>
<li>Index fields: title, content, tags, dates, and module type</li>
<li>Expose IPC endpoint <code>search(query)</code> that returns grouped results</li>
<li>Update index whenever data changes (add/update/delete)</li>
</ul>
</div>
</div>
);
};
// 65. Presentation Rehearsal Coach
const PresentationCoachModule = () => {
const [isRecording, setIsRecording] = useState(false);
const [slides, setSlides] = useState([
{ id: 1, title: 'Introduction', content: 'Welcome and agenda overview' },
{ id: 2, title: 'Market Analysis', content: 'Current trends and opportunities' },
{ id: 3, title: 'Product Demo', content: 'Key features and benefits' },
{ id: 4, title: 'Roadmap', content: 'Future development plans' },
{ id: 5, title: 'Q&A', content: 'Open discussion' },
]);
const [currentSlide, setCurrentSlide] = useState(0);
const [feedback, setFeedback] = useState(null);
const startRehearsal = () => {
setIsRecording(true);
setCurrentSlide(0);
setFeedback(null);
};
const stopRehearsal = () => {
setIsRecording(false);
// Simulate AI feedback generation
setTimeout(() => {
setFeedback({
pacing: 'You spent an average of 45 seconds per slide which is good, but the Product Demo section was a bit rushed at 30 seconds.',
fillerWords: 'You used "um" 12 times and "like" 8 times. Try to pause instead of using filler words.',
clarity: 'Your explanation of the Market Analysis was very clear. The Roadmap section could use more concrete examples.',
overall: 'Good rehearsal! Focus on reducing filler words and adding more examples in the Roadmap section.'
});
}, 2000);
};
const nextSlide = () => {
if (currentSlide < slides.length - 1) {
setCurrentSlide(currentSlide + 1);
}
};
const prevSlide = () => {
if (currentSlide > 0) {
setCurrentSlide(currentSlide - 1);
}
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Presentation Rehearsal Coach</h3>
<div className="flex justify-center mb-6 space-x-4">
{!isRecording ? (
<button
onClick={startRehearsal}
className="px-6 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600"
>
Start Rehearsal
</button>
) : (
<button
onClick={stopRehearsal}
className="px-6 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600"
>
Stop Rehearsal
</button>
)}
</div>
<div className="border border-gray-200 rounded-lg overflow-hidden mb-6">
<div className="bg-gray-100 px-4 py-2 flex justify-between items-center">
<div>
{isRecording && (
<div className="flex items-center">
<div className="w-3 h-3 bg-red-500 rounded-full mr-2 animate-pulse"></div>
<span className="text-sm">Recording</span>
</div>
)}
</div>
<div className="text-sm text-gray-600">
Slide {currentSlide + 1} of {slides.length}
</div>
</div>
<div className="p-8 bg-white min-h-96 flex flex-col items-center justify-center">
<h3 className="text-2xl font-bold mb-4 text-center">{slides[currentSlide].title}</h3>
<p className="text-lg text-gray-700 text-center mb-8">{slides[currentSlide].content}</p>
<div className="flex space-x-4">
<button
onClick={prevSlide}
disabled={currentSlide === 0}
className={`px-4 py-2 rounded-lg ${currentSlide === 0 ? 'bg-gray-200' : 'bg-blue-500 text-white'}`}
>
Previous
</button>
<button
onClick={nextSlide}
disabled={currentSlide === slides.length - 1}
className={`px-4 py-2 rounded-lg ${currentSlide === slides.length - 1 ? 'bg-gray-200' : 'bg-blue-500 text-white'}`}
>
Next
</button>
</div>
</div>
</div>
{feedback && (
<div className="border border-gray-200 rounded-lg p-6 bg-blue-50">
<h4 className="text-lg font-semibold mb-4">AI Feedback on Your Rehearsal</h4>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h5 className="font-medium mb-2">Pacing</h5>
<p className="text-gray-700">{feedback.pacing}</p>
</div>
<div>
<h5 className="font-medium mb-2">Filler Words</h5>
<p className="text-gray-700">{feedback.fillerWords}</p>
</div>
<div>
<h5 className="font-medium mb-2">Clarity</h5>
<p className="text-gray-700">{feedback.clarity}</p>
</div>
<div>
<h5 className="font-medium mb-2">Overall</h5>
<p className="text-gray-700">{feedback.overall}</p>
</div>
</div>
</div>
)}
<div className="mt-4 text-sm text-gray-600">
<p>Implementation notes:</p>
<ul className="list-disc pl-5">
<li>Record audio and track slide timestamps during rehearsal</li>
<li>Send audio to Whisper for transcription</li>
<li>Analyze transcript with OpenAI: "Provide feedback on pacing, filler words, and clarity"</li>
<li>Display detailed feedback with timestamps and suggestions</li>
</ul>
</div>
</div>
);
};
// 66. Study Group & AI Tutor Chat
const StudyGroupModule = () => {
const [messages, setMessages] = useState([
{ id: 1, sender: 'Alice', text: 'Hi everyone! Ready to study for the exam?', timestamp: '10:00 AM' },
{ id: 2, sender: 'Bob', text: 'Yes! I have some questions about chapter 3', timestamp: '10:02 AM' },
{ id: 3, sender: 'Charlie', text: 'Me too, especially the part about closures', timestamp: '10:03 AM' },
]);
const [newMessage, setNewMessage] = useState('');
const [aiTyping, setAiTyping] = useState(false);
const sendMessage = () => {
if (!newMessage.trim()) return;
// Add user message
const userMsg = {
id: messages.length + 1,
sender: 'You',
text: newMessage,
timestamp: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
};
setMessages([...messages, userMsg]);
setNewMessage('');
// Check if message is for AI
if (newMessage.startsWith('@AI')) {
setAiTyping(true);
// Simulate AI response
setTimeout(() => {
const aiMsg = {
id: messages.length + 2,
sender: 'AI Tutor',
text: 'In JavaScript, a closure is a function that has access to its own scope, the outer function\'s variables, and the global variables. This is a fundamental concept for understanding how scope works in JavaScript.',
timestamp: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
};
setMessages(prev => [...prev, aiMsg]);
setAiTyping(false);
}, 1500);
}
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Study Group & AI Tutor Chat</h3>
<div className="border border-gray-200 rounded-lg overflow-hidden mb-4">
<div className="bg-gray-100 px-4 py-2 flex justify-between items-center">
<div className="font-medium">Study Group: JavaScript Concepts</div>
<div className="text-sm text-gray-600">3 participants</div>
</div>
<div className="h-96 overflow-y-auto p-4 bg-white">
{messages.map(msg => (
<div
key={msg.id}
className={`mb-4 ${msg.sender === 'You' ? 'text-right' : 'text-left'}`}
>
<div className={`inline-block max-w-xs md:max-w-md lg:max-w-lg px-4 py-2 rounded-lg ${msg.sender === 'You' ? 'bg-blue-500 text-white' : msg.sender === 'AI Tutor' ? 'bg-green-500 text-white' : 'bg-gray-200'}`}>
<div className="font-medium">{msg.sender}</div>
<div>{msg.text}</div>
<div className="text-xs mt-1 opacity-70">{msg.timestamp}</div>
</div>
</div>
))}
{aiTyping && (
<div className="text-left mb-4">
<div className="inline-block max-w-xs md:max-w-md lg:max-w-lg px-4 py-2 rounded-lg bg-green-500 text-white">
<div className="font-medium">AI Tutor</div>
<div className="flex space-x-1">
<div className="w-2 h-2 bg-white rounded-full animate-bounce"></div>
<div className="w-2 h-2 bg-white rounded-full animate-bounce" style={{ animationDelay: '0.2s' }}></div>
<div className="w-2 h-2 bg-white rounded-full animate-bounce" style={{ animationDelay: '0.4s' }}></div>
</div>
</div>
</div>
)}
</div>
</div>
<div className="flex">
<input
type="text"
value={newMessage}
onChange={(e) => setNewMessage(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && sendMessage()}
placeholder="Type your message... (use @AI for tutor questions)"
className="flex-1 p-3 border border-gray-300 rounded-l-lg focus:ring-blue-500 focus:border-blue-500"
/>
<button
onClick={sendMessage}
className="px-4 py-3 bg-blue-500 text-white rounded-r-lg hover:bg-blue-600"
>
Send
</button>
</div>
<div className="mt-4 text-sm text-gray-600">
<p>Implementation notes:</p>
<ul className="list-disc pl-5">
<li>Use Socket.io in Electron for real-time chat</li>
<li>Detect messages starting with @AI and forward to OpenAI</li>
<li>Prompt OpenAI with "Act as a tutor and answer this"</li>
<li>Persist messages in SQLite "chat" table</li>
</ul>
</div>
</div>
);
};
// 67. Voice Note to Task Automator
const VoiceTasksModule = () => {
const [isRecording, setIsRecording] = useState(false);
const [tasks, setTasks] = useState([
{ id: 1, text: 'Finish project proposal by Friday', due: '2023-06-02', completed: false },
{ id: 2, text: 'Schedule meeting with client', due: '2023-06-01', completed: true },
{ id: 3, text: 'Review budget spreadsheet', due: '2023-06-03', completed: false },
]);
const [transcript, setTranscript] = useState('');
const startRecording = () => {
setIsRecording(true);
setTranscript('');
// In a real app, this would use the Web Speech API or Electron's audio capture
};
const stopRecording = () => {
setIsRecording(false);
// Simulate transcription and task extraction
setTimeout(() => {
setTranscript("I need to buy groceries tomorrow and call the dentist by Friday afternoon. Also, don't forget to send the report to John by end of day Thursday.");
setTimeout(() => {
setTasks([
...tasks,
{ id: 4, text: 'Buy groceries', due: '2023-06-01', completed: false },
{ id: 5, text: 'Call dentist', due: '2023-06-02', dueTime: '14:00', completed: false },
{ id: 6, text: 'Send report to John', due: '2023-06-01', completed: false },
]);
}, 1500);
}, 2000);
};
const toggleTask = (id) => {
setTasks(tasks.map(task =>
task.id === id ? { ...task, completed: !task.completed } : task
));
};
return (
<div className="bg-white rounded-lg shadow-lg p-6">
<h3 className="text-lg font-semibold mb-4">Voice Notes to Tasks</h3>
<div className="flex justify-center mb-6">
{!isRecording ? (
<button
onClick={startRecording}
className="flex items-center px-6 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-2" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M7 4a3 3 0 016 0v4a3 3 0 11-6 0V4zm4 10.93A7.001 7.001 0 0017 8a1 1 0 10-2 0A5 5 0 015 8a1 1 0 00-2 0 7.001 7.001 0 006 6.93V17H6a1 1 0 100 2h8a1 1 0 100-2h-3v-2.07z" clipRule="evenodd" />
</svg>
Record Task Note
</button>
) : (
<button
onClick={stopRecording}
className="flex items-center px-6 py-3 bg-red-500 text-white rounded-lg hover:bg-red-600"
>
<div className="w-3 h-3 bg-white rounded-full mr-2 animate-pulse"></div>
Stop Recording
</button>
)}
</div>
{transcript && (
<div className="mb-6 p-4 bg-blue-50 rounded-lg">
<h4 className="font-medium mb-2">Transcript:</h4>
<p className="text-gray-700">{transcript}</p>
</div>
)}
<div className="border border-gray-200 rounded-lg overflow-hidden">
<div className="bg-gray-100 px-4 py-2 font-medium">Extracted Tasks</div>
{tasks.length > 0 ? (
<ul className="divide-y divide-gray-200">
{tasks.map(task => (
<li key={task.id} className="px-4 py-3 hover:bg-gray-50">
<div className="flex items-center">
<input
type="checkbox"
checked={task.completed}
onChange={() => toggleTask(task.id)}
className="h-4 w-4 text-blue-600 rounded"
/>
<div className="ml-3 flex-1">
<span className={`${task.completed ? 'line-through text-gray-400' : 'text-gray-700'}`}>
{task.text}
</span>
{task.due && (
<span className="ml-2 text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded">
Due: {task.due}{task.dueTime ? ` at ${task.dueTime}` : ''}
</span>
)}
</div>
<button className="text-gray-400 hover:text-gray-600">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clipRule="evenodd" />
</svg>
</button>
</div>
</li>
))}
</ul>
) : (
<div className="p-4 text-center text-gray-500">
No tasks yet. Record a voice note to extract tasks.
</div>
)}
</div>
<div className="mt-4 text-sm text-gray-600">
<p>Implementation notes:</p>
<ul className="list-disc pl-5">
<li>Record audio in React using Web Speech API or Electron's audio capture</li>
<li>Send audio to Whisper for transcription</li>
<li>Parse transcript with OpenAI: "Extract tasks with due dates"</li>
<li>Insert tasks into SQLite "tasks" table and schedule node-cron reminders</li>
</ul>
</div>
</div>
);
};
// 68. AI Email Assistant
const EmailAssistantModule = () => {
const [email, setEmail] = useState({
to: '',
subject: '',
body: '',
isGenerating: false
});
const [sentEmails, setSentEmails] = useState([
{ id: 1, to: 'client@example.com', subject: 'Project Update', date: '2023-05-20', status: 'sent' },
{ id: 2, to: 'team@example.com', subject: 'Meeting Notes', date: '2023-05-18', status: 'sent' },
]);
const generateDraft = () => {
if (!email.subject) return;
setEmail({ ...email, isGenerating: true });
// Simulate AI generation
setTimeout(() => {
setEmail({
...email,
body: `Dear
</html> |