Skip to content

Commit c821d2e

Browse files
committed
merge: branch 'master' into i18n
2 parents 30c6304 + 9175584 commit c821d2e

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

app/(main)/submissions/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function SubmissionDetails({ submissionId }: { submissionId: string }) {
142142
<CardDescription>{t('details.log.description')}</CardDescription>
143143
</CardHeader>
144144
<CardContent>
145-
{problem && submission ? <SubmissionLogViewer submission={submission} problem={problem} onStatusUpdate={mutate} /> : <Skeleton className="h-96 w-full" />}
145+
{problem && submission ? <SubmissionLogViewer submission={submission} problem={problem} onStatusUpdate={mutate} /> : <Skeleton className="h-[60vh] w-full" />}
146146
</CardContent>
147147
</Card>
148148
</div>

components/submissions/submission-log-viewer.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ const StaticLogViewer = ({ submissionId, containerId }: { submissionId: string,
4848
</div>
4949
<div
5050
ref={logContainerRef}
51-
className="font-mono text-xs bg-muted rounded-md h-96 overflow-y-auto p-4"
51+
className="font-mono text-xs bg-muted rounded-md h-[60vh] overflow-y-auto p-4"
5252
>
53-
{isLoading && <Skeleton className="h-full w-full" />}
53+
{isLoading && <Skeleton className="h-[60vh] w-full" />}
5454
{error && <p className="text-red-400">Failed to load log.</p>}
5555
{messages.length > 0 && messages.map((msg, index) => (
5656
<span key={index} className="whitespace-pre-wrap break-all">
@@ -120,7 +120,7 @@ const RealtimeLogViewer = ({ wsUrl, onStatusUpdate }: { wsUrl: string | null, on
120120
</div>
121121
<div
122122
ref={logContainerRef}
123-
className="font-mono text-xs bg-muted rounded-md h-96 overflow-y-auto p-4"
123+
className="font-mono text-xs bg-muted rounded-md h-[60vh] overflow-y-auto p-4"
124124
>
125125
{messages.length === 0 && <p className="text-muted-foreground">Waiting for judge output...</p>}
126126
{messages.map((msg, index) => (
@@ -164,7 +164,7 @@ export function SubmissionLogViewer({ submission, problem, onStatusUpdate }: Sub
164164

165165
if (submission.containers.length === 0) {
166166
return (
167-
<div className="font-mono text-xs bg-muted rounded-md h-96 overflow-y-auto p-4 text-muted-foreground flex items-center justify-center">
167+
<div className="font-mono text-xs bg-muted rounded-md h-[60vh] overflow-y-auto p-4 text-muted-foreground flex items-center justify-center">
168168
Submission is in queue. No logs to display yet.
169169
</div>
170170
);
@@ -199,7 +199,7 @@ export function SubmissionLogViewer({ submission, problem, onStatusUpdate }: Sub
199199
return (
200200
<TabsContent key={container.id} value={container.id} className="mt-4">
201201
{!canShow ? (
202-
<div className="font-mono text-xs bg-muted rounded-md h-96 overflow-y-auto p-4 text-muted-foreground flex items-center justify-center">
202+
<div className="font-mono text-xs bg-muted rounded-md h-[60vh] overflow-y-auto p-4 text-muted-foreground flex items-center justify-center">
203203
Log for this step is hidden by the problem author.
204204
</div>
205205
) : isRunning ? (

components/submissions/submission-upload-form.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ interface SubmissionUploadFormProps {
2525

2626
const fetcher = (url: string) => api.get(url).then(res => res.data.data);
2727

28+
function btoaUTF8(str: string) {
29+
const bytes = new TextEncoder().encode(str);
30+
let binary = "";
31+
bytes.forEach(b => binary += String.fromCharCode(b));
32+
return btoa(binary);
33+
}
34+
2835
function AttemptsCounter({ problemId, onLimitReached }: { problemId: string, onLimitReached: (isReached: boolean) => void }) {
2936
const { data: attempts, isLoading } = useSWR<Attempts>(`/problems/${problemId}/attempts`, fetcher, {
3037
onSuccess: (data) => {
@@ -177,7 +184,7 @@ export default function SubmissionUploadForm({ problemId, uploadLimits }: Submis
177184
const formData = new FormData();
178185
filesToSubmit.forEach(file => {
179186
const filePath = (file as FileWithPath).path || (file as any).webkitRelativePath || file.name;
180-
formData.append('files', file, filePath);
187+
formData.append('files', file, btoaUTF8(filePath));
181188
});
182189

183190
try {

0 commit comments

Comments
 (0)