Skip to content

Commit 5d44dd6

Browse files
[fix πŸ™‚] code editor | output etc build issues fixed πŸ±β€πŸ
1 parent a8b176c commit 5d44dd6

4 files changed

Lines changed: 32 additions & 35 deletions

File tree

β€Žwebsites/src/app/_components/code-editor.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useTheme } from 'next-themes';
55
import { Card, CardContent } from '@/components/ui/card';
66
import { Badge } from '@/components/ui/badge';
77
import { Loader2 } from 'lucide-react';
8-
import { LANGUAGE_MAP, SAMPLE_CODE } from '@/constants';
8+
import { LANGUAGE_MAP } from '@/constants';
99
import { Language } from '@/@types';
1010

1111
interface CodeEditorProps {

β€Žwebsites/src/app/_components/output-viewer.tsxβ€Ž

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import { Card, CardContent } from '@/components/ui/card';
66
import { Button } from '@/components/ui/button';
77
import { Badge } from '@/components/ui/badge';
88
import { Copy, Download, Terminal } from 'lucide-react';
9+
import { Language, Status } from '@/@types';
10+
import { editorOptions } from '@/constants/editor';
911

1012
interface OutputViewerProps {
1113
output: string;
12-
language: string;
14+
language: Language;
1315
executionTime?: number;
14-
status: 'success' | 'error' | 'running';
16+
status: Status;
1517
}
1618

1719
export function OutputViewer({
@@ -35,34 +37,13 @@ export function OutputViewer({
3537
const url = URL.createObjectURL(blob);
3638
const a = document.createElement('a');
3739
a.href = url;
38-
a.download = `output_${Date.now()}.txt`;
40+
a.download = `executeme_${Date.now()}.txt`;
3941
document.body.appendChild(a);
4042
a.click();
4143
document.body.removeChild(a);
4244
URL.revokeObjectURL(url);
4345
};
4446

45-
const editorOptions = {
46-
readOnly: true,
47-
minimap: { enabled: false },
48-
fontSize: 14,
49-
lineNumbers: 'on' as const,
50-
scrollBeyondLastLine: false,
51-
automaticLayout: true,
52-
wordWrap: 'on' as const,
53-
contextmenu: false,
54-
selectOnLineNumbers: false,
55-
lineDecorationsWidth: 10,
56-
lineNumbersMinChars: 3,
57-
glyphMargin: false,
58-
folding: false,
59-
fontFamily:
60-
"'Fira Code', 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",
61-
fontLigatures: true,
62-
renderWhitespace: 'none' as const,
63-
renderControlCharacters: false,
64-
};
65-
6647
return (
6748
<Card className="overflow-hidden">
6849
<CardContent className="p-0">
@@ -112,9 +93,10 @@ export function OutputViewer({
11293
<div className="relative">
11394
<Editor
11495
height="300px"
115-
language="plaintext"
96+
language={'plaintext'}
11697
value={
117-
output || 'No output yet. Execute your code to see results here.'
98+
output ||
99+
`No ${language} output yet. Execute your code to see results here.`
118100
}
119101
theme={
120102
status === 'error' ? 'vs' : theme === 'dark' ? 'vs-dark' : 'vs'

β€Žwebsites/src/app/page.tsxβ€Ž

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use client';
22

3-
import type React from 'react';
4-
53
import { useState } from 'react';
64
import { Button } from '@/components/ui/button';
75
import {
@@ -11,7 +9,6 @@ import {
119
CardHeader,
1210
CardTitle,
1311
} from '@/components/ui/card';
14-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
1512
import {
1613
Select,
1714
SelectContent,
@@ -20,7 +17,7 @@ import {
2017
SelectValue,
2118
} from '@/components/ui/select';
2219
import { Badge } from '@/components/ui/badge';
23-
import { Upload, Play, FileText, Clock, Code2 } from 'lucide-react';
20+
import { Play, FileText, Clock, Code2 } from 'lucide-react';
2421
import { SUPPORTED_LANGUAGES } from '@/constants/language';
2522
import { CodeEditor } from './_components/code-editor';
2623
import { OutputViewer } from './_components/output-viewer';
@@ -30,15 +27,12 @@ import { ExecutionResult, Language } from '@/@types';
3027
export default function ExecuteMePlatform() {
3128
const [selectedLanguage, setSelectedLanguage] = useState<Language>('python');
3229
const [code, setCode] = useState('');
33-
const [uploadedFile, setUploadedFile] = useState<File | null>(null);
3430
const [executionResult, setExecutionResult] =
3531
useState<ExecutionResult | null>(null);
3632
const [isExecuting, setIsExecuting] = useState(false);
3733

3834
const executeCode = async () => {
39-
if (!code.trim()) {
40-
return;
41-
}
35+
if (!code.trim()) return;
4236

4337
setIsExecuting(true);
4438
setExecutionResult({
@@ -59,6 +53,7 @@ export default function ExecuteMePlatform() {
5953
language: selectedLanguage,
6054
});
6155
} catch (err) {
56+
console.log(err);
6257
setExecutionResult({
6358
status: 'error',
6459
output: 'error is here',
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const editorOptions = {
2+
readOnly: true,
3+
minimap: { enabled: false },
4+
fontSize: 14,
5+
lineNumbers: 'on' as const,
6+
scrollBeyondLastLine: false,
7+
automaticLayout: true,
8+
wordWrap: 'on' as const,
9+
contextmenu: false,
10+
selectOnLineNumbers: false,
11+
lineDecorationsWidth: 10,
12+
lineNumbersMinChars: 3,
13+
glyphMargin: false,
14+
folding: false,
15+
fontFamily:
16+
"'Fira Code', 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",
17+
fontLigatures: true,
18+
renderWhitespace: 'none' as const,
19+
renderControlCharacters: false,
20+
};

0 commit comments

Comments
Β (0)