Skip to content

Commit

Permalink
Merge branch 'main' into 1347-arrange-folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dotoleeoak committed Feb 26, 2024
2 parents ba54ec1 + 67ebb8a commit 9628851
Show file tree
Hide file tree
Showing 22 changed files with 2,227 additions and 1,969 deletions.
20 changes: 10 additions & 10 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
"dependencies": {
"@apollo/server": "^4.10.0",
"@aws-sdk/client-s3": "^3.515.0",
"@aws-sdk/client-ses": "^3.515.0",
"@aws-sdk/credential-provider-node": "^3.515.0",
"@aws-sdk/client-s3": "^3.521.0",
"@aws-sdk/client-ses": "^3.521.0",
"@aws-sdk/credential-provider-node": "^3.521.0",
"@golevelup/nestjs-rabbitmq": "^4.1.0",
"@nestjs-modules/mailer": "^1.10.3",
"@nestjs-modules/mailer": "^1.11.0",
"@nestjs/apollo": "^12.1.0",
"@nestjs/axios": "^3.0.2",
"@nestjs/cache-manager": "^2.2.1",
Expand All @@ -34,8 +34,8 @@
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.3",
"@nestjs/swagger": "^7.3.0",
"@prisma/client": "^5.9.1",
"argon2": "^0.31.2",
"@prisma/client": "^5.10.2",
"argon2": "^0.40.1",
"axios": "^1.6.7",
"cache-manager": "^5.4.0",
"cache-manager-redis-yet": "^4.1.2",
Expand All @@ -53,7 +53,7 @@
"graphql-upload": "13.0.0",
"handlebars": "^4.7.8",
"nestjs-pino": "^4.0.0",
"nodemailer": "^6.9.9",
"nodemailer": "^6.9.10",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-jwt": "^4.0.1",
Expand All @@ -70,20 +70,20 @@
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.3",
"@types/cache-manager": "^4.0.6",
"@types/chai": "^4.3.11",
"@types/chai": "^4.3.12",
"@types/chai-as-promised": "^7.1.8",
"@types/express": "^4.17.21",
"@types/graphql-upload": "8.0.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.19",
"@types/node": "^20.11.20",
"@types/nodemailer": "^6.4.14",
"@types/passport-jwt": "^4.0.1",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.3",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.1",
"mocha": "^10.3.0",
"prisma": "^5.9.1",
"prisma": "^5.10.2",
"prisma-nestjs-graphql": "^20.0.2",
"proxyquire": "^2.1.3",
"sinon": "^17.0.1",
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/app/admin/problem/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export default function Page({ params }: { params: { id: string } }) {
<Textarea
id="inputDescription"
placeholder="Enter a description..."
className="h-[120px] w-[360px] resize-none bg-white"
className="min-h-[120px] w-[360px] bg-white"
{...register('inputDescription')}
/>
{errors.inputDescription && (
Expand All @@ -495,7 +495,7 @@ export default function Page({ params }: { params: { id: string } }) {
<Textarea
id="outputDescription"
placeholder="Enter a description..."
className="h-[120px] w-[360px] resize-none bg-white"
className="min-h-[120px] w-[360px] bg-white"
{...register('outputDescription')}
/>
{errors.outputDescription && (
Expand Down Expand Up @@ -642,7 +642,7 @@ export default function Page({ params }: { params: { id: string } }) {
<Textarea
id="hint"
placeholder="Enter a hint"
className="h-[120px] w-[760px] resize-none bg-white"
className="min-h-[120px] w-[760px] bg-white"
{...register('hint')}
/>
)}
Expand Down
14 changes: 9 additions & 5 deletions apps/frontend/app/admin/problem/_components/Columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Checkbox } from '@/components/ui/checkbox'
import { Switch } from '@/components/ui/switch'
import { useMutation } from '@apollo/client'
import type { ColumnDef } from '@tanstack/react-table'
import { useState } from 'react'
import { FiEyeOff } from 'react-icons/fi'
import { FiEye } from 'react-icons/fi'

Expand Down Expand Up @@ -36,26 +37,28 @@ const EDIT_VISIBLE = gql(`

function VisibleCell({ isVisible, id }: { isVisible: boolean; id: number }) {
const [updateVisible] = useMutation(EDIT_VISIBLE)
const [isVisibleState, setIsVisibleState] = useState(isVisible)

return (
<div className="flex space-x-2">
<Switch
id="hidden-mode"
checked={isVisible}
checked={isVisibleState}
onCheckedChange={() => {
setIsVisibleState(!isVisibleState)
updateVisible({
variables: {
groupId: 1,
input: {
id,
isVisible: !isVisible
isVisible: !isVisibleState
}
}
})
}}
/>
<div className="flex items-center justify-center">
{isVisible ? (
{isVisibleState ? (
<FiEye className="text-primary h-[14px] w-[14px]" />
) : (
<FiEyeOff className="h-[14px] w-[14px] text-gray-400" />
Expand Down Expand Up @@ -210,8 +213,9 @@ export const columns: ColumnDef<DataTableProblem>[] = [
<DataTableColumnHeader column={column} title="Visible" />
),
cell: ({ row }) => {
const isVisible: boolean = row.getValue('isVisible')
return <VisibleCell isVisible={isVisible} id={row.original.id} />
return (
<VisibleCell isVisible={row.original.isVisible} id={row.original.id} />
)
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function ExampleTextarea({
return (
<div
className={cn(
'relative flex h-[120px] w-full rounded-md border border-gray-200 bg-gray-50 py-3 font-mono shadow-sm',
'relative flex min-h-[120px] w-full rounded-md border border-gray-200 bg-gray-50 py-3 font-mono shadow-sm',
className
)}
>
Expand All @@ -36,7 +36,7 @@ export default function ExampleTextarea({
/>
<Textarea
placeholder="Output"
className="resize-none rounded-none border-l border-transparent border-l-gray-200 px-4 py-0 shadow-none focus-visible:ring-0"
className="min-h-[120px] rounded-none border-l border-transparent border-l-gray-200 px-4 py-0 shadow-none focus-visible:ring-0"
{...register(outputName)}
/>
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/app/admin/problem/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export default function Page() {
<Textarea
id="inputDescription"
placeholder="Enter a description..."
className="h-[120px] w-[360px] resize-none bg-white"
className="min-h-[120px] w-[360px] bg-white"
{...register('inputDescription')}
/>
{errors.inputDescription && (
Expand All @@ -390,7 +390,7 @@ export default function Page() {
<Textarea
id="outputDescription"
placeholder="Enter a description..."
className="h-[120px] w-[360px] resize-none bg-white"
className="min-h-[120px] w-[360px] bg-white"
{...register('outputDescription')}
/>
{errors.outputDescription && (
Expand Down Expand Up @@ -535,7 +535,7 @@ export default function Page() {
<Textarea
id="hint"
placeholder="Enter a hint"
className="h-[120px] w-[760px] resize-none bg-white"
className="min-h-[120px] w-[760px] bg-white"
{...register('hint')}
/>
)}
Expand Down
3 changes: 3 additions & 0 deletions apps/frontend/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import type { Metadata, Viewport } from 'next'
import { Manrope, Noto_Sans_KR, Ubuntu_Mono } from 'next/font/google'
import './globals.css'

// TODO: 추후에 페이지 별로 revalidate 시간 논의 및 조정 필요
export const revalidate = 5

const noto = Noto_Sans_KR({
subsets: ['latin'],
weight: ['400', '600'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { fetcherWithAuth } from '@/lib/utils'
import type { SubmissionDetail } from '@/types/type'
import dayjs from 'dayjs'
import { revalidateTag } from 'next/cache'
import { IoIosLock } from 'react-icons/io'

interface Props {
Expand All @@ -23,16 +24,30 @@ export default async function SubmissionDetail({
submissionId
}: Props) {
const res = await fetcherWithAuth(`submission/${submissionId}`, {
searchParams: {
problemId
},
cache: 'no-store'
searchParams: { problemId },
next: {
tags: [`submission/${submissionId}`]
}
})

if (res.status == 403) {
return (
<div className="flex h-[300px] flex-col items-center justify-center gap-20">
<IoIosLock size={100} />
<p>
Unable to check others&apos; until your correct submission is accepted
</p>
</div>
)
}

const submission: SubmissionDetail = await res.json()

await new Promise((resolve) => setTimeout(resolve, 10000))
if (submission.result == 'Judging') {
revalidateTag(`submission/${submissionId}`)
}

return res.ok ? (
return (
<>
<ScrollArea className="shrink-0 rounded-md">
<div className="flex items-center justify-around gap-5 bg-slate-700 p-5 text-sm [&>div]:flex [&>div]:flex-col [&>div]:items-center [&>div]:gap-1 [&_*]:whitespace-nowrap [&_p]:text-slate-400">
Expand Down Expand Up @@ -98,20 +113,15 @@ export default async function SubmissionDetail({
{item.result}
</TableCell>
<TableCell>{item.cpuTime} ms</TableCell>
<TableCell>{item.memoryUsage} mb</TableCell>
<TableCell>
{(item.memoryUsage / (1024 * 1024)).toFixed(2)} MB
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)}
</>
) : (
<div className="flex h-[300px] flex-col items-center justify-center gap-20">
<IoIosLock size={100} />
<p>
Unable to check others&apos; until your correct submission is accepted
</p>
</div>
)
}
1 change: 0 additions & 1 deletion apps/frontend/components/DataTableAdmin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export function DataTableAdmin<TData, TValue>({
}
})
} else {
console.log('delete', row.original.id)
return Promise.resolve()
}
})
Expand Down
Loading

0 comments on commit 9628851

Please sign in to comment.