Compare commits
11 Commits
dev
...
5a999541d8
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a999541d8 | |||
| 58f99122ab | |||
| 79b146786b | |||
| f83e31967b | |||
| c55f7a972c | |||
| 5693701aa5 | |||
| d9f449f0b8 | |||
| 04da2b565a | |||
| 070edbfc42 | |||
|
|
a4480db444 | ||
| f2baf189e4 |
35
.gitea/workflows/build-and-push.yaml
Normal file
35
.gitea/workflows/build-and-push.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.nullptr.top
|
||||||
|
IMAGE_NAME: git.nullptr.top/liquidcode/liquidcode-frontend
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: liquidcode-ci-service
|
||||||
|
password: ${{ secrets.SERVICE_ACCOUNT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||||
|
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
|
||||||
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM node:20-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM node:20-alpine AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install a simple HTTP server to serve static files
|
||||||
|
RUN npm install -g serve
|
||||||
|
|
||||||
|
# Copy built application from build stage
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||||
@@ -50,7 +50,7 @@ const Article = () => {
|
|||||||
#{article.id}
|
#{article.id}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{article.tags.length && (
|
||||||
<div className="flex gap-[10px]">
|
<div className="flex gap-[10px]">
|
||||||
{article.tags.map((v, i) => (
|
{article.tags.map((v, i) => (
|
||||||
<div
|
<div
|
||||||
@@ -61,7 +61,7 @@ const Article = () => {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
<MarkdownPreview
|
<MarkdownPreview
|
||||||
content={article!.content}
|
content={article!.content}
|
||||||
className="bg-transparent"
|
className="bg-transparent"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import Editor from '@monaco-editor/react';
|
|||||||
import { upload } from '../../../assets/icons/input';
|
import { upload } from '../../../assets/icons/input';
|
||||||
import { cn } from '../../../lib/cn';
|
import { cn } from '../../../lib/cn';
|
||||||
import { DropDownList } from '../../../components/input/DropDownList';
|
import { DropDownList } from '../../../components/input/DropDownList';
|
||||||
import { useParams } from 'react-router-dom';
|
|
||||||
|
|
||||||
const languageMap: Record<string, string> = {
|
const languageMap: Record<string, string> = {
|
||||||
c: 'cpp',
|
c: 'cpp',
|
||||||
@@ -24,21 +23,19 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
|
|||||||
onChange,
|
onChange,
|
||||||
onChangeLanguage,
|
onChangeLanguage,
|
||||||
}) => {
|
}) => {
|
||||||
const { missionId } = useParams<{ missionId: string }>();
|
const [language, setLanguage] = useState<string>('C++');
|
||||||
|
|
||||||
const [code, setCode] = useState<string>('');
|
const [code, setCode] = useState<string>('');
|
||||||
const [isDragging, setIsDragging] = useState<boolean>(false);
|
const [isDragging, setIsDragging] = useState<boolean>(false);
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
|
{ value: 'c', text: 'C' },
|
||||||
{ value: 'C++', text: 'C++' },
|
{ value: 'C++', text: 'C++' },
|
||||||
{ value: 'java', text: 'Java' },
|
{ value: 'java', text: 'Java' },
|
||||||
{ value: 'python', text: 'Python' },
|
{ value: 'python', text: 'Python' },
|
||||||
|
{ value: 'pascal', text: 'Pascal' },
|
||||||
{ value: 'kotlin', text: 'Kotlin' },
|
{ value: 'kotlin', text: 'Kotlin' },
|
||||||
{ value: 'csharp', text: 'C#' },
|
{ value: 'csharp', text: 'C#' },
|
||||||
];
|
];
|
||||||
const [language, setLanguage] = useState<string>('C++');
|
|
||||||
|
|
||||||
const getCodeKey = (missionId?: string) => `mission_${missionId}_code`;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onChange(code);
|
onChange(code);
|
||||||
@@ -47,24 +44,6 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
|
|||||||
onChangeLanguage(language);
|
onChangeLanguage(language);
|
||||||
}, [language]);
|
}, [language]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!missionId || !code) return;
|
|
||||||
|
|
||||||
localStorage.setItem(getCodeKey(missionId), code);
|
|
||||||
}, [code, missionId]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!missionId) return;
|
|
||||||
|
|
||||||
const savedCode = localStorage.getItem(getCodeKey(missionId));
|
|
||||||
|
|
||||||
if (savedCode !== null) {
|
|
||||||
setCode(savedCode);
|
|
||||||
} else {
|
|
||||||
setCode('');
|
|
||||||
}
|
|
||||||
}, [missionId]);
|
|
||||||
|
|
||||||
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const file = e.target.files?.[0];
|
const file = e.target.files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
@@ -116,6 +95,7 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
|
|||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setLanguage(v);
|
setLanguage(v);
|
||||||
}}
|
}}
|
||||||
|
defaultState={{ value: 'C++', text: 'C++' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<label
|
<label
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { CopyIcon } from '../../../assets/icons/missions';
|
|||||||
// import FullLatexRenderer from "./FullLatexRenderer";
|
// import FullLatexRenderer from "./FullLatexRenderer";
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { toastSuccess } from '../../../lib/toastNotification';
|
|
||||||
|
|
||||||
interface CopyableDivPropd {
|
interface CopyableDivPropd {
|
||||||
content: string;
|
content: string;
|
||||||
@@ -17,7 +16,7 @@ const CopyableDiv: FC<CopyableDivPropd> = ({ content }) => {
|
|||||||
const handleCopy = async () => {
|
const handleCopy = async () => {
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(content);
|
await navigator.clipboard.writeText(content);
|
||||||
toastSuccess('Скопировано!');
|
alert('Скопировано!');
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user