mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 22:07:10 +00:00
Merge branch 'master' of gitlab.com:megazordpobeda/DataRush
This commit is contained in:
@@ -2,10 +2,6 @@ stages:
|
|||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
resource_group:
|
|
||||||
name: production
|
|
||||||
process_mode: oldest_first
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
DOCKER_TLS_CERTDIR: /certs
|
DOCKER_TLS_CERTDIR: /certs
|
||||||
DEPLOYMENT_VERSION: $CI_COMMIT_SHA
|
DEPLOYMENT_VERSION: $CI_COMMIT_SHA
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Stage 1: Install dependencies
|
# Stage 1: Install dependencies
|
||||||
FROM docker.io/python:3.11-alpine3.20 AS builder
|
FROM docker.io/python:3.13-alpine AS builder
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ RUN uv sync --no-dev --no-install-project --no-cache
|
|||||||
|
|
||||||
|
|
||||||
# Stage 2: Start the application
|
# Stage 2: Start the application
|
||||||
FROM docker.io/python:3.11-alpine3.20
|
FROM docker.io/python:3.13-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -39,4 +39,4 @@ EXPOSE 8080
|
|||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --start-interval=2s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --start-interval=2s --retries=3 \
|
||||||
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8080/api/health?format=json || exit 1
|
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8080/api/health?format=json || exit 1
|
||||||
|
|
||||||
CMD gunicorn config.wsgi --workers=8 -b 0.0.0.0:8080 --access-logfile - --error-logfile - --timeout=600
|
CMD [ "gunicorn", "config.wsgi", "--workers=8", "-b", "0.0.0.0:8080", "--access-logfile", "-", "--error-logfile", "-", "--timeout=600" ]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Stage 1: Install dependencies and compile staticfiles
|
# Stage 1: Install dependencies and compile staticfiles
|
||||||
FROM docker.io/python:3.11-alpine3.20 AS builder
|
FROM docker.io/python:3.13-alpine AS builder
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ COPY . .
|
|||||||
RUN uv run python manage.py collectstatic --noinput
|
RUN uv run python manage.py collectstatic --noinput
|
||||||
|
|
||||||
# Stage 2: Start nginx and serve staticfiles
|
# Stage 2: Start nginx and serve staticfiles
|
||||||
FROM docker.io/nginx:latest
|
FROM docker.io/nginx:1.28-alpine-slim
|
||||||
|
|
||||||
COPY --from=builder /app/static /usr/share/nginx/html
|
COPY --from=builder /app/static /usr/share/nginx/html
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
name = "datarush-backend"
|
name = "datarush-backend"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10,<3.12"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2-cffi>=23.1.0",
|
"argon2-cffi>=23.1.0",
|
||||||
"celery>=5.4.0",
|
"celery>=5.4.0",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Stage 1: Install dependencies
|
# Stage 1: Install dependencies
|
||||||
FROM docker.io/python:3.11-alpine3.20 AS builder
|
FROM docker.io/python:3.13-alpine AS builder
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ RUN uv sync --no-dev --no-install-project --no-cache
|
|||||||
|
|
||||||
|
|
||||||
# Stage 2: Start the application
|
# Stage 2: Start the application
|
||||||
FROM docker.io/python:3.11-alpine3.20
|
FROM docker.io/python:3.13-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -35,4 +35,4 @@ EXPOSE 8000
|
|||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --start-interval=2s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --start-interval=2s --retries=3 \
|
||||||
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8000/health || exit 1
|
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8000/health || exit 1
|
||||||
|
|
||||||
CMD uvicorn main:app --host 0.0.0.0 --port 8000
|
CMD [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000" ]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/python:3.11-slim
|
FROM docker.io/python:3.13-slim
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED=1 \
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
PIP_NO_CACHE_DIR=1
|
PIP_NO_CACHE_DIR=1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Stage 1: Base image
|
# Stage 1: Build
|
||||||
FROM node:lts-alpine AS base
|
FROM node:lts-alpine AS builder
|
||||||
|
|
||||||
ENV FORCE_COLOR=0
|
ENV FORCE_COLOR=0
|
||||||
|
|
||||||
@@ -7,11 +7,6 @@ RUN corepack enable
|
|||||||
|
|
||||||
WORKDIR /opt/docusaurus
|
WORKDIR /opt/docusaurus
|
||||||
|
|
||||||
# Stage 2: Production build mode
|
|
||||||
FROM base AS prod
|
|
||||||
|
|
||||||
WORKDIR /opt/docusaurus
|
|
||||||
|
|
||||||
COPY . /opt/docusaurus/
|
COPY . /opt/docusaurus/
|
||||||
|
|
||||||
RUN npm ci --omit=dev
|
RUN npm ci --omit=dev
|
||||||
@@ -19,7 +14,7 @@ RUN npm ci --omit=dev
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 3: Serve with nginx
|
# Stage 3: Serve with nginx
|
||||||
FROM nginx:stable-alpine AS serve
|
FROM nginx:1.28-alpine-slim AS serve
|
||||||
|
|
||||||
COPY --from=builder /opt/docusaurus/build /usr/share/nginx/html
|
COPY --from=builder /opt/docusaurus/build /usr/share/nginx/html
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ COPY . .
|
|||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
# Stage 2: Serve the built files with Nginx
|
# Stage 2: Serve the built files with Nginx
|
||||||
FROM nginx:latest
|
FROM nginx:1.28-alpine-slim
|
||||||
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
# React + TypeScript + Vite
|
|
||||||
|
|
||||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
||||||
|
|
||||||
Currently, two official plugins are available:
|
|
||||||
|
|
||||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
||||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
||||||
|
|
||||||
## Expanding the ESLint configuration
|
|
||||||
|
|
||||||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
||||||
|
|
||||||
- Configure the top-level `parserOptions` property like this:
|
|
||||||
|
|
||||||
```js
|
|
||||||
export default tseslint.config({
|
|
||||||
languageOptions: {
|
|
||||||
// other options...
|
|
||||||
parserOptions: {
|
|
||||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
|
||||||
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
|
||||||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// eslint.config.js
|
|
||||||
import react from 'eslint-plugin-react'
|
|
||||||
|
|
||||||
export default tseslint.config({
|
|
||||||
// Set the react version
|
|
||||||
settings: { react: { version: '18.3' } },
|
|
||||||
plugins: {
|
|
||||||
// Add the react plugin
|
|
||||||
react,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// other rules...
|
|
||||||
// Enable its recommended rules
|
|
||||||
...react.configs.recommended.rules,
|
|
||||||
...react.configs['jsx-runtime'].rules,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
```
|
|
||||||
+532
-178
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,16 @@ import globals from "globals";
|
|||||||
import reactHooks from "eslint-plugin-react-hooks";
|
import reactHooks from "eslint-plugin-react-hooks";
|
||||||
import reactRefresh from "eslint-plugin-react-refresh";
|
import reactRefresh from "eslint-plugin-react-refresh";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
|
import react from "eslint-plugin-react";
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{ ignores: ["dist"] },
|
{ ignores: ["dist"] },
|
||||||
{
|
{
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: "detect",
|
||||||
|
},
|
||||||
|
},
|
||||||
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||||
files: ["**/*.{ts,tsx}"],
|
files: ["**/*.{ts,tsx}"],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
@@ -16,10 +22,13 @@ export default tseslint.config(
|
|||||||
plugins: {
|
plugins: {
|
||||||
"react-hooks": reactHooks,
|
"react-hooks": reactHooks,
|
||||||
"react-refresh": reactRefresh,
|
"react-refresh": reactRefresh,
|
||||||
|
react,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
...reactHooks.configs.recommended.rules,
|
...reactHooks.configs.recommended.rules,
|
||||||
"react-refresh/only-export-components": 0,
|
"react-refresh/only-export-components": 0,
|
||||||
|
...react.configs.recommended.rules,
|
||||||
|
...react.configs["jsx-runtime"].rules,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Generated
-5921
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,10 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "bunx --bun vite --host",
|
||||||
"build": "vite build",
|
"build": "bun run lint && bunx --bun vite build",
|
||||||
"lint": "eslint . && tsc -b",
|
"lint": "eslint . && tsc -b",
|
||||||
"preview": "vite preview"
|
"preview": "bunx --bun vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@monaco-editor/react": "^4.7.0",
|
"@monaco-editor/react": "^4.7.0",
|
||||||
@@ -18,13 +18,14 @@
|
|||||||
"@radix-ui/react-radio-group": "^1.2.3",
|
"@radix-ui/react-radio-group": "^1.2.3",
|
||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
"@radix-ui/react-tabs": "^1.1.3",
|
"@radix-ui/react-tabs": "^1.1.3",
|
||||||
|
"@tailwindcss/typography": "^0.5.16",
|
||||||
"@tailwindcss/vite": "^4.0.9",
|
"@tailwindcss/vite": "^4.0.9",
|
||||||
"@tanstack/react-query": "^5.66.11",
|
"@tanstack/react-query": "^5.66.11",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"katex": "^0.16.21",
|
"katex": "^0.16.21",
|
||||||
"lucide-react": "^0.476.0",
|
"lucide-react": "^0.476.0",
|
||||||
@@ -48,7 +49,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.21.0",
|
||||||
"@tailwindcss/typography": "^0.5.16",
|
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/node": "^22.13.5",
|
"@types/node": "^22.13.5",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19.0.10",
|
||||||
|
|||||||
@@ -2,41 +2,46 @@ import "./styles/globals.css";
|
|||||||
|
|
||||||
import { Routes, Route } from "react-router";
|
import { Routes, Route } from "react-router";
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
import { lazy, Suspense } from "react";
|
||||||
|
|
||||||
import { AuthLayout } from "./widgets/auth-layout";
|
import { AuthLayout } from "./widgets/auth-layout";
|
||||||
import { NavbarLayout } from "./widgets/navbar-layout";
|
import { NavbarLayout } from "./widgets/navbar-layout";
|
||||||
|
import { Loading } from "./components/ui/loading";
|
||||||
|
|
||||||
import LoginPage from "./pages/Login";
|
import LoginPage from "./pages/Login";
|
||||||
import CompetitionPage from "./pages/Competition";
|
|
||||||
import CompetitionsPage from "./pages/Competitions";
|
import CompetitionsPage from "./pages/Competitions";
|
||||||
import SessionPage from "./pages/CompetitionSession";
|
|
||||||
import ReviewPage from "./pages/Review";
|
const CompetitionPage = lazy(() => import("./pages/Competition"));
|
||||||
import ProfilePage from "./pages/Profile";
|
const SessionPage = lazy(() => import("./pages/CompetitionSession"));
|
||||||
|
const ReviewPage = lazy(() => import("./pages/Review"));
|
||||||
|
const ProfilePage = lazy(() => import("./pages/Profile"));
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<Routes>
|
<Suspense fallback={<Loading />}>
|
||||||
<Route path="/login" element={<LoginPage />} />
|
<Routes>
|
||||||
|
<Route path="/login" element={<LoginPage />} />
|
||||||
|
|
||||||
<Route element={<AuthLayout />}>
|
<Route element={<AuthLayout />}>
|
||||||
<Route element={<NavbarLayout />}>
|
<Route element={<NavbarLayout />}>
|
||||||
<Route path="/" element={<CompetitionsPage />} />
|
<Route path="/" element={<CompetitionsPage />} />
|
||||||
<Route path="/competitions/:id" element={<CompetitionPage />} />
|
<Route path="/competitions/:id" element={<CompetitionPage />} />
|
||||||
<Route path="/profile" element={<ProfilePage />} />
|
<Route path="/profile" element={<ProfilePage />} />
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<Route path="/session/:competitionId" element={<SessionPage />} />
|
||||||
|
<Route
|
||||||
|
path="/session/:competitionId/tasks/:taskId"
|
||||||
|
element={<SessionPage />}
|
||||||
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route path="/session/:competitionId" element={<SessionPage />} />
|
<Route path="/review/:token" element={<ReviewPage />} />
|
||||||
<Route
|
</Routes>
|
||||||
path="/session/:competitionId/tasks/:taskId"
|
</Suspense>
|
||||||
element={<SessionPage />}
|
|
||||||
/>
|
|
||||||
</Route>
|
|
||||||
|
|
||||||
<Route path="/review/:token" element={<ReviewPage />} />
|
|
||||||
</Routes>
|
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+61
-49
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React from "react";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogDescription,
|
DialogDescription,
|
||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { Loader2 } from 'lucide-react';
|
import { Loader2 } from "lucide-react";
|
||||||
|
|
||||||
export interface CompetitionResult {
|
export interface CompetitionResult {
|
||||||
task_name: string;
|
task_name: string;
|
||||||
@@ -24,67 +24,77 @@ interface CompetitionResultsModalProps {
|
|||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CompetitionResultsModal: React.FC<CompetitionResultsModalProps> = ({
|
export const CompetitionResultsModal: React.FC<
|
||||||
competitionTitle,
|
CompetitionResultsModalProps
|
||||||
results,
|
> = ({ competitionTitle, results, isLoading, error, isOpen, onOpenChange }) => {
|
||||||
isLoading,
|
|
||||||
error,
|
|
||||||
isOpen,
|
|
||||||
onOpenChange,
|
|
||||||
}) => {
|
|
||||||
const renderResultValue = (result: number, maxPoints: number) => {
|
const renderResultValue = (result: number, maxPoints: number) => {
|
||||||
if (result === -1) {
|
if (result === -1) {
|
||||||
return (
|
return (
|
||||||
<span className="font-semibold" style={{
|
<span
|
||||||
color: 'var(--color-task-text-checking)',
|
className="font-semibold"
|
||||||
backgroundColor: 'var(--color-task-checking)',
|
style={{
|
||||||
padding: '4px 8px',
|
color: "var(--color-task-text-checking)",
|
||||||
borderRadius: '4px'
|
backgroundColor: "var(--color-task-checking)",
|
||||||
}}>
|
padding: "4px 8px",
|
||||||
|
borderRadius: "4px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
На проверке
|
На проверке
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else if (result === -2) {
|
} else if (result === -2) {
|
||||||
return (
|
return (
|
||||||
<span className="font-semibold" style={{
|
<span
|
||||||
color: 'var(--color-task-text-uncleared)',
|
className="font-semibold"
|
||||||
backgroundColor: 'var(--color-task-uncleared)',
|
style={{
|
||||||
padding: '4px 8px',
|
color: "var(--color-task-text-uncleared)",
|
||||||
borderRadius: '4px'
|
backgroundColor: "var(--color-task-uncleared)",
|
||||||
}}>
|
padding: "4px 8px",
|
||||||
|
borderRadius: "4px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
Нет ответа
|
Нет ответа
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else if (result === 0) {
|
} else if (result === 0) {
|
||||||
return (
|
return (
|
||||||
<span className="font-semibold" style={{
|
<span
|
||||||
color: 'var(--color-task-text-wrong)',
|
className="font-semibold"
|
||||||
backgroundColor: 'var(--color-task-wrong)',
|
style={{
|
||||||
padding: '4px 8px',
|
color: "var(--color-task-text-wrong)",
|
||||||
borderRadius: '4px'
|
backgroundColor: "var(--color-task-wrong)",
|
||||||
}}>
|
padding: "4px 8px",
|
||||||
|
borderRadius: "4px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
Неверно (0/{maxPoints})
|
Неверно (0/{maxPoints})
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else if (result < maxPoints) {
|
} else if (result < maxPoints) {
|
||||||
return (
|
return (
|
||||||
<span className="font-semibold" style={{
|
<span
|
||||||
color: 'var(--color-task-text-partial)',
|
className="font-semibold"
|
||||||
backgroundColor: 'var(--color-task-partial)',
|
style={{
|
||||||
padding: '4px 8px',
|
color: "var(--color-task-text-partial)",
|
||||||
borderRadius: '4px'
|
backgroundColor: "var(--color-task-partial)",
|
||||||
}}>
|
padding: "4px 8px",
|
||||||
|
borderRadius: "4px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
Частично верно ({result}/{maxPoints})
|
Частично верно ({result}/{maxPoints})
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span className="font-semibold" style={{
|
<span
|
||||||
color: 'var(--color-task-text-correct)',
|
className="font-semibold"
|
||||||
backgroundColor: 'var(--color-task-correct)',
|
style={{
|
||||||
padding: '4px 8px',
|
color: "var(--color-task-text-correct)",
|
||||||
borderRadius: '4px'
|
backgroundColor: "var(--color-task-correct)",
|
||||||
}}>
|
padding: "4px 8px",
|
||||||
|
borderRadius: "4px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
Верно ({result}/{maxPoints})
|
Верно ({result}/{maxPoints})
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
@@ -97,35 +107,37 @@ export const CompetitionResultsModal: React.FC<CompetitionResultsModalProps> = (
|
|||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Результаты</DialogTitle>
|
<DialogTitle>Результаты</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Ваши результаты по соревнованию "{competitionTitle}"
|
Ваши результаты по соревнованию «{competitionTitle}»
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="mt-4 space-y-4">
|
<div className="mt-4 space-y-4">
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="flex justify-center py-8">
|
<div className="flex justify-center py-8">
|
||||||
<Loader2 className="h-8 w-8 animate-spin text-gray-400" />
|
<Loader2 className="h-8 w-8 animate-spin text-gray-400" />
|
||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<div className="text-center py-6 text-red-500">
|
<div className="py-6 text-center text-red-500">
|
||||||
Произошла ошибка при загрузке результатов
|
Произошла ошибка при загрузке результатов
|
||||||
</div>
|
</div>
|
||||||
) : results && results.length > 0 ? (
|
) : results && results.length > 0 ? (
|
||||||
[...results]
|
[...results]
|
||||||
.sort((a, b) => a.position - b.position)
|
.sort((a, b) => a.position - b.position)
|
||||||
.map((result, index) => (
|
.map((result, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className="flex flex-col md:flex-row justify-between items-start md:items-center p-4 bg-gray-50 rounded-lg border"
|
className="flex flex-col items-start justify-between rounded-lg border bg-gray-50 p-4 md:flex-row md:items-center"
|
||||||
>
|
>
|
||||||
<div className="font-medium mb-2 md:mb-0">{result.task_name}</div>
|
<div className="mb-2 font-medium md:mb-0">
|
||||||
|
{result.task_name}
|
||||||
|
</div>
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
{renderResultValue(result.result, result.max_points)}
|
{renderResultValue(result.result, result.max_points)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<div className="text-center py-6 text-gray-500">
|
<div className="py-6 text-center text-gray-500">
|
||||||
Нет доступных результатов
|
Нет доступных результатов
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -133,4 +145,4 @@ export const CompetitionResultsModal: React.FC<CompetitionResultsModalProps> = (
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,7 +69,12 @@ export const FileAnswer = ({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<a download={answer.file.name} href={link} target="_blank">
|
<a
|
||||||
|
download={answer.file.name}
|
||||||
|
href={link}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
<div className="bg-muted flex w-full max-w-56 items-center gap-3 rounded-md border px-3 py-3 transition-transform active:scale-[0.95]">
|
<div className="bg-muted flex w-full max-w-56 items-center gap-3 rounded-md border px-3 py-3 transition-transform active:scale-[0.95]">
|
||||||
<File size={22} className="min-w-fit" />
|
<File size={22} className="min-w-fit" />
|
||||||
<div className="flex w-full flex-col gap-1 overflow-hidden">
|
<div className="flex w-full flex-col gap-1 overflow-hidden">
|
||||||
|
|||||||
@@ -35,7 +35,12 @@ export const AttachmentCard = ({
|
|||||||
const extension = filename?.split(".").at(-1);
|
const extension = filename?.split(".").at(-1);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a download={filename} href={attachment.file} target="_blank">
|
<a
|
||||||
|
download={filename}
|
||||||
|
href={attachment.file}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
<div className="bg-card flex w-full items-center gap-3 rounded-md px-3 py-3 transition-transform active:scale-[0.95]">
|
<div className="bg-card flex w-full items-center gap-3 rounded-md px-3 py-3 transition-transform active:scale-[0.95]">
|
||||||
<File size={22} className="min-w-fit" />
|
<File size={22} className="min-w-fit" />
|
||||||
<div className="flex w-full flex-col gap-1 overflow-hidden">
|
<div className="flex w-full flex-col gap-1 overflow-hidden">
|
||||||
|
|||||||
@@ -153,13 +153,7 @@ const ReviewDescription = ({ review }: { review: Review }) => {
|
|||||||
|
|
||||||
const ReviewContent = ({ review }: { review: Review }) => {
|
const ReviewContent = ({ review }: { review: Review }) => {
|
||||||
const extension = review.content.split(".").at(-1);
|
const extension = review.content.split(".").at(-1);
|
||||||
const fullFilename = review.content.split("/").at(-1);
|
const filename = review.content.split("/").at(-1);
|
||||||
|
|
||||||
const filename = fullFilename
|
|
||||||
? fullFilename.length > 20
|
|
||||||
? fullFilename.substring(0, 20) + "..."
|
|
||||||
: fullFilename
|
|
||||||
: "";
|
|
||||||
|
|
||||||
const { data: content, isLoading } = useQuery({
|
const { data: content, isLoading } = useQuery({
|
||||||
queryKey: ["review-file", review.id],
|
queryKey: ["review-file", review.id],
|
||||||
@@ -181,10 +175,13 @@ const ReviewContent = ({ review }: { review: Review }) => {
|
|||||||
<a
|
<a
|
||||||
href={review.content}
|
href={review.content}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="flex items-center gap-3"
|
className="flex items-center gap-3 overflow-hidden"
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<File size={16} />
|
<File size={16} className="min-w-4" />
|
||||||
<span>{filename}</span>
|
<span className="overflow-hidden overflow-ellipsis whitespace-nowrap">
|
||||||
|
{filename}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,15 +6,19 @@ import tsconfigPaths from "vite-tsconfig-paths";
|
|||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
outDir: 'dist',
|
outDir: "dist",
|
||||||
assetsDir: 'assets',
|
assetsDir: "assets",
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks: {
|
||||||
|
code: ["monaco-editor", "@monaco-editor/react"],
|
||||||
|
md: ["react-markdown", "rehype-katex", "remark-gfm", "remark-math"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [tsconfigPaths(), react(), tailwindcss()],
|
||||||
tsconfigPaths(),
|
assetsInclude: ["**/*.png", "**/*.jpg", "**/*.jpeg", "**/*.svg"],
|
||||||
react(),
|
publicDir: "public",
|
||||||
tailwindcss()
|
|
||||||
],
|
|
||||||
assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.svg'],
|
|
||||||
publicDir: 'public',
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user