diff --git a/.idea/deno.xml b/.idea/deno.xml new file mode 100644 index 0000000..b03feb5 --- /dev/null +++ b/.idea/deno.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/application/app.vue b/application/app.vue index 734c653..2f29ce4 100644 --- a/application/app.vue +++ b/application/app.vue @@ -1,15 +1,26 @@ - - - - - - - - + + + + + + + + + + diff --git a/application/assets/css/index.css b/application/assets/css/index.css index 4d646cc..4ddd86d 100644 --- a/application/assets/css/index.css +++ b/application/assets/css/index.css @@ -20,4 +20,9 @@ code, pre { pre { border-radius: 4px; +} + +a { + color: #c49e55; + text-decoration: none; } \ No newline at end of file diff --git a/application/bun.lockb b/application/bun.lockb index f6040fb..a0515e2 100755 Binary files a/application/bun.lockb and b/application/bun.lockb differ diff --git a/application/components/problem/preview/program.vue b/application/components/problem/preview/program.vue new file mode 100644 index 0000000..ae84ac0 --- /dev/null +++ b/application/components/problem/preview/program.vue @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/application/package.json b/application/package.json index 32024a1..73eaa36 100644 --- a/application/package.json +++ b/application/package.json @@ -26,6 +26,7 @@ "@ibm/plex": "^6.3.0", "@nuxtjs/mdc": "^0.2.8", "@supabase/supabase-js": "^2.39.0", + "highlight.js": "^11.9.0", "prismjs": "^1.29.0" } } diff --git a/application/pages/challenges/[id].vue b/application/pages/challenges/[id].vue index 5ec251a..72c1805 100644 --- a/application/pages/challenges/[id].vue +++ b/application/pages/challenges/[id].vue @@ -12,17 +12,52 @@ - + - + + + + + 状态 + {{ challenge?.status?.replaceAll("-", " ") }} + + + 问题 + + + #{{ challenge?.problem }} | {{ problem?.title }} + + + + + 答案 + + + + + + + + 结果 + + + + + + - + @@ -41,7 +76,7 @@ diff --git a/supabase/functions/judge-challenges/index.ts b/supabase/functions/judge-challenges/index.ts new file mode 100644 index 0000000..f1b224e --- /dev/null +++ b/supabase/functions/judge-challenges/index.ts @@ -0,0 +1,39 @@ +import { createClient } from "https://esm.sh/@supabase/supabase-js"; + +Deno.serve(async (req) => { + try { + const client = createClient( + Deno.env.get('SUPABASE_URL') ?? '', + Deno.env.get('SUPABASE_ANON_KEY') ?? '', + { global: { headers: { Authorization: req.headers.get('Authorization')! } } } + ) + + const { data, error } = await client + .from('challenges') + .select('*') + .eq('status', 'submitted') + + if (error) { + throw error + } + + return new Response(JSON.stringify({ data }), { + headers: { 'Content-Type': 'application/json' }, + status: 200, + }) + } catch (err) { + return new Response(String(err?.message ?? err), { status: 500 }) + } +}); + +/* To invoke locally: + + 1. Run `supabase start` (see: https://supabase.com/docs/reference/cli/supabase-start) + 2. Make an HTTP request: + + curl -i --location --request POST 'http://127.0.0.1:54321/functions/v1/judge-challenges' \ + --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \ + --header 'Content-Type: application/json' \ + --data '{"name":"Functions"}' + +*/