Refactor project tasks page and navigation components

- Updated the description in ProjectTasksPage to a placeholder.
- Commented out the display of assigned email in ProjectTasksList.
- Removed the dashboard link from the navigation items.
- Changed the main link in the navigation to point to projects instead of the dashboard.
- Commented out the LanguageSwitcher and user role display in the navigation.
- Translated "Project Location" to "Lokalizacja projektu" in ProjectMap.
- Commented out the instruction for using the layer control in ProjectMap.
- Removed the label "Coordinates:" from the coordinates display in ProjectMap.
- Updated project and contract subtitles in translations to placeholders.
- Added a new empty validation schema file.
This commit is contained in:
2025-07-28 20:56:04 +02:00
parent 747a68832e
commit 8e35821344
14 changed files with 305 additions and 1103 deletions

165
DOCKER_GIT_DEPLOYMENT.md Normal file
View File

@@ -0,0 +1,165 @@
# Docker Git Deployment Guide
This project now supports deploying directly from a Git repository using Docker. This is useful for automated deployments and CI/CD pipelines.
## File Structure
- `Dockerfile` - Production dockerfile that supports Git deployment
- `Dockerfile.dev` - Development dockerfile
- `docker-compose.yml` - Development environment
- `docker-compose.prod.yml` - Production environment with Git support
- `deploy.sh` / `deploy.bat` - Deployment scripts
## Deployment Options
### 1. Deploy from Local Files (Default)
```bash
# Development
docker-compose up
# Production
docker-compose -f docker-compose.prod.yml up --build
```
### 2. Deploy from Git Repository
#### Using Environment Variables
Create a `.env` file with:
```env
GIT_REPO_URL=https://github.com/yourusername/your-repo.git
GIT_BRANCH=main
GIT_COMMIT=abc123 # Optional: specific commit hash
```
Then run:
```bash
docker-compose -f docker-compose.prod.yml up --build
```
#### Using Build Arguments
```bash
docker build \
--build-arg GIT_REPO_URL=https://github.com/yourusername/your-repo.git \
--build-arg GIT_BRANCH=main \
--build-arg GIT_COMMIT=abc123 \
-t your-app .
```
#### Using Deployment Scripts
```bash
# Linux/Mac
./deploy.sh https://github.com/yourusername/your-repo.git main abc123
# Windows
deploy.bat https://github.com/yourusername/your-repo.git main abc123
```
## Private Repositories
For private repositories, you have several options:
### 1. SSH Keys (Recommended for development)
```bash
# Build with SSH URL
docker build --build-arg GIT_REPO_URL=git@github.com:yourusername/your-repo.git .
```
### 2. Personal Access Token
```bash
# Build with token in URL
docker build --build-arg GIT_REPO_URL=https://token@github.com/yourusername/your-repo.git .
```
### 3. Docker Secrets (Recommended for production)
```yaml
# In docker-compose.prod.yml
services:
app:
build:
context: .
args:
- GIT_REPO_URL=https://github.com/yourusername/your-repo.git
secrets:
- git_token
secrets:
git_token:
file: ./git_token.txt
```
## CI/CD Integration
### GitHub Actions Example
```yaml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to server
run: |
docker build \
--build-arg GIT_REPO_URL=${{ github.repository }} \
--build-arg GIT_COMMIT=${{ github.sha }} \
-t my-app .
docker run -d -p 3000:3000 my-app
```
### Docker Compose in CI/CD
```bash
# Set environment variables in your CI/CD system
export GIT_REPO_URL="https://github.com/yourusername/your-repo.git"
export GIT_BRANCH="main"
export GIT_COMMIT="$CI_COMMIT_SHA"
# Deploy
docker-compose -f docker-compose.prod.yml up --build -d
```
## Build Process
When `GIT_REPO_URL` is provided:
1. Git repository is cloned into the container
2. If `GIT_COMMIT` is specified, checkout that specific commit
3. Install dependencies from the repository's package.json
4. Build the application
5. Start the production server
When `GIT_REPO_URL` is not provided:
1. Copy local files into the container
2. Install dependencies
3. Build the application
4. Start the production server
## Environment Variables
- `GIT_REPO_URL` - Git repository URL (HTTPS or SSH)
- `GIT_BRANCH` - Git branch to checkout (default: main)
- `GIT_COMMIT` - Specific commit hash to checkout (optional)
- `NODE_ENV` - Node.js environment (development/production)
## Troubleshooting
### Git Authentication Issues
- Ensure your Git credentials are properly configured
- For HTTPS, use personal access tokens instead of passwords
- For SSH, ensure SSH keys are properly mounted or available
### Build Failures
- Check if the repository URL is accessible
- Verify the branch name exists
- Ensure the commit hash is valid
- Check Docker build logs for specific errors
### Permission Issues
- Ensure the Docker daemon has network access
- For private repositories, verify authentication tokens/keys

View File

@@ -1,20 +1,39 @@
# Use Node.js 22.11.0 as the base image # Use Node.js 22.11.0 as the base image
FROM node:22.11.0 FROM node:22.11.0
# Install git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Set the working directory # Set the working directory
WORKDIR /app WORKDIR /app
# Copy package.json and package-lock.json (if any) # If building from a git repository, clone it
# This will be used when the build context doesn't include source files
ARG GIT_REPO_URL
ARG GIT_BRANCH=main
ARG GIT_COMMIT
# If GIT_REPO_URL is provided, clone the repo; otherwise copy local files
RUN if [ -n "$GIT_REPO_URL" ]; then \
git clone --branch ${GIT_BRANCH} ${GIT_REPO_URL} . && \
if [ -n "$GIT_COMMIT" ]; then git checkout ${GIT_COMMIT}; fi; \
fi
# Copy package.json and package-lock.json (if not cloned from git)
COPY package*.json ./ COPY package*.json ./
# Install dependencies # Install dependencies
RUN npm install RUN npm install
# Copy the rest of the app # Copy the rest of the app (if not cloned from git)
RUN if [ -z "$GIT_REPO_URL" ]; then echo "Copying local files..."; fi
COPY . . COPY . .
# Build the application for production
RUN npm run build
# Expose the default Next.js port # Expose the default Next.js port
EXPOSE 3000 EXPOSE 3000
# Start the dev server # Start the production server
CMD ["npm", "run", "dev"] CMD ["npm", "start"]

23
Dockerfile.dev Normal file
View File

@@ -0,0 +1,23 @@
# Use Node.js 22.11.0 as the base image
FROM node:22.11.0
# Install git for development
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json (if any)
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the app
COPY . .
# Expose the default Next.js port
EXPOSE 3000
# Start the dev server
CMD ["npm", "run", "dev"]

29
deploy.bat Normal file
View File

@@ -0,0 +1,29 @@
@echo off
REM Production deployment script for Windows
REM Usage: deploy.bat [git_repo_url] [branch] [commit_hash]
set GIT_REPO_URL=%1
set GIT_BRANCH=%2
if "%GIT_BRANCH%"=="" set GIT_BRANCH=main
set GIT_COMMIT=%3
if "%GIT_REPO_URL%"=="" (
echo Building from local files...
docker-compose -f docker-compose.prod.yml build
) else (
echo Building from git repository: %GIT_REPO_URL%
echo Branch: %GIT_BRANCH%
if not "%GIT_COMMIT%"=="" echo Commit: %GIT_COMMIT%
set GIT_REPO_URL=%GIT_REPO_URL%
set GIT_BRANCH=%GIT_BRANCH%
set GIT_COMMIT=%GIT_COMMIT%
docker-compose -f docker-compose.prod.yml build
)
echo Starting production deployment...
docker-compose -f docker-compose.prod.yml down
docker-compose -f docker-compose.prod.yml up -d
echo Deployment completed successfully!
echo Application is running at http://localhost:3000

32
deploy.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Production deployment script
# Usage: ./deploy.sh [git_repo_url] [branch] [commit_hash]
set -e
# Default values
GIT_REPO_URL=${1:-""}
GIT_BRANCH=${2:-"main"}
GIT_COMMIT=${3:-""}
if [ -z "$GIT_REPO_URL" ]; then
echo "Building from local files..."
docker-compose -f docker-compose.prod.yml build
else
echo "Building from git repository: $GIT_REPO_URL"
echo "Branch: $GIT_BRANCH"
if [ -n "$GIT_COMMIT" ]; then
echo "Commit: $GIT_COMMIT"
fi
GIT_REPO_URL=$GIT_REPO_URL GIT_BRANCH=$GIT_BRANCH GIT_COMMIT=$GIT_COMMIT \
docker-compose -f docker-compose.prod.yml build
fi
echo "Starting production deployment..."
docker-compose -f docker-compose.prod.yml down
docker-compose -f docker-compose.prod.yml up -d
echo "Deployment completed successfully!"
echo "Application is running at http://localhost:3000"

18
docker-compose.prod.yml Normal file
View File

@@ -0,0 +1,18 @@
version: "3.9"
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
- GIT_REPO_URL=${GIT_REPO_URL}
- GIT_BRANCH=${GIT_BRANCH:-main}
- GIT_COMMIT=${GIT_COMMIT}
ports:
- "3000:3000"
volumes:
- ./data:/app/data
environment:
- NODE_ENV=production
restart: unless-stopped

View File

@@ -2,7 +2,9 @@ version: "3.9"
services: services:
app: app:
build: . build:
context: .
dockerfile: Dockerfile.dev
ports: ports:
- "3000:3000" - "3000:3000"
volumes: volumes:

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@ export default function ProjectTasksPage() {
<PageContainer> <PageContainer>
<PageHeader <PageHeader
title="Zadania projektów" title="Zadania projektów"
description="Przeglądaj i zarządzaj zadaniami wszystkich projektów w ustrukturyzowanym formacie listy" description="---"
/> />
<ProjectTasksList /> <ProjectTasksList />
</PageContainer> </PageContainer>

View File

@@ -304,9 +304,9 @@ export default function ProjectTasksList() {
{task.assigned_to_name ? ( {task.assigned_to_name ? (
<div> <div>
<div className="font-medium">{task.assigned_to_name}</div> <div className="font-medium">{task.assigned_to_name}</div>
<div className="text-xs text-gray-500"> {/* <div className="text-xs text-gray-500">
{task.assigned_to_email} {task.assigned_to_email}
</div> </div> */}
</div> </div>
) : ( ) : (
<span className="text-gray-400 italic">{t("projects.unassigned")}</span> <span className="text-gray-400 italic">{t("projects.unassigned")}</span>

View File

@@ -21,7 +21,6 @@ const Navigation = () => {
}; };
const navItems = [ const navItems = [
{ href: "/", label: t('navigation.dashboard') },
{ href: "/projects", label: t('navigation.projects') }, { href: "/projects", label: t('navigation.projects') },
{ href: "/tasks/templates", label: t('navigation.taskTemplates') }, { href: "/tasks/templates", label: t('navigation.taskTemplates') },
{ href: "/project-tasks", label: t('navigation.projectTasks') }, { href: "/project-tasks", label: t('navigation.projectTasks') },
@@ -47,7 +46,7 @@ const Navigation = () => {
<div className="max-w-6xl mx-auto px-6"> <div className="max-w-6xl mx-auto px-6">
<div className="flex items-center justify-between h-16"> <div className="flex items-center justify-between h-16">
<div className="flex items-center"> <div className="flex items-center">
<Link href="/" className="text-xl font-bold text-gray-900"> <Link href="/projects" className="text-xl font-bold text-gray-900">
{t('navigation.projectPanel')} {t('navigation.projectPanel')}
</Link> </Link>
</div> </div>
@@ -74,12 +73,12 @@ const Navigation = () => {
</div> </div>
<div className="flex items-center space-x-4 ml-8 pl-8 border-l border-gray-200"> <div className="flex items-center space-x-4 ml-8 pl-8 border-l border-gray-200">
<LanguageSwitcher /> {/* <LanguageSwitcher /> */}
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<div className="text-sm"> <div className="text-sm">
<div className="font-medium text-gray-900">{session.user.name}</div> <div className="font-medium text-gray-900">{session.user.name}</div>
<div className="text-gray-500 capitalize">{t(`userRoles.${session.user.role}`) || session.user.role?.replace('_', ' ')}</div> {/* <div className="text-gray-500 capitalize">{t(`userRoles.${session.user.role}`) || session.user.role?.replace('_', ' ')}</div> */}
</div> </div>
</div> </div>

View File

@@ -51,7 +51,7 @@ export default function ProjectMap({
<div className="space-y-2"> <div className="space-y-2">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h3 className="text-sm font-medium text-gray-700"> <h3 className="text-sm font-medium text-gray-700">
Project Location Lokalizacja projektu
</h3> </h3>
<div className="text-xs text-gray-500">No coordinates available</div> <div className="text-xs text-gray-500">No coordinates available</div>
</div> </div>
@@ -85,7 +85,7 @@ export default function ProjectMap({
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<h3 className="text-sm font-medium text-gray-700"> <h3 className="text-sm font-medium text-gray-700">
Project Location Lokalizacja projektu
</h3> </h3>
<div <div
className="w-3 h-3 rounded-full border border-white shadow-sm" className="w-3 h-3 rounded-full border border-white shadow-sm"
@@ -95,7 +95,7 @@ export default function ProjectMap({
</div> </div>
{showLayerControl && ( {showLayerControl && (
<div className="text-xs text-gray-500"> <div className="text-xs text-gray-500">
Use the layer control (📚) to switch map views {/* Use the layer control (📚) to switch map views */}
</div> </div>
)} )}
</div> </div>
@@ -158,7 +158,7 @@ export default function ProjectMap({
</div> </div>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<p className="text-xs text-gray-500"> <p className="text-xs text-gray-500">
Coordinates: {coords.lat.toFixed(6)}, {coords.lng.toFixed(6)} {coords.lat.toFixed(6)}, {coords.lng.toFixed(6)}
</p> </p>
<div className="flex items-center gap-1 text-xs text-gray-500"> <div className="flex items-center gap-1 text-xs text-gray-500">
<div <div

View File

@@ -119,7 +119,7 @@ const translations = {
// Projects // Projects
projects: { projects: {
title: "Projekty", title: "Projekty",
subtitle: "Zarządzaj swoimi projektami", subtitle: "---",
newProject: "Nowy projekt", newProject: "Nowy projekt",
editProject: "Edytuj projekt", editProject: "Edytuj projekt",
deleteProject: "Usuń projekt", deleteProject: "Usuń projekt",
@@ -162,7 +162,7 @@ const translations = {
// Contracts // Contracts
contracts: { contracts: {
title: "Umowy", title: "Umowy",
subtitle: "Zarządzaj swoimi umowami i kontraktami", subtitle: "---",
newContract: "Nowa umowa", newContract: "Nowa umowa",
editContract: "Edytuj umowę", editContract: "Edytuj umowę",
deleteContract: "Usuń umowę", deleteContract: "Usuń umowę",

View File