Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64a75d265f | ||
|
|
f2fb381964 | ||
|
|
0ed4942a30 | ||
|
|
aeab383116 | ||
|
|
f098ded0c4 | ||
|
|
3ac9a5ca30 | ||
|
|
c708c013f3 | ||
|
|
fb6531d00d | ||
|
|
46e0838792 | ||
|
|
72f1c0a66d | ||
|
|
1adad49020 | ||
|
|
c2d17e4c04 | ||
|
|
02866c8ea5 | ||
|
|
e58c1070d6 | ||
|
|
6fe92ef3fa | ||
|
|
ebce8f698b |
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: fccview
|
||||||
2
.github/workflows/docker-build.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Reusable Docker Build Logic
|
name: Builder
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|||||||
2
.github/workflows/docker-publish.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Publish Multi-Platform Docker Image
|
name: Build and Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
48
.github/workflows/pr-checks.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: PR Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-branch:
|
||||||
|
name: Validate Target Branch
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: YOU SHALL NOT PASS
|
||||||
|
if: github.base_ref == 'main'
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.head_ref }}" != "develop" ]; then
|
||||||
|
echo "ERROR: Pull requests to 'main' are not allowed."
|
||||||
|
echo "Current source branch: ${{ github.head_ref }}"
|
||||||
|
echo ""
|
||||||
|
echo "Please create a PR to 'develop' first, this will become a release candidate when merged into 'main' by a maintainer"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Valid PR: develop → main"
|
||||||
|
|
||||||
|
- name: PR info
|
||||||
|
run: |
|
||||||
|
echo "PR validation passed"
|
||||||
|
echo "Source: ${{ github.head_ref }}"
|
||||||
|
echo "Target: ${{ github.base_ref }}"
|
||||||
|
|
||||||
|
typing:
|
||||||
|
name: Type and install checks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: validate-branch
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup the best engine ever
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- name: Install all dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: This will totally fail if you only use AI
|
||||||
|
run: yarn tsc --noEmit
|
||||||
60
.github/workflows/prebuild-release.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
name: Build and Release Prebuilt Tarball
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["*"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-prebuild:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup the best engine ever
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'yarn'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Bake cronmaster
|
||||||
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
NEXT_TELEMETRY_DISABLED: 1
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Get version from tag
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION="${GITHUB_REF#refs/tags/}"
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Structure the prebuild stuff
|
||||||
|
run: |
|
||||||
|
mkdir -p prebuild-release/cronmaster/.next
|
||||||
|
cp -r .next/standalone/. prebuild-release/cronmaster/
|
||||||
|
cp -r .next/static prebuild-release/cronmaster/.next/static
|
||||||
|
if [ -f .next/BUILD_ID ]; then
|
||||||
|
cp .next/BUILD_ID prebuild-release/cronmaster/.next/BUILD_ID
|
||||||
|
fi
|
||||||
|
cp -r public prebuild-release/cronmaster/public
|
||||||
|
cp -r howto prebuild-release/cronmaster/howto
|
||||||
|
|
||||||
|
- name: Create tarball - tarball is a funny name
|
||||||
|
run: |
|
||||||
|
cd prebuild-release
|
||||||
|
tar -czf cronmaster_${{ steps.version.outputs.version }}_prebuild.tar.gz cronmaster
|
||||||
|
sha256sum cronmaster_${{ steps.version.outputs.version }}_prebuild.tar.gz > cronmaster_${{ steps.version.outputs.version }}_prebuild.tar.gz.sha256
|
||||||
|
|
||||||
|
- name: Attach to Release - pray it works
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
prebuild-release/cronmaster_*_prebuild.tar.gz
|
||||||
|
prebuild-release/cronmaster_*_prebuild.tar.gz.sha256
|
||||||
|
tag_name: ${{ steps.version.outputs.version }}
|
||||||
44
Dockerfile
@@ -1,22 +1,7 @@
|
|||||||
FROM node:20-slim AS base
|
FROM node:20-alpine AS base
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
pciutils \
|
|
||||||
curl \
|
|
||||||
iputils-ping \
|
|
||||||
util-linux \
|
|
||||||
ca-certificates \
|
|
||||||
gnupg \
|
|
||||||
lsb-release \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
|
|
||||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y docker-ce-cli \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
|
RUN apk add --no-cache libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||||
@@ -42,26 +27,27 @@ WORKDIR /app
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN groupadd --system --gid 1001 nodejs
|
RUN apk add --no-cache su-exec docker-cli pciutils curl iputils util-linux ca-certificates
|
||||||
RUN useradd --system --uid 1001 nextjs
|
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
RUN mkdir -p /app/scripts /app/data /app/snippets && \
|
RUN mkdir -p /app/scripts /app/data /app/snippets && \
|
||||||
chown -R nextjs:nodejs /app/scripts /app/data /app/snippets
|
chown -R nextjs:nodejs /app/scripts /app/data /app/snippets
|
||||||
|
|
||||||
|
RUN mkdir -p /app/.next/cache && \
|
||||||
|
chown -R nextjs:nodejs /app/.next
|
||||||
|
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
|
||||||
|
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/app ./app
|
|
||||||
|
|
||||||
COPY --from=builder /app/package.json ./package.json
|
|
||||||
COPY --from=builder /app/yarn.lock ./yarn.lock
|
|
||||||
|
|
||||||
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME="0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
CMD ["yarn", "start"]
|
USER nextjs
|
||||||
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
|
|||||||
45
README.md
@@ -1,8 +1,8 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="public/heading.png" width="400px">
|
<img src="public/heading.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Table of Contents
|
## Quick links
|
||||||
|
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [Quick Start](#quick-start)
|
- [Quick Start](#quick-start)
|
||||||
@@ -18,11 +18,16 @@
|
|||||||
- [Managing Cron Jobs](#managing-cron-jobs)
|
- [Managing Cron Jobs](#managing-cron-jobs)
|
||||||
- [Job Execution Logging](#job-execution-logging)
|
- [Job Execution Logging](#job-execution-logging)
|
||||||
- [Managing Scripts](#managing-scripts)
|
- [Managing Scripts](#managing-scripts)
|
||||||
- [Technologies Used](#technologies-used)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
- [License](#license)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
| Desktop | Mobile |
|
||||||
|
|---------|--------|
|
||||||
|
|  |  |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -51,26 +56,13 @@
|
|||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
## Before we start
|
|
||||||
|
|
||||||
Hey there! 👋 Just a friendly heads-up: I'm a big believer in open source and love sharing my work with the community. Everything you find in my GitHub repos is and always will be 100% free. If someone tries to sell you a "premium" version of any of my projects while claiming to be me, please know that this is not legitimate. 🚫
|
|
||||||
|
|
||||||
If you find my projects helpful and want to fuel my late-night coding sessions with caffeine, I'd be super grateful for any support! ☕
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.buymeacoffee.com/fccview">
|
<a href="https://www.buymeacoffee.com/fccview">
|
||||||
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy me a coffee" width="150">
|
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy me a coffee" width="120">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div align="center">
|
---
|
||||||
<img width="500px" src="screenshots/home.png">
|
|
||||||
<img width="500px" src="screenshots/live-running.png" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a id="quick-start"></a>
|
<a id="quick-start"></a>
|
||||||
|
|
||||||
@@ -93,7 +85,6 @@ services:
|
|||||||
- "40123:3000"
|
- "40123:3000"
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- DOCKER=true
|
|
||||||
- NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL=30000
|
- NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL=30000
|
||||||
- AUTH_PASSWORD=very_strong_password
|
- AUTH_PASSWORD=very_strong_password
|
||||||
- HOST_CRONTAB_USER=root
|
- HOST_CRONTAB_USER=root
|
||||||
@@ -335,16 +326,6 @@ I would like to thank the following members for raising issues and help test/deb
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<a id="license"></a>
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under the MIT License.
|
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
For issues and questions, please open an issue on the GitHub repository.
|
|
||||||
|
|
||||||
## Star History
|
## Star History
|
||||||
|
|
||||||
[](https://www.star-history.com/#fccview/cronmaster&Date)
|
[](https://www.star-history.com/#fccview/cronmaster&Date)
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ import {
|
|||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Switch } from "@/app/_components/GlobalComponents/UIElements/Switch";
|
import { Switch } from "@/app/_components/GlobalComponents/UIElements/Switch";
|
||||||
import {
|
import {
|
||||||
Clock,
|
ClockIcon,
|
||||||
Plus,
|
PlusIcon,
|
||||||
Archive,
|
Archive,
|
||||||
ChevronDown,
|
CaretDownIcon,
|
||||||
Code,
|
CodeIcon,
|
||||||
MessageSquare,
|
ChatTextIcon,
|
||||||
Settings,
|
GearIcon,
|
||||||
Loader2,
|
CircleNotchIcon,
|
||||||
Filter,
|
FunnelIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { CronJob } from "@/app/_utils/cronjob-utils";
|
import { CronJob } from "@/app/_utils/cronjob-utils";
|
||||||
import { Script } from "@/app/_utils/scripts-utils";
|
import { Script } from "@/app/_utils/scripts-utils";
|
||||||
import { UserFilter } from "@/app/_components/FeatureComponents/User/UserFilter";
|
import { UserFilter } from "@/app/_components/FeatureComponents/User/UserFilter";
|
||||||
@@ -236,8 +236,8 @@ export const CronJobList = ({ cronJobs, scripts }: CronJobListProps) => {
|
|||||||
<CardHeader>
|
<CardHeader>
|
||||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<div className="p-2 bg-primary/10 rounded-lg">
|
<div className="p-2 bg-primary/10 ascii-border">
|
||||||
<Clock className="h-5 w-5 text-primary" />
|
<ClockIcon className="h-5 w-5 text-primary" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<CardTitle className="text-xl brand-gradient">
|
<CardTitle className="text-xl brand-gradient">
|
||||||
@@ -261,7 +261,7 @@ export const CronJobList = ({ cronJobs, scripts }: CronJobListProps) => {
|
|||||||
className="btn-outline"
|
className="btn-outline"
|
||||||
title={t("cronjobs.filters")}
|
title={t("cronjobs.filters")}
|
||||||
>
|
>
|
||||||
<Filter className="h-4 w-4" />
|
<FunnelIcon className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setIsBackupModalOpen(true)}
|
onClick={() => setIsBackupModalOpen(true)}
|
||||||
@@ -276,7 +276,7 @@ export const CronJobList = ({ cronJobs, scripts }: CronJobListProps) => {
|
|||||||
onClick={() => setIsNewCronModalOpen(true)}
|
onClick={() => setIsNewCronModalOpen(true)}
|
||||||
className="btn-primary glow-primary"
|
className="btn-primary glow-primary"
|
||||||
>
|
>
|
||||||
<Plus className="h-4 w-4 mr-2" />
|
<PlusIcon className="h-4 w-4 mr-2" />
|
||||||
{t("cronjobs.newTask")}
|
{t("cronjobs.newTask")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -301,7 +301,7 @@ export const CronJobList = ({ cronJobs, scripts }: CronJobListProps) => {
|
|||||||
onNewTaskClick={() => setIsNewCronModalOpen(true)}
|
onNewTaskClick={() => setIsNewCronModalOpen(true)}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-3 max-h-[55vh] min-h-[55vh] overflow-y-auto">
|
<div className="space-y-4 max-h-[55vh] min-h-[55vh] overflow-y-auto tui-scrollbar pr-1">
|
||||||
{loadedSettings ? (
|
{loadedSettings ? (
|
||||||
filteredJobs.map((job) =>
|
filteredJobs.map((job) =>
|
||||||
minimalMode ? (
|
minimalMode ? (
|
||||||
@@ -347,7 +347,7 @@ export const CronJobList = ({ cronJobs, scripts }: CronJobListProps) => {
|
|||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<div className="flex items-center justify-center h-full min-h-[55vh]">
|
<div className="flex items-center justify-center h-full min-h-[55vh]">
|
||||||
<Loader2 className="h-8 w-8 animate-spin text-primary" />
|
<CircleNotchIcon className="h-8 w-8 animate-spin text-primary" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Clock, Plus } from "lucide-react";
|
import { ClockIcon, PlusIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
interface CronJobEmptyStateProps {
|
interface CronJobEmptyStateProps {
|
||||||
selectedUser: string | null;
|
selectedUser: string | null;
|
||||||
@@ -15,7 +15,7 @@ export const CronJobEmptyState = ({
|
|||||||
return (
|
return (
|
||||||
<div className="text-center py-16">
|
<div className="text-center py-16">
|
||||||
<div className="mx-auto w-20 h-20 bg-gradient-to-br from-primary/20 to-blue-500/20 rounded-full flex items-center justify-center mb-6">
|
<div className="mx-auto w-20 h-20 bg-gradient-to-br from-primary/20 to-blue-500/20 rounded-full flex items-center justify-center mb-6">
|
||||||
<Clock className="h-10 w-10 text-primary" />
|
<ClockIcon className="h-10 w-10 text-primary" />
|
||||||
</div>
|
</div>
|
||||||
<h3 className="text-xl font-semibold mb-3 brand-gradient">
|
<h3 className="text-xl font-semibold mb-3 brand-gradient">
|
||||||
{selectedUser
|
{selectedUser
|
||||||
@@ -32,7 +32,7 @@ export const CronJobEmptyState = ({
|
|||||||
className="btn-primary glow-primary"
|
className="btn-primary glow-primary"
|
||||||
size="lg"
|
size="lg"
|
||||||
>
|
>
|
||||||
<Plus className="h-5 w-5 mr-2" />
|
<PlusIcon className="h-5 w-5 mr-2" />
|
||||||
Create Your First Task
|
Create Your First Task
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,24 +4,24 @@ import { useState, useEffect } from "react";
|
|||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { DropdownMenu } from "@/app/_components/GlobalComponents/UIElements/DropdownMenu";
|
import { DropdownMenu } from "@/app/_components/GlobalComponents/UIElements/DropdownMenu";
|
||||||
import {
|
import {
|
||||||
Trash2,
|
TrashIcon,
|
||||||
Edit,
|
PencilSimpleIcon,
|
||||||
Files,
|
FilesIcon,
|
||||||
User,
|
UserIcon,
|
||||||
Play,
|
PlayIcon,
|
||||||
Pause,
|
PauseIcon,
|
||||||
Code,
|
CodeIcon,
|
||||||
Info,
|
InfoIcon,
|
||||||
FileOutput,
|
FileArrowDownIcon,
|
||||||
FileX,
|
FileXIcon,
|
||||||
FileText,
|
FileTextIcon,
|
||||||
AlertCircle,
|
WarningCircleIcon,
|
||||||
CheckCircle,
|
CheckCircleIcon,
|
||||||
AlertTriangle,
|
WarningIcon,
|
||||||
Download,
|
DownloadIcon,
|
||||||
Hash,
|
HashIcon,
|
||||||
Check,
|
CheckIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { CronJob } from "@/app/_utils/cronjob-utils";
|
import { CronJob } from "@/app/_utils/cronjob-utils";
|
||||||
import { JobError } from "@/app/_utils/error-utils";
|
import { JobError } from "@/app/_utils/error-utils";
|
||||||
import { ErrorBadge } from "@/app/_components/GlobalComponents/Badges/ErrorBadge";
|
import { ErrorBadge } from "@/app/_components/GlobalComponents/Badges/ErrorBadge";
|
||||||
@@ -92,7 +92,7 @@ export const CronJobItem = ({
|
|||||||
const dropdownMenuItems = [
|
const dropdownMenuItems = [
|
||||||
{
|
{
|
||||||
label: t("cronjobs.editCronJob"),
|
label: t("cronjobs.editCronJob"),
|
||||||
icon: <Edit className="h-3 w-3" />,
|
icon: <PencilSimpleIcon className="h-3 w-3" />,
|
||||||
onClick: () => onEdit(job),
|
onClick: () => onEdit(job),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -100,45 +100,45 @@ export const CronJobItem = ({
|
|||||||
? t("cronjobs.disableLogging")
|
? t("cronjobs.disableLogging")
|
||||||
: t("cronjobs.enableLogging"),
|
: t("cronjobs.enableLogging"),
|
||||||
icon: job.logsEnabled ? (
|
icon: job.logsEnabled ? (
|
||||||
<FileX className="h-3 w-3" />
|
<FileXIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<FileOutput className="h-3 w-3" />
|
<FileArrowDownIcon className="h-3 w-3" />
|
||||||
),
|
),
|
||||||
onClick: () => onToggleLogging(job.id),
|
onClick: () => onToggleLogging(job.id),
|
||||||
},
|
},
|
||||||
...(job.logsEnabled
|
...(job.logsEnabled
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: t("cronjobs.viewLogs"),
|
label: t("cronjobs.viewLogs"),
|
||||||
icon: <FileText className="h-3 w-3" />,
|
icon: <FileTextIcon className="h-3 w-3" />,
|
||||||
onClick: () => onViewLogs(job),
|
onClick: () => onViewLogs(job),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
{
|
{
|
||||||
label: job.paused
|
label: job.paused
|
||||||
? t("cronjobs.resumeCronJob")
|
? t("cronjobs.resumeCronJob")
|
||||||
: t("cronjobs.pauseCronJob"),
|
: t("cronjobs.pauseCronJob"),
|
||||||
icon: job.paused ? (
|
icon: job.paused ? (
|
||||||
<Play className="h-3 w-3" />
|
<PlayIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<Pause className="h-3 w-3" />
|
<PauseIcon className="h-3 w-3" />
|
||||||
),
|
),
|
||||||
onClick: () => (job.paused ? onResume(job.id) : onPause(job.id)),
|
onClick: () => (job.paused ? onResume(job.id) : onPause(job.id)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("cronjobs.cloneCronJob"),
|
label: t("cronjobs.cloneCronJob"),
|
||||||
icon: <Files className="h-3 w-3" />,
|
icon: <FilesIcon className="h-3 w-3" />,
|
||||||
onClick: () => onClone(job),
|
onClick: () => onClone(job),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("cronjobs.backupJob"),
|
label: t("cronjobs.backupJob"),
|
||||||
icon: <Download className="h-3 w-3" />,
|
icon: <DownloadIcon className="h-3 w-3" />,
|
||||||
onClick: () => onBackup(job.id),
|
onClick: () => onBackup(job.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("cronjobs.deleteCronJob"),
|
label: t("cronjobs.deleteCronJob"),
|
||||||
icon: <Trash2 className="h-3 w-3" />,
|
icon: <TrashIcon className="h-3 w-3" />,
|
||||||
onClick: () => onDelete(job),
|
onClick: () => onDelete(job),
|
||||||
variant: "destructive" as const,
|
variant: "destructive" as const,
|
||||||
disabled: deletingId === job.id,
|
disabled: deletingId === job.id,
|
||||||
@@ -148,22 +148,21 @@ export const CronJobItem = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={job.id}
|
key={job.id}
|
||||||
className={`glass-card p-4 border border-border/50 rounded-lg hover:bg-accent/30 transition-colors ${
|
className={`border border-border lg:tui-card p-4 terminal-font transition-colors ${isDropdownOpen ? "relative z-10" : ""
|
||||||
isDropdownOpen ? "relative z-10" : ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<div className="flex flex-col sm:flex-row sm:items-start gap-4">
|
<div className="flex flex-col sm:flex-row sm:items-start gap-4">
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-3 mb-2">
|
<div className="flex items-center gap-3 mb-2">
|
||||||
{(scheduleDisplayMode === "cron" ||
|
{(scheduleDisplayMode === "cron" ||
|
||||||
scheduleDisplayMode === "both") && (
|
scheduleDisplayMode === "both") && (
|
||||||
<code className="text-sm bg-purple-500/10 text-purple-600 dark:text-purple-400 px-2 py-1 rounded font-mono border border-purple-500/20">
|
<code className="text-sm bg-background0 text-status-warning px-2 py-1 terminal-font ascii-border">
|
||||||
{job.schedule}
|
{job.schedule}
|
||||||
</code>
|
</code>
|
||||||
)}
|
)}
|
||||||
{scheduleDisplayMode === "human" && cronExplanation?.isValid && (
|
{scheduleDisplayMode === "human" && cronExplanation?.isValid && (
|
||||||
<div className="flex items-start gap-1.5 border-b border-primary/30 bg-primary/10 rounded text-primary px-2 py-0.5">
|
<div className="flex items-start gap-1.5 ascii-border bg-background2 px-2 py-0.5">
|
||||||
<Info className="h-3 w-3 text-primary mt-0.5 flex-shrink-0" />
|
<InfoIcon className="h-3 w-3 mt-0.5 flex-shrink-0" />
|
||||||
<p className="text-sm italic">
|
<p className="text-sm italic">
|
||||||
{cronExplanation.humanReadable}
|
{cronExplanation.humanReadable}
|
||||||
</p>
|
</p>
|
||||||
@@ -172,7 +171,7 @@ export const CronJobItem = ({
|
|||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2 min-w-0 w-full">
|
<div className="flex items-center gap-2 min-w-0 w-full">
|
||||||
{commandCopied === job.id && (
|
{commandCopied === job.id && (
|
||||||
<Check className="h-3 w-3 text-green-600" />
|
<CheckIcon className="h-3 w-3 text-status-success" />
|
||||||
)}
|
)}
|
||||||
<pre
|
<pre
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -181,7 +180,7 @@ export const CronJobItem = ({
|
|||||||
setCommandCopied(job.id);
|
setCommandCopied(job.id);
|
||||||
setTimeout(() => setCommandCopied(null), 3000);
|
setTimeout(() => setCommandCopied(null), 3000);
|
||||||
}}
|
}}
|
||||||
className="w-full cursor-pointer overflow-x-auto text-sm font-medium text-foreground bg-muted/30 px-2 py-1 rounded border border-border/30 hide-scrollbar"
|
className="w-full cursor-pointer overflow-x-auto text-sm font-medium terminal-font bg-background1 px-2 py-1 ascii-border hide-scrollbar"
|
||||||
>
|
>
|
||||||
{unwrapCommand(displayCommand)}
|
{unwrapCommand(displayCommand)}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -191,8 +190,8 @@ export const CronJobItem = ({
|
|||||||
|
|
||||||
<div className="flex items-center gap-2 pb-2 pt-4">
|
<div className="flex items-center gap-2 pb-2 pt-4">
|
||||||
{scheduleDisplayMode === "both" && cronExplanation?.isValid && (
|
{scheduleDisplayMode === "both" && cronExplanation?.isValid && (
|
||||||
<div className="flex items-start gap-1.5 border-b border-primary/30 bg-primary/10 rounded text-primary px-2 py-0.5">
|
<div className="flex items-start gap-1.5 ascii-border bg-background2 px-2 py-0.5">
|
||||||
<Info className="h-3 w-3 text-primary mt-0.5 flex-shrink-0" />
|
<InfoIcon className="h-3 w-3 mt-0.5 flex-shrink-0" />
|
||||||
<p className="text-xs italic">
|
<p className="text-xs italic">
|
||||||
{cronExplanation.humanReadable}
|
{cronExplanation.humanReadable}
|
||||||
</p>
|
</p>
|
||||||
@@ -201,7 +200,7 @@ export const CronJobItem = ({
|
|||||||
|
|
||||||
{job.comment && (
|
{job.comment && (
|
||||||
<p
|
<p
|
||||||
className="text-xs text-muted-foreground italic truncate"
|
className="text-xs italic truncate"
|
||||||
title={job.comment}
|
title={job.comment}
|
||||||
>
|
>
|
||||||
{job.comment}
|
{job.comment}
|
||||||
@@ -210,13 +209,13 @@ export const CronJobItem = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-wrap items-center gap-2 py-3">
|
<div className="flex flex-wrap items-center gap-2 py-3">
|
||||||
<div className="flex items-center gap-1 text-xs bg-muted/50 text-muted-foreground px-2 py-0.5 rounded border border-border/30 cursor-pointer hover:bg-muted/70 transition-colors relative">
|
<div className="flex items-center gap-1 text-xs bg-background0 px-2 py-0.5 ascii-border cursor-pointer hover:bg-background2 transition-colors relative terminal-font">
|
||||||
<User className="h-3 w-3" />
|
<UserIcon className="h-3 w-3" />
|
||||||
<span>{job.user}</span>
|
<span>{job.user}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="flex items-center gap-1 text-xs bg-muted/50 text-muted-foreground px-2 py-0.5 rounded border border-border/30 cursor-pointer hover:bg-muted/70 transition-colors relative"
|
className="flex items-center gap-1 text-xs bg-background0 px-2 py-0.5 ascii-border cursor-pointer hover:bg-background2 transition-colors relative terminal-font"
|
||||||
title="Click to copy Job UUID"
|
title="Click to copy Job UUID"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const success = await copyToClipboard(job.id);
|
const success = await copyToClipboard(job.id);
|
||||||
@@ -227,22 +226,22 @@ export const CronJobItem = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{showCopyConfirmation ? (
|
{showCopyConfirmation ? (
|
||||||
<Check className="h-3 w-3 text-green-600" />
|
<CheckIcon className="h-3 w-3 text-status-success" />
|
||||||
) : (
|
) : (
|
||||||
<Hash className="h-3 w-3" />
|
<HashIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
<span className="font-mono">{job.id}</span>
|
<span className="font-mono">{job.id}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{job.paused && (
|
{job.paused && (
|
||||||
<span className="text-xs bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 px-2 py-0.5 rounded border border-yellow-500/20">
|
<span className="text-xs bg-background2 px-2 py-0.5 ascii-border terminal-font">
|
||||||
{t("cronjobs.paused")}
|
<span className="text-status-warning">{t("cronjobs.paused")}</span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{job.logsEnabled && (
|
{job.logsEnabled && (
|
||||||
<span className="text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400 px-2 py-0.5 rounded border border-blue-500/20">
|
<span className="text-xs bg-background0 px-2 py-0.5 ascii-border terminal-font">
|
||||||
{t("cronjobs.logged")}
|
<span className="text-status-info">{t("cronjobs.logged")}</span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -252,11 +251,11 @@ export const CronJobItem = ({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onViewLogs(job);
|
onViewLogs(job);
|
||||||
}}
|
}}
|
||||||
className="flex items-center gap-1 text-xs bg-red-500/10 text-red-600 dark:text-red-400 px-2 py-0.5 rounded border border-red-500/30 hover:bg-red-500/20 transition-colors cursor-pointer"
|
className="flex items-center gap-1 text-xs bg-background0 px-2 py-0.5 ascii-border hover:bg-background1 transition-colors cursor-pointer terminal-font"
|
||||||
title="Latest execution failed - Click to view error log"
|
title="Latest execution failed - Click to view error log"
|
||||||
>
|
>
|
||||||
<AlertCircle className="h-3 w-3" />
|
<WarningCircleIcon className="h-3 w-3 text-status-error" />
|
||||||
<span>
|
<span className="text-status-error">
|
||||||
{t("cronjobs.failed", {
|
{t("cronjobs.failed", {
|
||||||
exitCode: job.logError?.exitCode?.toString() ?? "",
|
exitCode: job.logError?.exitCode?.toString() ?? "",
|
||||||
})}
|
})}
|
||||||
@@ -272,12 +271,12 @@ export const CronJobItem = ({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onViewLogs(job);
|
onViewLogs(job);
|
||||||
}}
|
}}
|
||||||
className="flex items-center gap-1 text-xs bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 px-2 py-0.5 rounded border border-yellow-500/30 hover:bg-yellow-500/20 transition-colors cursor-pointer"
|
className="flex items-center gap-1 text-xs bg-background0 px-2 py-0.5 ascii-border hover:bg-background1 transition-colors cursor-pointer terminal-font"
|
||||||
title="Latest execution succeeded, but has historical failures - Click to view logs"
|
title="Latest execution succeeded, but has historical failures - Click to view logs"
|
||||||
>
|
>
|
||||||
<CheckCircle className="h-3 w-3" />
|
<CheckCircleIcon className="h-3 w-3 text-status-success" />
|
||||||
<span>{t("cronjobs.healthy")}</span>
|
<span className="text-status-warning">{t("cronjobs.healthy")}</span>
|
||||||
<AlertTriangle className="h-3 w-3" />
|
<WarningIcon className="h-3 w-3 text-status-warning" />
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -285,9 +284,9 @@ export const CronJobItem = ({
|
|||||||
!job.logError?.hasError &&
|
!job.logError?.hasError &&
|
||||||
!job.logError?.hasHistoricalFailures &&
|
!job.logError?.hasHistoricalFailures &&
|
||||||
job.logError?.latestExitCode === 0 && (
|
job.logError?.latestExitCode === 0 && (
|
||||||
<div className="flex items-center gap-1 text-xs bg-green-500/10 text-green-600 dark:text-green-400 px-2 py-0.5 rounded border border-green-500/30">
|
<div className="flex items-center gap-1 text-xs bg-background0 px-2 py-0.5 ascii-border terminal-font">
|
||||||
<CheckCircle className="h-3 w-3" />
|
<CheckCircleIcon className="h-3 w-3 text-status-success" />
|
||||||
<span>{t("cronjobs.healthy")}</span>
|
<span className="text-status-success">{t("cronjobs.healthy")}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -315,7 +314,7 @@ export const CronJobItem = ({
|
|||||||
{runningJobId === job.id ? (
|
{runningJobId === job.id ? (
|
||||||
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
||||||
) : (
|
) : (
|
||||||
<Code className="h-3 w-3" />
|
<CodeIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -334,9 +333,9 @@ export const CronJobItem = ({
|
|||||||
aria-label={t("cronjobs.pauseCronJob")}
|
aria-label={t("cronjobs.pauseCronJob")}
|
||||||
>
|
>
|
||||||
{job.paused ? (
|
{job.paused ? (
|
||||||
<Play className="h-3 w-3" />
|
<PlayIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<Pause className="h-3 w-3" />
|
<PauseIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -363,9 +362,9 @@ export const CronJobItem = ({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{job.logsEnabled ? (
|
{job.logsEnabled ? (
|
||||||
<FileText className="h-3 w-3" />
|
<FileTextIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<FileOutput className="h-3 w-3" />
|
<FileArrowDownIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ import { useState, useEffect } from "react";
|
|||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { DropdownMenu } from "@/app/_components/GlobalComponents/UIElements/DropdownMenu";
|
import { DropdownMenu } from "@/app/_components/GlobalComponents/UIElements/DropdownMenu";
|
||||||
import {
|
import {
|
||||||
Trash2,
|
TrashIcon,
|
||||||
Edit,
|
PencilSimpleIcon,
|
||||||
Files,
|
FilesIcon,
|
||||||
Play,
|
PlayIcon,
|
||||||
Pause,
|
PauseIcon,
|
||||||
Code,
|
CodeIcon,
|
||||||
Info,
|
InfoIcon,
|
||||||
Download,
|
DownloadIcon,
|
||||||
Check,
|
CheckIcon,
|
||||||
FileX,
|
FileXIcon,
|
||||||
FileText,
|
FileTextIcon,
|
||||||
FileOutput,
|
FileArrowDownIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { CronJob } from "@/app/_utils/cronjob-utils";
|
import { CronJob } from "@/app/_utils/cronjob-utils";
|
||||||
import { JobError } from "@/app/_utils/error-utils";
|
import { JobError } from "@/app/_utils/error-utils";
|
||||||
import {
|
import {
|
||||||
@@ -83,7 +83,7 @@ export const MinimalCronJobItem = ({
|
|||||||
const dropdownMenuItems = [
|
const dropdownMenuItems = [
|
||||||
{
|
{
|
||||||
label: t("cronjobs.editCronJob"),
|
label: t("cronjobs.editCronJob"),
|
||||||
icon: <Edit className="h-3 w-3" />,
|
icon: <PencilSimpleIcon className="h-3 w-3" />,
|
||||||
onClick: () => onEdit(job),
|
onClick: () => onEdit(job),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -91,9 +91,9 @@ export const MinimalCronJobItem = ({
|
|||||||
? t("cronjobs.disableLogging")
|
? t("cronjobs.disableLogging")
|
||||||
: t("cronjobs.enableLogging"),
|
: t("cronjobs.enableLogging"),
|
||||||
icon: job.logsEnabled ? (
|
icon: job.logsEnabled ? (
|
||||||
<FileX className="h-3 w-3" />
|
<FileXIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<Code className="h-3 w-3" />
|
<CodeIcon className="h-3 w-3" />
|
||||||
),
|
),
|
||||||
onClick: () => onToggleLogging(job.id),
|
onClick: () => onToggleLogging(job.id),
|
||||||
},
|
},
|
||||||
@@ -101,7 +101,7 @@ export const MinimalCronJobItem = ({
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: t("cronjobs.viewLogs"),
|
label: t("cronjobs.viewLogs"),
|
||||||
icon: <Code className="h-3 w-3" />,
|
icon: <CodeIcon className="h-3 w-3" />,
|
||||||
onClick: () => onViewLogs(job),
|
onClick: () => onViewLogs(job),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -111,25 +111,25 @@ export const MinimalCronJobItem = ({
|
|||||||
? t("cronjobs.resumeCronJob")
|
? t("cronjobs.resumeCronJob")
|
||||||
: t("cronjobs.pauseCronJob"),
|
: t("cronjobs.pauseCronJob"),
|
||||||
icon: job.paused ? (
|
icon: job.paused ? (
|
||||||
<Play className="h-3 w-3" />
|
<PlayIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<Pause className="h-3 w-3" />
|
<PauseIcon className="h-3 w-3" />
|
||||||
),
|
),
|
||||||
onClick: () => (job.paused ? onResume(job.id) : onPause(job.id)),
|
onClick: () => (job.paused ? onResume(job.id) : onPause(job.id)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("cronjobs.cloneCronJob"),
|
label: t("cronjobs.cloneCronJob"),
|
||||||
icon: <Files className="h-3 w-3" />,
|
icon: <FilesIcon className="h-3 w-3" />,
|
||||||
onClick: () => onClone(job),
|
onClick: () => onClone(job),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("cronjobs.backupJob"),
|
label: t("cronjobs.backupJob"),
|
||||||
icon: <Download className="h-3 w-3" />,
|
icon: <DownloadIcon className="h-3 w-3" />,
|
||||||
onClick: () => onBackup(job.id),
|
onClick: () => onBackup(job.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("cronjobs.deleteCronJob"),
|
label: t("cronjobs.deleteCronJob"),
|
||||||
icon: <Trash2 className="h-3 w-3" />,
|
icon: <TrashIcon className="h-3 w-3" />,
|
||||||
onClick: () => onDelete(job),
|
onClick: () => onDelete(job),
|
||||||
variant: "destructive" as const,
|
variant: "destructive" as const,
|
||||||
disabled: deletingId === job.id,
|
disabled: deletingId === job.id,
|
||||||
@@ -139,19 +139,19 @@ export const MinimalCronJobItem = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={job.id}
|
key={job.id}
|
||||||
className={`glass-card p-3 border border-border/50 rounded-lg hover:bg-accent/30 transition-colors ${isDropdownOpen ? "relative z-10" : ""
|
className={`border border-border lg:tui-card p-3 terminal-font transition-colors ${isDropdownOpen ? "relative z-10" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<div className="flex items-center gap-1 flex-shrink-0">
|
<div className="flex items-center gap-1 flex-shrink-0">
|
||||||
{scheduleDisplayMode === "cron" && (
|
{scheduleDisplayMode === "cron" && (
|
||||||
<code className="text-xs bg-purple-500/10 text-purple-600 dark:text-purple-400 px-1.5 py-0.5 rounded font-mono border border-purple-500/20">
|
<code className="text-xs bg-background0 text-status-warning px-1.5 py-0.5 terminal-font ascii-border">
|
||||||
{job.schedule}
|
{job.schedule}
|
||||||
</code>
|
</code>
|
||||||
)}
|
)}
|
||||||
{scheduleDisplayMode === "human" && cronExplanation?.isValid && (
|
{scheduleDisplayMode === "human" && cronExplanation?.isValid && (
|
||||||
<div className="flex items-center gap-1 border-b border-primary/30 bg-primary/10 rounded text-primary px-1.5 py-0.5">
|
<div className="flex items-center gap-1 ascii-border bg-background2 px-1.5 py-0.5">
|
||||||
<Info className="h-3 w-3 text-primary flex-shrink-0" />
|
<InfoIcon className="h-3 w-3 flex-shrink-0" />
|
||||||
<span className="text-xs italic truncate max-w-32">
|
<span className="text-xs italic truncate max-w-32">
|
||||||
{cronExplanation.humanReadable}
|
{cronExplanation.humanReadable}
|
||||||
</span>
|
</span>
|
||||||
@@ -159,15 +159,15 @@ export const MinimalCronJobItem = ({
|
|||||||
)}
|
)}
|
||||||
{scheduleDisplayMode === "both" && (
|
{scheduleDisplayMode === "both" && (
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<code className="text-xs bg-purple-500/10 text-purple-600 dark:text-purple-400 px-1 py-0.5 rounded font-mono border border-purple-500/20">
|
<code className="text-xs bg-background0 text-status-warning px-1 py-0.5 terminal-font ascii-border">
|
||||||
{job.schedule}
|
{job.schedule}
|
||||||
</code>
|
</code>
|
||||||
{cronExplanation?.isValid && (
|
{cronExplanation?.isValid && (
|
||||||
<div
|
<div
|
||||||
className="flex items-center gap-1 border-b border-primary/30 bg-primary/10 rounded text-primary px-1 py-0.5 cursor-help"
|
className="flex items-center gap-1 ascii-border bg-background0 px-1 py-0.5 cursor-help"
|
||||||
title={cronExplanation.humanReadable}
|
title={cronExplanation.humanReadable}
|
||||||
>
|
>
|
||||||
<Info className="h-2.5 w-2.5 text-primary flex-shrink-0" />
|
<InfoIcon className="h-2.5 w-2.5 flex-shrink-0" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -177,7 +177,7 @@ export const MinimalCronJobItem = ({
|
|||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{commandCopied === job.id && (
|
{commandCopied === job.id && (
|
||||||
<Check className="h-3 w-3 text-green-600 flex-shrink-0" />
|
<CheckIcon className="h-3 w-3 text-status-success flex-shrink-0" />
|
||||||
)}
|
)}
|
||||||
<pre
|
<pre
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -186,7 +186,7 @@ export const MinimalCronJobItem = ({
|
|||||||
setCommandCopied(job.id);
|
setCommandCopied(job.id);
|
||||||
setTimeout(() => setCommandCopied(null), 3000);
|
setTimeout(() => setCommandCopied(null), 3000);
|
||||||
}}
|
}}
|
||||||
className="flex-1 cursor-pointer overflow-hidden text-sm font-medium text-foreground bg-muted/30 px-2 py-1 rounded border border-border/30 truncate"
|
className="flex-1 cursor-pointer overflow-hidden text-sm font-medium terminal-font bg-background1 px-2 py-1 ascii-border truncate"
|
||||||
title={unwrapCommand(job.command)}
|
title={unwrapCommand(job.command)}
|
||||||
>
|
>
|
||||||
{unwrapCommand(displayCommand)}
|
{unwrapCommand(displayCommand)}
|
||||||
@@ -197,25 +197,25 @@ export const MinimalCronJobItem = ({
|
|||||||
<div className="flex items-center gap-1 flex-shrink-0">
|
<div className="flex items-center gap-1 flex-shrink-0">
|
||||||
{job.logsEnabled && (
|
{job.logsEnabled && (
|
||||||
<div
|
<div
|
||||||
className="w-2 h-2 bg-blue-500 rounded-full"
|
className="w-2 h-2 bg-status-info ascii-border"
|
||||||
title={t("cronjobs.logged")}
|
title={t("cronjobs.logged")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{job.paused && (
|
{job.paused && (
|
||||||
<div
|
<div
|
||||||
className="w-2 h-2 bg-yellow-500 rounded-full"
|
className="w-2 h-2 bg-status-warning ascii-border"
|
||||||
title={t("cronjobs.paused")}
|
title={t("cronjobs.paused")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!job.logError?.hasError && job.logsEnabled && (
|
{!job.logError?.hasError && job.logsEnabled && (
|
||||||
<div
|
<div
|
||||||
className="w-2 h-2 bg-green-500 rounded-full"
|
className="w-2 h-2 bg-status-success ascii-border"
|
||||||
title={t("cronjobs.healthy")}
|
title={t("cronjobs.healthy")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{job.logsEnabled && job.logError?.hasError && (
|
{job.logsEnabled && job.logError?.hasError && (
|
||||||
<div
|
<div
|
||||||
className="w-2 h-2 bg-red-500 rounded-full cursor-pointer"
|
className="w-2 h-2 bg-status-error ascii-border cursor-pointer"
|
||||||
title="Latest execution failed - Click to view error log"
|
title="Latest execution failed - Click to view error log"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -225,31 +225,32 @@ export const MinimalCronJobItem = ({
|
|||||||
)}
|
)}
|
||||||
{!job.logsEnabled && errors.length > 0 && (
|
{!job.logsEnabled && errors.length > 0 && (
|
||||||
<div
|
<div
|
||||||
className="w-2 h-2 bg-orange-500 rounded-full cursor-pointer"
|
className="w-2 h-2 bg-status-warning ascii-border cursor-pointer"
|
||||||
title={`${errors.length} error(s)`}
|
title={`${errors.length} error(s)`}
|
||||||
onClick={(e) => onErrorClick(errors[0])}
|
onClick={(e) => onErrorClick(errors[0])}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-1 flex-shrink-0">
|
<div className="flex items-center gap-2 flex-shrink-0">
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onRun(job.id)}
|
onClick={() => onRun(job.id)}
|
||||||
disabled={runningJobId === job.id || job.paused}
|
disabled={runningJobId === job.id || job.paused}
|
||||||
className="h-6 w-6 p-0"
|
className="btn-outline h-8 px-3 hidden md:flex"
|
||||||
title={t("cronjobs.runCronManually")}
|
title={t("cronjobs.runCronManually")}
|
||||||
|
aria-label={t("cronjobs.runCronManually")}
|
||||||
>
|
>
|
||||||
{runningJobId === job.id ? (
|
{runningJobId === job.id ? (
|
||||||
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
||||||
) : (
|
) : (
|
||||||
<Code className="h-3 w-3" />
|
<CodeIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (job.paused) {
|
if (job.paused) {
|
||||||
@@ -258,18 +259,19 @@ export const MinimalCronJobItem = ({
|
|||||||
onPause(job.id);
|
onPause(job.id);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="h-6 w-6 p-0"
|
className="btn-outline h-8 px-3 hidden md:flex"
|
||||||
title={t("cronjobs.pauseCronJob")}
|
title={t("cronjobs.pauseCronJob")}
|
||||||
|
aria-label={t("cronjobs.pauseCronJob")}
|
||||||
>
|
>
|
||||||
{job.paused ? (
|
{job.paused ? (
|
||||||
<Play className="h-3 w-3" />
|
<PlayIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<Pause className="h-3 w-3" />
|
<PauseIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (job.logsEnabled) {
|
if (job.logsEnabled) {
|
||||||
@@ -278,17 +280,22 @@ export const MinimalCronJobItem = ({
|
|||||||
onToggleLogging(job.id);
|
onToggleLogging(job.id);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="h-6 w-6 p-0"
|
className="btn-outline h-8 px-3 hidden md:flex"
|
||||||
title={
|
title={
|
||||||
job.logsEnabled
|
job.logsEnabled
|
||||||
? t("cronjobs.viewLogs")
|
? t("cronjobs.viewLogs")
|
||||||
: t("cronjobs.enableLogging")
|
: t("cronjobs.enableLogging")
|
||||||
}
|
}
|
||||||
|
aria-label={
|
||||||
|
job.logsEnabled
|
||||||
|
? t("cronjobs.viewLogs")
|
||||||
|
: t("cronjobs.enableLogging")
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{job.logsEnabled ? (
|
{job.logsEnabled ? (
|
||||||
<FileText className="h-3 w-3" />
|
<FileTextIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<FileOutput className="h-3 w-3" />
|
<FileArrowDownIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|||||||
431
app/_components/FeatureComponents/Games/SnakeGame.tsx
Normal file
@@ -0,0 +1,431 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useRef, useState, useCallback } from "react";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import { ArrowUpIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowClockwiseIcon, PlayIcon, PauseIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
|
interface Position {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Direction = "UP" | "DOWN" | "LEFT" | "RIGHT";
|
||||||
|
|
||||||
|
const GRID_SIZE = 20;
|
||||||
|
const INITIAL_SNAKE: Position[] = [
|
||||||
|
{ x: 10, y: 10 },
|
||||||
|
{ x: 9, y: 10 },
|
||||||
|
{ x: 8, y: 10 },
|
||||||
|
];
|
||||||
|
const INITIAL_DIRECTION: Direction = "RIGHT";
|
||||||
|
const GAME_SPEED = 150;
|
||||||
|
|
||||||
|
export const SnakeGame = () => {
|
||||||
|
const t = useTranslations("notFound");
|
||||||
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const [snake, setSnake] = useState<Position[]>(INITIAL_SNAKE);
|
||||||
|
const [direction, setDirection] = useState<Direction>(INITIAL_DIRECTION);
|
||||||
|
const [food, setFood] = useState<Position>({ x: 15, y: 15 });
|
||||||
|
const [gameOver, setGameOver] = useState(false);
|
||||||
|
const [gameStarted, setGameStarted] = useState(false);
|
||||||
|
const [score, setScore] = useState(0);
|
||||||
|
const [highScore, setHighScore] = useState(0);
|
||||||
|
const [isPaused, setIsPaused] = useState(false);
|
||||||
|
const [colors, setColors] = useState({ snake: "#00ff00", food: "#ff0000", grid: "#333333" });
|
||||||
|
const [cellSize, setCellSize] = useState(20);
|
||||||
|
|
||||||
|
const directionRef = useRef<Direction>(INITIAL_DIRECTION);
|
||||||
|
const gameLoopRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const savedHighScore = localStorage.getItem("snakeHighScore");
|
||||||
|
if (savedHighScore) {
|
||||||
|
setHighScore(parseInt(savedHighScore));
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateColors = () => {
|
||||||
|
const theme = document.documentElement.getAttribute("data-webtui-theme");
|
||||||
|
if (theme === "catppuccin-mocha") {
|
||||||
|
setColors({
|
||||||
|
snake: "#9ca0b0",
|
||||||
|
food: "#f38ba8",
|
||||||
|
grid: "#313244",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setColors({
|
||||||
|
snake: "#313244",
|
||||||
|
food: "#d20f39",
|
||||||
|
grid: "#9ca0b0",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateColors();
|
||||||
|
|
||||||
|
const observer = new MutationObserver(updateColors);
|
||||||
|
observer.observe(document.documentElement, {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ["data-webtui-theme"],
|
||||||
|
});
|
||||||
|
|
||||||
|
const updateCellSize = () => {
|
||||||
|
if (containerRef.current) {
|
||||||
|
const containerWidth = containerRef.current.offsetWidth;
|
||||||
|
const maxCanvasSize = Math.min(containerWidth - 32, 400);
|
||||||
|
const newCellSize = Math.floor(maxCanvasSize / GRID_SIZE);
|
||||||
|
setCellSize(newCellSize);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateCellSize();
|
||||||
|
window.addEventListener("resize", updateCellSize);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
observer.disconnect();
|
||||||
|
window.removeEventListener("resize", updateCellSize);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const generateFood = useCallback((): Position => {
|
||||||
|
let newFood: Position;
|
||||||
|
do {
|
||||||
|
newFood = {
|
||||||
|
x: Math.floor(Math.random() * GRID_SIZE),
|
||||||
|
y: Math.floor(Math.random() * GRID_SIZE),
|
||||||
|
};
|
||||||
|
} while (snake.some((segment) => segment.x === newFood.x && segment.y === newFood.y));
|
||||||
|
return newFood;
|
||||||
|
}, [snake]);
|
||||||
|
|
||||||
|
const resetGame = useCallback(() => {
|
||||||
|
setSnake(INITIAL_SNAKE);
|
||||||
|
setDirection(INITIAL_DIRECTION);
|
||||||
|
directionRef.current = INITIAL_DIRECTION;
|
||||||
|
setFood(generateFood());
|
||||||
|
setGameOver(false);
|
||||||
|
setGameStarted(true);
|
||||||
|
setScore(0);
|
||||||
|
setIsPaused(false);
|
||||||
|
}, [generateFood]);
|
||||||
|
|
||||||
|
const draw = useCallback(() => {
|
||||||
|
const canvas = canvasRef.current;
|
||||||
|
if (!canvas) return;
|
||||||
|
|
||||||
|
const ctx = canvas.getContext("2d");
|
||||||
|
if (!ctx) return;
|
||||||
|
|
||||||
|
const theme = document.documentElement.getAttribute("data-webtui-theme");
|
||||||
|
const bgColor = theme === "catppuccin-mocha" ? "#1e1e2e" : "#eff1f5";
|
||||||
|
|
||||||
|
ctx.fillStyle = bgColor;
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
ctx.strokeStyle = colors.grid;
|
||||||
|
ctx.lineWidth = 1;
|
||||||
|
for (let i = 0; i <= GRID_SIZE; i++) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(i * cellSize, 0);
|
||||||
|
ctx.lineTo(i * cellSize, GRID_SIZE * cellSize);
|
||||||
|
ctx.stroke();
|
||||||
|
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(0, i * cellSize);
|
||||||
|
ctx.lineTo(GRID_SIZE * cellSize, i * cellSize);
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
snake.forEach((segment) => {
|
||||||
|
ctx.fillStyle = colors.snake;
|
||||||
|
ctx.fillRect(
|
||||||
|
segment.x * cellSize + 1,
|
||||||
|
segment.y * cellSize + 1,
|
||||||
|
cellSize - 2,
|
||||||
|
cellSize - 2
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.fillStyle = colors.food;
|
||||||
|
ctx.fillRect(
|
||||||
|
food.x * cellSize + 1,
|
||||||
|
food.y * cellSize + 1,
|
||||||
|
cellSize - 2,
|
||||||
|
cellSize - 2
|
||||||
|
);
|
||||||
|
}, [snake, food, colors, cellSize]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
draw();
|
||||||
|
}, [draw]);
|
||||||
|
|
||||||
|
const moveSnake = useCallback(() => {
|
||||||
|
if (gameOver || !gameStarted || isPaused) return;
|
||||||
|
|
||||||
|
setSnake((prevSnake) => {
|
||||||
|
const head = prevSnake[0];
|
||||||
|
const newHead: Position = { ...head };
|
||||||
|
|
||||||
|
switch (directionRef.current) {
|
||||||
|
case "UP":
|
||||||
|
newHead.y -= 1;
|
||||||
|
break;
|
||||||
|
case "DOWN":
|
||||||
|
newHead.y += 1;
|
||||||
|
break;
|
||||||
|
case "LEFT":
|
||||||
|
newHead.x -= 1;
|
||||||
|
break;
|
||||||
|
case "RIGHT":
|
||||||
|
newHead.x += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
newHead.x < 0 ||
|
||||||
|
newHead.x >= GRID_SIZE ||
|
||||||
|
newHead.y < 0 ||
|
||||||
|
newHead.y >= GRID_SIZE ||
|
||||||
|
prevSnake.some((segment) => segment.x === newHead.x && segment.y === newHead.y)
|
||||||
|
) {
|
||||||
|
setGameOver(true);
|
||||||
|
setGameStarted(false);
|
||||||
|
return prevSnake;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newSnake = [newHead, ...prevSnake];
|
||||||
|
|
||||||
|
if (newHead.x === food.x && newHead.y === food.y) {
|
||||||
|
setScore((prev) => {
|
||||||
|
const newScore = prev + 10;
|
||||||
|
if (newScore > highScore) {
|
||||||
|
setHighScore(newScore);
|
||||||
|
localStorage.setItem("snakeHighScore", newScore.toString());
|
||||||
|
}
|
||||||
|
return newScore;
|
||||||
|
});
|
||||||
|
setFood(generateFood());
|
||||||
|
} else {
|
||||||
|
newSnake.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return newSnake;
|
||||||
|
});
|
||||||
|
}, [gameOver, gameStarted, isPaused, food, highScore, generateFood]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (gameStarted && !gameOver && !isPaused) {
|
||||||
|
gameLoopRef.current = setInterval(moveSnake, GAME_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (gameLoopRef.current) {
|
||||||
|
clearInterval(gameLoopRef.current);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [gameStarted, gameOver, isPaused, moveSnake]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleKeyPress = (e: KeyboardEvent) => {
|
||||||
|
if (e.code === "Space") {
|
||||||
|
e.preventDefault();
|
||||||
|
if (gameOver) {
|
||||||
|
resetGame();
|
||||||
|
} else if (!gameStarted) {
|
||||||
|
setGameStarted(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.code === "KeyP") {
|
||||||
|
e.preventDefault();
|
||||||
|
if (gameStarted && !gameOver) {
|
||||||
|
setIsPaused((prev) => !prev);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gameStarted || gameOver || isPaused) return;
|
||||||
|
|
||||||
|
let newDirection: Direction | null = null;
|
||||||
|
|
||||||
|
switch (e.key) {
|
||||||
|
case "ArrowUp":
|
||||||
|
if (directionRef.current !== "DOWN") {
|
||||||
|
newDirection = "UP";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "ArrowDown":
|
||||||
|
if (directionRef.current !== "UP") {
|
||||||
|
newDirection = "DOWN";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "ArrowLeft":
|
||||||
|
if (directionRef.current !== "RIGHT") {
|
||||||
|
newDirection = "LEFT";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "ArrowRight":
|
||||||
|
if (directionRef.current !== "LEFT") {
|
||||||
|
newDirection = "RIGHT";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newDirection) {
|
||||||
|
e.preventDefault();
|
||||||
|
directionRef.current = newDirection;
|
||||||
|
setDirection(newDirection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("keydown", handleKeyPress);
|
||||||
|
return () => window.removeEventListener("keydown", handleKeyPress);
|
||||||
|
}, [gameOver, gameStarted, isPaused, resetGame]);
|
||||||
|
|
||||||
|
const handleTouchMove = (dir: Direction) => {
|
||||||
|
if (!gameStarted) {
|
||||||
|
setGameStarted(true);
|
||||||
|
directionRef.current = dir;
|
||||||
|
setDirection(dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gameOver || isPaused) return;
|
||||||
|
|
||||||
|
let canMove = false;
|
||||||
|
|
||||||
|
switch (dir) {
|
||||||
|
case "UP":
|
||||||
|
canMove = directionRef.current !== "DOWN";
|
||||||
|
break;
|
||||||
|
case "DOWN":
|
||||||
|
canMove = directionRef.current !== "UP";
|
||||||
|
break;
|
||||||
|
case "LEFT":
|
||||||
|
canMove = directionRef.current !== "RIGHT";
|
||||||
|
break;
|
||||||
|
case "RIGHT":
|
||||||
|
canMove = directionRef.current !== "LEFT";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canMove) {
|
||||||
|
directionRef.current = dir;
|
||||||
|
setDirection(dir);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCanvasClick = () => {
|
||||||
|
if (gameOver) {
|
||||||
|
resetGame();
|
||||||
|
} else if (!gameStarted) {
|
||||||
|
setGameStarted(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={containerRef} className="flex flex-col items-center gap-4 w-full">
|
||||||
|
<div className="tui-card p-4 w-full max-w-md">
|
||||||
|
<div className="flex justify-between items-center mb-4 terminal-font">
|
||||||
|
<div className="text-sm">
|
||||||
|
<span className="text-status-success">{t("score")}:</span> {score}
|
||||||
|
</div>
|
||||||
|
<div className="text-sm">
|
||||||
|
<span className="text-status-info">{t("highScore")}:</span> {highScore}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="relative">
|
||||||
|
<canvas
|
||||||
|
ref={canvasRef}
|
||||||
|
width={GRID_SIZE * cellSize}
|
||||||
|
height={GRID_SIZE * cellSize}
|
||||||
|
className="ascii-border mx-auto cursor-pointer bg-background0"
|
||||||
|
onClick={handleCanvasClick}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{!gameStarted && !gameOver && (
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 flex items-center justify-center bg-background0 bg-opacity-90 ascii-border cursor-pointer"
|
||||||
|
onClick={handleCanvasClick}
|
||||||
|
>
|
||||||
|
<div className="text-center terminal-font">
|
||||||
|
<p className="text-lg font-bold uppercase mb-2">{t("pressToStart")}</p>
|
||||||
|
<p className="text-xs text-foreground0 opacity-70">{t("pauseGame")}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{gameOver && (
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 flex items-center justify-center bg-background0 bg-opacity-90 ascii-border cursor-pointer"
|
||||||
|
onClick={handleCanvasClick}
|
||||||
|
>
|
||||||
|
<div className="text-center terminal-font">
|
||||||
|
<p className="text-2xl font-bold uppercase text-status-error mb-2">
|
||||||
|
{t("gameOver")}
|
||||||
|
</p>
|
||||||
|
<p className="text-lg mb-1">
|
||||||
|
{t("score")}: {score}
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-foreground0 opacity-70">{t("pressToRestart")}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isPaused && (
|
||||||
|
<div className="absolute inset-0 flex items-center justify-center bg-background0 bg-opacity-90 ascii-border">
|
||||||
|
<div className="text-center terminal-font">
|
||||||
|
<p className="text-2xl font-bold uppercase text-status-warning">
|
||||||
|
{t("paused")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-4 grid grid-cols-3 gap-2 md:hidden">
|
||||||
|
<div></div>
|
||||||
|
<button
|
||||||
|
onClick={() => handleTouchMove("UP")}
|
||||||
|
className="ascii-border bg-background1 p-3 active:bg-background2 terminal-font flex items-center justify-center"
|
||||||
|
>
|
||||||
|
<ArrowUpIcon size={20} weight="bold" />
|
||||||
|
</button>
|
||||||
|
<div></div>
|
||||||
|
<button
|
||||||
|
onClick={() => handleTouchMove("LEFT")}
|
||||||
|
className="ascii-border bg-background1 p-3 active:bg-background2 terminal-font flex items-center justify-center"
|
||||||
|
>
|
||||||
|
<ArrowLeftIcon size={20} weight="bold" />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => (gameStarted && !gameOver ? setIsPaused(!isPaused) : resetGame())}
|
||||||
|
className="ascii-border bg-background1 p-3 active:bg-background2 terminal-font flex items-center justify-center"
|
||||||
|
>
|
||||||
|
{gameOver ? <ArrowClockwiseIcon size={20} weight="bold" /> : isPaused ? <PlayIcon size={20} weight="fill" /> : <PauseIcon size={20} weight="fill" />}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => handleTouchMove("RIGHT")}
|
||||||
|
className="ascii-border bg-background1 p-3 active:bg-background2 terminal-font flex items-center justify-center"
|
||||||
|
>
|
||||||
|
<ArrowRightIcon size={20} weight="bold" />
|
||||||
|
</button>
|
||||||
|
<div></div>
|
||||||
|
<button
|
||||||
|
onClick={() => handleTouchMove("DOWN")}
|
||||||
|
className="ascii-border bg-background1 p-3 active:bg-background2 terminal-font flex items-center justify-center"
|
||||||
|
>
|
||||||
|
<ArrowDownIcon size={20} weight="bold" />
|
||||||
|
</button>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-4 terminal-font text-xs text-center text-foreground0 opacity-70">
|
||||||
|
<p className="hidden md:block">{t("useArrowKeys")}</p>
|
||||||
|
<p className="md:hidden">{t("tapToMove")}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -2,15 +2,15 @@ import { cn } from "@/app/_utils/global-utils";
|
|||||||
import { HTMLAttributes, forwardRef, useState, useEffect } from "react";
|
import { HTMLAttributes, forwardRef, useState, useEffect } from "react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {
|
import {
|
||||||
ChevronLeft,
|
CaretLeftIcon,
|
||||||
ChevronRight,
|
CaretRightIcon,
|
||||||
Server,
|
HardDrivesIcon,
|
||||||
Menu,
|
ListIcon,
|
||||||
X,
|
XIcon,
|
||||||
Cpu,
|
CpuIcon,
|
||||||
HardDrive,
|
HardDriveIcon,
|
||||||
Wifi,
|
WifiHighIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export interface SidebarProps extends HTMLAttributes<HTMLDivElement> {
|
export interface SidebarProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
@@ -54,18 +54,18 @@ export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsMobileOpen(!isMobileOpen)}
|
onClick={() => setIsMobileOpen(!isMobileOpen)}
|
||||||
className="fixed bottom-4 right-4 z-50 lg:hidden p-2 bg-background/80 backdrop-blur-md border border-border/50 rounded-lg hover:bg-accent transition-colors"
|
className="fixed bottom-4 right-4 z-50 lg:hidden p-2 bg-background0 ascii-border transition-colors terminal-font"
|
||||||
>
|
>
|
||||||
{isMobileOpen ? (
|
{isMobileOpen ? (
|
||||||
<X className="h-5 w-5" />
|
<XIcon className="h-5 w-5" />
|
||||||
) : (
|
) : (
|
||||||
<Menu className="h-5 w-5" />
|
<ListIcon className="h-5 w-5" />
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"fixed inset-0 bg-black/50 z-20 lg:hidden transition-opacity duration-300",
|
"fixed inset-0 bg-background0 z-20 lg:hidden transition-opacity duration-300",
|
||||||
isMobileOpen ? "opacity-100" : "opacity-0 pointer-events-none"
|
isMobileOpen ? "opacity-100" : "opacity-0 pointer-events-none"
|
||||||
)}
|
)}
|
||||||
onClick={() => setIsMobileOpen(false)}
|
onClick={() => setIsMobileOpen(false)}
|
||||||
@@ -74,7 +74,7 @@ export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(
|
|||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-background/95 backdrop-blur-md border-r border-border/50 transition-all duration-300 ease-in-out glass-card",
|
"bg-background0 ascii-border transition-all duration-300 ease-in-out terminal-font",
|
||||||
isMobileOpen
|
isMobileOpen
|
||||||
? "fixed left-0 top-0 h-full w-80 z-30 translate-x-0"
|
? "fixed left-0 top-0 h-full w-80 z-30 translate-x-0"
|
||||||
: "fixed left-0 top-0 h-full w-80 z-30 -translate-x-full lg:translate-x-0",
|
: "fixed left-0 top-0 h-full w-80 z-30 -translate-x-full lg:translate-x-0",
|
||||||
@@ -92,38 +92,20 @@ export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(
|
|||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsCollapsed(!isCollapsed)}
|
onClick={() => setIsCollapsed(!isCollapsed)}
|
||||||
className="absolute -right-3 top-[21.5vh] w-6 h-6 bg-background border border-border rounded-full items-center justify-center hover:bg-accent transition-colors z-40 hidden lg:flex"
|
className="sidebar-shrinker absolute -right-3 top-[21.5vh] w-6 h-6 bg-background0 ascii-border items-center justify-center transition-colors z-40 hidden lg:flex"
|
||||||
>
|
>
|
||||||
{isCollapsed ? (
|
{isCollapsed ? (
|
||||||
<ChevronRight className="h-3 w-3" />
|
<CaretRightIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<ChevronLeft className="h-3 w-3" />
|
<CaretLeftIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div className="p-4 border-b border-border/50 bg-background/95 backdrop-blur-md">
|
|
||||||
<div
|
|
||||||
className={cn(
|
|
||||||
"flex items-center gap-3",
|
|
||||||
isCollapsed && "lg:justify-center"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className="p-2 bg-gradient-to-br from-cyan-500/20 to-blue-500/20 rounded-lg flex-shrink-0">
|
|
||||||
<Server className="h-4 w-4 text-cyan-500" />
|
|
||||||
</div>
|
|
||||||
{(!isCollapsed || !isCollapsed) && (
|
|
||||||
<h2 className="text-sm font-semibold text-foreground truncate">
|
|
||||||
{t("sidebar.systemOverview")}
|
|
||||||
</h2>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"overflow-y-auto custom-scrollbar",
|
"overflow-y-auto tui-scrollbar",
|
||||||
isCollapsed ? "lg:p-2" : "p-4",
|
isCollapsed ? "lg:p-2" : "p-4",
|
||||||
"h-full lg:h-[calc(100vh-88px-80px)]"
|
"h-full lg:h-[calc(100vh-88px)]"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isCollapsed ? (
|
{isCollapsed ? (
|
||||||
@@ -131,22 +113,22 @@ export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(
|
|||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
{quickStats ? (
|
{quickStats ? (
|
||||||
<>
|
<>
|
||||||
<div className="w-12 h-12 bg-card/50 border border-border/30 rounded-lg flex flex-col items-center justify-center p-1">
|
<div className="w-12 h-12 bg-background0 ascii-border flex flex-col items-center justify-center p-1">
|
||||||
<Cpu className="h-3 w-3 text-pink-500 mb-1" />
|
<CpuIcon className="h-3 w-3 mb-1" />
|
||||||
<span className="text-xs font-bold text-foreground">
|
<span className="text-xs font-bold text-foreground">
|
||||||
{quickStats.cpu}%
|
{quickStats.cpu}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-12 h-12 bg-card/50 border border-border/30 rounded-lg flex flex-col items-center justify-center p-1">
|
<div className="w-12 h-12 bg-background0 ascii-border flex flex-col items-center justify-center p-1">
|
||||||
<HardDrive className="h-3 w-3 text-cyan-500 mb-1" />
|
<HardDriveIcon className="h-3 w-3 mb-1" />
|
||||||
<span className="text-xs font-bold text-foreground">
|
<span className="text-xs font-bold text-foreground">
|
||||||
{quickStats.memory}%
|
{quickStats.memory}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-12 h-12 bg-card/50 border border-border/30 rounded-lg flex flex-col items-center justify-center p-1">
|
<div className="w-12 h-12 bg-background0 ascii-border flex flex-col items-center justify-center p-1">
|
||||||
<Wifi className="h-3 w-3 text-teal-500 mb-1" />
|
<WifiHighIcon className="h-3 w-3 mb-1" />
|
||||||
<div className="flex flex-col items-center">
|
<div className="flex flex-col items-center">
|
||||||
<span className="text-xs font-bold text-foreground leading-none">
|
<span className="text-xs font-bold text-foreground leading-none">
|
||||||
{quickStats.network}
|
{quickStats.network}
|
||||||
@@ -163,9 +145,9 @@ export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className="w-8 h-8 bg-card/50 border border-border/30 rounded-lg flex items-center justify-center"
|
className="w-8 h-8 bg-background2 ascii-border flex items-center justify-center"
|
||||||
>
|
>
|
||||||
<Server className="h-4 w-4 text-muted-foreground" />
|
<HardDrivesIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { CronJobList } from "@/app/_components/FeatureComponents/Cronjobs/CronJo
|
|||||||
import { ScriptsManager } from "@/app/_components/FeatureComponents/Scripts/ScriptsManager";
|
import { ScriptsManager } from "@/app/_components/FeatureComponents/Scripts/ScriptsManager";
|
||||||
import { CronJob } from "@/app/_utils/cronjob-utils";
|
import { CronJob } from "@/app/_utils/cronjob-utils";
|
||||||
import { Script } from "@/app/_utils/scripts-utils";
|
import { Script } from "@/app/_utils/scripts-utils";
|
||||||
import { Clock, FileText } from "lucide-react";
|
import { ClockIcon, FileTextIcon } from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface TabbedInterfaceProps {
|
interface TabbedInterfaceProps {
|
||||||
@@ -24,33 +24,31 @@ export const TabbedInterface = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div className="bg-background/80 backdrop-blur-md border border-border/50 rounded-lg p-1 glass-card">
|
<div className="tui-card p-1 terminal-font">
|
||||||
<div className="flex">
|
<div className="flex gap-2">
|
||||||
<button
|
<button
|
||||||
onClick={() => setActiveTab("cronjobs")}
|
onClick={() => setActiveTab("cronjobs")}
|
||||||
className={`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all duration-200 rounded-md flex-1 justify-center ${
|
className={`flex items-center gap-2 px-4 py-2 border border-transparent text-sm font-medium flex-1 justify-center terminal-font ${activeTab === "cronjobs"
|
||||||
activeTab === "cronjobs"
|
? "bg-background0 ascii-border"
|
||||||
? "bg-primary/10 text-primary shadow-sm border border-primary/20"
|
: "hover:ascii-border"
|
||||||
: "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<Clock className="h-4 w-4" />
|
<ClockIcon className="h-4 w-4" />
|
||||||
{t("cronjobs.cronJobs")}
|
{t("cronjobs.cronJobs")}
|
||||||
<span className="ml-1 text-xs bg-primary/20 text-primary px-2 py-0.5 rounded-full font-medium">
|
<span className="ml-1 text-xs bg-background0 px-2 py-0.5 ascii-border font-medium">
|
||||||
{cronJobs.length}
|
{cronJobs.length}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setActiveTab("scripts")}
|
onClick={() => setActiveTab("scripts")}
|
||||||
className={`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all duration-200 rounded-md flex-1 justify-center ${
|
className={`flex items-center gap-2 px-4 py-2 border border-transparent text-sm font-medium flex-1 justify-center terminal-font ${activeTab === "scripts"
|
||||||
activeTab === "scripts"
|
? "bg-background0 ascii-border"
|
||||||
? "bg-primary/10 text-primary shadow-sm border border-primary/20"
|
: "hover:ascii-border"
|
||||||
: "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<FileText className="h-4 w-4" />
|
<FileTextIcon className="h-4 w-4" />
|
||||||
{t("scripts.scripts")}
|
{t("scripts.scripts")}
|
||||||
<span className="ml-1 text-xs bg-primary/20 text-primary px-2 py-0.5 rounded-full font-medium">
|
<span className="ml-1 text-xs bg-background0 px-2 py-0.5 ascii-border font-medium">
|
||||||
{scripts.length}
|
{scripts.length}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
CardDescription,
|
CardDescription,
|
||||||
CardContent,
|
CardContent,
|
||||||
} from "@/app/_components/GlobalComponents/Cards/Card";
|
} from "@/app/_components/GlobalComponents/Cards/Card";
|
||||||
import { Lock, Eye, EyeOff, Shield, AlertTriangle, Loader2 } from "lucide-react";
|
import { LockIcon, EyeIcon, EyeSlashIcon, ShieldIcon, WarningIcon, CircleNotchIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
interface LoginFormProps {
|
interface LoginFormProps {
|
||||||
hasPassword?: boolean;
|
hasPassword?: boolean;
|
||||||
@@ -88,7 +88,7 @@ export const LoginForm = ({
|
|||||||
<Card className="w-full max-w-md shadow-xl">
|
<Card className="w-full max-w-md shadow-xl">
|
||||||
<CardContent className="pt-6">
|
<CardContent className="pt-6">
|
||||||
<div className="flex flex-col items-center justify-center py-8 space-y-4">
|
<div className="flex flex-col items-center justify-center py-8 space-y-4">
|
||||||
<Loader2 className="w-12 h-12 text-primary animate-spin" />
|
<CircleNotchIcon className="w-12 h-12 text-primary animate-spin" />
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<p className="text-lg font-medium">{t("login.redirectingToOIDC")}</p>
|
<p className="text-lg font-medium">{t("login.redirectingToOIDC")}</p>
|
||||||
<p className="text-sm text-muted-foreground mt-1">
|
<p className="text-sm text-muted-foreground mt-1">
|
||||||
@@ -105,15 +105,15 @@ export const LoginForm = ({
|
|||||||
<Card className="w-full max-w-md shadow-xl">
|
<Card className="w-full max-w-md shadow-xl">
|
||||||
<CardHeader className="text-center">
|
<CardHeader className="text-center">
|
||||||
<div className="mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mb-4">
|
<div className="mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mb-4">
|
||||||
<Lock className="w-8 h-8 text-primary" />
|
<LockIcon className="w-8 h-8 text-primary" />
|
||||||
</div>
|
</div>
|
||||||
<CardTitle>{t("login.welcomeTitle")}</CardTitle>
|
<CardTitle>{t("login.welcomeTitle")}</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
{hasPassword && hasOIDC
|
{hasPassword && hasOIDC
|
||||||
? t("login.signInWithPasswordOrSSO")
|
? t("login.signInWithPasswordOrSSO")
|
||||||
: hasOIDC
|
: hasOIDC
|
||||||
? t("login.signInWithSSO")
|
? t("login.signInWithSSO")
|
||||||
: t("login.enterPasswordToContinue")}
|
: t("login.enterPasswordToContinue")}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ export const LoginForm = ({
|
|||||||
{!hasPassword && !hasOIDC && (
|
{!hasPassword && !hasOIDC && (
|
||||||
<div className="mb-4 p-3 bg-amber-500/10 border border-amber-500/20 rounded-md">
|
<div className="mb-4 p-3 bg-amber-500/10 border border-amber-500/20 rounded-md">
|
||||||
<div className="flex items-start space-x-2">
|
<div className="flex items-start space-x-2">
|
||||||
<AlertTriangle className="w-4 h-4 text-amber-500 mt-0.5 flex-shrink-0" />
|
<WarningIcon className="w-4 h-4 text-amber-500 mt-0.5 flex-shrink-0" />
|
||||||
<div className="text-sm text-amber-700 dark:text-amber-400">
|
<div className="text-sm text-amber-700 dark:text-amber-400">
|
||||||
<div className="font-medium">
|
<div className="font-medium">
|
||||||
{t("login.authenticationNotConfigured")}
|
{t("login.authenticationNotConfigured")}
|
||||||
@@ -152,9 +152,9 @@ export const LoginForm = ({
|
|||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
{showPassword ? (
|
{showPassword ? (
|
||||||
<EyeOff className="w-4 h-4" />
|
<EyeSlashIcon className="w-4 h-4" />
|
||||||
) : (
|
) : (
|
||||||
<Eye className="w-4 h-4" />
|
<EyeIcon className="w-4 h-4" />
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -175,7 +175,7 @@ export const LoginForm = ({
|
|||||||
<span className="w-full border-t" />
|
<span className="w-full border-t" />
|
||||||
</div>
|
</div>
|
||||||
<div className="relative flex justify-center text-xs uppercase">
|
<div className="relative flex justify-center text-xs uppercase">
|
||||||
<span className="bg-background px-2 text-muted-foreground">
|
<span className="bg-background0 px-2 text-muted-foreground">
|
||||||
{t("login.orContinueWith")}
|
{t("login.orContinueWith")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -190,7 +190,7 @@ export const LoginForm = ({
|
|||||||
onClick={handleOIDCLogin}
|
onClick={handleOIDCLogin}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
<Shield className="w-4 h-4 mr-2" />
|
<ShieldIcon className="w-4 h-4 mr-2" />
|
||||||
{isLoading ? t("login.redirecting") : t("login.signInWithSSO")}
|
{isLoading ? t("login.redirecting") : t("login.signInWithSSO")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@@ -203,7 +203,7 @@ export const LoginForm = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{version && (
|
{version && (
|
||||||
<div className="mt-6 pt-4 border-t border-border/50">
|
<div className="mt-6 pt-4 border-t border-border">
|
||||||
<div className="text-center text-xs text-muted-foreground">
|
<div className="text-center text-xs text-muted-foreground">
|
||||||
Cr*nMaster {t("common.version", { version })}
|
Cr*nMaster {t("common.version", { version })}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { LogOut } from "lucide-react";
|
import { SignOutIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
export const LogoutButton = () => {
|
export const LogoutButton = () => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -35,7 +35,7 @@ export const LogoutButton = () => {
|
|||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
title="Logout"
|
title="Logout"
|
||||||
>
|
>
|
||||||
<LogOut className="h-[1.2rem] w-[1.2rem]" />
|
<SignOutIcon className="h-[1.2rem] w-[1.2rem]" />
|
||||||
<span className="sr-only">Logout</span>
|
<span className="sr-only">Logout</span>
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Copy } from "lucide-react";
|
import { CopyIcon } from "@phosphor-icons/react";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
@@ -89,7 +89,7 @@ export const CloneScriptModal = ({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Copy className="h-4 w-4 mr-2" />
|
<CopyIcon className="h-4 w-4 mr-2" />
|
||||||
Clone Script
|
Clone Script
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Copy } from "lucide-react";
|
import { CopyIcon } from "@phosphor-icons/react";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
@@ -89,7 +89,7 @@ export const CloneTaskModal = ({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Copy className="h-4 w-4 mr-2" />
|
<CopyIcon className="h-4 w-4 mr-2" />
|
||||||
Clone Cron Job
|
Clone Cron Job
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Plus } from "lucide-react";
|
import { PlusIcon } from "@phosphor-icons/react";
|
||||||
import { ScriptModal } from "@/app/_components/FeatureComponents/Modals/ScriptModal";
|
import { ScriptModal } from "@/app/_components/FeatureComponents/Modals/ScriptModal";
|
||||||
|
|
||||||
interface CreateScriptModalProps {
|
interface CreateScriptModalProps {
|
||||||
@@ -35,7 +35,7 @@ export const CreateScriptModal = ({
|
|||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
title="Create New Script"
|
title="Create New Script"
|
||||||
submitButtonText="Create Script"
|
submitButtonText="Create Script"
|
||||||
submitButtonIcon={<Plus className="h-4 w-4 mr-2" />}
|
submitButtonIcon={<PlusIcon className="h-4 w-4 mr-2" />}
|
||||||
form={form}
|
form={form}
|
||||||
onFormChange={onFormChange}
|
onFormChange={onFormChange}
|
||||||
isDraft={isDraft}
|
isDraft={isDraft}
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import { useState, useEffect } from "react";
|
|||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
|
import { Switch } from "@/app/_components/GlobalComponents/UIElements/Switch";
|
||||||
import { CronExpressionHelper } from "@/app/_components/FeatureComponents/Scripts/CronExpressionHelper";
|
import { CronExpressionHelper } from "@/app/_components/FeatureComponents/Scripts/CronExpressionHelper";
|
||||||
import { SelectScriptModal } from "@/app/_components/FeatureComponents/Modals/SelectScriptModal";
|
import { SelectScriptModal } from "@/app/_components/FeatureComponents/Modals/SelectScriptModal";
|
||||||
import { UserSwitcher } from "@/app/_components/FeatureComponents/User/UserSwitcher";
|
import { UserSwitcher } from "@/app/_components/FeatureComponents/User/UserSwitcher";
|
||||||
import { Plus, Terminal, FileText, X, FileOutput } from "lucide-react";
|
import { PlusIcon, TerminalIcon, FileTextIcon, XIcon, FileArrowDownIcon } from "@phosphor-icons/react";
|
||||||
import { getScriptContent } from "@/app/_server/actions/scripts";
|
import { getScriptContent } from "@/app/_server/actions/scripts";
|
||||||
import { getHostScriptPath } from "@/app/_server/actions/scripts";
|
import { getHostScriptPath } from "@/app/_server/actions/scripts";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
@@ -100,7 +101,7 @@ export const CreateTaskModal = ({
|
|||||||
</label>
|
</label>
|
||||||
<UserSwitcher
|
<UserSwitcher
|
||||||
selectedUser={form.user}
|
selectedUser={form.user}
|
||||||
onUserChange={(user) => onFormChange({ user })}
|
onUserChange={(user: string) => onFormChange({ user })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -124,13 +125,13 @@ export const CreateTaskModal = ({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleCustomCommand}
|
onClick={handleCustomCommand}
|
||||||
className={`p-4 rounded-lg border-2 transition-all ${!form.selectedScriptId
|
className={`p-4 rounded-lg transition-all ${!form.selectedScriptId
|
||||||
? "border-primary bg-primary/5 text-primary"
|
? "border-border border-2"
|
||||||
: "border-border bg-muted/30 text-muted-foreground hover:border-border/60"
|
: "border-border border"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Terminal className="h-5 w-5" />
|
<TerminalIcon className="h-5 w-5" />
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<div className="font-medium">
|
<div className="font-medium">
|
||||||
{t("cronjobs.customCommand")}
|
{t("cronjobs.customCommand")}
|
||||||
@@ -145,13 +146,13 @@ export const CreateTaskModal = ({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsSelectScriptModalOpen(true)}
|
onClick={() => setIsSelectScriptModalOpen(true)}
|
||||||
className={`p-4 rounded-lg border-2 transition-all ${form.selectedScriptId
|
className={`p-4 rounded-lg transition-all ${form.selectedScriptId
|
||||||
? "border-primary bg-primary/5 text-primary"
|
? "border-border border-2"
|
||||||
: "border-border bg-muted/30 text-muted-foreground hover:border-border/60"
|
: "border-border border"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<FileText className="h-5 w-5" />
|
<FileTextIcon className="h-5 w-5" />
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<div className="font-medium">
|
<div className="font-medium">
|
||||||
{t("scripts.savedScript")}
|
{t("scripts.savedScript")}
|
||||||
@@ -170,7 +171,7 @@ export const CreateTaskModal = ({
|
|||||||
<div className="flex items-start justify-between">
|
<div className="flex items-start justify-between">
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<FileText className="h-4 w-4 text-primary" />
|
<FileTextIcon className="h-4 w-4 text-primary" />
|
||||||
<h4 className="font-medium text-foreground">
|
<h4 className="font-medium text-foreground">
|
||||||
{selectedScript.name}
|
{selectedScript.name}
|
||||||
</h4>
|
</h4>
|
||||||
@@ -178,7 +179,7 @@ export const CreateTaskModal = ({
|
|||||||
<p className="text-sm text-muted-foreground mb-2">
|
<p className="text-sm text-muted-foreground mb-2">
|
||||||
{selectedScript.description}
|
{selectedScript.description}
|
||||||
</p>
|
</p>
|
||||||
<div className="bg-muted/30 p-2 rounded border border-border/30">
|
<div className="bg-muted/30 p-2 rounded border border-border">
|
||||||
<code className="text-xs font-mono text-foreground break-all">
|
<code className="text-xs font-mono text-foreground break-all">
|
||||||
{form.command}
|
{form.command}
|
||||||
</code>
|
</code>
|
||||||
@@ -201,7 +202,7 @@ export const CreateTaskModal = ({
|
|||||||
onClick={handleClearScript}
|
onClick={handleClearScript}
|
||||||
className="h-8 w-8 p-0 text-muted-foreground hover:text-foreground"
|
className="h-8 w-8 p-0 text-muted-foreground hover:text-foreground"
|
||||||
>
|
>
|
||||||
<X className="h-4 w-4" />
|
<XIcon className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -222,12 +223,12 @@ export const CreateTaskModal = ({
|
|||||||
? "/app/scripts/script_name.sh"
|
? "/app/scripts/script_name.sh"
|
||||||
: "/usr/bin/command"
|
: "/usr/bin/command"
|
||||||
}
|
}
|
||||||
className="w-full h-24 p-2 border border-border rounded bg-background text-foreground font-mono text-sm resize-none focus:outline-none focus:ring-1 focus:ring-primary/20"
|
className="w-full h-24 p-2 border border-border rounded bg-background0 text-foreground font-mono text-sm resize-none focus:outline-none focus:ring-1 focus:ring-primary/20"
|
||||||
required
|
required
|
||||||
readOnly={!!form.selectedScriptId}
|
readOnly={!!form.selectedScriptId}
|
||||||
/>
|
/>
|
||||||
<div className="absolute right-3 top-2">
|
<div className="absolute right-3 top-2">
|
||||||
<Terminal className="h-4 w-4 text-muted-foreground" />
|
<TerminalIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{form.selectedScriptId && (
|
{form.selectedScriptId && (
|
||||||
@@ -249,29 +250,28 @@ export const CreateTaskModal = ({
|
|||||||
value={form.comment}
|
value={form.comment}
|
||||||
onChange={(e) => onFormChange({ comment: e.target.value })}
|
onChange={(e) => onFormChange({ comment: e.target.value })}
|
||||||
placeholder={t("cronjobs.whatDoesThisTaskDo")}
|
placeholder={t("cronjobs.whatDoesThisTaskDo")}
|
||||||
className="bg-muted/30 border-border/50 focus:border-primary/50"
|
className="bg-muted/30 border-border focus:border-primary/50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="border border-border/30 bg-muted/10 rounded-lg p-4">
|
|
||||||
<div className="flex items-start gap-3">
|
<div className="border border-border bg-muted/10 rounded-lg p-4">
|
||||||
<input
|
<div
|
||||||
type="checkbox"
|
className="flex items-start gap-3 cursor-pointer"
|
||||||
id="logsEnabled"
|
onClick={() => onFormChange({ logsEnabled: !form.logsEnabled })}
|
||||||
|
>
|
||||||
|
<Switch
|
||||||
checked={form.logsEnabled}
|
checked={form.logsEnabled}
|
||||||
onChange={(e) =>
|
onCheckedChange={(checked) =>
|
||||||
onFormChange({ logsEnabled: e.target.checked })
|
onFormChange({ logsEnabled: checked })
|
||||||
}
|
}
|
||||||
className="mt-1 h-4 w-4 rounded border-border text-primary focus:ring-primary/20 cursor-pointer"
|
className="mt-1"
|
||||||
/>
|
/>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<label
|
<div className="flex items-center gap-2 text-sm font-medium text-foreground">
|
||||||
htmlFor="logsEnabled"
|
<FileArrowDownIcon className="h-4 w-4 text-primary" />
|
||||||
className="flex items-center gap-2 text-sm font-medium text-foreground cursor-pointer"
|
|
||||||
>
|
|
||||||
<FileOutput className="h-4 w-4 text-primary" />
|
|
||||||
{t("cronjobs.enableLogging")}
|
{t("cronjobs.enableLogging")}
|
||||||
</label>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground mt-1">
|
<p className="text-xs text-muted-foreground mt-1">
|
||||||
{t("cronjobs.loggingDescription")}
|
{t("cronjobs.loggingDescription")}
|
||||||
</p>
|
</p>
|
||||||
@@ -279,7 +279,8 @@ export const CreateTaskModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-3 border-t border-border/50">
|
|
||||||
|
<div className="flex justify-end gap-2 pt-3 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -289,7 +290,7 @@ export const CreateTaskModal = ({
|
|||||||
{t("common.cancel")}
|
{t("common.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit" className="btn-primary glow-primary">
|
<Button type="submit" className="btn-primary glow-primary">
|
||||||
<Plus className="h-4 w-4 mr-2" />
|
<PlusIcon className="h-4 w-4 mr-2" />
|
||||||
{t("cronjobs.createTask")}
|
{t("cronjobs.createTask")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { FileText, AlertCircle, Trash2 } from "lucide-react";
|
import { FileTextIcon, WarningCircleIcon, TrashIcon } from "@phosphor-icons/react";
|
||||||
import { Script } from "@/app/_utils/scripts-utils";
|
import { Script } from "@/app/_utils/scripts-utils";
|
||||||
|
|
||||||
interface DeleteScriptModalProps {
|
interface DeleteScriptModalProps {
|
||||||
@@ -25,10 +25,10 @@ export const DeleteScriptModal = ({
|
|||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} onClose={onClose} title="Delete Script" size="sm">
|
<Modal isOpen={isOpen} onClose={onClose} title="Delete Script" size="sm">
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="bg-muted/30 rounded p-2 border border-border/50">
|
<div className="bg-muted/30 rounded p-2 border border-border">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<FileText className="h-3 w-3 text-muted-foreground" />
|
<FileTextIcon className="h-3 w-3 text-muted-foreground" />
|
||||||
<span className="text-xs font-medium text-foreground">
|
<span className="text-xs font-medium text-foreground">
|
||||||
{script.name}
|
{script.name}
|
||||||
</span>
|
</span>
|
||||||
@@ -36,7 +36,7 @@ export const DeleteScriptModal = ({
|
|||||||
|
|
||||||
{script.description && (
|
{script.description && (
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<FileText className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
<FileTextIcon className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
||||||
<p className="text-xs text-muted-foreground break-words italic">
|
<p className="text-xs text-muted-foreground break-words italic">
|
||||||
{script.description}
|
{script.description}
|
||||||
</p>
|
</p>
|
||||||
@@ -44,8 +44,8 @@ export const DeleteScriptModal = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<FileText className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
<FileTextIcon className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
||||||
<code className="text-xs font-mono bg-muted/30 px-1 py-0.5 rounded border border-border/30">
|
<code className="text-xs font-mono bg-muted/30 px-1 py-0.5 rounded border border-border">
|
||||||
{script.filename}
|
{script.filename}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,7 +54,7 @@ export const DeleteScriptModal = ({
|
|||||||
|
|
||||||
<div className="bg-destructive/5 border border-destructive/20 rounded p-2">
|
<div className="bg-destructive/5 border border-destructive/20 rounded p-2">
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<AlertCircle className="h-4 w-4 text-destructive mt-0.5 flex-shrink-0" />
|
<WarningCircleIcon className="h-4 w-4 text-destructive mt-0.5 flex-shrink-0" />
|
||||||
<div>
|
<div>
|
||||||
<p className="text-xs font-medium text-destructive mb-0.5">
|
<p className="text-xs font-medium text-destructive mb-0.5">
|
||||||
This action cannot be undone
|
This action cannot be undone
|
||||||
@@ -66,7 +66,7 @@ export const DeleteScriptModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-2 border-t border-border/50">
|
<div className="flex justify-end gap-2 pt-2 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
@@ -78,7 +78,6 @@ export const DeleteScriptModal = ({
|
|||||||
<Button
|
<Button
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
className="btn-destructive"
|
|
||||||
disabled={isDeleting}
|
disabled={isDeleting}
|
||||||
>
|
>
|
||||||
{isDeleting ? (
|
{isDeleting ? (
|
||||||
@@ -88,7 +87,7 @@ export const DeleteScriptModal = ({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Trash2 className="h-4 w-4 mr-2" />
|
<TrashIcon className="h-4 w-4 mr-2" />
|
||||||
Delete Script
|
Delete Script
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
|||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import {
|
import {
|
||||||
Calendar,
|
Calendar,
|
||||||
Terminal,
|
TerminalIcon,
|
||||||
MessageSquare,
|
ChatTextIcon,
|
||||||
AlertCircle,
|
WarningCircleIcon,
|
||||||
Trash2,
|
TrashIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { CronJob } from "@/app/_utils/cronjob-utils";
|
import { CronJob } from "@/app/_utils/cronjob-utils";
|
||||||
|
|
||||||
interface DeleteTaskModalProps {
|
interface DeleteTaskModalProps {
|
||||||
@@ -34,7 +34,7 @@ export const DeleteTaskModal = ({
|
|||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="bg-muted/30 rounded p-2 border border-border/50">
|
<div className="bg-muted/30 rounded p-2 border border-border">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Calendar className="h-3 w-3 text-muted-foreground" />
|
<Calendar className="h-3 w-3 text-muted-foreground" />
|
||||||
@@ -44,15 +44,15 @@ export const DeleteTaskModal = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<Terminal className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
<TerminalIcon className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
||||||
<pre className="max-w-full overflow-x-auto text-xs font-medium text-foreground break-words bg-muted/30 px-1 py-0.5 rounded border border-border/30 flex-1 hide-scrollbar">
|
<pre className="max-w-full overflow-x-auto text-xs font-medium text-foreground break-words bg-muted/30 px-1 py-0.5 rounded border border-border flex-1 hide-scrollbar">
|
||||||
{job.command}
|
{job.command}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{job.comment && (
|
{job.comment && (
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<MessageSquare className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
<ChatTextIcon className="h-3 w-3 text-muted-foreground mt-0.5 flex-shrink-0" />
|
||||||
<p className="text-xs text-muted-foreground break-words italic">
|
<p className="text-xs text-muted-foreground break-words italic">
|
||||||
{job.comment}
|
{job.comment}
|
||||||
</p>
|
</p>
|
||||||
@@ -63,7 +63,7 @@ export const DeleteTaskModal = ({
|
|||||||
|
|
||||||
<div className="bg-destructive/5 border border-destructive/20 rounded p-2">
|
<div className="bg-destructive/5 border border-destructive/20 rounded p-2">
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<AlertCircle className="h-4 w-4 text-destructive mt-0.5 flex-shrink-0" />
|
<WarningCircleIcon className="h-4 w-4 text-destructive mt-0.5 flex-shrink-0" />
|
||||||
<div>
|
<div>
|
||||||
<p className="text-xs font-medium text-destructive mb-0.5">
|
<p className="text-xs font-medium text-destructive mb-0.5">
|
||||||
This action cannot be undone
|
This action cannot be undone
|
||||||
@@ -75,16 +75,15 @@ export const DeleteTaskModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-2 border-t border-border/50">
|
<div className="flex justify-end gap-2 pt-2 border-t border-border">
|
||||||
<Button variant="outline" onClick={onClose} className="btn-outline">
|
<Button variant="outline" onClick={onClose} className="btn-outline">
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
className="btn-destructive"
|
|
||||||
>
|
>
|
||||||
<Trash2 className="h-4 w-4 mr-2" />
|
<TrashIcon className="h-4 w-4 mr-2" />
|
||||||
Delete Task
|
Delete Task
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Edit } from "lucide-react";
|
import { PencilSimpleIcon } from "@phosphor-icons/react";
|
||||||
import { Script } from "@/app/_utils/scripts-utils";
|
import { Script } from "@/app/_utils/scripts-utils";
|
||||||
import { ScriptModal } from "@/app/_components/FeatureComponents/Modals/ScriptModal";
|
import { ScriptModal } from "@/app/_components/FeatureComponents/Modals/ScriptModal";
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ export const EditScriptModal = ({
|
|||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
title="Edit Script"
|
title="Edit Script"
|
||||||
submitButtonText="Update Script"
|
submitButtonText="Update Script"
|
||||||
submitButtonIcon={<Edit className="h-4 w-4 mr-2" />}
|
submitButtonIcon={<PencilSimpleIcon className="h-4 w-4 mr-2" />}
|
||||||
form={form}
|
form={form}
|
||||||
onFormChange={onFormChange}
|
onFormChange={onFormChange}
|
||||||
additionalFormData={{ id: script.id }}
|
additionalFormData={{ id: script.id }}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
|
import { Switch } from "@/app/_components/GlobalComponents/UIElements/Switch";
|
||||||
import { CronExpressionHelper } from "@/app/_components/FeatureComponents/Scripts/CronExpressionHelper";
|
import { CronExpressionHelper } from "@/app/_components/FeatureComponents/Scripts/CronExpressionHelper";
|
||||||
import { Edit, Terminal, FileOutput } from "lucide-react";
|
import { PencilSimpleIcon, TerminalIcon, FileArrowDownIcon } from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface EditTaskModalProps {
|
interface EditTaskModalProps {
|
||||||
@@ -59,11 +60,11 @@ export const EditTaskModal = ({
|
|||||||
value={form.command}
|
value={form.command}
|
||||||
onChange={(e) => onFormChange({ command: e.target.value })}
|
onChange={(e) => onFormChange({ command: e.target.value })}
|
||||||
placeholder="/usr/bin/command"
|
placeholder="/usr/bin/command"
|
||||||
className="font-mono bg-muted/30 border-border/50 focus:border-primary/50"
|
className="font-mono bg-muted/30 border-border focus:border-primary/50"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<div className="absolute right-3 top-1/2 -translate-y-1/2">
|
<div className="absolute right-3 top-1/2 -translate-y-1/2">
|
||||||
<Terminal className="h-4 w-4 text-muted-foreground" />
|
<TerminalIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,27 +81,26 @@ export const EditTaskModal = ({
|
|||||||
value={form.comment}
|
value={form.comment}
|
||||||
onChange={(e) => onFormChange({ comment: e.target.value })}
|
onChange={(e) => onFormChange({ comment: e.target.value })}
|
||||||
placeholder={t("cronjobs.whatDoesThisTaskDo")}
|
placeholder={t("cronjobs.whatDoesThisTaskDo")}
|
||||||
className="bg-muted/30 border-border/50 focus:border-primary/50"
|
className="bg-muted/30 border-border focus:border-primary/50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="border border-border/30 bg-muted/10 rounded-lg p-4">
|
|
||||||
<div className="flex items-start gap-3">
|
<div className="border border-border bg-muted/10 rounded-lg p-4">
|
||||||
<input
|
<div
|
||||||
type="checkbox"
|
className="flex items-start gap-3 cursor-pointer"
|
||||||
id="logsEnabled"
|
onClick={() => onFormChange({ logsEnabled: !form.logsEnabled })}
|
||||||
|
>
|
||||||
|
<Switch
|
||||||
checked={form.logsEnabled}
|
checked={form.logsEnabled}
|
||||||
onChange={(e) => onFormChange({ logsEnabled: e.target.checked })}
|
onCheckedChange={(checked) => onFormChange({ logsEnabled: checked })}
|
||||||
className="mt-1 h-4 w-4 rounded border-border text-primary focus:ring-primary/20 cursor-pointer"
|
className="mt-1"
|
||||||
/>
|
/>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<label
|
<div className="flex items-center gap-2 text-sm font-medium text-foreground">
|
||||||
htmlFor="logsEnabled"
|
<FileArrowDownIcon className="h-4 w-4 text-primary" />
|
||||||
className="flex items-center gap-2 text-sm font-medium text-foreground cursor-pointer"
|
|
||||||
>
|
|
||||||
<FileOutput className="h-4 w-4 text-primary" />
|
|
||||||
{t("cronjobs.enableLogging")}
|
{t("cronjobs.enableLogging")}
|
||||||
</label>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground mt-1">
|
<p className="text-xs text-muted-foreground mt-1">
|
||||||
{t("cronjobs.loggingDescription")}
|
{t("cronjobs.loggingDescription")}
|
||||||
</p>
|
</p>
|
||||||
@@ -108,7 +108,8 @@ export const EditTaskModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-3 border-t border-border/50">
|
|
||||||
|
<div className="flex justify-end gap-2 pt-3 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -118,7 +119,7 @@ export const EditTaskModal = ({
|
|||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit" className="btn-primary glow-primary">
|
<Button type="submit" className="btn-primary glow-primary">
|
||||||
<Edit className="h-4 w-4 mr-2" />
|
<PencilSimpleIcon className="h-4 w-4 mr-2" />
|
||||||
Update Task
|
Update Task
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { AlertCircle, Copy, X } from "lucide-react";
|
import { WarningCircleIcon, CopyIcon, XIcon } from "@phosphor-icons/react";
|
||||||
import { showToast } from "@/app/_components/GlobalComponents/UIElements/Toast";
|
import { showToast } from "@/app/_components/GlobalComponents/UIElements/Toast";
|
||||||
|
|
||||||
interface ErrorDetails {
|
interface ErrorDetails {
|
||||||
@@ -54,7 +54,7 @@ Timestamp: ${error.timestamp}
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="bg-destructive/5 border border-destructive/20 rounded-lg p-4">
|
<div className="bg-destructive/5 border border-destructive/20 rounded-lg p-4">
|
||||||
<div className="flex items-start gap-3">
|
<div className="flex items-start gap-3">
|
||||||
<AlertCircle className="h-5 w-5 text-destructive mt-0.5 flex-shrink-0" />
|
<WarningCircleIcon className="h-5 w-5 text-destructive mt-0.5 flex-shrink-0" />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<h3 className="font-medium text-destructive mb-1">
|
<h3 className="font-medium text-destructive mb-1">
|
||||||
{error.title}
|
{error.title}
|
||||||
@@ -69,7 +69,7 @@ Timestamp: ${error.timestamp}
|
|||||||
<h4 className="text-sm font-medium text-foreground mb-2">
|
<h4 className="text-sm font-medium text-foreground mb-2">
|
||||||
Details
|
Details
|
||||||
</h4>
|
</h4>
|
||||||
<div className="bg-muted/30 p-3 rounded border border-border/30">
|
<div className="bg-muted/30 p-3 rounded border border-border">
|
||||||
<pre className="text-sm font-mono text-foreground whitespace-pre-wrap break-words">
|
<pre className="text-sm font-mono text-foreground whitespace-pre-wrap break-words">
|
||||||
{error.details}
|
{error.details}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -82,7 +82,7 @@ Timestamp: ${error.timestamp}
|
|||||||
<h4 className="text-sm font-medium text-foreground mb-2">
|
<h4 className="text-sm font-medium text-foreground mb-2">
|
||||||
Command
|
Command
|
||||||
</h4>
|
</h4>
|
||||||
<div className="bg-muted/30 p-3 rounded border border-border/30">
|
<div className="bg-muted/30 p-3 rounded border border-border">
|
||||||
<code className="text-sm font-mono text-foreground break-all">
|
<code className="text-sm font-mono text-foreground break-all">
|
||||||
{error.command}
|
{error.command}
|
||||||
</code>
|
</code>
|
||||||
@@ -93,7 +93,7 @@ Timestamp: ${error.timestamp}
|
|||||||
{error.output && (
|
{error.output && (
|
||||||
<div>
|
<div>
|
||||||
<h4 className="text-sm font-medium text-foreground mb-2">Output</h4>
|
<h4 className="text-sm font-medium text-foreground mb-2">Output</h4>
|
||||||
<div className="bg-muted/30 p-3 rounded border border-border/30 max-h-32 overflow-y-auto">
|
<div className="bg-muted/30 p-3 rounded border border-border max-h-32 overflow-y-auto tui-scrollbar">
|
||||||
<pre className="text-sm font-mono text-foreground whitespace-pre-wrap">
|
<pre className="text-sm font-mono text-foreground whitespace-pre-wrap">
|
||||||
{error.output}
|
{error.output}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -106,7 +106,7 @@ Timestamp: ${error.timestamp}
|
|||||||
<h4 className="text-sm font-medium text-foreground mb-2">
|
<h4 className="text-sm font-medium text-foreground mb-2">
|
||||||
Error Output
|
Error Output
|
||||||
</h4>
|
</h4>
|
||||||
<div className="bg-destructive/5 p-3 rounded border border-destructive/20 max-h-32 overflow-y-auto">
|
<div className="bg-destructive/5 p-3 rounded border border-destructive/20 max-h-32 overflow-y-auto tui-scrollbar">
|
||||||
<pre className="text-sm font-mono text-destructive whitespace-pre-wrap">
|
<pre className="text-sm font-mono text-destructive whitespace-pre-wrap">
|
||||||
{error.stderr}
|
{error.stderr}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -118,14 +118,14 @@ Timestamp: ${error.timestamp}
|
|||||||
Timestamp: {error.timestamp}
|
Timestamp: {error.timestamp}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-3 border-t border-border/50">
|
<div className="flex justify-end gap-2 pt-3 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={handleCopyDetails}
|
onClick={handleCopyDetails}
|
||||||
className="btn-outline"
|
className="btn-outline"
|
||||||
>
|
>
|
||||||
<Copy className="h-4 w-4 mr-2" />
|
<CopyIcon className="h-4 w-4 mr-2" />
|
||||||
Copy Details
|
CopyIcon Details
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={onClose} className="btn-primary">
|
<Button onClick={onClose} className="btn-primary">
|
||||||
Close
|
Close
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { ChevronDown, Code, MessageSquare } from "lucide-react";
|
import { CaretDownIcon, CodeIcon, ChatTextIcon } from "@phosphor-icons/react";
|
||||||
import { UserFilter } from "@/app/_components/FeatureComponents/User/UserFilter";
|
import { UserFilter } from "@/app/_components/FeatureComponents/User/UserFilter";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
@@ -72,15 +72,15 @@ export const FiltersModal = ({
|
|||||||
>
|
>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
{localScheduleMode === "cron" && (
|
{localScheduleMode === "cron" && (
|
||||||
<Code className="h-4 w-4 mr-2" />
|
<CodeIcon className="h-4 w-4 mr-2" />
|
||||||
)}
|
)}
|
||||||
{localScheduleMode === "human" && (
|
{localScheduleMode === "human" && (
|
||||||
<MessageSquare className="h-4 w-4 mr-2" />
|
<ChatTextIcon className="h-4 w-4 mr-2" />
|
||||||
)}
|
)}
|
||||||
{localScheduleMode === "both" && (
|
{localScheduleMode === "both" && (
|
||||||
<>
|
<>
|
||||||
<Code className="h-4 w-4 mr-1" />
|
<CodeIcon className="h-4 w-4 mr-1" />
|
||||||
<MessageSquare className="h-4 w-4 mr-2" />
|
<ChatTextIcon className="h-4 w-4 mr-2" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<span>
|
<span>
|
||||||
@@ -90,23 +90,22 @@ export const FiltersModal = ({
|
|||||||
{localScheduleMode === "both" && t("cronjobs.both")}
|
{localScheduleMode === "both" && t("cronjobs.both")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronDown className="h-4 w-4 ml-2" />
|
<CaretDownIcon className="h-4 w-4 ml-2" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{isScheduleDropdownOpen && (
|
{isScheduleDropdownOpen && (
|
||||||
<div className="absolute top-full left-0 right-0 mt-1 bg-background border border-border rounded-md shadow-lg z-50 min-w-[140px]">
|
<div className="absolute top-full left-0 p-1 right-0 mt-1 bg-background0 border border-border rounded-md shadow-lg z-50 min-w-[140px]">
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLocalScheduleMode("cron");
|
setLocalScheduleMode("cron");
|
||||||
setIsScheduleDropdownOpen(false);
|
setIsScheduleDropdownOpen(false);
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors flex items-center gap-2 ${
|
className={`w-full text-left px-3 border py-2 text-sm hover:border-border border-transparent transition-colors flex items-center gap-2 ${localScheduleMode === "cron"
|
||||||
localScheduleMode === "cron"
|
? "border-border"
|
||||||
? "bg-accent text-accent-foreground"
|
: ""
|
||||||
: ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<Code className="h-3 w-3" />
|
<CodeIcon className="h-3 w-3" />
|
||||||
{t("cronjobs.cronSyntax")}
|
{t("cronjobs.cronSyntax")}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -114,13 +113,12 @@ export const FiltersModal = ({
|
|||||||
setLocalScheduleMode("human");
|
setLocalScheduleMode("human");
|
||||||
setIsScheduleDropdownOpen(false);
|
setIsScheduleDropdownOpen(false);
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors flex items-center gap-2 ${
|
className={`w-full text-left px-3 py-2 border text-sm hover:border-border border-transparent transition-colors flex items-center gap-2 ${localScheduleMode === "human"
|
||||||
localScheduleMode === "human"
|
? "border-border"
|
||||||
? "bg-accent text-accent-foreground"
|
: ""
|
||||||
: ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<MessageSquare className="h-3 w-3" />
|
<ChatTextIcon className="h-3 w-3" />
|
||||||
{t("cronjobs.humanReadable")}
|
{t("cronjobs.humanReadable")}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -128,14 +126,13 @@ export const FiltersModal = ({
|
|||||||
setLocalScheduleMode("both");
|
setLocalScheduleMode("both");
|
||||||
setIsScheduleDropdownOpen(false);
|
setIsScheduleDropdownOpen(false);
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors flex items-center gap-2 ${
|
className={`w-full text-left px-3 py-2 border text-sm hover:border-border border-transparent transition-colors flex items-center gap-2 ${localScheduleMode === "both"
|
||||||
localScheduleMode === "both"
|
? "border-border"
|
||||||
? "bg-accent text-accent-foreground"
|
: ""
|
||||||
: ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<Code className="h-3 w-3" />
|
<CodeIcon className="h-3 w-3" />
|
||||||
<MessageSquare className="h-3 w-3" />
|
<ChatTextIcon className="h-3 w-3" />
|
||||||
{t("cronjobs.both")}
|
{t("cronjobs.both")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,7 +141,7 @@ export const FiltersModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-4 border-t border-border">
|
<div className="flex justify-end gap-2 pt-4">
|
||||||
<Button variant="outline" onClick={onClose}>
|
<Button variant="outline" onClick={onClose}>
|
||||||
{t("common.cancel")}
|
{t("common.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState, useEffect, useRef, useCallback } from "react";
|
import { useState, useEffect, useRef, useCallback } from "react";
|
||||||
import { Loader2, CheckCircle2, XCircle, AlertTriangle, Minimize2, Maximize2 } from "lucide-react";
|
import { CircleNotchIcon, CheckCircleIcon, XCircleIcon, WarningIcon, ArrowsInIcon, ArrowsOutIcon } from "@phosphor-icons/react";
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { useSSEContext } from "@/app/_contexts/SSEContext";
|
import { useSSEContext } from "@/app/_contexts/SSEContext";
|
||||||
@@ -228,20 +228,20 @@ export const LiveLogModal = ({
|
|||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<span>{t("cronjobs.liveJobExecution")}{jobComment && `: ${jobComment}`}</span>
|
<span>{t("cronjobs.liveJobExecution")}{jobComment && `: ${jobComment}`}</span>
|
||||||
{status === "running" && (
|
{status === "running" && (
|
||||||
<span className="flex items-center gap-1 text-sm text-blue-500">
|
<span className="flex items-center gap-1 text-sm text-status-info">
|
||||||
<Loader2 className="w-4 h-4 animate-spin" />
|
<CircleNotchIcon className="w-4 h-4 animate-spin" />
|
||||||
{t("cronjobs.running")}
|
{t("cronjobs.running")}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{status === "completed" && (
|
{status === "completed" && (
|
||||||
<span className="flex items-center gap-1 text-sm text-green-500">
|
<span className="flex items-center gap-1 text-sm text-status-success">
|
||||||
<CheckCircle2 className="w-4 h-4" />
|
<CheckCircleIcon className="w-4 h-4" />
|
||||||
{t("cronjobs.completed", { exitCode: exitCode ?? 0 })}
|
{t("cronjobs.completed", { exitCode: exitCode ?? 0 })}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{status === "failed" && (
|
{status === "failed" && (
|
||||||
<span className="flex items-center gap-1 text-sm text-red-500">
|
<span className="flex items-center gap-1 text-sm text-status-error">
|
||||||
<XCircle className="w-4 h-4" />
|
<XCircleIcon className="w-4 h-4" />
|
||||||
{t("cronjobs.jobFailed", { exitCode: exitCode ?? 1 })}
|
{t("cronjobs.jobFailed", { exitCode: exitCode ?? 1 })}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -268,7 +268,7 @@ export const LiveLogModal = ({
|
|||||||
id="maxLines"
|
id="maxLines"
|
||||||
value={maxLines}
|
value={maxLines}
|
||||||
onChange={(e) => setMaxLines(parseInt(e.target.value, 10))}
|
onChange={(e) => setMaxLines(parseInt(e.target.value, 10))}
|
||||||
className="bg-background border border-border rounded px-2 py-1 text-sm"
|
className="bg-background0 border border-border rounded px-2 py-1 text-sm"
|
||||||
>
|
>
|
||||||
<option value="100">{t("cronjobs.nLines", { count: "100" })}</option>
|
<option value="100">{t("cronjobs.nLines", { count: "100" })}</option>
|
||||||
<option value="500">{t("cronjobs.nLines", { count: "500" })}</option>
|
<option value="500">{t("cronjobs.nLines", { count: "500" })}</option>
|
||||||
@@ -316,8 +316,8 @@ export const LiveLogModal = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{truncated && !showFullLog && (
|
{truncated && !showFullLog && (
|
||||||
<div className="text-sm text-orange-500 flex items-center gap-1">
|
<div className="text-sm text-status-warning flex items-center gap-1 terminal-font">
|
||||||
<AlertTriangle className="h-4 w-4" />
|
<WarningIcon className="h-4 w-4" />
|
||||||
{t("cronjobs.showingLastOf", {
|
{t("cronjobs.showingLastOf", {
|
||||||
lineCount: lineCount.toLocaleString(),
|
lineCount: lineCount.toLocaleString(),
|
||||||
totalLines: totalLines.toLocaleString()
|
totalLines: totalLines.toLocaleString()
|
||||||
@@ -327,8 +327,8 @@ export const LiveLogModal = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showSizeWarning && (
|
{showSizeWarning && (
|
||||||
<div className="bg-orange-500/10 border border-orange-500/30 rounded-lg p-3 flex items-start gap-3">
|
<div className="bg-background2 ascii-border p-3 flex items-start gap-3 terminal-font">
|
||||||
<AlertTriangle className="h-4 w-4 text-orange-500 mt-0.5 flex-shrink-0" />
|
<WarningIcon className="h-4 w-4 text-status-warning mt-0.5 flex-shrink-0" />
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-sm text-foreground">
|
<p className="text-sm text-foreground">
|
||||||
<span className="font-medium">{t("cronjobs.largeLogFileDetected")}</span> ({formatFileSize(fileSize)})
|
<span className="font-medium">{t("cronjobs.largeLogFileDetected")}</span> ({formatFileSize(fileSize)})
|
||||||
@@ -340,16 +340,16 @@ export const LiveLogModal = ({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={toggleTailMode}
|
onClick={toggleTailMode}
|
||||||
className="text-orange-500 hover:text-orange-400 hover:bg-orange-500/10 h-auto py-1 px-2 text-xs"
|
className="text-status-warning hover:text-status-warning hover:bg-background2 h-auto py-1 px-2 text-xs"
|
||||||
title={tailMode ? t("cronjobs.showAllLines") : t("cronjobs.enableTailMode")}
|
title={tailMode ? t("cronjobs.showAllLines") : t("cronjobs.enableTailMode")}
|
||||||
>
|
>
|
||||||
{tailMode ? <Maximize2 className="h-3 w-3" /> : <Minimize2 className="h-3 w-3" />}
|
{tailMode ? <ArrowsOutIcon className="h-3 w-3" /> : <ArrowsInIcon className="h-3 w-3" />}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="bg-black/90 dark:bg-black/60 rounded-lg p-4 max-h-[60vh] overflow-auto">
|
<div className="bg-background0 p-4 max-h-[60vh] overflow-auto terminal-font ascii-border">
|
||||||
<pre className="text-xs font-mono text-green-400 whitespace-pre-wrap break-words">
|
<pre className="text-xs text-status-success whitespace-pre-wrap break-words">
|
||||||
{logContent || t("cronjobs.waitingForJobToStart")}
|
{logContent || t("cronjobs.waitingForJobToStart")}
|
||||||
<div ref={logEndRef} />
|
<div ref={logEndRef} />
|
||||||
</pre>
|
</pre>
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { FileText, Trash2, Eye, X, RefreshCw, AlertCircle, CheckCircle } from "lucide-react";
|
import { FileTextIcon, TrashIcon, EyeIcon, XIcon, ArrowsClockwiseIcon, WarningCircleIcon, CheckCircleIcon, DownloadIcon } from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { zipSync, strToU8 } from "fflate";
|
||||||
import {
|
import {
|
||||||
getJobLogs,
|
getJobLogs,
|
||||||
getLogContent,
|
getLogContent,
|
||||||
@@ -44,6 +45,7 @@ export const LogsModal = ({
|
|||||||
const [logContent, setLogContent] = useState<string>("");
|
const [logContent, setLogContent] = useState<string>("");
|
||||||
const [isLoadingLogs, setIsLoadingLogs] = useState(false);
|
const [isLoadingLogs, setIsLoadingLogs] = useState(false);
|
||||||
const [isLoadingContent, setIsLoadingContent] = useState(false);
|
const [isLoadingContent, setIsLoadingContent] = useState(false);
|
||||||
|
const [isDownloading, setIsDownloading] = useState(false);
|
||||||
const [stats, setStats] = useState<{
|
const [stats, setStats] = useState<{
|
||||||
count: number;
|
count: number;
|
||||||
totalSize: number;
|
totalSize: number;
|
||||||
@@ -133,6 +135,28 @@ export const LogsModal = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDownloadLogs = async () => {
|
||||||
|
if (logs.length === 0) return;
|
||||||
|
setIsDownloading(true);
|
||||||
|
try {
|
||||||
|
const files: Record<string, Uint8Array> = {};
|
||||||
|
for (const log of logs) {
|
||||||
|
const content = await getLogContent(jobId, log.filename);
|
||||||
|
files[log.filename] = strToU8(content);
|
||||||
|
}
|
||||||
|
const zipped = zipSync(files);
|
||||||
|
const blob = new Blob([zipped as unknown as ArrayBuffer], { type: "application/zip" });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${jobComment || jobId}_logs.zip`;
|
||||||
|
a.click();
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
} finally {
|
||||||
|
setIsDownloading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const formatFileSize = (bytes: number): string => {
|
const formatFileSize = (bytes: number): string => {
|
||||||
if (bytes < 1024) return `${bytes} B`;
|
if (bytes < 1024) return `${bytes} B`;
|
||||||
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;
|
||||||
@@ -157,43 +181,56 @@ export const LogsModal = ({
|
|||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} onClose={onClose} title={t("cronjobs.viewLogs")} size="xl">
|
<Modal isOpen={isOpen} onClose={onClose} title={t("cronjobs.viewLogs")} size="xl">
|
||||||
<div className="flex flex-col h-[600px]">
|
<div className="flex flex-col h-[600px]">
|
||||||
<div className="flex items-center justify-between mb-4 pb-4 border-b border-border">
|
<div className="block sm:flex items-center justify-between mb-4 pb-4 border-b border-border">
|
||||||
<div>
|
<div className="min-w-0 mb-4 sm:mb-0">
|
||||||
<h3 className="font-semibold text-lg">{jobComment || jobId}</h3>
|
<h3 className="font-semibold text-lg truncate">{jobComment || jobId}</h3>
|
||||||
{stats && (
|
{stats && (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{stats.count} {t("cronjobs.logs")} • {stats.totalSizeMB} MB
|
{stats.count} {t("cronjobs.logs")} • {stats.totalSizeMB} MB
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2 flex-shrink-0">
|
||||||
|
<Button
|
||||||
|
onClick={handleDownloadLogs}
|
||||||
|
disabled={logs.length === 0 || isDownloading}
|
||||||
|
className="btn-primary glow-primary"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
{isDownloading ? (
|
||||||
|
<ArrowsClockwiseIcon className="w-4 h-4 sm:mr-2 animate-spin" />
|
||||||
|
) : (
|
||||||
|
<DownloadIcon className="w-4 h-4 sm:mr-2" />
|
||||||
|
)}
|
||||||
|
<span className="hidden sm:inline">{t("cronjobs.downloadLog")}</span>
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={loadLogs}
|
onClick={loadLogs}
|
||||||
disabled={isLoadingLogs}
|
disabled={isLoadingLogs}
|
||||||
className="btn-primary glow-primary"
|
className="btn-primary glow-primary"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
<RefreshCw
|
<ArrowsClockwiseIcon
|
||||||
className={`w-4 h-4 mr-2 ${isLoadingLogs ? "animate-spin" : ""
|
className={`w-4 h-4 sm:mr-2 ${isLoadingLogs ? "animate-spin" : ""
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
{t("common.refresh")}
|
<span className="hidden sm:inline">{t("common.refresh")}</span>
|
||||||
</Button>
|
</Button>
|
||||||
{logs.length > 0 && (
|
{logs.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleDeleteAllLogs}
|
onClick={handleDeleteAllLogs}
|
||||||
className="btn-destructive glow-primary"
|
variant="destructive"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
<Trash2 className="w-4 h-4 mr-2" />
|
<TrashIcon className="w-4 h-4 sm:mr-2" />
|
||||||
{t("cronjobs.deleteAll")}
|
<span className="hidden sm:inline">{t("cronjobs.deleteAll")}</span>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-1 flex gap-4 overflow-hidden">
|
<div className="flex-1 flex flex-col sm:flex-row gap-4 overflow-hidden">
|
||||||
<div className="w-1/3 flex flex-col border-r border-border pr-4 overflow-hidden">
|
<div className="sm:w-1/3 flex flex-col sm:border-r border-b sm:border-b-0 border-border sm:pr-4 pb-4 sm:pb-0 overflow-hidden max-h-[40%] sm:max-h-none">
|
||||||
<h4 className="font-semibold mb-2">{t("cronjobs.logFiles")}</h4>
|
<h4 className="font-semibold mb-2">{t("cronjobs.logFiles")}</h4>
|
||||||
<div className="flex-1 overflow-y-auto space-y-2">
|
<div className="flex-1 overflow-y-auto space-y-2">
|
||||||
{isLoadingLogs ? (
|
{isLoadingLogs ? (
|
||||||
@@ -208,11 +245,11 @@ export const LogsModal = ({
|
|||||||
logs.map((log) => (
|
logs.map((log) => (
|
||||||
<div
|
<div
|
||||||
key={log.filename}
|
key={log.filename}
|
||||||
className={`p-3 rounded border cursor-pointer transition-colors ${selectedLog === log.filename
|
className={`p-3 ascii-border cursor-pointer transition-colors terminal-font ${selectedLog === log.filename
|
||||||
? "border-primary bg-primary/10"
|
? "border-primary bg-background2"
|
||||||
: log.hasError
|
: log.hasError
|
||||||
? "border-red-500/50 hover:border-red-500"
|
? "border-red-600 hover:border-red-600"
|
||||||
: "border-border hover:border-primary/50"
|
: "ascii-border hover:border-primary"
|
||||||
}`}
|
}`}
|
||||||
onClick={() => handleViewLog(log.filename)}
|
onClick={() => handleViewLog(log.filename)}
|
||||||
>
|
>
|
||||||
@@ -220,11 +257,11 @@ export const LogsModal = ({
|
|||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
{log.hasError ? (
|
{log.hasError ? (
|
||||||
<AlertCircle className="w-4 h-4 flex-shrink-0 text-red-500" />
|
<WarningCircleIcon className="w-4 h-4 flex-shrink-0 text-status-error" />
|
||||||
) : log.exitCode === 0 ? (
|
) : log.exitCode === 0 ? (
|
||||||
<CheckCircle className="w-4 h-4 flex-shrink-0 text-green-500" />
|
<CheckCircleIcon className="w-4 h-4 flex-shrink-0 text-status-success" />
|
||||||
) : (
|
) : (
|
||||||
<FileText className="w-4 h-4 flex-shrink-0" />
|
<FileTextIcon className="w-4 h-4 flex-shrink-0" />
|
||||||
)}
|
)}
|
||||||
<span className="text-sm font-medium truncate">
|
<span className="text-sm font-medium truncate">
|
||||||
{formatTimestamp(log.timestamp)}
|
{formatTimestamp(log.timestamp)}
|
||||||
@@ -236,9 +273,9 @@ export const LogsModal = ({
|
|||||||
</p>
|
</p>
|
||||||
{log.exitCode !== undefined && (
|
{log.exitCode !== undefined && (
|
||||||
<span
|
<span
|
||||||
className={`text-xs px-1.5 py-0.5 rounded ${log.hasError
|
className={`text-xs px-1.5 py-0.5 ${log.hasError
|
||||||
? "bg-red-500/10 text-red-600 dark:text-red-400"
|
? "bg-background2 text-status-error"
|
||||||
: "bg-green-500/10 text-green-600 dark:text-green-400"
|
: "bg-background2 text-status-success"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Exit: {log.exitCode}
|
Exit: {log.exitCode}
|
||||||
@@ -251,10 +288,10 @@ export const LogsModal = ({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
handleDeleteLog(log.filename);
|
handleDeleteLog(log.filename);
|
||||||
}}
|
}}
|
||||||
className="btn-destructive glow-primary p-1 h-auto"
|
variant="destructive"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
<Trash2 className="w-3 h-3" />
|
<TrashIcon className="w-3 h-3" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -271,13 +308,13 @@ export const LogsModal = ({
|
|||||||
{t("common.loading")}...
|
{t("common.loading")}...
|
||||||
</div>
|
</div>
|
||||||
) : selectedLog ? (
|
) : selectedLog ? (
|
||||||
<pre className="h-full overflow-auto bg-muted/50 p-4 rounded border border-border text-xs font-mono whitespace-pre-wrap">
|
<pre className="h-full overflow-auto bg-background0 tui-scrollbar p-4 ascii-border text-xs font-mono whitespace-pre-wrap terminal-font">
|
||||||
{logContent}
|
{logContent}
|
||||||
</pre>
|
</pre>
|
||||||
) : (
|
) : (
|
||||||
<div className="h-full flex items-center justify-center text-muted-foreground">
|
<div className="h-full flex items-center justify-center text-muted-foreground">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Eye className="w-12 h-12 mx-auto mb-2 opacity-50" />
|
<EyeIcon className="w-12 h-12 mx-auto mb-2 opacity-50" />
|
||||||
<p>{t("cronjobs.selectLogToView")}</p>
|
<p>{t("cronjobs.selectLogToView")}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -288,8 +325,8 @@ export const LogsModal = ({
|
|||||||
|
|
||||||
<div className="mt-4 pt-4 border-t border-border flex justify-end">
|
<div className="mt-4 pt-4 border-t border-border flex justify-end">
|
||||||
<Button onClick={onClose} className="btn-primary glow-primary">
|
<Button onClick={onClose} className="btn-primary glow-primary">
|
||||||
<X className="w-4 h-4 mr-2" />
|
<XIcon className="w-4 h-4 sm:mr-2" />
|
||||||
{t("common.close")}
|
<span className="hidden sm:inline">{t("common.close")}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { useState, useEffect } from "react";
|
|||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import {
|
import {
|
||||||
Upload,
|
UploadIcon,
|
||||||
Trash2,
|
TrashIcon,
|
||||||
Calendar,
|
CalendarIcon,
|
||||||
User,
|
UserIcon,
|
||||||
Download,
|
DownloadIcon,
|
||||||
RefreshCw,
|
ArrowsClockwiseIcon,
|
||||||
Check,
|
CheckIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { CronJob } from "@/app/_utils/cronjob-utils";
|
import { CronJob } from "@/app/_utils/cronjob-utils";
|
||||||
import { unwrapCommand } from "@/app/_utils/wrapper-utils-client";
|
import { unwrapCommand } from "@/app/_utils/wrapper-utils-client";
|
||||||
@@ -86,14 +86,15 @@ export const RestoreBackupModal = ({
|
|||||||
size="xl"
|
size="xl"
|
||||||
>
|
>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex gap-2">
|
<div className="flex flex-col sm:flex-row gap-2">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={onBackupAll}
|
onClick={onBackupAll}
|
||||||
className="btn-outline flex-1"
|
className="btn-outline flex-1"
|
||||||
>
|
>
|
||||||
<Download className="h-4 w-4 mr-2" />
|
<DownloadIcon className="h-4 w-4 sm:mr-2" />
|
||||||
{t("cronjobs.backupAll")}
|
<span className="hidden sm:inline">{t("cronjobs.backupAll")}</span>
|
||||||
|
<span className="sm:hidden">Backup</span>
|
||||||
</Button>
|
</Button>
|
||||||
{backups.length > 0 && (
|
{backups.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
@@ -101,17 +102,19 @@ export const RestoreBackupModal = ({
|
|||||||
onClick={handleRestoreAll}
|
onClick={handleRestoreAll}
|
||||||
className="btn-primary flex-1"
|
className="btn-primary flex-1"
|
||||||
>
|
>
|
||||||
<Upload className="h-4 w-4 mr-2" />
|
<UploadIcon className="h-4 w-4 sm:mr-2" />
|
||||||
{t("cronjobs.restoreAll")}
|
<span className="hidden sm:inline">{t("cronjobs.restoreAll")}</span>
|
||||||
|
<span className="sm:hidden">Restore</span>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={onRefresh}
|
onClick={onRefresh}
|
||||||
className="btn-outline"
|
className="btn-outline sm:w-auto"
|
||||||
title={t("common.refresh")}
|
title={t("common.refresh")}
|
||||||
>
|
>
|
||||||
<RefreshCw className="h-4 w-4" />
|
<ArrowsClockwiseIcon className="h-4 w-4" />
|
||||||
|
<span className="sm:hidden ml-2">Refresh</span>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -120,15 +123,80 @@ export const RestoreBackupModal = ({
|
|||||||
<p>{t("cronjobs.noBackupsFound")}</p>
|
<p>{t("cronjobs.noBackupsFound")}</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-2 max-h-[500px] overflow-y-auto">
|
<div className="space-y-3 max-h-[500px] overflow-y-auto tui-scrollbar pr-2 pb-2">
|
||||||
{backups.map((backup) => (
|
{backups.map((backup) => (
|
||||||
<div
|
<div
|
||||||
key={backup.filename}
|
key={backup.filename}
|
||||||
className="glass-card p-3 border border-border/50 rounded-lg hover:bg-accent/30 transition-colors"
|
className="tui-card p-3 terminal-font"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex flex-col gap-3 lg:hidden">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<code className="text-xs bg-background0 text-status-warning px-1.5 py-0.5 terminal-font ascii-border">
|
||||||
|
{backup.job.schedule}
|
||||||
|
</code>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => {
|
||||||
|
onRestore(backup.filename);
|
||||||
|
onClose();
|
||||||
|
}}
|
||||||
|
className="btn-outline h-8 px-3"
|
||||||
|
title={t("cronjobs.restoreThisBackup")}
|
||||||
|
>
|
||||||
|
<UploadIcon className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="destructive"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => handleDelete(backup.filename)}
|
||||||
|
disabled={deletingFilename === backup.filename}
|
||||||
|
className="h-8 px-3"
|
||||||
|
title={t("cronjobs.deleteBackup")}
|
||||||
|
>
|
||||||
|
{deletingFilename === backup.filename ? (
|
||||||
|
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
||||||
|
) : (
|
||||||
|
<TrashIcon className="h-3 w-3" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
{commandCopied === backup.filename && (
|
||||||
|
<CheckIcon className="h-3 w-3 text-status-success flex-shrink-0" />
|
||||||
|
)}
|
||||||
|
<pre
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
copyToClipboard(unwrapCommand(backup.job.command));
|
||||||
|
setCommandCopied(backup.filename);
|
||||||
|
setTimeout(() => setCommandCopied(null), 3000);
|
||||||
|
}}
|
||||||
|
className="max-w-full overflow-x-auto flex-1 cursor-pointer text-sm font-medium terminal-font bg-background1 px-2 py-1 ascii-border break-all"
|
||||||
|
title={unwrapCommand(backup.job.command)}
|
||||||
|
>
|
||||||
|
{unwrapCommand(backup.job.command)}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center gap-3 text-xs text-muted-foreground">
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<UserIcon className="h-3 w-3" />
|
||||||
|
<span>{backup.job.user}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<CalendarIcon className="h-3 w-3" />
|
||||||
|
<span>{formatDate(backup.backedUpAt)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="hidden lg:flex items-center gap-3">
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
<code className="text-xs bg-purple-500/10 text-purple-600 dark:text-purple-400 px-1.5 py-0.5 rounded font-mono border border-purple-500/20">
|
<code className="text-xs bg-background0 text-status-warning px-1.5 py-0.5 terminal-font ascii-border">
|
||||||
{backup.job.schedule}
|
{backup.job.schedule}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -136,7 +204,7 @@ export const RestoreBackupModal = ({
|
|||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{commandCopied === backup.filename && (
|
{commandCopied === backup.filename && (
|
||||||
<Check className="h-3 w-3 text-green-600 flex-shrink-0" />
|
<CheckIcon className="h-3 w-3 text-status-success flex-shrink-0" />
|
||||||
)}
|
)}
|
||||||
<pre
|
<pre
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -145,7 +213,7 @@ export const RestoreBackupModal = ({
|
|||||||
setCommandCopied(backup.filename);
|
setCommandCopied(backup.filename);
|
||||||
setTimeout(() => setCommandCopied(null), 3000);
|
setTimeout(() => setCommandCopied(null), 3000);
|
||||||
}}
|
}}
|
||||||
className="flex-1 cursor-pointer overflow-hidden text-sm font-medium text-foreground bg-muted/30 px-2 py-1 rounded border border-border/30 truncate"
|
className="flex-1 cursor-pointer overflow-hidden text-sm font-medium terminal-font bg-background1 px-2 py-1 ascii-border truncate"
|
||||||
title={unwrapCommand(backup.job.command)}
|
title={unwrapCommand(backup.job.command)}
|
||||||
>
|
>
|
||||||
{unwrapCommand(backup.job.command)}
|
{unwrapCommand(backup.job.command)}
|
||||||
@@ -155,47 +223,47 @@ export const RestoreBackupModal = ({
|
|||||||
|
|
||||||
<div className="flex items-center gap-3 text-xs text-muted-foreground flex-shrink-0">
|
<div className="flex items-center gap-3 text-xs text-muted-foreground flex-shrink-0">
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<User className="h-3 w-3" />
|
<UserIcon className="h-3 w-3" />
|
||||||
<span>{backup.job.user}</span>
|
<span>{backup.job.user}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<Calendar className="h-3 w-3" />
|
<CalendarIcon className="h-3 w-3" />
|
||||||
<span>{formatDate(backup.backedUpAt)}</span>
|
<span>{formatDate(backup.backedUpAt)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-1 flex-shrink-0">
|
<div className="flex items-center gap-2 flex-shrink-0">
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onRestore(backup.filename);
|
onRestore(backup.filename);
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
className="h-7 w-7 p-0"
|
className="btn-outline h-8 px-3"
|
||||||
title={t("cronjobs.restoreThisBackup")}
|
title={t("cronjobs.restoreThisBackup")}
|
||||||
>
|
>
|
||||||
<Upload className="h-3 w-3" />
|
<UploadIcon className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="destructive"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => handleDelete(backup.filename)}
|
onClick={() => handleDelete(backup.filename)}
|
||||||
disabled={deletingFilename === backup.filename}
|
disabled={deletingFilename === backup.filename}
|
||||||
className="h-7 w-7 p-0 text-destructive hover:text-destructive"
|
className="h-8 px-3"
|
||||||
title={t("cronjobs.deleteBackup")}
|
title={t("cronjobs.deleteBackup")}
|
||||||
>
|
>
|
||||||
{deletingFilename === backup.filename ? (
|
{deletingFilename === backup.filename ? (
|
||||||
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
<div className="h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent" />
|
||||||
) : (
|
) : (
|
||||||
<Trash2 className="h-3 w-3" />
|
<TrashIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{backup.job.comment && (
|
{backup.job.comment && (
|
||||||
<p className="text-xs text-muted-foreground italic mt-2 ml-0">
|
<p className="text-xs text-muted-foreground italic mt-2">
|
||||||
{backup.job.comment}
|
{backup.job.comment}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
@@ -204,11 +272,11 @@ export const RestoreBackupModal = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex justify-between gap-2 pt-4 border-t border-border/50">
|
<div className="flex flex-col sm:flex-row sm:justify-between gap-2 pt-4 border-t border-border">
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground text-center sm:text-left">
|
||||||
{t("cronjobs.availableBackups")}: {backups.length}
|
{t("cronjobs.availableBackups")}: {backups.length}
|
||||||
</p>
|
</p>
|
||||||
<Button variant="outline" onClick={onClose} className="btn-outline">
|
<Button variant="outline" onClick={onClose} className="btn-outline w-full sm:w-auto">
|
||||||
{t("common.close")}
|
{t("common.close")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
|||||||
import { BashEditor } from "@/app/_components/FeatureComponents/Scripts/BashEditor";
|
import { BashEditor } from "@/app/_components/FeatureComponents/Scripts/BashEditor";
|
||||||
import { BashSnippetHelper } from "@/app/_components/FeatureComponents/Scripts/BashSnippetHelper";
|
import { BashSnippetHelper } from "@/app/_components/FeatureComponents/Scripts/BashSnippetHelper";
|
||||||
import { showToast } from "@/app/_components/GlobalComponents/UIElements/Toast";
|
import { showToast } from "@/app/_components/GlobalComponents/UIElements/Toast";
|
||||||
import { FileText, Code, Info, Trash2 } from "lucide-react";
|
import { FileTextIcon, CodeIcon, InfoIcon, TrashIcon } from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface ScriptModalProps {
|
interface ScriptModalProps {
|
||||||
@@ -80,11 +80,11 @@ export const ScriptModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} onClose={onClose} title={title} size="2xl">
|
<Modal isOpen={isOpen} onClose={onClose} title={title} size="2xl">
|
||||||
<form onSubmit={handleSubmit} className="space-y-6">
|
<form onSubmit={handleSubmit} className="space-y-6 terminal-font">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-foreground mb-2">
|
<label className="block text-sm font-medium mb-2">
|
||||||
Script Name <span className="text-red-500">*</span>
|
Script Name <span className="text-status-error">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
value={form.name}
|
value={form.name}
|
||||||
@@ -93,15 +93,15 @@ export const ScriptModal = ({
|
|||||||
required
|
required
|
||||||
className={
|
className={
|
||||||
!form.name.trim()
|
!form.name.trim()
|
||||||
? "border-red-300 focus:border-red-500 focus:ring-red-500"
|
? "border-status-error focus:border-status-error"
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-foreground mb-2">
|
<label className="block text-sm font-medium mb-2">
|
||||||
Description{" "}
|
Description{" "}
|
||||||
<span className="text-muted-foreground text-xs">(optional)</span>
|
<span className="text-xs opacity-60">(optional)</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
value={form.description}
|
value={form.description}
|
||||||
@@ -112,24 +112,24 @@ export const ScriptModal = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 h-[500px]">
|
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 h-[500px]">
|
||||||
<div className="lg:col-span-1 bg-muted/20 rounded-lg p-4 flex flex-col h-full overflow-hidden">
|
<div className="lg:col-span-1 bg-background0 ascii-border p-4 flex flex-col h-full overflow-hidden">
|
||||||
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
||||||
<Code className="h-4 w-4 text-primary" />
|
<CodeIcon className="h-4 w-4" />
|
||||||
<h3 className="text-sm font-medium text-foreground">Snippets</h3>
|
<h3 className="text-sm font-medium">Snippets</h3>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 overflow-y-auto min-h-0 !pr-0">
|
<div className="flex-1 overflow-y-auto min-h-0 !pr-0 tui-scrollbar">
|
||||||
<BashSnippetHelper onInsertSnippet={handleInsertSnippet} />
|
<BashSnippetHelper onInsertSnippet={handleInsertSnippet} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="lg:col-span-2 flex flex-col h-full overflow-hidden">
|
<div className="lg:col-span-2 flex flex-col h-full overflow-hidden">
|
||||||
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
||||||
<FileText className="h-4 w-4 text-primary" />
|
<FileTextIcon className="h-4 w-4" />
|
||||||
<h3 className="text-sm font-medium text-foreground">
|
<h3 className="text-sm font-medium">
|
||||||
Script Content <span className="text-red-500">*</span>
|
Script Content <span className="text-status-error">*</span>
|
||||||
</h3>
|
</h3>
|
||||||
{isDraft && (
|
{isDraft && (
|
||||||
<span className="ml-auto px-2 py-0.5 text-xs font-medium bg-blue-500/10 text-blue-500 border border-blue-500/30 rounded-full">
|
<span className="ml-auto px-2 py-0.5 text-xs font-medium bg-background0 text-status-info ascii-border">
|
||||||
{t("scripts.draft")}
|
{t("scripts.draft")}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -145,16 +145,16 @@ export const ScriptModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-between items-center gap-3 pt-4 border-t border-border/30">
|
<div className="flex justify-between items-center gap-3 pt-4 border-border border-t">
|
||||||
<div>
|
<div>
|
||||||
{isDraft && onClearDraft && (
|
{isDraft && onClearDraft && (
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={onClearDraft}
|
onClick={onClearDraft}
|
||||||
className="text-muted-foreground hover:text-foreground"
|
className="opacity-60 hover:opacity-100"
|
||||||
>
|
>
|
||||||
<Trash2 className="h-4 w-4 mr-2" />
|
<TrashIcon className="h-4 w-4 mr-2" />
|
||||||
{t("scripts.clearDraft")}
|
{t("scripts.clearDraft")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
|
|||||||
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
import { Modal } from "@/app/_components/GlobalComponents/UIElements/Modal";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
import { FileText, Search, Check, Terminal } from "lucide-react";
|
import { FileTextIcon, MagnifyingGlassIcon, CheckIcon, TerminalIcon } from "@phosphor-icons/react";
|
||||||
import { Script } from "@/app/_utils/scripts-utils";
|
import { Script } from "@/app/_utils/scripts-utils";
|
||||||
import { getScriptContent } from "@/app/_server/actions/scripts";
|
import { getScriptContent } from "@/app/_server/actions/scripts";
|
||||||
import { getHostScriptPath } from "@/app/_server/actions/scripts";
|
import { getHostScriptPath } from "@/app/_server/actions/scripts";
|
||||||
@@ -84,7 +84,7 @@ export const SelectScriptModal = ({
|
|||||||
>
|
>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
<MagnifyingGlassIcon className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
||||||
<Input
|
<Input
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
@@ -119,12 +119,12 @@ export const SelectScriptModal = ({
|
|||||||
<div className="flex items-start justify-between">
|
<div className="flex items-start justify-between">
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<FileText className="h-4 w-4 text-primary flex-shrink-0" />
|
<FileTextIcon className="h-4 w-4 text-primary flex-shrink-0" />
|
||||||
<h4 className="font-medium text-foreground truncate">
|
<h4 className="font-medium text-foreground truncate">
|
||||||
{script.name}
|
{script.name}
|
||||||
</h4>
|
</h4>
|
||||||
{selectedScriptId === script.id && (
|
{selectedScriptId === script.id && (
|
||||||
<Check className="h-4 w-4 text-green-500 flex-shrink-0" />
|
<CheckIcon className="h-4 w-4 text-status-success flex-shrink-0" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm text-muted-foreground line-clamp-2">
|
<p className="text-sm text-muted-foreground line-clamp-2">
|
||||||
@@ -148,7 +148,7 @@ export const SelectScriptModal = ({
|
|||||||
{t("scripts.scriptPreview")}
|
{t("scripts.scriptPreview")}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-4 h-full max-h-80 overflow-y-auto">
|
<div className="p-4 h-full max-h-80 overflow-y-auto tui-scrollbar">
|
||||||
{previewScript ? (
|
{previewScript ? (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
@@ -162,12 +162,12 @@ export const SelectScriptModal = ({
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center gap-2 mb-2">
|
<div className="flex items-center gap-2 mb-2">
|
||||||
<Terminal className="h-4 w-4 text-primary" />
|
<TerminalIcon className="h-4 w-4 text-primary" />
|
||||||
<span className="text-sm font-medium text-foreground">
|
<span className="text-sm font-medium text-foreground">
|
||||||
{t("scripts.commandPreview")}
|
{t("scripts.commandPreview")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-muted/30 p-3 rounded border border-border/30">
|
<div className="bg-muted/30 p-3 rounded border border-border">
|
||||||
<code className="text-sm font-mono text-foreground break-all">
|
<code className="text-sm font-mono text-foreground break-all">
|
||||||
{hostScriptPath}
|
{hostScriptPath}
|
||||||
</code>
|
</code>
|
||||||
@@ -178,7 +178,7 @@ export const SelectScriptModal = ({
|
|||||||
<span className="text-sm font-medium text-foreground">
|
<span className="text-sm font-medium text-foreground">
|
||||||
{t("scripts.scriptContent")}
|
{t("scripts.scriptContent")}
|
||||||
</span>
|
</span>
|
||||||
<div className="bg-muted/30 p-3 rounded border border-border/30 mt-2 max-h-32 overflow-auto">
|
<div className="bg-muted/30 p-3 rounded border border-border mt-2 max-h-32 overflow-auto tui-scrollbar">
|
||||||
<pre className="text-xs font-mono text-foreground whitespace-pre-wrap">
|
<pre className="text-xs font-mono text-foreground whitespace-pre-wrap">
|
||||||
{previewContent}
|
{previewContent}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -187,7 +187,7 @@ export const SelectScriptModal = ({
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="text-center text-muted-foreground py-8">
|
<div className="text-center text-muted-foreground py-8">
|
||||||
<FileText className="h-12 w-12 mx-auto mb-4 opacity-50" />
|
<FileTextIcon className="h-12 w-12 mx-auto mb-4 opacity-50" />
|
||||||
<p>{t("scripts.selectScriptToPreview")}</p>
|
<p>{t("scripts.selectScriptToPreview")}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -195,7 +195,7 @@ export const SelectScriptModal = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end gap-2 pt-3 border-t border-border/50">
|
<div className="flex justify-end gap-2 pt-3 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -210,7 +210,7 @@ export const SelectScriptModal = ({
|
|||||||
disabled={!previewScript}
|
disabled={!previewScript}
|
||||||
className="btn-primary glow-primary"
|
className="btn-primary glow-primary"
|
||||||
>
|
>
|
||||||
<Check className="h-4 w-4 mr-2" />
|
<CheckIcon className="h-4 w-4 mr-2" />
|
||||||
{t("scripts.selectScript")}
|
{t("scripts.selectScript")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState, type JSX } from "react";
|
||||||
|
|
||||||
type BeforeInstallPromptEvent = Event & {
|
type BeforeInstallPromptEvent = Event & {
|
||||||
prompt: () => Promise<void>;
|
prompt: () => Promise<void>;
|
||||||
@@ -16,7 +16,6 @@ export const PWAInstallPrompt = (): JSX.Element | null => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window === "undefined") return;
|
if (typeof window === "undefined") return;
|
||||||
const onBeforeInstallPrompt = (e: Event) => {
|
const onBeforeInstallPrompt = (e: Event) => {
|
||||||
e.preventDefault();
|
|
||||||
setDeferred(e as BeforeInstallPromptEvent);
|
setDeferred(e as BeforeInstallPromptEvent);
|
||||||
};
|
};
|
||||||
const onAppInstalled = () => {
|
const onAppInstalled = () => {
|
||||||
@@ -42,17 +41,17 @@ export const PWAInstallPrompt = (): JSX.Element | null => {
|
|||||||
if (choice.outcome === "accepted") {
|
if (choice.outcome === "accepted") {
|
||||||
setDeferred(null);
|
setDeferred(null);
|
||||||
}
|
}
|
||||||
} catch (_err) {}
|
} catch (_err) { }
|
||||||
}, [deferred]);
|
}, [deferred]);
|
||||||
|
|
||||||
if (isInstalled || !deferred) return null;
|
if (isInstalled || !deferred) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className="px-3 py-1 rounded-md border border-border/50 bg-background/80 hover:bg-background/60"
|
className="px-3 py-2 ascii-border bg-background0 hover:bg-background1 transition-colors terminal-font text-sm"
|
||||||
onClick={onInstall}
|
onClick={onInstall}
|
||||||
>
|
>
|
||||||
Install App
|
Install
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ export const ServiceWorkerRegister = (): null => {
|
|||||||
r.scope.endsWith("/")
|
r.scope.endsWith("/")
|
||||||
);
|
);
|
||||||
if (alreadyRegistered) return;
|
if (alreadyRegistered) return;
|
||||||
await navigator.serviceWorker.register("/sw.js", { scope: "/" });
|
await navigator.serviceWorker.register("/serwist/sw.js", {
|
||||||
|
scope: "/",
|
||||||
|
updateViaCache: "none",
|
||||||
|
});
|
||||||
} catch (_err) {}
|
} catch (_err) {}
|
||||||
};
|
};
|
||||||
register();
|
register();
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import { EditorView, keymap } from "@codemirror/view";
|
|||||||
import { EditorState, Transaction } from "@codemirror/state";
|
import { EditorState, Transaction } from "@codemirror/state";
|
||||||
import { shell } from "@codemirror/legacy-modes/mode/shell";
|
import { shell } from "@codemirror/legacy-modes/mode/shell";
|
||||||
import { StreamLanguage } from "@codemirror/language";
|
import { StreamLanguage } from "@codemirror/language";
|
||||||
import { oneDark } from "@codemirror/theme-one-dark";
|
import { catppuccinMocha, catppuccinLatte } from './catppuccin-theme';
|
||||||
|
import { useTheme } from 'next-themes';
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Terminal, Copy, Check } from "lucide-react";
|
import { TerminalIcon, CopyIcon, CheckIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
interface BashEditorProps {
|
interface BashEditorProps {
|
||||||
value: string;
|
value: string;
|
||||||
@@ -27,6 +28,7 @@ export const BashEditor = ({
|
|||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
const editorRef = useRef<HTMLDivElement>(null);
|
const editorRef = useRef<HTMLDivElement>(null);
|
||||||
const editorViewRef = useRef<EditorView | null>(null);
|
const editorViewRef = useRef<EditorView | null>(null);
|
||||||
|
const { theme } = useTheme();
|
||||||
|
|
||||||
const insertFourSpaces = ({
|
const insertFourSpaces = ({
|
||||||
state,
|
state,
|
||||||
@@ -99,13 +101,54 @@ export const BashEditor = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editorRef.current) return;
|
if (!editorRef.current) return;
|
||||||
|
|
||||||
|
const isDark = theme === 'catppuccin-mocha';
|
||||||
const bashLanguage = StreamLanguage.define(shell);
|
const bashLanguage = StreamLanguage.define(shell);
|
||||||
|
|
||||||
|
const getThemeColors = () => {
|
||||||
|
const root = document.documentElement;
|
||||||
|
const style = getComputedStyle(root);
|
||||||
|
|
||||||
|
return {
|
||||||
|
background: style.getPropertyValue('--base').trim() || (isDark ? '#1e1e2e' : '#eff1f5'),
|
||||||
|
foreground: style.getPropertyValue('--text').trim() || (isDark ? '#cdd6f4' : '#4c4f69'),
|
||||||
|
border: style.getPropertyValue('--box-border-color').trim() || (isDark ? '#313244' : '#9ca0b0'),
|
||||||
|
surface: style.getPropertyValue('--surface0').trim() || (isDark ? '#313244' : '#ccd0da'),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const colors = getThemeColors();
|
||||||
|
|
||||||
|
const customTheme = EditorView.theme({
|
||||||
|
"&": {
|
||||||
|
backgroundColor: colors.background,
|
||||||
|
color: colors.foreground,
|
||||||
|
border: `1px solid ${colors.border}`,
|
||||||
|
borderRadius: '0',
|
||||||
|
},
|
||||||
|
".cm-content": {
|
||||||
|
caretColor: colors.foreground,
|
||||||
|
padding: '12px'
|
||||||
|
},
|
||||||
|
".cm-gutters": {
|
||||||
|
backgroundColor: colors.surface,
|
||||||
|
color: colors.foreground,
|
||||||
|
borderRight: `1px solid ${colors.border}`,
|
||||||
|
opacity: '0.6',
|
||||||
|
},
|
||||||
|
".cm-activeLineGutter": {
|
||||||
|
backgroundColor: colors.surface,
|
||||||
|
opacity: '1',
|
||||||
|
},
|
||||||
|
".cm-scroller": {
|
||||||
|
fontFamily: 'JetBrains Mono, Fira CodeIcon, monospace',
|
||||||
|
},
|
||||||
|
}, { dark: isDark });
|
||||||
|
|
||||||
const state = EditorState.create({
|
const state = EditorState.create({
|
||||||
doc: value || placeholder,
|
doc: value || placeholder,
|
||||||
extensions: [
|
extensions: [
|
||||||
bashLanguage,
|
bashLanguage,
|
||||||
oneDark,
|
customTheme,
|
||||||
keymap.of([
|
keymap.of([
|
||||||
{ key: "Tab", run: insertFourSpaces },
|
{ key: "Tab", run: insertFourSpaces },
|
||||||
{ key: "Shift-Tab", run: removeFourSpaces },
|
{ key: "Shift-Tab", run: removeFourSpaces },
|
||||||
@@ -119,7 +162,7 @@ export const BashEditor = ({
|
|||||||
"&": {
|
"&": {
|
||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
fontFamily:
|
fontFamily:
|
||||||
'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace',
|
'JetBrains Mono, Fira CodeIcon, ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace',
|
||||||
height: "100%",
|
height: "100%",
|
||||||
maxHeight: "100%",
|
maxHeight: "100%",
|
||||||
},
|
},
|
||||||
@@ -132,7 +175,7 @@ export const BashEditor = ({
|
|||||||
},
|
},
|
||||||
".cm-scroller": {
|
".cm-scroller": {
|
||||||
fontFamily:
|
fontFamily:
|
||||||
'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace',
|
'JetBrains Mono, Fira CodeIcon, ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace',
|
||||||
height: "100%",
|
height: "100%",
|
||||||
maxHeight: "100%",
|
maxHeight: "100%",
|
||||||
},
|
},
|
||||||
@@ -150,7 +193,7 @@ export const BashEditor = ({
|
|||||||
return () => {
|
return () => {
|
||||||
view.destroy();
|
view.destroy();
|
||||||
};
|
};
|
||||||
}, []);
|
}, [theme]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editorViewRef.current) {
|
if (editorViewRef.current) {
|
||||||
@@ -181,7 +224,7 @@ export const BashEditor = ({
|
|||||||
{label && (
|
{label && (
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Terminal className="h-4 w-4 text-cyan-500" />
|
<TerminalIcon className="h-4 w-4" />
|
||||||
<span className="text-sm font-medium">{label}</span>
|
<span className="text-sm font-medium">{label}</span>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
@@ -192,16 +235,16 @@ export const BashEditor = ({
|
|||||||
className="btn-outline h-7 px-2"
|
className="btn-outline h-7 px-2"
|
||||||
>
|
>
|
||||||
{copied ? (
|
{copied ? (
|
||||||
<Check className="h-3 w-3 mr-1" />
|
<CheckIcon className="h-3 w-3 mr-1" />
|
||||||
) : (
|
) : (
|
||||||
<Copy className="h-3 w-3 mr-1" />
|
<CopyIcon className="h-3 w-3 mr-1" />
|
||||||
)}
|
)}
|
||||||
{copied ? "Copied!" : "Copy"}
|
{copied ? "Copied!" : "CopyIcon"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="border border-border overflow-hidden h-full">
|
<div className="overflow-hidden h-full">
|
||||||
<div ref={editorRef} className="h-full rounded-lg" />
|
<div ref={editorRef} className="h-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import { useState, useEffect } from "react";
|
|||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
import {
|
import {
|
||||||
Search,
|
MagnifyingGlassIcon,
|
||||||
FileText,
|
FileTextIcon,
|
||||||
FolderOpen,
|
FolderOpen,
|
||||||
Code,
|
CodeIcon,
|
||||||
Settings,
|
GearIcon,
|
||||||
Database,
|
Database,
|
||||||
Copy,
|
CopyIcon,
|
||||||
Check,
|
CheckIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import {
|
import {
|
||||||
fetchSnippets,
|
fetchSnippets,
|
||||||
fetchSnippetCategories,
|
fetchSnippetCategories,
|
||||||
@@ -25,13 +25,13 @@ interface BashSnippetHelperProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const categoryIcons = {
|
const categoryIcons = {
|
||||||
"File Operations": FileText,
|
"File Operations": FileTextIcon,
|
||||||
Loops: Code,
|
Loops: CodeIcon,
|
||||||
Conditionals: Code,
|
Conditionals: CodeIcon,
|
||||||
"System Operations": Settings,
|
"System Operations": GearIcon,
|
||||||
"Database Operations": Database,
|
"Database Operations": Database,
|
||||||
"User Examples": FolderOpen,
|
"UserIcon Examples": FolderOpen,
|
||||||
"Custom Scripts": Code,
|
"Custom Scripts": CodeIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BashSnippetHelper = ({
|
export const BashSnippetHelper = ({
|
||||||
@@ -109,7 +109,7 @@ export const BashSnippetHelper = ({
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="text-center py-8">
|
<div className="text-center py-8">
|
||||||
<Code className="h-8 w-8 text-muted-foreground mx-auto mb-2 animate-spin" />
|
<CodeIcon className="h-8 w-8 text-muted-foreground mx-auto mb-2 animate-spin" />
|
||||||
<p className="text-sm text-muted-foreground">Loading snippets...</p>
|
<p className="text-sm text-muted-foreground">Loading snippets...</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,7 +119,7 @@ export const BashSnippetHelper = ({
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
<MagnifyingGlassIcon className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
||||||
<Input
|
<Input
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
@@ -129,7 +129,7 @@ export const BashSnippetHelper = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!searchQuery && (
|
{!searchQuery && (
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto tui-scrollbar">
|
||||||
<div className="flex gap-1 pb-2 min-w-max">
|
<div className="flex gap-1 pb-2 min-w-max">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -142,7 +142,7 @@ export const BashSnippetHelper = ({
|
|||||||
</Button>
|
</Button>
|
||||||
{categories.map((category) => {
|
{categories.map((category) => {
|
||||||
const Icon =
|
const Icon =
|
||||||
categoryIcons[category as keyof typeof categoryIcons] || Code;
|
categoryIcons[category as keyof typeof categoryIcons] || CodeIcon;
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
key={category}
|
key={category}
|
||||||
@@ -163,15 +163,15 @@ export const BashSnippetHelper = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="space-y-2 overflow-y-auto !pr-0 custom-scrollbar">
|
<div className="space-y-2 overflow-y-auto !pr-0 tui-scrollbar">
|
||||||
{filteredSnippets.map((snippet) => {
|
{filteredSnippets.map((snippet) => {
|
||||||
const Icon =
|
const Icon =
|
||||||
categoryIcons[snippet.category as keyof typeof categoryIcons] ||
|
categoryIcons[snippet.category as keyof typeof categoryIcons] ||
|
||||||
Code;
|
CodeIcon;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={snippet.id}
|
key={snippet.id}
|
||||||
className="bg-muted/30 rounded-lg border border-border/50 p-3 hover:bg-accent/30 transition-colors"
|
className="bg-muted/30 rounded-lg border border-border p-3 hover:bg-accent/30 transition-colors"
|
||||||
>
|
>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
@@ -180,7 +180,7 @@ export const BashSnippetHelper = ({
|
|||||||
{snippet.title}
|
{snippet.title}
|
||||||
</h4>
|
</h4>
|
||||||
{snippet.source === "user" && (
|
{snippet.source === "user" && (
|
||||||
<span className="inline-block px-1.5 py-0.5 text-xs bg-green-100 text-green-700 rounded border border-green-200">
|
<span className="inline-block px-1.5 py-0.5 text-xs text-status-success border border-border">
|
||||||
User
|
User
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -192,7 +192,7 @@ export const BashSnippetHelper = ({
|
|||||||
{snippet.tags.slice(0, 3).map((tag) => (
|
{snippet.tags.slice(0, 3).map((tag) => (
|
||||||
<span
|
<span
|
||||||
key={tag}
|
key={tag}
|
||||||
className="inline-block px-2 py-1 text-xs bg-primary/10 text-primary rounded border border-primary/20"
|
className="inline-block px-2 py-1 text-xs bg-primary/10 text-primary border border-border"
|
||||||
>
|
>
|
||||||
{tag}
|
{tag}
|
||||||
</span>
|
</span>
|
||||||
@@ -209,12 +209,11 @@ export const BashSnippetHelper = ({
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => handleCopy(snippet)}
|
onClick={() => handleCopy(snippet)}
|
||||||
className="h-6 w-8 p-0 text-xs"
|
|
||||||
>
|
>
|
||||||
{copiedId === snippet.id ? (
|
{copiedId === snippet.id ? (
|
||||||
<Check className="h-3 w-3" />
|
<CheckIcon className="h-3 w-3" />
|
||||||
) : (
|
) : (
|
||||||
<Copy className="h-3 w-3" />
|
<CopyIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@@ -222,7 +221,7 @@ export const BashSnippetHelper = ({
|
|||||||
variant="default"
|
variant="default"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => handleInsert(snippet)}
|
onClick={() => handleInsert(snippet)}
|
||||||
className="h-6 px-3 text-xs flex-1"
|
className="flex-1"
|
||||||
>
|
>
|
||||||
Insert
|
Insert
|
||||||
</Button>
|
</Button>
|
||||||
@@ -234,7 +233,7 @@ export const BashSnippetHelper = ({
|
|||||||
|
|
||||||
{filteredSnippets.length === 0 && (
|
{filteredSnippets.length === 0 && (
|
||||||
<div className="text-center py-8">
|
<div className="text-center py-8">
|
||||||
<Code className="h-8 w-8 text-muted-foreground mx-auto mb-2" />
|
<CodeIcon className="h-8 w-8 text-muted-foreground mx-auto mb-2" />
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{searchQuery
|
{searchQuery
|
||||||
? `No snippets found for "${searchQuery}"`
|
? `No snippets found for "${searchQuery}"`
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ import {
|
|||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
import { Input } from "@/app/_components/GlobalComponents/FormElements/Input";
|
||||||
import {
|
import {
|
||||||
Clock,
|
ClockIcon,
|
||||||
Info,
|
InfoIcon,
|
||||||
CheckCircle,
|
CheckCircleIcon,
|
||||||
AlertCircle,
|
WarningCircleIcon,
|
||||||
Calendar,
|
Calendar,
|
||||||
ChevronDown,
|
CaretDownIcon,
|
||||||
ChevronUp,
|
CaretUpIcon,
|
||||||
Search,
|
MagnifyingGlassIcon,
|
||||||
} from "lucide-react";
|
} from "@phosphor-icons/react";
|
||||||
import { useLocale } from "next-intl";
|
import { useLocale } from "next-intl";
|
||||||
|
|
||||||
interface CronExpressionHelperProps {
|
interface CronExpressionHelperProps {
|
||||||
@@ -87,20 +87,20 @@ export const CronExpressionHelper = ({
|
|||||||
/>
|
/>
|
||||||
<div className="absolute right-3 top-1/2 -translate-y-1/2">
|
<div className="absolute right-3 top-1/2 -translate-y-1/2">
|
||||||
{explanation?.isValid ? (
|
{explanation?.isValid ? (
|
||||||
<CheckCircle className="h-4 w-4 text-green-500" />
|
<CheckCircleIcon className="h-4 w-4 text-status-success" />
|
||||||
) : value ? (
|
) : value ? (
|
||||||
<AlertCircle className="h-4 w-4 text-red-500" />
|
<WarningCircleIcon className="h-4 w-4 text-status-error" />
|
||||||
) : (
|
) : (
|
||||||
<Clock className="h-4 w-4 text-muted-foreground" />
|
<ClockIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{explanation && (
|
{explanation && (
|
||||||
<div className="bg-muted/30 rounded p-2 border border-border/30">
|
<div className="bg-background0 p-2 text-status-warning ascii-border terminal-font">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<Info className="h-3 w-3 text-primary mt-0.5 flex-shrink-0" />
|
<InfoIcon className="h-3 w-3 text-primary mt-0.5 flex-shrink-0" />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<p className="text-xs italic text-muted-foreground">
|
<p className="text-xs italic text-muted-foreground">
|
||||||
{explanation.isValid
|
{explanation.isValid
|
||||||
@@ -108,7 +108,7 @@ export const CronExpressionHelper = ({
|
|||||||
: "Invalid Expression"}
|
: "Invalid Expression"}
|
||||||
</p>
|
</p>
|
||||||
{explanation.error && (
|
{explanation.error && (
|
||||||
<p className="text-xs text-red-600 dark:text-red-400 mt-0.5">
|
<p className="text-xs text-status-error mt-0.5">
|
||||||
{explanation.error}
|
{explanation.error}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
@@ -117,7 +117,7 @@ export const CronExpressionHelper = ({
|
|||||||
|
|
||||||
{explanation.isValid && explanation.nextRuns.length > 0 && (
|
{explanation.isValid && explanation.nextRuns.length > 0 && (
|
||||||
<div className="flex items-start gap-2">
|
<div className="flex items-start gap-2">
|
||||||
<Calendar className="h-3 w-3 text-blue-500 mt-0.5 flex-shrink-0" />
|
<Calendar className="h-3 w-3 text-status-info mt-0.5 flex-shrink-0" />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<p className="text-xs text-muted-foreground mb-1">
|
<p className="text-xs text-muted-foreground mb-1">
|
||||||
Next executions:
|
Next executions:
|
||||||
@@ -137,7 +137,7 @@ export const CronExpressionHelper = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{showPatterns && (
|
{showPatterns && (
|
||||||
<div className="bg-muted/30 rounded-lg border border-border/50">
|
<div className="bg-background0 ascii-border terminal-font">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -145,24 +145,24 @@ export const CronExpressionHelper = ({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setShowPatternsPanel(!showPatternsPanel);
|
setShowPatternsPanel(!showPatternsPanel);
|
||||||
}}
|
}}
|
||||||
className="w-full text-left p-3 hover:bg-accent/30 transition-colors rounded-t-lg"
|
className="w-full text-left p-3 hover:bg-background0 transition-colors"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<span className="text-sm font-medium">Quick Patterns</span>
|
<span className="text-sm font-medium">Quick Patterns</span>
|
||||||
<div className="p-1">
|
<div className="p-1">
|
||||||
{showPatternsPanel ? (
|
{showPatternsPanel ? (
|
||||||
<ChevronUp className="h-4 w-4" />
|
<CaretUpIcon className="h-4 w-4" />
|
||||||
) : (
|
) : (
|
||||||
<ChevronDown className="h-4 w-4" />
|
<CaretDownIcon className="h-4 w-4" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{showPatternsPanel && (
|
{showPatternsPanel && (
|
||||||
<div className="p-3 border-t border-border/50">
|
<div className="p-3 border-t border-border">
|
||||||
<div className="relative mb-3">
|
<div className="relative mb-3">
|
||||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
<MagnifyingGlassIcon className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
||||||
<Input
|
<Input
|
||||||
value={patternSearch}
|
value={patternSearch}
|
||||||
onChange={(e) => setPatternSearch(e.target.value)}
|
onChange={(e) => setPatternSearch(e.target.value)}
|
||||||
@@ -171,7 +171,7 @@ export const CronExpressionHelper = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-3 max-h-64 overflow-y-auto custom-scrollbar">
|
<div className="space-y-3 max-h-64 overflow-y-auto tui-scrollbar">
|
||||||
{filteredPatterns.map((category) => (
|
{filteredPatterns.map((category) => (
|
||||||
<div key={category.category} className="space-y-2">
|
<div key={category.category} className="space-y-2">
|
||||||
<h4 className="font-medium text-foreground text-sm">
|
<h4 className="font-medium text-foreground text-sm">
|
||||||
|
|||||||
@@ -4,15 +4,14 @@ import { useState, useEffect } from "react";
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/app/_components/GlobalComponents/Cards/Card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/app/_components/GlobalComponents/Cards/Card";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import {
|
import {
|
||||||
FileText,
|
FileTextIcon,
|
||||||
Plus,
|
PlusIcon,
|
||||||
Edit,
|
PencilSimpleIcon,
|
||||||
Trash2,
|
TrashIcon,
|
||||||
Copy,
|
CopyIcon,
|
||||||
Copy as CopyIcon,
|
CheckCircleIcon,
|
||||||
CheckCircle,
|
FilesIcon,
|
||||||
Files,
|
} from "@phosphor-icons/react";
|
||||||
} from "lucide-react";
|
|
||||||
import { Script } from "@/app/_utils/scripts-utils";
|
import { Script } from "@/app/_utils/scripts-utils";
|
||||||
import {
|
import {
|
||||||
createScript,
|
createScript,
|
||||||
@@ -207,8 +206,8 @@ export const ScriptsManager = ({
|
|||||||
<CardHeader>
|
<CardHeader>
|
||||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<div className="p-2 bg-primary/10 rounded-lg">
|
<div className="p-2 bg-background0 ascii-border">
|
||||||
<FileText className="h-5 w-5 text-primary" />
|
<FileTextIcon className="h-5 w-5 text-primary" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<CardTitle className="text-xl brand-gradient">
|
<CardTitle className="text-xl brand-gradient">
|
||||||
@@ -223,16 +222,16 @@ export const ScriptsManager = ({
|
|||||||
onClick={() => setIsCreateModalOpen(true)}
|
onClick={() => setIsCreateModalOpen(true)}
|
||||||
className="btn-primary glow-primary"
|
className="btn-primary glow-primary"
|
||||||
>
|
>
|
||||||
<Plus className="h-4 w-4 mr-2" />
|
<PlusIcon className="h-4 w-4 mr-2" />
|
||||||
{t("scripts.newScript")}
|
{t("scripts.newScript")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
{scripts.length === 0 ? (
|
{scripts.length === 0 ? (
|
||||||
<div className="text-center py-16">
|
<div className="text-center py-16 terminal-font">
|
||||||
<div className="mx-auto w-20 h-20 bg-gradient-to-br from-primary/20 to-blue-500/20 rounded-full flex items-center justify-center mb-6">
|
<div className="mx-auto w-20 h-20 bg-background2 ascii-border flex items-center justify-center mb-6">
|
||||||
<FileText className="h-10 w-10 text-primary" />
|
<FileTextIcon className="h-10 w-10 text-primary" />
|
||||||
</div>
|
</div>
|
||||||
<h3 className="text-xl font-semibold mb-3 brand-gradient">
|
<h3 className="text-xl font-semibold mb-3 brand-gradient">
|
||||||
{t("scripts.noScriptsYet")}
|
{t("scripts.noScriptsYet")}
|
||||||
@@ -245,7 +244,7 @@ export const ScriptsManager = ({
|
|||||||
className="btn-primary glow-primary"
|
className="btn-primary glow-primary"
|
||||||
size="lg"
|
size="lg"
|
||||||
>
|
>
|
||||||
<Plus className="h-5 w-5 mr-2" />
|
<PlusIcon className="h-5 w-5 mr-2" />
|
||||||
{t("scripts.createYourFirstScript")}
|
{t("scripts.createYourFirstScript")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -254,7 +253,7 @@ export const ScriptsManager = ({
|
|||||||
{scripts.map((script) => (
|
{scripts.map((script) => (
|
||||||
<div
|
<div
|
||||||
key={script.id}
|
key={script.id}
|
||||||
className="glass-card p-4 border border-border/50 rounded-lg hover:bg-accent/30 transition-colors"
|
className="glass-card p-4 ascii-border hover:bg-accent/30 transition-colors terminal-font"
|
||||||
>
|
>
|
||||||
<div className="flex items-start justify-between gap-4">
|
<div className="flex items-start justify-between gap-4">
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
@@ -282,11 +281,11 @@ export const ScriptsManager = ({
|
|||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => handleCopy(script)}
|
onClick={() => handleCopy(script)}
|
||||||
className="btn-outline h-8 px-3"
|
className="btn-outline h-8 px-3"
|
||||||
title="Copy script content to clipboard"
|
title="CopyIcon script content to clipboard"
|
||||||
aria-label="Copy script content to clipboard"
|
aria-label="CopyIcon script content to clipboard"
|
||||||
>
|
>
|
||||||
{copiedId === script.id ? (
|
{copiedId === script.id ? (
|
||||||
<CheckCircle className="h-3 w-3 text-green-500" />
|
<CheckCircleIcon className="h-3 w-3 text-status-success" />
|
||||||
) : (
|
) : (
|
||||||
<CopyIcon className="h-3 w-3" />
|
<CopyIcon className="h-3 w-3" />
|
||||||
)}
|
)}
|
||||||
@@ -302,7 +301,7 @@ export const ScriptsManager = ({
|
|||||||
title="Clone script"
|
title="Clone script"
|
||||||
aria-label="Clone script"
|
aria-label="Clone script"
|
||||||
>
|
>
|
||||||
<Files className="h-3 w-3" />
|
<FilesIcon className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -323,7 +322,7 @@ export const ScriptsManager = ({
|
|||||||
title="Edit script"
|
title="Edit script"
|
||||||
aria-label="Edit script"
|
aria-label="Edit script"
|
||||||
>
|
>
|
||||||
<Edit className="h-3 w-3" />
|
<PencilSimpleIcon className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
@@ -332,11 +331,11 @@ export const ScriptsManager = ({
|
|||||||
setSelectedScript(script);
|
setSelectedScript(script);
|
||||||
setIsDeleteModalOpen(true);
|
setIsDeleteModalOpen(true);
|
||||||
}}
|
}}
|
||||||
className="btn-destructive h-8 px-3"
|
className="h-8 px-3"
|
||||||
title="Delete script"
|
title="Delete script"
|
||||||
aria-label="Delete script"
|
aria-label="Delete script"
|
||||||
>
|
>
|
||||||
<Trash2 className="h-3 w-3" />
|
<TrashIcon className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { Extension } from '@codemirror/state';
|
||||||
|
import { EditorView } from '@codemirror/view';
|
||||||
|
|
||||||
|
export const catppuccinMocha: Extension = EditorView.theme({
|
||||||
|
'&': {
|
||||||
|
backgroundColor: '#1e1e2e',
|
||||||
|
color: '#cdd6f4',
|
||||||
|
fontSize: '14px',
|
||||||
|
fontFamily: 'JetBrains Mono, monospace',
|
||||||
|
border: '1px solid #45475a',
|
||||||
|
borderRadius: '0',
|
||||||
|
},
|
||||||
|
'.cm-content': { caretColor: '#f5e0dc', padding: '12px' },
|
||||||
|
'.cm-gutters': {
|
||||||
|
backgroundColor: '#181825',
|
||||||
|
color: '#6c7086',
|
||||||
|
borderRight: '1px solid #45475a',
|
||||||
|
},
|
||||||
|
}, { dark: true });
|
||||||
|
|
||||||
|
export const catppuccinLatte: Extension = EditorView.theme({
|
||||||
|
'&': {
|
||||||
|
backgroundColor: '#eff1f5',
|
||||||
|
color: '#4c4f69',
|
||||||
|
fontSize: '14px',
|
||||||
|
fontFamily: 'JetBrains Mono, monospace',
|
||||||
|
border: '1px solid #9ca0b0',
|
||||||
|
borderRadius: '0',
|
||||||
|
},
|
||||||
|
'.cm-content': { caretColor: '#dc8a78', padding: '12px' },
|
||||||
|
'.cm-gutters': {
|
||||||
|
backgroundColor: '#e6e9ef',
|
||||||
|
color: '#8c8fa1',
|
||||||
|
borderRight: '1px solid #9ca0b0',
|
||||||
|
},
|
||||||
|
}, { dark: false });
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { cn } from "@/app/_utils/global-utils";
|
import { cn } from "@/app/_utils/global-utils";
|
||||||
import { HTMLAttributes, forwardRef } from "react";
|
import { HTMLAttributes, forwardRef } from "react";
|
||||||
import { Zap } from "lucide-react";
|
import { LightningIcon } from "@phosphor-icons/react";
|
||||||
import { StatusBadge } from "@/app/_components/GlobalComponents/Badges/StatusBadge";
|
import { StatusBadge } from "@/app/_components/GlobalComponents/Badges/StatusBadge";
|
||||||
|
|
||||||
export interface PerformanceMetric {
|
export interface PerformanceMetric {
|
||||||
@@ -20,14 +20,14 @@ export const PerformanceSummary = forwardRef<HTMLDivElement, PerformanceSummaryP
|
|||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"p-3 bg-gradient-to-r from-purple-500/5 to-pink-500/5 border border-purple-500/20 rounded-lg glass-card",
|
"p-3 bg-background0 ascii-border glass-card terminal-font",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 mb-3">
|
<div className="flex items-center gap-2 mb-3">
|
||||||
<Zap className="h-4 w-4 text-purple-500" />
|
<LightningIcon className="h-4 w-4" />
|
||||||
<span className="text-sm font-medium text-purple-600 dark:text-purple-400">
|
<span className="text-sm font-medium">
|
||||||
Performance Summary
|
Performance Summary
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MetricCard } from "@/app/_components/GlobalComponents/Cards/MetricCard"
|
|||||||
import { SystemStatus } from "@/app/_components/FeatureComponents/System/SystemStatus";
|
import { SystemStatus } from "@/app/_components/FeatureComponents/System/SystemStatus";
|
||||||
import { PerformanceSummary } from "@/app/_components/FeatureComponents/System/PerformanceSummary";
|
import { PerformanceSummary } from "@/app/_components/FeatureComponents/System/PerformanceSummary";
|
||||||
import { Sidebar } from "@/app/_components/FeatureComponents/Layout/Sidebar";
|
import { Sidebar } from "@/app/_components/FeatureComponents/Layout/Sidebar";
|
||||||
import { Clock, HardDrive, Cpu, Monitor, Wifi } from "lucide-react";
|
import { ClockIcon, HardDriveIcon, CpuIcon, MonitorIcon, WifiHighIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
interface SystemInfoType {
|
interface SystemInfoType {
|
||||||
hostname: string;
|
hostname: string;
|
||||||
@@ -170,53 +170,48 @@ export const SystemInfoCard = ({
|
|||||||
|
|
||||||
const basicInfoItems = [
|
const basicInfoItems = [
|
||||||
{
|
{
|
||||||
icon: Clock,
|
icon: ClockIcon,
|
||||||
label: t("sidebar.uptime"),
|
label: t("sidebar.uptime"),
|
||||||
value: systemInfo.uptime,
|
value: systemInfo.uptime,
|
||||||
color: "text-orange-500",
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const performanceItems = [
|
const performanceItems = [
|
||||||
{
|
{
|
||||||
icon: HardDrive,
|
icon: HardDriveIcon,
|
||||||
label: t("sidebar.memory"),
|
label: t("sidebar.memory"),
|
||||||
value: `${systemInfo.memory.used} / ${systemInfo.memory.total}`,
|
value: `${systemInfo.memory.used} / ${systemInfo.memory.total}`,
|
||||||
detail: `${systemInfo.memory.free} free`,
|
detail: `${systemInfo.memory.free} free`,
|
||||||
status: systemInfo.memory.status,
|
status: systemInfo.memory.status,
|
||||||
color: "text-cyan-500",
|
|
||||||
showProgress: true,
|
showProgress: true,
|
||||||
progressValue: systemInfo.memory.usage,
|
progressValue: systemInfo.memory.usage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Cpu,
|
icon: CpuIcon,
|
||||||
label: t("sidebar.cpu"),
|
label: t("sidebar.cpu"),
|
||||||
value: systemInfo.cpu.model,
|
value: systemInfo.cpu.model,
|
||||||
detail: `${systemInfo.cpu.cores} cores`,
|
detail: `${systemInfo.cpu.cores} cores`,
|
||||||
status: systemInfo.cpu.status,
|
status: systemInfo.cpu.status,
|
||||||
color: "text-pink-500",
|
|
||||||
showProgress: true,
|
showProgress: true,
|
||||||
progressValue: systemInfo.cpu.usage,
|
progressValue: systemInfo.cpu.usage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Monitor,
|
icon: MonitorIcon,
|
||||||
label: t("sidebar.gpu"),
|
label: t("sidebar.gpu"),
|
||||||
value: systemInfo.gpu.model,
|
value: systemInfo.gpu.model,
|
||||||
detail: systemInfo.gpu.memory
|
detail: systemInfo.gpu.memory
|
||||||
? `${systemInfo.gpu.memory} VRAM`
|
? `${systemInfo.gpu.memory} VRAM`
|
||||||
: systemInfo.gpu.status,
|
: systemInfo.gpu.status,
|
||||||
status: systemInfo.gpu.status,
|
status: systemInfo.gpu.status,
|
||||||
color: "text-indigo-500",
|
|
||||||
},
|
},
|
||||||
...(systemInfo.network
|
...(systemInfo.network
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
icon: Wifi,
|
icon: WifiHighIcon,
|
||||||
label: t("sidebar.network"),
|
label: t("sidebar.network"),
|
||||||
value: `${systemInfo.network.latency}ms`,
|
value: `${systemInfo.network.latency}ms`,
|
||||||
detail: `${systemInfo.network.latency}ms latency • ${systemInfo.network.speed}`,
|
detail: `${systemInfo.network.latency}ms latency • ${systemInfo.network.speed}`,
|
||||||
status: systemInfo.network.status,
|
status: systemInfo.network.status,
|
||||||
color: "text-teal-500",
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
@@ -264,7 +259,6 @@ export const SystemInfoCard = ({
|
|||||||
icon={item.icon}
|
icon={item.icon}
|
||||||
label={item.label}
|
label={item.label}
|
||||||
value={item.value}
|
value={item.value}
|
||||||
color={item.color}
|
|
||||||
variant="basic"
|
variant="basic"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -275,7 +269,7 @@ export const SystemInfoCard = ({
|
|||||||
<h3 className="text-xs font-semibold text-foreground mb-2 uppercase tracking-wide">
|
<h3 className="text-xs font-semibold text-foreground mb-2 uppercase tracking-wide">
|
||||||
{t("sidebar.performanceMetrics")}
|
{t("sidebar.performanceMetrics")}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="space-y-2">
|
<div className="space-y-4">
|
||||||
{performanceItems.map((item) => (
|
{performanceItems.map((item) => (
|
||||||
<MetricCard
|
<MetricCard
|
||||||
key={item.label}
|
key={item.label}
|
||||||
@@ -284,7 +278,6 @@ export const SystemInfoCard = ({
|
|||||||
value={item.value}
|
value={item.value}
|
||||||
detail={item.detail}
|
detail={item.detail}
|
||||||
status={item.status}
|
status={item.status}
|
||||||
color={item.color}
|
|
||||||
variant="performance"
|
variant="performance"
|
||||||
showProgress={item.showProgress}
|
showProgress={item.showProgress}
|
||||||
progressValue={item.progressValue}
|
progressValue={item.progressValue}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { cn } from "@/app/_utils/global-utils";
|
import { cn } from "@/app/_utils/global-utils";
|
||||||
import { HTMLAttributes, forwardRef } from "react";
|
import { HTMLAttributes, forwardRef } from "react";
|
||||||
import { Activity } from "lucide-react";
|
import { PulseIcon } from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export interface SystemStatusProps extends HTMLAttributes<HTMLDivElement> {
|
export interface SystemStatusProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
@@ -22,27 +22,27 @@ export const SystemStatus = forwardRef<HTMLDivElement, SystemStatusProps>(
|
|||||||
switch (lowerStatus) {
|
switch (lowerStatus) {
|
||||||
case "operational":
|
case "operational":
|
||||||
return {
|
return {
|
||||||
bgColor: "bg-emerald-500/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-emerald-500/20",
|
borderColor: "ascii-border",
|
||||||
dotColor: "bg-emerald-500",
|
dotColor: "bg-status-success",
|
||||||
};
|
};
|
||||||
case "warning":
|
case "warning":
|
||||||
return {
|
return {
|
||||||
bgColor: "bg-yellow-500/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-yellow-500/20",
|
borderColor: "ascii-border",
|
||||||
dotColor: "bg-yellow-500",
|
dotColor: "bg-status-warning",
|
||||||
};
|
};
|
||||||
case "critical":
|
case "critical":
|
||||||
return {
|
return {
|
||||||
bgColor: "bg-destructive/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-destructive/20",
|
borderColor: "ascii-border",
|
||||||
dotColor: "bg-destructive",
|
dotColor: "bg-status-error",
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return {
|
return {
|
||||||
bgColor: "bg-muted",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-border",
|
borderColor: "ascii-border",
|
||||||
dotColor: "bg-muted-foreground",
|
dotColor: "bg-status-success",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -53,7 +53,7 @@ export const SystemStatus = forwardRef<HTMLDivElement, SystemStatusProps>(
|
|||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"p-4 border border-border/50 rounded-lg glass-card",
|
"p-4 glass-card terminal-font",
|
||||||
config.bgColor,
|
config.bgColor,
|
||||||
config.borderColor,
|
config.borderColor,
|
||||||
className
|
className
|
||||||
@@ -61,10 +61,10 @@ export const SystemStatus = forwardRef<HTMLDivElement, SystemStatusProps>(
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<div className={cn("w-3 h-3 rounded-full", config.dotColor)} />
|
<div className={cn("w-3 h-3", config.dotColor)} />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Activity className="h-4 w-4 text-muted-foreground" />
|
<PulseIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
<span className="text-sm font-medium text-foreground">
|
<span className="text-sm font-medium text-foreground">
|
||||||
{t("system.systemStatus")}: {status}
|
{t("system.systemStatus")}: {status}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { AlertTriangle, X } from "lucide-react";
|
import { WarningIcon, XIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
export const WrapperScriptWarning = () => {
|
export const WrapperScriptWarning = () => {
|
||||||
const [isVisible, setIsVisible] = useState(false);
|
const [isVisible, setIsVisible] = useState(false);
|
||||||
@@ -46,7 +46,7 @@ export const WrapperScriptWarning = () => {
|
|||||||
<div className="bg-amber-500/10 border border-amber-500/20 rounded-lg p-4 mb-4">
|
<div className="bg-amber-500/10 border border-amber-500/20 rounded-lg p-4 mb-4">
|
||||||
<div className="flex items-start justify-between">
|
<div className="flex items-start justify-between">
|
||||||
<div className="flex items-start space-x-3">
|
<div className="flex items-start space-x-3">
|
||||||
<AlertTriangle className="w-5 h-5 text-amber-500 mt-0.5 flex-shrink-0" />
|
<WarningIcon className="w-5 h-5 text-amber-500 mt-0.5 flex-shrink-0" />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<h3 className="text-sm font-medium text-amber-800 dark:text-amber-400">
|
<h3 className="text-sm font-medium text-amber-800 dark:text-amber-400">
|
||||||
{t("warnings.wrapperScriptModified")}
|
{t("warnings.wrapperScriptModified")}
|
||||||
@@ -61,7 +61,7 @@ export const WrapperScriptWarning = () => {
|
|||||||
className="text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-300 transition-colors ml-4"
|
className="text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-300 transition-colors ml-4"
|
||||||
aria-label="Dismiss warning"
|
aria-label="Dismiss warning"
|
||||||
>
|
>
|
||||||
<X className="w-4 h-4" />
|
<XIcon className="w-4 h-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { Moon, Sun } from 'lucide-react';
|
|
||||||
import { useTheme } from 'next-themes';
|
import { useTheme } from 'next-themes';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Button } from '@/app/_components/GlobalComponents/UIElements/Button';
|
import { SunIcon, MoonIcon } from '@phosphor-icons/react';
|
||||||
|
|
||||||
export const ThemeToggle = () => {
|
export const ThemeToggle = () => {
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
@@ -13,19 +12,22 @@ export const ThemeToggle = () => {
|
|||||||
setMounted(true);
|
setMounted(true);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (!mounted) {
|
if (!mounted) return null;
|
||||||
return null;
|
|
||||||
}
|
const isDark = theme === 'dark';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<button
|
||||||
variant="ghost"
|
onClick={() => setTheme(isDark ? 'light' : 'dark')}
|
||||||
size="icon"
|
className="p-2 ascii-border bg-background0 hover:bg-background1 transition-colors"
|
||||||
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
|
aria-label={isDark ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||||
|
title={isDark ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||||
>
|
>
|
||||||
<Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
{isDark ? (
|
||||||
<Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
<SunIcon size={20} weight="regular" className="text-foreground" />
|
||||||
<span className="sr-only">Toggle theme</span>
|
) : (
|
||||||
</Button>
|
<MoonIcon size={20} weight="regular" className="text-foreground" />
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { ChevronDown, User, X } from "lucide-react";
|
import { CaretDownIcon, UserIcon, XIcon } from "@phosphor-icons/react";
|
||||||
import { fetchAvailableUsers } from "@/app/_server/actions/cronjobs";
|
import { fetchAvailableUsers } from "@/app/_server/actions/cronjobs";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ export const UserFilter = ({
|
|||||||
<div
|
<div
|
||||||
className={`flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-md ${className}`}
|
className={`flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-md ${className}`}
|
||||||
>
|
>
|
||||||
<User className="h-4 w-4 text-muted-foreground" />
|
<UserIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
<span className="text-sm text-muted-foreground">Loading users...</span>
|
<span className="text-sm text-muted-foreground">Loading users...</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -57,14 +57,14 @@ export const UserFilter = ({
|
|||||||
className="flex-1 justify-between"
|
className="flex-1 justify-between"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<User className="h-4 w-4" />
|
<UserIcon className="h-4 w-4" />
|
||||||
<span className="text-sm">
|
<span className="text-sm">
|
||||||
{selectedUser
|
{selectedUser
|
||||||
? `${t("common.userWithUsername", { user: selectedUser })}`
|
? `${t("common.userWithUsername", { user: selectedUser })}`
|
||||||
: t("common.allUsers")}
|
: t("common.allUsers")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronDown className="h-4 w-4" />
|
<CaretDownIcon className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
{selectedUser && (
|
{selectedUser && (
|
||||||
<Button
|
<Button
|
||||||
@@ -73,21 +73,20 @@ export const UserFilter = ({
|
|||||||
onClick={() => onUserChange(null)}
|
onClick={() => onUserChange(null)}
|
||||||
className="p-2 h-8 w-8 flex-shrink-0"
|
className="p-2 h-8 w-8 flex-shrink-0"
|
||||||
>
|
>
|
||||||
<X className="h-3 w-3" />
|
<XIcon className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div className="absolute top-full left-0 right-0 mt-1 bg-background border border-border rounded-md shadow-lg z-50 max-h-48 overflow-y-auto">
|
<div className="absolute top-full left-0 right-0 p-1 mt-1 bg-background0 border border-border rounded-md shadow-lg z-50 max-h-48 overflow-y-auto tui-scrollbar">
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onUserChange(null);
|
onUserChange(null);
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors ${
|
className={`w-full text-left px-3 py-2 text-sm hover:border-border transition-colors ${!selectedUser ? "border border-border" : "border border-transparent"
|
||||||
!selectedUser ? "bg-accent text-accent-foreground" : ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{t("common.allUsers")}
|
{t("common.allUsers")}
|
||||||
</button>
|
</button>
|
||||||
@@ -98,9 +97,8 @@ export const UserFilter = ({
|
|||||||
onUserChange(user);
|
onUserChange(user);
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors ${
|
className={`w-full text-left px-3 py-2 text-sm border border-transparent hover:border-border transition-colors ${selectedUser === user ? "border border-border" : "border border-transparent"
|
||||||
selectedUser === user ? "bg-accent text-accent-foreground" : ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{user}
|
{user}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { ChevronDown, User } from "lucide-react";
|
import { CaretDownIcon, UserIcon } from "@phosphor-icons/react";
|
||||||
import { fetchAvailableUsers } from "@/app/_server/actions/cronjobs";
|
import { fetchAvailableUsers } from "@/app/_server/actions/cronjobs";
|
||||||
|
|
||||||
interface UserSwitcherProps {
|
interface UserSwitcherProps {
|
||||||
@@ -43,7 +43,7 @@ export const UserSwitcher = ({
|
|||||||
<div
|
<div
|
||||||
className={`flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-md ${className}`}
|
className={`flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-md ${className}`}
|
||||||
>
|
>
|
||||||
<User className="h-4 w-4 text-muted-foreground" />
|
<UserIcon className="h-4 w-4 text-muted-foreground" />
|
||||||
<span className="text-sm text-muted-foreground">Loading users...</span>
|
<span className="text-sm text-muted-foreground">Loading users...</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -62,14 +62,14 @@ export const UserSwitcher = ({
|
|||||||
className="w-full justify-between"
|
className="w-full justify-between"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<User className="h-4 w-4" />
|
<UserIcon className="h-4 w-4" />
|
||||||
<span className="text-sm">{selectedUser || "Select user"}</span>
|
<span className="text-sm">{selectedUser || "Select user"}</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronDown className="h-4 w-4" />
|
<CaretDownIcon className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div className="absolute top-full left-0 right-0 mt-1 bg-background border border-border rounded-md shadow-lg z-50 max-h-48 overflow-y-auto">
|
<div className="absolute top-full left-0 right-0 mt-1 bg-background0 border border-border rounded-md shadow-lg z-50 max-h-48 overflow-y-auto tui-scrollbar">
|
||||||
{users.map((user) => (
|
{users.map((user) => (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -80,9 +80,8 @@ export const UserSwitcher = ({
|
|||||||
onUserChange(user);
|
onUserChange(user);
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
}}
|
}}
|
||||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors ${
|
className={`w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors ${selectedUser === user ? "border border-border" : "border border-transparent"
|
||||||
selectedUser === user ? "bg-accent text-accent-foreground" : ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{user}
|
{user}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { AlertCircle, X } from "lucide-react";
|
import { WarningCircleIcon, XIcon } from "@phosphor-icons/react";
|
||||||
import { JobError, removeJobError } from "@/app/_utils/error-utils";
|
import { JobError, removeJobError } from "@/app/_utils/error-utils";
|
||||||
|
|
||||||
interface ErrorBadgeProps {
|
interface ErrorBadgeProps {
|
||||||
@@ -30,7 +30,7 @@ export const ErrorBadge = ({
|
|||||||
className="flex items-center gap-1 px-2 py-1 bg-destructive/10 text-destructive border border-destructive/20 rounded text-xs hover:bg-destructive/20 transition-colors"
|
className="flex items-center gap-1 px-2 py-1 bg-destructive/10 text-destructive border border-destructive/20 rounded text-xs hover:bg-destructive/20 transition-colors"
|
||||||
title={error.message}
|
title={error.message}
|
||||||
>
|
>
|
||||||
<AlertCircle className="h-3 w-3" />
|
<WarningCircleIcon className="h-3 w-3" />
|
||||||
<span className="hidden sm:inline">Error</span>
|
<span className="hidden sm:inline">Error</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -38,7 +38,7 @@ export const ErrorBadge = ({
|
|||||||
className="p-1 text-destructive hover:bg-destructive/10 rounded transition-colors"
|
className="p-1 text-destructive hover:bg-destructive/10 rounded transition-colors"
|
||||||
title="Dismiss error"
|
title="Dismiss error"
|
||||||
>
|
>
|
||||||
<X className="h-3 w-3" />
|
<XIcon className="h-3 w-3" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { cn } from "@/app/_utils/global-utils";
|
import { cn } from "@/app/_utils/global-utils";
|
||||||
import { HTMLAttributes, forwardRef } from "react";
|
import { HTMLAttributes, forwardRef } from "react";
|
||||||
import { CheckCircle, AlertTriangle, XCircle, Activity } from "lucide-react";
|
import { CheckCircleIcon, WarningIcon, XCircleIcon, PulseIcon } from "@phosphor-icons/react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export interface StatusBadgeProps extends HTMLAttributes<HTMLDivElement> {
|
export interface StatusBadgeProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
@@ -31,46 +31,41 @@ export const StatusBadge = forwardRef<HTMLDivElement, StatusBadgeProps>(
|
|||||||
case "operational":
|
case "operational":
|
||||||
case "stable":
|
case "stable":
|
||||||
return {
|
return {
|
||||||
color: "text-emerald-500",
|
color: "text-status-success",
|
||||||
bgColor: "bg-emerald-500/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-emerald-500/20",
|
icon: CheckCircleIcon,
|
||||||
icon: CheckCircle,
|
|
||||||
label: t("system.optimal"),
|
label: t("system.optimal"),
|
||||||
};
|
};
|
||||||
case "moderate":
|
case "moderate":
|
||||||
case "warning":
|
case "warning":
|
||||||
return {
|
return {
|
||||||
color: "text-yellow-500",
|
color: "text-status-warning",
|
||||||
bgColor: "bg-yellow-500/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-yellow-500/20",
|
icon: WarningIcon,
|
||||||
icon: AlertTriangle,
|
|
||||||
label: t("system.warning"),
|
label: t("system.warning"),
|
||||||
};
|
};
|
||||||
case "high":
|
case "high":
|
||||||
case "slow":
|
case "slow":
|
||||||
return {
|
return {
|
||||||
color: "text-orange-500",
|
color: "text-status-warning",
|
||||||
bgColor: "bg-orange-500/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-orange-500/20",
|
icon: WarningIcon,
|
||||||
icon: AlertTriangle,
|
|
||||||
label: t("system.high"),
|
label: t("system.high"),
|
||||||
};
|
};
|
||||||
case "critical":
|
case "critical":
|
||||||
case "poor":
|
case "poor":
|
||||||
case "offline":
|
case "offline":
|
||||||
return {
|
return {
|
||||||
color: "text-destructive",
|
color: "text-status-error",
|
||||||
bgColor: "bg-destructive/10",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-destructive/20",
|
icon: XCircleIcon,
|
||||||
icon: XCircle,
|
|
||||||
label: t("system.critical"),
|
label: t("system.critical"),
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return {
|
return {
|
||||||
color: "text-muted-foreground",
|
color: "",
|
||||||
bgColor: "bg-muted",
|
bgColor: "bg-background0",
|
||||||
borderColor: "border-border",
|
icon: PulseIcon,
|
||||||
icon: Activity,
|
|
||||||
label: t("system.unknown"),
|
label: t("system.unknown"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -83,9 +78,8 @@ export const StatusBadge = forwardRef<HTMLDivElement, StatusBadgeProps>(
|
|||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex items-center gap-1.5 rounded-full border px-2 py-1",
|
"inline-flex items-center gap-1.5 ascii-border px-2 py-1 terminal-font",
|
||||||
config.bgColor,
|
config.bgColor,
|
||||||
config.borderColor,
|
|
||||||
{
|
{
|
||||||
"text-xs": size === "sm",
|
"text-xs": size === "sm",
|
||||||
"text-sm": size === "md",
|
"text-sm": size === "md",
|
||||||
|
|||||||
@@ -1,72 +1,43 @@
|
|||||||
import { cn } from '@/app/_utils/global-utils';
|
|
||||||
import { HTMLAttributes, forwardRef } from 'react';
|
import { HTMLAttributes, forwardRef } from 'react';
|
||||||
|
|
||||||
export const Card = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
export const Card = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
||||||
({ className, ...props }, ref) => (
|
({ className = '', ...props }, ref) => (
|
||||||
<div
|
<div ref={ref} className={`tui-card ${className}`} {...props} />
|
||||||
ref={ref}
|
|
||||||
className={cn(
|
|
||||||
'rounded-lg border bg-card text-card-foreground shadow-sm',
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
Card.displayName = 'Card';
|
Card.displayName = 'Card';
|
||||||
|
|
||||||
const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
export const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
||||||
({ className, ...props }, ref) => (
|
({ className = '', ...props }, ref) => (
|
||||||
<div
|
<div ref={ref} className={`p-4 border-b border-foreground1 ${className}`} {...props} />
|
||||||
ref={ref}
|
|
||||||
className={cn('flex flex-col space-y-1.5 p-6', className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
CardHeader.displayName = 'CardHeader';
|
CardHeader.displayName = 'CardHeader';
|
||||||
|
|
||||||
const CardTitle = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLHeadingElement>>(
|
export const CardTitle = forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement>>(
|
||||||
({ className, ...props }, ref) => (
|
({ className = '', ...props }, ref) => (
|
||||||
<h3
|
<h3 ref={ref} className={`terminal-font font-bold uppercase ${className}`} {...props} />
|
||||||
ref={ref}
|
|
||||||
className={cn(
|
|
||||||
'text-2xl font-semibold leading-none tracking-tight',
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
CardTitle.displayName = 'CardTitle';
|
CardTitle.displayName = 'CardTitle';
|
||||||
|
|
||||||
const CardDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(
|
export const CardDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(
|
||||||
({ className, ...props }, ref) => (
|
({ className = '', ...props }, ref) => (
|
||||||
<p
|
<p ref={ref} className={`terminal-font text-sm ${className}`} {...props} />
|
||||||
ref={ref}
|
|
||||||
className={cn('text-sm text-muted-foreground', className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
CardDescription.displayName = 'CardDescription';
|
CardDescription.displayName = 'CardDescription';
|
||||||
|
|
||||||
const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
export const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
||||||
({ className, ...props }, ref) => (
|
({ className = '', ...props }, ref) => (
|
||||||
<div ref={ref} className={cn('p-4 lg:p-6 pt-0', className)} {...props} />
|
<div ref={ref} className={`p-4 ${className}`} {...props} />
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
CardContent.displayName = 'CardContent';
|
CardContent.displayName = 'CardContent';
|
||||||
|
|
||||||
const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
export const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
||||||
({ className, ...props }, ref) => (
|
({ className = '', ...props }, ref) => (
|
||||||
<div
|
<div ref={ref} className={`flex items-center p-4 border-t border-foreground1 ${className}`} {...props} />
|
||||||
ref={ref}
|
|
||||||
className={cn('flex items-center p-6 pt-0', className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
CardFooter.displayName = 'CardFooter';
|
CardFooter.displayName = 'CardFooter';
|
||||||
|
|
||||||
export { CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { cn } from "@/app/_utils/global-utils";
|
import { cn } from "@/app/_utils/global-utils";
|
||||||
import { HTMLAttributes, forwardRef } from "react";
|
import { HTMLAttributes, forwardRef, ComponentType } from "react";
|
||||||
import { LucideIcon } from "lucide-react";
|
import { IconProps } from "@phosphor-icons/react";
|
||||||
import { StatusBadge } from "@/app/_components/GlobalComponents/Badges/StatusBadge";
|
import { StatusBadge } from "@/app/_components/GlobalComponents/Badges/StatusBadge";
|
||||||
import { ProgressBar } from "@/app/_components/GlobalComponents/UIElements/ProgressBar";
|
import { ProgressBar } from "@/app/_components/GlobalComponents/UIElements/ProgressBar";
|
||||||
import { TruncatedText } from "@/app/_components/GlobalComponents/UIElements/TruncatedText";
|
import { TruncatedText } from "@/app/_components/GlobalComponents/UIElements/TruncatedText";
|
||||||
|
|
||||||
export interface MetricCardProps extends HTMLAttributes<HTMLDivElement> {
|
export interface MetricCardProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
icon: LucideIcon;
|
icon: ComponentType<IconProps>;
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
detail?: string;
|
detail?: string;
|
||||||
@@ -27,7 +27,7 @@ export const MetricCard = forwardRef<HTMLDivElement, MetricCardProps>(
|
|||||||
value,
|
value,
|
||||||
detail,
|
detail,
|
||||||
status,
|
status,
|
||||||
color = "text-blue-500",
|
color,
|
||||||
variant = "basic",
|
variant = "basic",
|
||||||
showProgress = false,
|
showProgress = false,
|
||||||
progressValue = 0,
|
progressValue = 0,
|
||||||
@@ -40,14 +40,14 @@ export const MetricCard = forwardRef<HTMLDivElement, MetricCardProps>(
|
|||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex items-start gap-3 p-3 border border-border/50 rounded-lg hover:bg-accent/50 transition-colors duration-200 glass-card-hover",
|
"flex items-start gap-3 p-3 tui-card-mini transition-colors duration-200 terminal-font",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"p-2 rounded-lg border border-border/50 flex-shrink-0 bg-card/50"
|
"p-2 ascii-border flex-shrink-0 bg-background0"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Icon className={cn("h-4 w-4", color)} />
|
<Icon className={cn("h-4 w-4", color)} />
|
||||||
@@ -55,7 +55,7 @@ export const MetricCard = forwardRef<HTMLDivElement, MetricCardProps>(
|
|||||||
|
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
|
<p className="text-xs font-medium uppercase tracking-wide terminal-font">
|
||||||
{label}
|
{label}
|
||||||
</p>
|
</p>
|
||||||
{status && variant === "performance" && (
|
{status && variant === "performance" && (
|
||||||
@@ -67,12 +67,12 @@ export const MetricCard = forwardRef<HTMLDivElement, MetricCardProps>(
|
|||||||
<TruncatedText
|
<TruncatedText
|
||||||
text={value}
|
text={value}
|
||||||
maxLength={40}
|
maxLength={40}
|
||||||
className="text-sm font-medium text-foreground"
|
className="text-sm font-medium terminal-font"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{detail && (
|
{detail && (
|
||||||
<p className="text-xs text-muted-foreground mb-2">{detail}</p>
|
<p className="text-xs mb-2 terminal-font">{detail}</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showProgress && (
|
{showProgress && (
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
import { cn } from '@/app/_utils/global-utils';
|
|
||||||
import { InputHTMLAttributes, forwardRef } from 'react';
|
import { InputHTMLAttributes, forwardRef } from 'react';
|
||||||
|
|
||||||
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> { }
|
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {}
|
||||||
|
|
||||||
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
||||||
({ className, type, ...props }, ref) => {
|
({ className = '', ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type={type}
|
className={`terminal-font ascii-border px-3 py-2 bg-background0 w-full ${className}`}
|
||||||
className={cn(
|
|
||||||
'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|||||||
46
app/_components/GlobalComponents/Logo/Logo.tsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AsteriskIcon, TerminalIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
|
interface LogoProps {
|
||||||
|
size?: number;
|
||||||
|
showGlow?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Logo = ({ size = 48, showGlow = false }: LogoProps) => {
|
||||||
|
const iconSize = size * 0.8;
|
||||||
|
const asteriskSize = size * 0.4;
|
||||||
|
const asteriskOffset = size * 0.08;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="relative flex items-center justify-center flex-shrink-0"
|
||||||
|
style={{ width: size, height: size }}
|
||||||
|
>
|
||||||
|
{showGlow && (
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 bg-gradient-to-br from-primary/20 via-primary/10 to-transparent blur-xl"
|
||||||
|
style={{ width: size, height: size }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="relative z-10 flex items-center justify-center w-full h-full">
|
||||||
|
<TerminalIcon
|
||||||
|
className="text-primary drop-shadow-[0_0_10px_rgba(var(--primary-rgb),0.4)]"
|
||||||
|
weight="duotone"
|
||||||
|
style={{ width: iconSize, height: iconSize }}
|
||||||
|
/>
|
||||||
|
<AsteriskIcon
|
||||||
|
className="text-primary absolute drop-shadow-[0_0_8px_rgba(var(--primary-rgb),0.6)]"
|
||||||
|
weight="bold"
|
||||||
|
style={{
|
||||||
|
width: asteriskSize,
|
||||||
|
height: asteriskSize,
|
||||||
|
top: -asteriskOffset,
|
||||||
|
right: -asteriskOffset
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import { cn } from '@/app/_utils/global-utils';
|
|
||||||
import { ButtonHTMLAttributes, forwardRef } from 'react';
|
import { ButtonHTMLAttributes, forwardRef } from 'react';
|
||||||
|
|
||||||
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||||
@@ -7,30 +6,31 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
({ className, variant = 'default', size = 'default', ...props }, ref) => {
|
({ className = '', variant = 'default', size = 'default', children, ...props }, ref) => {
|
||||||
|
const baseClasses = 'terminal-font border border-border px-4 py-2 cursor-pointer inline-flex items-center justify-center disabled:opacity-50 disabled:cursor-not-allowed';
|
||||||
|
const variantClasses = {
|
||||||
|
default: 'bg-background1 hover:bg-background2',
|
||||||
|
destructive: 'text-status-error hover:bg-status-error hover:text-white',
|
||||||
|
outline: 'bg-background0 hover:bg-background1',
|
||||||
|
secondary: 'bg-background2 hover:bg-background1',
|
||||||
|
ghost: 'border-0 bg-transparent hover:bg-background1',
|
||||||
|
link: 'border-0 underline bg-transparent',
|
||||||
|
};
|
||||||
|
const sizeClasses = {
|
||||||
|
default: '',
|
||||||
|
sm: 'px-2 py-1 text-sm',
|
||||||
|
lg: 'px-6 py-3',
|
||||||
|
icon: 'p-2',
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={cn(
|
className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${className}`}
|
||||||
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
||||||
{
|
|
||||||
'bg-primary text-primary-foreground hover:bg-primary/90': variant === 'default',
|
|
||||||
'bg-destructive text-destructive-foreground hover:bg-destructive/90': variant === 'destructive',
|
|
||||||
'border border-input bg-background hover:bg-accent hover:text-accent-foreground': variant === 'outline',
|
|
||||||
'bg-secondary text-secondary-foreground hover:bg-secondary/80': variant === 'secondary',
|
|
||||||
'hover:bg-accent hover:text-accent-foreground': variant === 'ghost',
|
|
||||||
'text-primary underline-offset-4 hover:underline': variant === 'link',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'h-10 px-4 py-2': size === 'default',
|
|
||||||
'h-9 rounded-md px-3': size === 'sm',
|
|
||||||
'h-11 rounded-md px-8': size === 'lg',
|
|
||||||
'h-10 w-10': size === 'icon',
|
|
||||||
},
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
>
|
||||||
|
{children}
|
||||||
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState, useRef, useEffect, ReactNode } from "react";
|
import { useState, useRef, useEffect, ReactNode } from "react";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
||||||
import { MoreVertical } from "lucide-react";
|
import { DotsThreeVerticalIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
const DROPDOWN_HEIGHT = 200;
|
const DROPDOWN_HEIGHT = 200;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ interface DropdownMenuProps {
|
|||||||
export const DropdownMenu = ({
|
export const DropdownMenu = ({
|
||||||
items,
|
items,
|
||||||
triggerLabel,
|
triggerLabel,
|
||||||
triggerIcon = <MoreVertical className="h-3 w-3" />,
|
triggerIcon = <DotsThreeVerticalIcon className="h-3 w-3" />,
|
||||||
triggerClassName = "btn-outline h-8 px-3",
|
triggerClassName = "btn-outline h-8 px-3",
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
}: DropdownMenuProps) => {
|
}: DropdownMenuProps) => {
|
||||||
@@ -98,23 +98,21 @@ export const DropdownMenu = ({
|
|||||||
|
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div
|
<div
|
||||||
className={`absolute right-0 w-56 rounded-lg border border-border/50 bg-background shadow-lg z-[9999] overflow-hidden ${
|
className={`absolute right-0 w-56 ascii-border bg-background0 shadow-lg z-[9999] overflow-hidden terminal-font ${positionAbove ? "bottom-full mb-2" : "top-full mt-2"
|
||||||
positionAbove ? "bottom-full mb-2" : "top-full mt-2"
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<div className="py-1">
|
<div className="p-1">
|
||||||
{items.map((item, index) => (
|
{items.map((item, index) => (
|
||||||
<button
|
<button
|
||||||
key={index}
|
key={index}
|
||||||
onClick={() => handleItemClick(item)}
|
onClick={() => handleItemClick(item)}
|
||||||
disabled={item.disabled}
|
disabled={item.disabled}
|
||||||
className={`w-full flex items-center gap-3 px-4 py-2 text-sm transition-colors ${
|
className={`w-full flex items-center border border-transparent gap-3 px-4 py-2 text-sm transition-colors ${item.disabled
|
||||||
item.disabled
|
? "opacity-50 cursor-not-allowed"
|
||||||
? "opacity-50 cursor-not-allowed"
|
: item.variant === "destructive"
|
||||||
: item.variant === "destructive"
|
? "text-status-error hover:border hover:border-border"
|
||||||
? "text-destructive hover:bg-destructive/10"
|
: "hover:border-border"
|
||||||
: "text-foreground hover:bg-accent"
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{item.icon && (
|
{item.icon && (
|
||||||
<span className="flex-shrink-0">{item.icon}</span>
|
<span className="flex-shrink-0">{item.icon}</span>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { X } from "lucide-react";
|
import { XIcon } from "@phosphor-icons/react";
|
||||||
import { cn } from "@/app/_utils/global-utils";
|
import { Button } from "./Button";
|
||||||
import { Button } from "@/app/_components/GlobalComponents/UIElements/Button";
|
|
||||||
|
|
||||||
interface ModalProps {
|
interface ModalProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@@ -26,99 +25,51 @@ export const Modal = ({
|
|||||||
preventCloseOnClickOutside = false,
|
preventCloseOnClickOutside = false,
|
||||||
className = "",
|
className = "",
|
||||||
}: ModalProps) => {
|
}: ModalProps) => {
|
||||||
const modalRef = useRef<HTMLDivElement>(null);
|
const dialogRef = useRef<HTMLDialogElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleEscape = (e: KeyboardEvent) => {
|
const dialog = dialogRef.current;
|
||||||
if (e.key === "Escape") {
|
if (!dialog) return;
|
||||||
onClose();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
document.addEventListener("keydown", handleEscape);
|
dialog.showModal();
|
||||||
document.body.style.overflow = "hidden";
|
document.body.style.overflow = "hidden";
|
||||||
}
|
} else {
|
||||||
|
dialog.close();
|
||||||
return () => {
|
|
||||||
document.removeEventListener("keydown", handleEscape);
|
|
||||||
document.body.style.overflow = "unset";
|
document.body.style.overflow = "unset";
|
||||||
};
|
|
||||||
}, [isOpen, onClose]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handleClickOutside = (event: MouseEvent) => {
|
|
||||||
if (
|
|
||||||
modalRef.current &&
|
|
||||||
!modalRef.current.contains(event.target as Node) &&
|
|
||||||
!preventCloseOnClickOutside
|
|
||||||
) {
|
|
||||||
const target = event.target as Element;
|
|
||||||
const isClickingOnModal = target.closest('[data-modal="true"]');
|
|
||||||
const isClickingOnBackdrop =
|
|
||||||
target.classList.contains("modal-backdrop");
|
|
||||||
|
|
||||||
if (isClickingOnBackdrop) {
|
|
||||||
onClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isOpen) {
|
|
||||||
document.addEventListener("mousedown", handleClickOutside);
|
|
||||||
}
|
}
|
||||||
|
}, [isOpen]);
|
||||||
return () => {
|
|
||||||
document.removeEventListener("mousedown", handleClickOutside);
|
|
||||||
};
|
|
||||||
}, [isOpen, onClose, preventCloseOnClickOutside]);
|
|
||||||
|
|
||||||
if (!isOpen) return null;
|
|
||||||
|
|
||||||
const sizeClasses = {
|
const sizeClasses = {
|
||||||
sm: "max-w-md",
|
sm: "w-[600px]",
|
||||||
md: "max-w-lg",
|
md: "w-[800px]",
|
||||||
lg: "max-w-2xl",
|
lg: "w-[1000px]",
|
||||||
xl: "max-w-4xl",
|
xl: "w-[1200px]",
|
||||||
"2xl": "max-w-6xl",
|
"2xl": "w-[1400px]",
|
||||||
"3xl": "max-w-8xl",
|
"3xl": "w-[90vw]",
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<dialog
|
||||||
className="fixed inset-0 z-50 flex items-end justify-center sm:items-center p-0 sm:p-4"
|
ref={dialogRef}
|
||||||
data-modal="true"
|
className={`ascii-border terminal-font bg-background0 mobile-modal ${sizeClasses[size]} max-w-[95vw] ${className}`}
|
||||||
|
onClick={(e) => {
|
||||||
|
if (e.target === dialogRef.current && !preventCloseOnClickOutside) {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="absolute inset-0 bg-black/50 backdrop-blur-sm modal-backdrop" />
|
<div className="border-border border-b p-4 flex justify-between items-center bg-background0">
|
||||||
|
<h2 className="terminal-font font-bold uppercase">{title}</h2>
|
||||||
<div
|
{showCloseButton && (
|
||||||
ref={modalRef}
|
<Button variant="ghost" size="icon" onClick={onClose}>
|
||||||
className={cn(
|
<XIcon className="h-4 w-4" />
|
||||||
"relative w-full bg-card border border-border shadow-lg",
|
</Button>
|
||||||
"max-h-[85vh]",
|
|
||||||
"sm:rounded-lg sm:max-h-[90vh] sm:w-full",
|
|
||||||
sizeClasses[size],
|
|
||||||
className
|
|
||||||
)}
|
)}
|
||||||
>
|
|
||||||
<div className="flex items-center justify-between p-4 sm:p-6 border-b border-border sticky top-0 bg-card z-10">
|
|
||||||
<h2 className="text-lg font-semibold text-foreground">{title}</h2>
|
|
||||||
{showCloseButton && (
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="icon"
|
|
||||||
onClick={onClose}
|
|
||||||
className="h-8 w-8"
|
|
||||||
>
|
|
||||||
<X className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="p-4 sm:p-6 overflow-y-auto max-h-[calc(80vh-100px)]">
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="p-4 max-h-[70vh] overflow-y-auto tui-scrollbar bg-background0">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,35 +25,29 @@ export const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(
|
|||||||
const percentage = Math.min(Math.max((value / max) * 100, 0), 100);
|
const percentage = Math.min(Math.max((value / max) * 100, 0), 100);
|
||||||
|
|
||||||
const getColorClass = (percentage: number) => {
|
const getColorClass = (percentage: number) => {
|
||||||
if (percentage >= 90) return "bg-destructive";
|
if (percentage >= 90) return "bg-red-600";
|
||||||
if (percentage >= 80) return "bg-orange-500";
|
if (percentage >= 80) return "bg-yellow-600";
|
||||||
if (percentage >= 70) return "bg-yellow-500";
|
if (percentage >= 70) return "bg-yellow-600";
|
||||||
return "bg-emerald-500";
|
return "bg-green-600";
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGradientClass = (percentage: number) => {
|
const getGradientClass = (percentage: number) => {
|
||||||
if (percentage >= 90)
|
return getColorClass(percentage);
|
||||||
return "bg-gradient-to-r from-destructive to-red-600";
|
|
||||||
if (percentage >= 80)
|
|
||||||
return "bg-gradient-to-r from-orange-500 to-orange-600";
|
|
||||||
if (percentage >= 70)
|
|
||||||
return "bg-gradient-to-r from-yellow-500 to-yellow-600";
|
|
||||||
return "bg-gradient-to-r from-emerald-500 to-emerald-600";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={ref} className={cn("w-full", className)} {...props}>
|
<div ref={ref} className={cn("w-full terminal-font", className)} {...props}>
|
||||||
{showLabel && (
|
{showLabel && (
|
||||||
<div className="flex justify-between items-center mb-1">
|
<div className="flex justify-between items-center mb-1">
|
||||||
<span className="text-xs text-muted-foreground">Usage</span>
|
<span className="text-xs">Usage</span>
|
||||||
<span className="text-xs font-medium text-foreground">
|
<span className="text-xs font-medium">
|
||||||
{Math.round(percentage)}%
|
{Math.round(percentage)}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={cn("w-full bg-muted rounded-full overflow-hidden", {
|
className={cn("w-full bg-background2 ascii-border overflow-hidden", {
|
||||||
"h-1.5": size === "sm",
|
"h-1.5": size === "sm",
|
||||||
"h-2": size === "md",
|
"h-2": size === "md",
|
||||||
"h-3": size === "lg",
|
"h-3": size === "lg",
|
||||||
|
|||||||
@@ -1,35 +1,54 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { cn } from "@/app/_utils/global-utils";
|
|
||||||
|
|
||||||
interface SwitchProps {
|
interface SwitchProps {
|
||||||
checked: boolean;
|
checked: boolean;
|
||||||
onCheckedChange: (checked: boolean) => void;
|
onCheckedChange: (checked: boolean) => void;
|
||||||
className?: string;
|
className?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Switch = ({
|
export const Switch = ({ checked, onCheckedChange, className = "", disabled = false, id }: SwitchProps) => {
|
||||||
checked,
|
const handleClick = () => {
|
||||||
onCheckedChange,
|
if (!disabled) {
|
||||||
className = "",
|
onCheckedChange(!checked);
|
||||||
disabled = false,
|
}
|
||||||
}: SwitchProps) => {
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label
|
<div
|
||||||
className={cn(
|
className={`inline-flex items-center ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'} ${className}`}
|
||||||
"relative inline-flex items-center cursor-pointer",
|
onClick={handleClick}
|
||||||
className
|
role="checkbox"
|
||||||
)}
|
aria-checked={checked}
|
||||||
|
aria-labelledby={id}
|
||||||
|
tabIndex={disabled ? -1 : 0}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (!disabled && (e.key === ' ' || e.key === 'Enter')) {
|
||||||
|
e.preventDefault();
|
||||||
|
handleClick();
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<input
|
<div className="relative w-5 h-5 ascii-border bg-background0 transition-all focus-within:ring-2 focus-within:ring-primary/20 flex items-center justify-center group">
|
||||||
type="checkbox"
|
{checked && (
|
||||||
className="sr-only peer"
|
<svg
|
||||||
checked={checked}
|
className="w-3.5 h-3.5 text-primary transition-transform duration-200"
|
||||||
onChange={(e) => onCheckedChange(e.target.checked)}
|
viewBox="0 0 12 12"
|
||||||
disabled={disabled}
|
fill="none"
|
||||||
/>
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
<div className="w-9 h-5 bg-muted peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-primary/25 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-primary peer-disabled:opacity-50 peer-disabled:cursor-not-allowed"></div>
|
>
|
||||||
</label>
|
<path
|
||||||
|
d="M10 3L4.5 8.5L2 6"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="square"
|
||||||
|
strokeLinejoin="miter"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
|
<div className="absolute inset-0 border border-primary/0 group-hover:border-primary/50 transition-colors pointer-events-none" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { X, CheckCircle, AlertCircle, Info, AlertTriangle } from "lucide-react";
|
import { XIcon, CheckCircleIcon, WarningCircleIcon, InfoIcon, WarningIcon } from "@phosphor-icons/react";
|
||||||
import { cn } from "@/app/_utils/global-utils";
|
import { cn } from "@/app/_utils/global-utils";
|
||||||
import { ErrorDetailsModal } from "@/app/_components/FeatureComponents/Modals/ErrorDetailsModal";
|
import { ErrorDetailsModal } from "@/app/_components/FeatureComponents/Modals/ErrorDetailsModal";
|
||||||
|
|
||||||
@@ -30,19 +30,17 @@ interface ToastProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const toastIcons = {
|
const toastIcons = {
|
||||||
success: CheckCircle,
|
success: CheckCircleIcon,
|
||||||
error: AlertCircle,
|
error: WarningCircleIcon,
|
||||||
info: Info,
|
info: InfoIcon,
|
||||||
warning: AlertTriangle,
|
warning: WarningIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
const toastStyles = {
|
const toastStyles = {
|
||||||
success:
|
success: "ascii-border bg-background0 text-status-success",
|
||||||
"border-green-500/20 bg-green-500/10 text-green-700 dark:text-green-400",
|
error: "ascii-border bg-background0 text-status-error",
|
||||||
error: "border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-400",
|
info: "ascii-border bg-background0 text-status-info",
|
||||||
info: "border-blue-500/20 bg-blue-500/10 text-blue-700 dark:text-blue-400",
|
warning: "ascii-border bg-background0 text-status-warning",
|
||||||
warning:
|
|
||||||
"border-yellow-500/20 bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Toast = ({ toast, onRemove, onErrorClick }: ToastProps) => {
|
export const Toast = ({ toast, onRemove, onErrorClick }: ToastProps) => {
|
||||||
@@ -62,7 +60,7 @@ export const Toast = ({ toast, onRemove, onErrorClick }: ToastProps) => {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex items-start gap-3 p-4 rounded-lg border backdrop-blur-md transition-all duration-300 ease-in-out",
|
"flex items-start gap-3 p-4 terminal-font transition-all duration-300 ease-in-out",
|
||||||
toastStyles[toast.type],
|
toastStyles[toast.type],
|
||||||
isVisible ? "translate-x-0 opacity-100" : "translate-x-full opacity-0"
|
isVisible ? "translate-x-0 opacity-100" : "translate-x-full opacity-0"
|
||||||
)}
|
)}
|
||||||
@@ -92,7 +90,7 @@ export const Toast = ({ toast, onRemove, onErrorClick }: ToastProps) => {
|
|||||||
}}
|
}}
|
||||||
className="flex-shrink-0 p-1 rounded-md hover:bg-black/10 transition-colors"
|
className="flex-shrink-0 p-1 rounded-md hover:bg-black/10 transition-colors"
|
||||||
>
|
>
|
||||||
<X className="h-4 w-4" />
|
<XIcon className="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,21 @@ import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
|||||||
import { type ThemeProviderProps } from 'next-themes/dist/types';
|
import { type ThemeProviderProps } from 'next-themes/dist/types';
|
||||||
|
|
||||||
export const ThemeProvider = ({ children, ...props }: ThemeProviderProps) => {
|
export const ThemeProvider = ({ children, ...props }: ThemeProviderProps) => {
|
||||||
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
return (
|
||||||
|
<NextThemesProvider
|
||||||
|
attribute="data-webtui-theme"
|
||||||
|
defaultTheme="light"
|
||||||
|
themes={['light', 'dark']}
|
||||||
|
value={{
|
||||||
|
light: 'catppuccin-latte',
|
||||||
|
dark: 'catppuccin-mocha',
|
||||||
|
}}
|
||||||
|
disableTransitionOnChange
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</NextThemesProvider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"close": "Close",
|
"close": "Close",
|
||||||
"refresh": "Refresh",
|
"refresh": "Refresh",
|
||||||
"loading": "Loading",
|
"loading": "Loading",
|
||||||
"version": "{version}"
|
"version": "Version {version}"
|
||||||
},
|
},
|
||||||
"cronjobs": {
|
"cronjobs": {
|
||||||
"cronJobs": "Cron Jobs",
|
"cronJobs": "Cron Jobs",
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
"logs": "logs",
|
"logs": "logs",
|
||||||
"logFiles": "Log Files",
|
"logFiles": "Log Files",
|
||||||
"logContent": "Log Content",
|
"logContent": "Log Content",
|
||||||
|
"downloadLog": "Download",
|
||||||
"selectLogToView": "Select a log file to view its content",
|
"selectLogToView": "Select a log file to view its content",
|
||||||
"noLogsFound": "No logs found for this job",
|
"noLogsFound": "No logs found for this job",
|
||||||
"confirmDeleteLog": "Are you sure you want to delete this log file?",
|
"confirmDeleteLog": "Are you sure you want to delete this log file?",
|
||||||
@@ -188,5 +189,21 @@
|
|||||||
"warnings": {
|
"warnings": {
|
||||||
"wrapperScriptModified": "Wrapper Script Modified",
|
"wrapperScriptModified": "Wrapper Script Modified",
|
||||||
"wrapperScriptModifiedDescription": "Your cron-log-wrapper.sh script has been modified from the official version. This may affect logging functionality. Consider reverting to the official version or ensure your changes don't break the required format for log parsing."
|
"wrapperScriptModifiedDescription": "Your cron-log-wrapper.sh script has been modified from the official version. This may affect logging functionality. Consider reverting to the official version or ensure your changes don't break the required format for log parsing."
|
||||||
|
},
|
||||||
|
"notFound": {
|
||||||
|
"title": "404 - Page Not Found",
|
||||||
|
"subtitle": "ERROR: The requested resource could not be located",
|
||||||
|
"message": "The page you're looking for doesn't exist. Want to play snake instead?",
|
||||||
|
"gameOver": "GAME OVER",
|
||||||
|
"score": "Score",
|
||||||
|
"highScore": "High Score",
|
||||||
|
"pressToStart": "Press SPACE or tap to start",
|
||||||
|
"pressToRestart": "Press SPACE or tap to restart",
|
||||||
|
"controls": "Controls",
|
||||||
|
"useArrowKeys": "Use arrow keys to move",
|
||||||
|
"tapToMove": "Tap screen edges to move",
|
||||||
|
"goHome": "Return to Dashboard",
|
||||||
|
"pauseGame": "Press P to pause",
|
||||||
|
"paused": "PAUSED"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"cancel": "Annulla",
|
"cancel": "Annulla",
|
||||||
"refresh": "Aggiorna",
|
"refresh": "Aggiorna",
|
||||||
"close": "Chiudi",
|
"close": "Chiudi",
|
||||||
"version": "{version}"
|
"version": "Versione {version}"
|
||||||
},
|
},
|
||||||
"cronjobs": {
|
"cronjobs": {
|
||||||
"cronJobs": "Operazioni Cron",
|
"cronJobs": "Operazioni Cron",
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
"logs": "log",
|
"logs": "log",
|
||||||
"logFiles": "File",
|
"logFiles": "File",
|
||||||
"logContent": "Contenuto Log",
|
"logContent": "Contenuto Log",
|
||||||
|
"downloadLog": "Scarica",
|
||||||
"selectLogToView": "Seleziona un file per visualizzarne il contenuto",
|
"selectLogToView": "Seleziona un file per visualizzarne il contenuto",
|
||||||
"noLogsFound": "Nessun log trovato per questa operazione",
|
"noLogsFound": "Nessun log trovato per questa operazione",
|
||||||
"confirmDeleteLog": "Sei sicuro di voler eliminare questo file?",
|
"confirmDeleteLog": "Sei sicuro di voler eliminare questo file?",
|
||||||
@@ -184,5 +185,22 @@
|
|||||||
"warnings": {
|
"warnings": {
|
||||||
"wrapperScriptModified": "Script Wrapper Modificato",
|
"wrapperScriptModified": "Script Wrapper Modificato",
|
||||||
"wrapperScriptModifiedDescription": "Il tuo script cron-log-wrapper.sh è stato modificato dalla versione ufficiale. Questo potrebbe influenzare la funzionalità di logging. Considera di ripristinare la versione ufficiale o assicurati che le tue modifiche non interrompano il formato richiesto per l'analisi dei log."
|
"wrapperScriptModifiedDescription": "Il tuo script cron-log-wrapper.sh è stato modificato dalla versione ufficiale. Questo potrebbe influenzare la funzionalità di logging. Considera di ripristinare la versione ufficiale o assicurati che le tue modifiche non interrompano il formato richiesto per l'analisi dei log."
|
||||||
|
},
|
||||||
|
"notFound": {
|
||||||
|
"title": "404 - Pagina Non Trovata",
|
||||||
|
"subtitle": "ERRORE: La risorsa richiesta non è stata trovata",
|
||||||
|
"message": "La pagina che stai cercando non esiste. Partitella a snake?",
|
||||||
|
"playSnake": "Gioca a Snake mentre sei qui",
|
||||||
|
"gameOver": "GAME OVER",
|
||||||
|
"score": "Punteggio",
|
||||||
|
"highScore": "Punteggio Massimo",
|
||||||
|
"pressToStart": "Premi SPAZIO o tocca per iniziare",
|
||||||
|
"pressToRestart": "Premi SPAZIO o tocca per ricominciare",
|
||||||
|
"controls": "Controlli",
|
||||||
|
"useArrowKeys": "Usa i tasti freccia per muoverti",
|
||||||
|
"tapToMove": "Tocca i bordi dello schermo per muoverti",
|
||||||
|
"goHome": "Torna alla Dashboard",
|
||||||
|
"pauseGame": "Premi P per mettere in pausa",
|
||||||
|
"paused": "IN PAUSA"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,8 @@ import { executeJob } from "@/app/_server/actions/cronjobs";
|
|||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(request: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
request: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const authError = await requireAuth(request);
|
const authError = await requireAuth(request);
|
||||||
if (authError) return authError;
|
if (authError) return authError;
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import {
|
|||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(request: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
request: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const authError = await requireAuth(request);
|
const authError = await requireAuth(request);
|
||||||
if (authError) return authError;
|
if (authError) return authError;
|
||||||
|
|
||||||
@@ -40,10 +38,8 @@ export async function GET(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PATCH(
|
export async function PATCH(request: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
request: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const authError = await requireAuth(request);
|
const authError = await requireAuth(request);
|
||||||
if (authError) return authError;
|
if (authError) return authError;
|
||||||
|
|
||||||
@@ -79,10 +75,8 @@ export async function PATCH(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(request: NextRequest, props: { params: Promise<{ id: string }> }) {
|
||||||
request: NextRequest,
|
const params = await props.params;
|
||||||
{ params }: { params: { id: string } }
|
|
||||||
) {
|
|
||||||
const authError = await requireAuth(request);
|
const authError = await requireAuth(request);
|
||||||
if (authError) return authError;
|
if (authError) return authError;
|
||||||
|
|
||||||
|
|||||||
544
app/globals.css
@@ -1,325 +1,279 @@
|
|||||||
/* eslint-disable */
|
|
||||||
/* @ts-nocheck */
|
|
||||||
|
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
|
||||||
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');
|
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap');
|
|
||||||
|
|
||||||
@tailwind base;
|
@tailwind base;
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
:root {
|
[data-webtui-theme="catppuccin-latte"] {
|
||||||
--font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
--box-border-color: #9ca0b0;
|
||||||
--font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
|
--table-border-color: #9ca0b0;
|
||||||
--background: 0 0% 100%;
|
--separator-color: #9ca0b0;
|
||||||
--foreground: 240 10% 3.9%;
|
|
||||||
--card: 0 0% 100%;
|
|
||||||
--card-foreground: 240 10% 3.9%;
|
|
||||||
--popover: 0 0% 100%;
|
|
||||||
--popover-foreground: 240 10% 3.9%;
|
|
||||||
--primary: 280 100% 60%;
|
|
||||||
--primary-foreground: 0 0% 98%;
|
|
||||||
--secondary: 240 4.8% 95.9%;
|
|
||||||
--secondary-foreground: 240 5.9% 10%;
|
|
||||||
--muted: 240 4.8% 95.9%;
|
|
||||||
--muted-foreground: 240 3.8% 46.1%;
|
|
||||||
--accent: 240 4.8% 95.9%;
|
|
||||||
--accent-foreground: 240 5.9% 10%;
|
|
||||||
--destructive: 0 84.2% 60.2%;
|
|
||||||
--destructive-foreground: 210 40% 98%;
|
|
||||||
--border: 240 5.9% 90%;
|
|
||||||
--input: 240 5.9% 90%;
|
|
||||||
--ring: 280 100% 60%;
|
|
||||||
--radius: 0.75rem;
|
|
||||||
--chart-1: 280 100% 60%;
|
|
||||||
--chart-2: 160 84% 39%;
|
|
||||||
--chart-3: 30 100% 50%;
|
|
||||||
--chart-4: 340 100% 50%;
|
|
||||||
--chart-5: 200 100% 50%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
[data-webtui-theme="catppuccin-mocha"] {
|
||||||
--background: 240 10% 8%;
|
--box-border-color: #313244;
|
||||||
--foreground: 0 0% 98%;
|
--table-border-color: #313244;
|
||||||
--card: 240 10% 12%;
|
--separator-color: #313244;
|
||||||
--card-foreground: 0 0% 98%;
|
|
||||||
--popover: 240 10% 12%;
|
|
||||||
--popover-foreground: 0 0% 98%;
|
|
||||||
--primary: 280 100% 40%;
|
|
||||||
--primary-foreground: 240 10% 8%;
|
|
||||||
--secondary: 240 3.7% 18%;
|
|
||||||
--secondary-foreground: 0 0% 98%;
|
|
||||||
--muted: 240 3.7% 18%;
|
|
||||||
--muted-foreground: 240 5% 64.9%;
|
|
||||||
--accent: 240 3.7% 18%;
|
|
||||||
--accent-foreground: 0 0% 98%;
|
|
||||||
--destructive: 0 62.8% 30.6%;
|
|
||||||
--destructive-foreground: 0 0% 98%;
|
|
||||||
--border: 240 3.7% 25%;
|
|
||||||
--input: 240 3.7% 18%;
|
|
||||||
--ring: 280 100% 40%;
|
|
||||||
--chart-1: 280 100% 40%;
|
|
||||||
--chart-2: 160 84% 30%;
|
|
||||||
--chart-3: 30 100% 35%;
|
|
||||||
--chart-4: 340 100% 35%;
|
|
||||||
--chart-5: 200 100% 35%;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.hide-scrollbar::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide-scrollbar {
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overflow-y-auto {
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overflow-y-auto::-webkit-scrollbar {
|
|
||||||
width: 4px;
|
|
||||||
}
|
|
||||||
.overflow-y-auto::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.overflow-y-auto::-webkit-scrollbar-thumb {
|
|
||||||
background-color: hsl(var(--primary) / 0.8);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
|
|
||||||
background-color: hsl(var(--primary) / 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@layer base {
|
|
||||||
* {
|
* {
|
||||||
@apply border-border;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground;
|
margin: 0;
|
||||||
position: relative;
|
padding: 0;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
font-family: var(--font-sans);
|
|
||||||
font-feature-settings: "cv02", "cv03", "cv04", "cv11";
|
|
||||||
font-variation-settings: normal;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
code, pre, .font-mono {
|
|
||||||
font-family: var(--font-mono);
|
body {
|
||||||
font-feature-settings: "liga" 1, "calt" 1;
|
font-family: 'IBM Plex Mono', monospace !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
font-family: 'Azeret Mono Variable', monospace !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
span,
|
||||||
|
a,
|
||||||
|
label,
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
button,
|
||||||
|
select,
|
||||||
|
option {
|
||||||
|
font-family: 'IBM Plex Mono', monospace !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
scrollbar-width: none !important;
|
||||||
|
-ms-overflow-style: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre::-webkit-scrollbar {
|
||||||
|
display: none !important;
|
||||||
|
width: 0 !important;
|
||||||
|
height: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@layer utilities {
|
||||||
|
.ascii-border {
|
||||||
|
border: 1px solid var(--box-border-color, var(--foreground2));
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-text {
|
.border-border {
|
||||||
font-family: var(--font-mono);
|
border-color: var(--box-border-color, var(--foreground2)) !important;
|
||||||
font-weight: 600;
|
|
||||||
letter-spacing: -0.025em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
.tui-scrollbar {
|
||||||
font-family: var(--font-sans);
|
scrollbar-width: auto !important;
|
||||||
font-weight: 600;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button, input, textarea, select {
|
@media (min-width: 992px) {
|
||||||
font-family: var(--font-sans);
|
.tui-scrollbar {
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal-text {
|
.tui-scrollbar::-webkit-scrollbar {
|
||||||
font-family: var(--font-mono);
|
-webkit-appearance: none;
|
||||||
font-size: 0.875rem;
|
width: 7px;
|
||||||
line-height: 1.5;
|
height: 10px;
|
||||||
|
background-color: var(--background1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-scrollbar::-webkit-scrollbar-thumb {
|
||||||
|
background-color: var(--background0) !important;
|
||||||
|
border: 1px solid var(--box-border-color, var(--foreground2));
|
||||||
|
visibility: visible !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
min-height: 40px !important;
|
||||||
|
height: 40px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: var(--primary) !important;
|
||||||
|
box-shadow: 0 0 8px var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-scrollbar::-webkit-scrollbar-track {
|
||||||
|
background: var(--background1);
|
||||||
|
border-left: 1px solid var(--box-border-color, var(--foreground2));
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-scrollbar::-webkit-scrollbar-corner {
|
||||||
|
background: var(--background1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-background0 {
|
||||||
|
background-color: var(--background0) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-background1 {
|
||||||
|
background-color: var(--background1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-background2 {
|
||||||
|
background-color: var(--background2) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-foreground1 {
|
||||||
|
border-color: var(--box-border-color, var(--foreground2)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-foreground0 {
|
||||||
|
color: var(--foreground0) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sr-only {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border-width: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
.hero-gradient {
|
.tui-card {
|
||||||
background: linear-gradient(135deg,
|
background: var(--background0) !important;
|
||||||
hsl(280 100% 60% / 0.1) 0%,
|
border: 1px solid var(--box-border-color, var(--foreground2)) !important;
|
||||||
hsl(160 84% 39% / 0.05) 25%,
|
box-shadow: 8px 4px 0 var(--box-border-color, var(--foreground2));
|
||||||
hsl(30 100% 50% / 0.05) 50%,
|
border-radius: 0 !important;
|
||||||
hsl(340 100% 50% / 0.05) 75%,
|
|
||||||
hsl(200 100% 50% / 0.1) 100%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-gradient::before {
|
.tui-card-mini {
|
||||||
content: '';
|
background: var(--background0) !important;
|
||||||
position: absolute;
|
border: 1px solid var(--box-border-color, var(--foreground2)) !important;
|
||||||
top: 0;
|
box-shadow: 2px 4px 0 var(--box-border-color, var(--foreground2));
|
||||||
left: 0;
|
border-radius: 0 !important;
|
||||||
right: 0;
|
}
|
||||||
|
|
||||||
|
.terminal-log {
|
||||||
|
background: var(--background0) !important;
|
||||||
|
border: 1px solid var(--box-border-color, var(--foreground2)) !important;
|
||||||
|
font-family: 'JetBrains Mono', monospace;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
padding: 1rem;
|
||||||
|
color: var(--foreground0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-status-info {
|
||||||
|
color: var(--mauve);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-status-warning {
|
||||||
|
color: var(--yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-status-success {
|
||||||
|
color: var(--green);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-status-error {
|
||||||
|
color: var(--red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-status-info {
|
||||||
|
background-color: var(--mauve);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-status-warning {
|
||||||
|
background-color: var(--yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-status-success {
|
||||||
|
background-color: var(--green);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-status-error {
|
||||||
|
background-color: var(--red);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog {
|
||||||
|
background: var(--background0) !important;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0;
|
||||||
|
width: 90vw;
|
||||||
|
max-height: 90vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog::backdrop {
|
||||||
|
background: rgba(0, 0, 0, 0.8) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog[open] {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-sidebar main {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body:not(.sidebar-collapsed) main {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1024px) {
|
||||||
|
body:not(.sidebar-collapsed) main {
|
||||||
|
margin-left: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.sidebar-collapsed main {
|
||||||
|
margin-left: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-sidebar main {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.mobile-modal {
|
||||||
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background:
|
top: auto;
|
||||||
radial-gradient(circle at 20% 80%, hsl(280 100% 60% / 0.15) 0%, transparent 50%),
|
width: 100% !important;
|
||||||
radial-gradient(circle at 80% 20%, hsl(160 84% 39% / 0.15) 0%, transparent 50%),
|
max-height: 90vh;
|
||||||
radial-gradient(circle at 40% 40%, hsl(340 100% 50% / 0.1) 0%, transparent 50%);
|
max-width: 100%;
|
||||||
pointer-events: none;
|
margin: inherit;
|
||||||
}
|
|
||||||
|
|
||||||
.dark .hero-gradient::before {
|
|
||||||
background:
|
|
||||||
radial-gradient(circle at 20% 80%, hsl(280 100% 50% / 0.08) 0%, transparent 50%),
|
|
||||||
radial-gradient(circle at 80% 20%, hsl(160 84% 35% / 0.08) 0%, transparent 50%),
|
|
||||||
radial-gradient(circle at 40% 40%, hsl(340 100% 45% / 0.06) 0%, transparent 50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.glass-card {
|
|
||||||
@apply backdrop-blur-md bg-card/80 border border-border/50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .glass-card {
|
|
||||||
@apply backdrop-blur-md bg-card/80 border border-border/70;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glass-card-hover {
|
|
||||||
@apply glass-card;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-gradient {
|
|
||||||
@apply bg-gradient-to-r from-purple-500 via-pink-500 to-orange-500 bg-clip-text text-transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .brand-gradient {
|
|
||||||
@apply bg-gradient-to-r from-purple-600 via-pink-600 to-orange-600 bg-clip-text text-transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-gradient-alt {
|
|
||||||
@apply bg-gradient-to-r from-cyan-500 via-blue-500 to-purple-500 bg-clip-text text-transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .brand-gradient-alt {
|
|
||||||
@apply bg-gradient-to-r from-cyan-600 via-blue-600 to-purple-600 bg-clip-text text-transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glow-primary {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glow-primary:hover {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glow-cyan {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glow-orange {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glow-pink {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-error {
|
|
||||||
@apply bg-red-500/20 text-red-700 dark:text-red-400 border-red-500/30;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-scrollbar {
|
|
||||||
scrollbar-width: thin;
|
|
||||||
scrollbar-color: hsl(var(--muted-foreground) / 0.3) transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-scrollbar::-webkit-scrollbar {
|
|
||||||
width: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-scrollbar::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
||||||
background-color: hsl(var(--muted-foreground) / 0.3);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
||||||
background-color: hsl(var(--muted-foreground) / 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip {
|
|
||||||
@apply absolute z-50 px-3 py-2 text-sm text-white bg-gray-900 rounded-lg shadow-lg opacity-0 invisible transition-all duration-200;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip.show {
|
|
||||||
@apply opacity-100 visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-responsive {
|
|
||||||
@apply text-sm sm:text-base lg:text-lg;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-responsive-lg {
|
|
||||||
@apply text-base sm:text-lg lg:text-xl;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-responsive-xl {
|
|
||||||
@apply text-lg sm:text-xl lg:text-2xl;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
@apply bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 transition-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .btn-primary {
|
|
||||||
@apply bg-gradient-to-r from-purple-600 to-pink-600 text-white hover:from-purple-700 hover:to-pink-700 transition-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
@apply bg-gradient-to-r from-cyan-500 to-blue-500 text-white hover:from-cyan-600 hover:to-blue-600 transition-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .btn-secondary {
|
|
||||||
@apply bg-gradient-to-r from-cyan-600 to-blue-600 text-white hover:from-cyan-700 hover:to-blue-700 transition-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-outline {
|
|
||||||
@apply border border-border bg-background hover:bg-accent hover:text-accent-foreground transition-colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-ghost {
|
|
||||||
@apply hover:bg-accent hover:text-accent-foreground transition-colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-destructive {
|
|
||||||
@apply bg-gradient-to-r from-red-500 to-pink-500 text-white hover:from-red-600 hover:to-pink-600 transition-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .btn-destructive {
|
|
||||||
@apply bg-gradient-to-r from-red-600 to-pink-600 text-white hover:from-red-700 hover:to-pink-700 transition-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.neon-border {
|
|
||||||
border: 1px solid transparent;
|
|
||||||
background: linear-gradient(white, white) padding-box,
|
|
||||||
linear-gradient(45deg, hsl(280 100% 60%), hsl(160 84% 39%), hsl(30 100% 50%)) border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.neon-border-dark {
|
|
||||||
border: 1px solid transparent;
|
|
||||||
background: linear-gradient(hsl(240 10% 3.9%), hsl(240 10% 3.9%)) padding-box,
|
|
||||||
linear-gradient(45deg, hsl(280 100% 70%), hsl(160 84% 45%), hsl(30 100% 60%)) border-box;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer utilities {
|
.sidebar-shrinker {
|
||||||
body.sidebar-collapsed main.lg\:ml-80 {
|
z-index: 1;
|
||||||
margin-left: 4rem !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-overflow-fix {
|
.sidebar-shrinker:before {
|
||||||
overflow: visible;
|
content: '';
|
||||||
position: relative;
|
width: 0;
|
||||||
}
|
height: 0;
|
||||||
|
border-top: 6px solid var(--box-border-color, var(--foreground2));
|
||||||
.dropdown-overflow-fix > * {
|
border-right: 12px solid transparent;
|
||||||
position: relative;
|
position: absolute;
|
||||||
}
|
right: -1px;
|
||||||
|
bottom: -6px;
|
||||||
.dropdown-overflow-fix .dropdown-container,
|
z-index: -1;
|
||||||
.dropdown-overflow-fix [class*="dropdown"] {
|
}
|
||||||
overflow: visible !important;
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { JetBrains_Mono, Inter } from "next/font/google";
|
import { JetBrains_Mono } from "next/font/google";
|
||||||
import "@/app/globals.css";
|
import "@/app/globals.css";
|
||||||
import { ThemeProvider } from "@/app/_providers/ThemeProvider";
|
import { ThemeProvider } from "@/app/_providers/ThemeProvider";
|
||||||
import { ServiceWorkerRegister } from "@/app/_components/FeatureComponents/PWA/ServiceWorkerRegister";
|
import { ServiceWorkerRegister } from "@/app/_components/FeatureComponents/PWA/ServiceWorkerRegister";
|
||||||
import { loadTranslationMessages } from "@/app/_server/actions/translations";
|
import { loadTranslationMessages } from "@/app/_server/actions/translations";
|
||||||
|
import '@fontsource/ibm-plex-mono/400.css';
|
||||||
|
import '@fontsource/ibm-plex-mono/500.css';
|
||||||
|
import '@fontsource/ibm-plex-mono/600.css';
|
||||||
|
import '@fontsource-variable/azeret-mono';
|
||||||
|
|
||||||
import { NextIntlClientProvider } from "next-intl";
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
|
|
||||||
@@ -13,12 +17,6 @@ const jetbrainsMono = JetBrains_Mono({
|
|||||||
display: "swap",
|
display: "swap",
|
||||||
});
|
});
|
||||||
|
|
||||||
const inter = Inter({
|
|
||||||
subsets: ["latin"],
|
|
||||||
variable: "--font-sans",
|
|
||||||
display: "swap",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Cr*nMaster - Cron Management made easy",
|
title: "Cr*nMaster - Cron Management made easy",
|
||||||
description:
|
description:
|
||||||
@@ -33,9 +31,9 @@ export const metadata: Metadata = {
|
|||||||
telephone: false,
|
telephone: false,
|
||||||
},
|
},
|
||||||
icons: {
|
icons: {
|
||||||
icon: "/logo.png",
|
icon: "/favicon.png",
|
||||||
shortcut: "/logo.png",
|
shortcut: "/logo.png",
|
||||||
apple: "/logo.png",
|
apple: "/logo-pwa.png",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -58,7 +56,7 @@ export default async function RootLayout({
|
|||||||
messages = await loadTranslationMessages(locale);
|
messages = await loadTranslationMessages(locale);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning data-webtui-theme="catppuccin-latte">
|
||||||
<head>
|
<head>
|
||||||
<meta name="application-name" content="Cr*nMaster" />
|
<meta name="application-name" content="Cr*nMaster" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
@@ -66,15 +64,23 @@ export default async function RootLayout({
|
|||||||
<meta name="apple-mobile-web-app-title" content="Cr*nMaster" />
|
<meta name="apple-mobile-web-app-title" content="Cr*nMaster" />
|
||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<link rel="apple-touch-icon" href="/logo.png" />
|
<link rel="apple-touch-icon" href="/logo.png" />
|
||||||
|
<link rel="stylesheet" href="/webtui/base.css" />
|
||||||
|
<link rel="stylesheet" href="/webtui/theme-catppuccin.css" />
|
||||||
|
<script
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: `
|
||||||
|
(function() {
|
||||||
|
const theme = localStorage.getItem('theme') || 'light';
|
||||||
|
const webtui = theme === 'dark' ? 'catppuccin-mocha' : 'catppuccin-latte';
|
||||||
|
document.documentElement.setAttribute('data-webtui-theme', webtui);
|
||||||
|
})();
|
||||||
|
`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</head>
|
</head>
|
||||||
<body className={`${inter.variable} ${jetbrainsMono.variable} font-sans`}>
|
<body className={`${jetbrainsMono.variable} terminal-font`}>
|
||||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||||
<ThemeProvider
|
<ThemeProvider>
|
||||||
attribute="class"
|
|
||||||
defaultTheme="dark"
|
|
||||||
enableSystem
|
|
||||||
disableTransitionOnChange
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
<ServiceWorkerRegister />
|
<ServiceWorkerRegister />
|
||||||
|
|||||||
@@ -1,12 +1,24 @@
|
|||||||
import { Asterisk, Terminal } from "lucide-react";
|
"use client";
|
||||||
|
|
||||||
export default async function Logo() {
|
import { AsteriskIcon, TerminalIcon } from "@phosphor-icons/react";
|
||||||
|
|
||||||
|
export default function Logo() {
|
||||||
return (
|
return (
|
||||||
<div className="m-auto mt-20 relative w-[600px] h-[600px]">
|
<div className="min-h-screen bg-background0 flex items-center justify-center p-8">
|
||||||
<div className="p-3 bg-gradient-to-br from-purple-500 via-pink-500 to-orange-500 rounded-[200px] w-full h-full">
|
<div className="relative">
|
||||||
<div className="relative">
|
<div className="w-[600px] h-[600px] ascii-border bg-background1 p-16 flex items-center justify-center">
|
||||||
<Terminal className="h-[350px] w-[350px] text-white relative top-[120px] left-[120px]" />
|
<div className="absolute w-[600px] h-[600px] bg-gradient-to-br from-primary/20 via-primary/10 to-transparent blur-3xl" />
|
||||||
<Asterisk className="h-[200px] w-[200px] text-white absolute top-14 right-[90px]" />
|
|
||||||
|
<div className="relative z-10 flex items-center justify-center w-full h-full">
|
||||||
|
<TerminalIcon
|
||||||
|
className="h-80 w-80 text-primary drop-shadow-[0_0_40px_rgba(var(--primary-rgb),0.6)]"
|
||||||
|
weight="duotone"
|
||||||
|
/>
|
||||||
|
<AsteriskIcon
|
||||||
|
className="h-40 w-40 text-primary absolute -top-4 -right-4 drop-shadow-[0_0_30px_rgba(var(--primary-rgb),0.8)]"
|
||||||
|
weight="bold"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
117
app/not-found.tsx
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
import { getTranslations } from "@/app/_server/actions/translations";
|
||||||
|
import { SnakeGame } from "@/app/_components/FeatureComponents/Games/SnakeGame";
|
||||||
|
import { Logo } from "@/app/_components/GlobalComponents/Logo/Logo";
|
||||||
|
import { SystemInfoCard } from "@/app/_components/FeatureComponents/System/SystemInfo";
|
||||||
|
import { ThemeToggle } from "@/app/_components/FeatureComponents/Theme/ThemeToggle";
|
||||||
|
import { LogoutButton } from "@/app/_components/FeatureComponents/LoginForm/LogoutButton";
|
||||||
|
import { ToastContainer } from "@/app/_components/GlobalComponents/UIElements/Toast";
|
||||||
|
import { PWAInstallPrompt } from "@/app/_components/FeatureComponents/PWA/PWAInstallPrompt";
|
||||||
|
import { SSEProvider } from "@/app/_contexts/SSEContext";
|
||||||
|
import { readFileSync } from "fs";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
export default async function NotFound() {
|
||||||
|
const t = await getTranslations();
|
||||||
|
const liveUpdatesEnabled =
|
||||||
|
(typeof process.env.LIVE_UPDATES === "boolean" &&
|
||||||
|
process.env.LIVE_UPDATES === true) ||
|
||||||
|
process.env.LIVE_UPDATES !== "false";
|
||||||
|
|
||||||
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
||||||
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
||||||
|
const version = packageJson.version;
|
||||||
|
|
||||||
|
const initialSystemInfo = {
|
||||||
|
hostname: "Loading...",
|
||||||
|
platform: "Loading...",
|
||||||
|
uptime: "Loading...",
|
||||||
|
memory: {
|
||||||
|
total: "0 B",
|
||||||
|
used: "0 B",
|
||||||
|
free: "0 B",
|
||||||
|
usage: 0,
|
||||||
|
status: "Loading",
|
||||||
|
},
|
||||||
|
cpu: {
|
||||||
|
model: "Loading...",
|
||||||
|
cores: 0,
|
||||||
|
usage: 0,
|
||||||
|
status: "Loading",
|
||||||
|
},
|
||||||
|
gpu: {
|
||||||
|
model: "Loading...",
|
||||||
|
status: "Loading",
|
||||||
|
},
|
||||||
|
disk: {
|
||||||
|
total: "0 B",
|
||||||
|
used: "0 B",
|
||||||
|
free: "0 B",
|
||||||
|
usage: 0,
|
||||||
|
status: "Loading",
|
||||||
|
},
|
||||||
|
systemStatus: {
|
||||||
|
overall: "Loading",
|
||||||
|
details: "Fetching system information...",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const bodyClass = process.env.DISABLE_SYSTEM_STATS === "true" ? "no-sidebar" : "";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SSEProvider liveUpdatesEnabled={liveUpdatesEnabled}>
|
||||||
|
<div className={`min-h-screen bg-background0 ${bodyClass}`}>
|
||||||
|
<header className="border-border border-b sticky top-0 z-20 bg-background0 lg:h-[90px]">
|
||||||
|
<div className="container mx-auto px-4 py-4">
|
||||||
|
<div className="flex items-center justify-between lg:justify-center">
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
<Logo size={48} showGlow={true} />
|
||||||
|
<div>
|
||||||
|
<h1 className="text-xl sm:text-2xl lg:text-3xl font-bold terminal-font uppercase">
|
||||||
|
Cr*nMaster
|
||||||
|
</h1>
|
||||||
|
<p className="text-xs terminal-font flex items-center gap-2">
|
||||||
|
{t("common.version").replace("{version}", version)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{process.env.AUTH_PASSWORD && (
|
||||||
|
<div className="lg:absolute lg:right-10">
|
||||||
|
<LogoutButton />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
{process.env.DISABLE_SYSTEM_STATS !== "true" && (
|
||||||
|
<SystemInfoCard systemInfo={initialSystemInfo} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
<main className="transition-all duration-300">
|
||||||
|
<div className="px-4 py-8 lg:px-8">
|
||||||
|
<div className="text-center mt-6 mb-12">
|
||||||
|
<div className="text-6xl font-bold terminal-font text-status-error mb-2">404</div>
|
||||||
|
<p className="terminal-font text-sm mb-4">{t("notFound.message")}</p>
|
||||||
|
<Link
|
||||||
|
href="/"
|
||||||
|
className="ascii-border bg-background1 hover:bg-background2 px-4 py-2 terminal-font uppercase font-bold transition-colors text-sm inline-block"
|
||||||
|
>
|
||||||
|
{t("notFound.goHome")}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<SnakeGame />
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<ToastContainer />
|
||||||
|
|
||||||
|
<div className="flex items-center gap-2 fixed bottom-4 left-4 lg:right-4 lg:left-auto z-10 bg-background0 ascii-border p-1">
|
||||||
|
<ThemeToggle />
|
||||||
|
<PWAInstallPrompt />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SSEProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
77
app/page.tsx
@@ -9,6 +9,9 @@ import { PWAInstallPrompt } from "@/app/_components/FeatureComponents/PWA/PWAIns
|
|||||||
import { WrapperScriptWarning } from "@/app/_components/FeatureComponents/System/WrapperScriptWarning";
|
import { WrapperScriptWarning } from "@/app/_components/FeatureComponents/System/WrapperScriptWarning";
|
||||||
import { getTranslations } from "@/app/_server/actions/translations";
|
import { getTranslations } from "@/app/_server/actions/translations";
|
||||||
import { SSEProvider } from "@/app/_contexts/SSEContext";
|
import { SSEProvider } from "@/app/_contexts/SSEContext";
|
||||||
|
import { Logo } from "@/app/_components/GlobalComponents/Logo/Logo";
|
||||||
|
import { readFileSync } from "fs";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
export const maxDuration = 300;
|
export const maxDuration = 300;
|
||||||
@@ -20,6 +23,10 @@ export default async function Home() {
|
|||||||
process.env.LIVE_UPDATES === true) ||
|
process.env.LIVE_UPDATES === true) ||
|
||||||
process.env.LIVE_UPDATES !== "false";
|
process.env.LIVE_UPDATES !== "false";
|
||||||
|
|
||||||
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
||||||
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
||||||
|
const version = packageJson.version;
|
||||||
|
|
||||||
const [cronJobs, scripts] = await Promise.all([
|
const [cronJobs, scripts] = await Promise.all([
|
||||||
getCronJobs(),
|
getCronJobs(),
|
||||||
fetchScripts(),
|
fetchScripts(),
|
||||||
@@ -59,52 +66,50 @@ export default async function Home() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const bodyClass = process.env.DISABLE_SYSTEM_STATS === "true" ? "no-sidebar" : "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SSEProvider liveUpdatesEnabled={liveUpdatesEnabled}>
|
<SSEProvider liveUpdatesEnabled={liveUpdatesEnabled}>
|
||||||
<div className="min-h-screen relative">
|
<div className={`min-h-screen bg-background0 ${bodyClass}`}>
|
||||||
<div className="hero-gradient absolute inset-0 -z-10"></div>
|
<header className="border-border border-b sticky top-0 z-20 bg-background0 lg:h-[90px]">
|
||||||
<div className="relative z-10">
|
<div className="container mx-auto px-4 py-4">
|
||||||
<header className="border-b border-border/50 bg-background/80 backdrop-blur-md sticky top-0 z-20 shadow-sm lg:h-[90px]">
|
<div className="flex items-center justify-between lg:justify-center">
|
||||||
<div className="container mx-auto px-4 py-4">
|
<div className="flex items-center gap-4">
|
||||||
<div className="flex items-center justify-between lg:justify-center">
|
<Logo size={48} showGlow={true} />
|
||||||
<div className="flex items-center gap-4">
|
<div>
|
||||||
<div className="relative">
|
<h1 className="text-xl sm:text-2xl lg:text-3xl font-bold terminal-font uppercase">
|
||||||
<img src="/logo.png" alt="logo" className="w-14 h-14" />
|
Cr<span className="text-status-error">*</span>nMaster
|
||||||
<div className="absolute top-0 right-0 w-3 h-3 bg-emerald-500 rounded-full animate-pulse"></div>
|
</h1>
|
||||||
</div>
|
<p className="text-xs terminal-font flex items-center gap-2">
|
||||||
<div>
|
<a href={`https://github.com/fccview/cronmaster/releases/tag/${version}`} target="_blank" rel="noopener noreferrer">
|
||||||
<h1 className="text-xl sm:text-2xl lg:text-3xl font-bold brand-gradient brand-text">
|
{t("common.version").replace("{version}", version)}
|
||||||
Cr*nMaster
|
</a>
|
||||||
</h1>
|
</p>
|
||||||
<p className="text-xs text-muted-foreground font-mono tracking-wide">
|
|
||||||
{t("common.cronManagementMadeEasy")}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{process.env.AUTH_PASSWORD && (
|
|
||||||
<div className="lg:absolute lg:right-10">
|
|
||||||
<LogoutButton />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
{process.env.AUTH_PASSWORD && (
|
||||||
|
<div className="lg:absolute lg:right-10">
|
||||||
|
<LogoutButton />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
{process.env.DISABLE_SYSTEM_STATS !== "true" && (
|
{process.env.DISABLE_SYSTEM_STATS !== "true" && (
|
||||||
<SystemInfoCard systemInfo={initialSystemInfo} />
|
<SystemInfoCard systemInfo={initialSystemInfo} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<main className={`${process.env.DISABLE_SYSTEM_STATS === "true" ? "lg:ml-0" : "lg:ml-80"} transition-all duration-300 ml-0 sidebar-collapsed:lg:ml-16`}>
|
<main className="transition-all duration-300">
|
||||||
<div className="container mx-auto px-4 py-8 lg:px-8">
|
<div className="px-4 py-8 lg:px-8">
|
||||||
<WrapperScriptWarning />
|
<WrapperScriptWarning />
|
||||||
<TabbedInterface cronJobs={cronJobs} scripts={scripts} />
|
<TabbedInterface cronJobs={cronJobs} scripts={scripts} />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
|
||||||
|
|
||||||
<ToastContainer />
|
<ToastContainer />
|
||||||
|
|
||||||
<div className="flex items-center gap-2 fixed bottom-4 left-4 lg:right-4 lg:left-auto z-10 bg-background/80 backdrop-blur-md border border-border/50 rounded-lg p-1">
|
<div className="flex items-center gap-2 fixed bottom-4 left-4 lg:right-4 lg:left-auto z-10 bg-background0 ascii-border p-1">
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
<PWAInstallPrompt />
|
<PWAInstallPrompt />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
7
app/serwist/[path]/route.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { createSerwistRoute } from "@serwist/turbopack";
|
||||||
|
|
||||||
|
const { GET } = createSerwistRoute({
|
||||||
|
swSrc: "app/sw.ts",
|
||||||
|
});
|
||||||
|
|
||||||
|
export { GET };
|
||||||
89
app/sw.ts
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import type { PrecacheEntry, SerwistGlobalConfig } from "serwist";
|
||||||
|
import {
|
||||||
|
Serwist,
|
||||||
|
NetworkFirst,
|
||||||
|
CacheableResponsePlugin,
|
||||||
|
ExpirationPlugin,
|
||||||
|
StaleWhileRevalidate,
|
||||||
|
CacheFirst,
|
||||||
|
} from "serwist";
|
||||||
|
import { cleanupOutdatedCaches } from "serwist/internal";
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface WorkerGlobalScope extends SerwistGlobalConfig {
|
||||||
|
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const self: WorkerGlobalScope;
|
||||||
|
|
||||||
|
const pageStrategy = new NetworkFirst({
|
||||||
|
cacheName: "pages",
|
||||||
|
matchOptions: { ignoreVary: true },
|
||||||
|
networkTimeoutSeconds: 5,
|
||||||
|
plugins: [
|
||||||
|
new CacheableResponsePlugin({ statuses: [200] }),
|
||||||
|
new ExpirationPlugin({
|
||||||
|
maxEntries: 128,
|
||||||
|
maxAgeSeconds: 30 * 24 * 60 * 60,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
cleanupOutdatedCaches();
|
||||||
|
|
||||||
|
const serwist = new Serwist({
|
||||||
|
precacheEntries: self.__SW_MANIFEST,
|
||||||
|
skipWaiting: true,
|
||||||
|
clientsClaim: true,
|
||||||
|
navigationPreload: false,
|
||||||
|
runtimeCaching: [
|
||||||
|
{
|
||||||
|
matcher: ({ request }) => request.mode === "navigate",
|
||||||
|
handler: pageStrategy,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
matcher: ({ request, sameOrigin }) =>
|
||||||
|
request.headers.get("RSC") === "1" && sameOrigin,
|
||||||
|
handler: pageStrategy,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
matcher: /\/_next\/static.+\.js$/i,
|
||||||
|
handler: new CacheFirst({
|
||||||
|
cacheName: "static-js",
|
||||||
|
plugins: [
|
||||||
|
new ExpirationPlugin({
|
||||||
|
maxEntries: 64,
|
||||||
|
maxAgeSeconds: 30 * 24 * 60 * 60,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
matcher: /\.(?:css|woff|woff2|ttf|eot|otf)$/i,
|
||||||
|
handler: new StaleWhileRevalidate({
|
||||||
|
cacheName: "static-assets",
|
||||||
|
plugins: [
|
||||||
|
new ExpirationPlugin({
|
||||||
|
maxEntries: 64,
|
||||||
|
maxAgeSeconds: 30 * 24 * 60 * 60,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
matcher: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
||||||
|
handler: new StaleWhileRevalidate({
|
||||||
|
cacheName: "images",
|
||||||
|
plugins: [
|
||||||
|
new ExpirationPlugin({
|
||||||
|
maxEntries: 128,
|
||||||
|
maxAgeSeconds: 30 * 24 * 60 * 60,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
serwist.addEventListeners();
|
||||||
18
eslint.config.mjs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
|
||||||
|
import nextTypescript from "eslint-config-next/typescript";
|
||||||
|
|
||||||
|
const eslintConfig = [
|
||||||
|
...nextCoreWebVitals,
|
||||||
|
...nextTypescript,
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
"node_modules/**",
|
||||||
|
".next/**",
|
||||||
|
"out/**",
|
||||||
|
"build/**",
|
||||||
|
"next-env.d.ts",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default eslintConfig;
|
||||||
@@ -35,14 +35,12 @@ ports:
|
|||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- DOCKER=true
|
|
||||||
- NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL=30000
|
- NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL=30000
|
||||||
- AUTH_PASSWORD=very_strong_password
|
- AUTH_PASSWORD=very_strong_password
|
||||||
- HOST_CRONTAB_USER=root
|
- HOST_CRONTAB_USER=root
|
||||||
```
|
```
|
||||||
|
|
||||||
- **NODE_ENV**: Set to `production` for production deployments
|
- **NODE_ENV**: Set to `production` for production deployments
|
||||||
- **DOCKER**: Must be `true` when running in Docker
|
|
||||||
- **NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL**: Clock update interval in milliseconds (default: 30000)
|
- **NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL**: Clock update interval in milliseconds (default: 30000)
|
||||||
- **AUTH_PASSWORD**: Strong password for authentication
|
- **AUTH_PASSWORD**: Strong password for authentication
|
||||||
- **HOST_CRONTAB_USER**: User whose crontab to read (default: root, can be comma-separated for multiple users)
|
- **HOST_CRONTAB_USER**: User whose crontab to read (default: root, can be comma-separated for multiple users)
|
||||||
@@ -155,7 +153,6 @@ services:
|
|||||||
- "40123:3000"
|
- "40123:3000"
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- DOCKER=true
|
|
||||||
- NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL=30000
|
- NEXT_PUBLIC_CLOCK_UPDATE_INTERVAL=30000
|
||||||
|
|
||||||
# Localization
|
# Localization
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
CronMaster supports internationalization (i18n) with both **unofficial custom translations** and **official translations** that can be contributed to the project.
|
CronMaster supports internationalization (i18n) with both **unofficial custom translations** and **official translations** that can be contributed to the project.
|
||||||
|
|
||||||
## Table of Contents
|
## Quick links
|
||||||
|
|
||||||
- [Custom User Translations (Unofficial)](#custom-user-translations-unofficial)
|
- [Custom User Translations (Unofficial)](#custom-user-translations-unofficial)
|
||||||
- [Official Translations via Pull Request](#official-translations-via-pull-request)
|
- [Official Translations via Pull Request](#official-translations-via-pull-request)
|
||||||
|
|||||||
3
next-env.d.ts
vendored
@@ -1,5 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
import "./.next/dev/types/routes.d.ts";
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
const withNextIntl = require('next-intl/plugin')('./app/i18n.ts');
|
|
||||||
|
|
||||||
const withPWA = require('next-pwa')({
|
|
||||||
dest: 'public',
|
|
||||||
register: true,
|
|
||||||
skipWaiting: true,
|
|
||||||
disable: process.env.NODE_ENV === 'development',
|
|
||||||
buildExcludes: [/middleware-manifest\.json$/]
|
|
||||||
})
|
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
|
||||||
const nextConfig = {
|
|
||||||
webpack: (config, { dev, isServer }) => {
|
|
||||||
config.resolve.alias = {
|
|
||||||
...config.resolve.alias,
|
|
||||||
'osx-temperature-sensor': false,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (dev && !isServer) {
|
|
||||||
config.watchOptions = {
|
|
||||||
...config.watchOptions,
|
|
||||||
ignored: /node_modules/,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
},
|
|
||||||
async headers() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
source: '/manifest.json',
|
|
||||||
headers: [
|
|
||||||
{ key: 'Content-Type', value: 'application/manifest+json' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: '/sw.js',
|
|
||||||
headers: [
|
|
||||||
{ key: 'Service-Worker-Allowed', value: '/' },
|
|
||||||
{ key: 'Cache-Control', value: 'no-cache' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = withNextIntl({
|
|
||||||
...withPWA(nextConfig)
|
|
||||||
});
|
|
||||||
39
next.config.mjs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { withSerwist } from "@serwist/turbopack";
|
||||||
|
import createNextIntlPlugin from "next-intl/plugin";
|
||||||
|
|
||||||
|
const withNextIntl = createNextIntlPlugin("./app/i18n.ts");
|
||||||
|
|
||||||
|
/** @type {import('next').NextConfig} */
|
||||||
|
const nextConfig = {
|
||||||
|
output: "standalone",
|
||||||
|
images: {
|
||||||
|
unoptimized: true,
|
||||||
|
},
|
||||||
|
webpack: (config, { dev, isServer }) => {
|
||||||
|
config.resolve.alias = {
|
||||||
|
...config.resolve.alias,
|
||||||
|
"osx-temperature-sensor": false,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dev && !isServer) {
|
||||||
|
config.watchOptions = {
|
||||||
|
...config.watchOptions,
|
||||||
|
ignored: /node_modules/,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
async headers() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: "/manifest.json",
|
||||||
|
headers: [
|
||||||
|
{ key: "Content-Type", value: "application/manifest+json" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withSerwist(withNextIntl(nextConfig));
|
||||||
39
package.json
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "cronjob-manager",
|
"name": "cronjob-manager",
|
||||||
"version": "1.5.4",
|
"version": "2.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "eslint ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "^6.18.6",
|
"@codemirror/autocomplete": "^6.18.6",
|
||||||
@@ -19,37 +19,52 @@
|
|||||||
"@codemirror/state": "^6.5.2",
|
"@codemirror/state": "^6.5.2",
|
||||||
"@codemirror/theme-one-dark": "^6.1.3",
|
"@codemirror/theme-one-dark": "^6.1.3",
|
||||||
"@codemirror/view": "^6.38.1",
|
"@codemirror/view": "^6.38.1",
|
||||||
|
"@fontsource-variable/azeret-mono": "^5.2.11",
|
||||||
|
"@fontsource/ibm-plex-mono": "^5.2.7",
|
||||||
|
"@phosphor-icons/react": "^2.1.10",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^18",
|
"@types/react": "19.2.14",
|
||||||
"@types/react-dom": "^18",
|
"@types/react-dom": "19.2.3",
|
||||||
"@types/react-syntax-highlighter": "^15.5.13",
|
"@types/react-syntax-highlighter": "^15.5.13",
|
||||||
|
"@webtui/css": "^0.1.5",
|
||||||
|
"@webtui/theme-catppuccin": "^0.0.3",
|
||||||
"autoprefixer": "^10.0.1",
|
"autoprefixer": "^10.0.1",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"codemirror": "^6.0.2",
|
"codemirror": "^6.0.2",
|
||||||
"cron-parser": "^5.3.0",
|
"cron-parser": "^5.3.0",
|
||||||
"cronstrue": "^3.2.0",
|
"cronstrue": "^3.2.0",
|
||||||
|
"fflate": "^0.8.2",
|
||||||
"jose": "^6.1.1",
|
"jose": "^6.1.1",
|
||||||
"lucide-react": "^0.294.0",
|
|
||||||
"minimatch": "^10.0.3",
|
"minimatch": "^10.0.3",
|
||||||
"next": "14.2.35",
|
"next": "16.1.6",
|
||||||
"next-intl": "^4.4.0",
|
"next-intl": "^4.4.0",
|
||||||
"next-pwa": "^5.6.0",
|
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"proper-lockfile": "^4.1.2",
|
"proper-lockfile": "^4.1.2",
|
||||||
"react": "^18",
|
"react": "19.2.4",
|
||||||
"react-dom": "^18",
|
"react-dom": "19.2.4",
|
||||||
"react-syntax-highlighter": "^15.6.1",
|
"react-syntax-highlighter": "^15.6.1",
|
||||||
"systeminformation": "^5.27.11",
|
"serwist": "^9.5.5",
|
||||||
|
"systeminformation": "^5.27.14",
|
||||||
"tailwind-merge": "^2.0.0",
|
"tailwind-merge": "^2.0.0",
|
||||||
"tailwindcss": "^3.3.0",
|
"tailwindcss": "^3.3.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@serwist/turbopack": "^9.5.5",
|
||||||
"@types/bcryptjs": "^2.4.6",
|
"@types/bcryptjs": "^2.4.6",
|
||||||
"@types/minimatch": "^6.0.0",
|
"@types/minimatch": "^6.0.0",
|
||||||
"eslint": "^8",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "14.0.4"
|
"eslint-config-next": "16.1.6",
|
||||||
|
"postcss-import": "^16.1.1"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"@isaacs/brace-expansion": "^5.0.1",
|
||||||
|
"@types/react": "19.2.14",
|
||||||
|
"@types/react-dom": "19.2.3",
|
||||||
|
"lodash": "^4.17.23",
|
||||||
|
"prismjs": "^1.30.0",
|
||||||
|
"systeminformation": "^5.27.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
|
'postcss-import': {},
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import type { NextRequest } from "next/server";
|
import type { NextRequest } from "next/server";
|
||||||
|
|
||||||
export const middleware = async (request: NextRequest) => {
|
export const proxy = async (request: NextRequest) => {
|
||||||
const { pathname } = request.nextUrl;
|
const { pathname } = request.nextUrl;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
BIN
public/favicon.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 10 KiB |
BIN
public/legacy/heading-legacy.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
public/legacy/logo-legacy.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
public/logo-pwa.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/logo.png
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 24 KiB |
@@ -9,13 +9,13 @@
|
|||||||
"orientation": "portrait-primary",
|
"orientation": "portrait-primary",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/logo.png",
|
"src": "/logo-pwa.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/logo.png",
|
"src": "/logo-pwa.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
|
|||||||
1
public/webtui/base.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@layer base{:root{--background0: #fff;--background1: #ddd;--background2: #bbb;--background3: #999;--foreground0: #000;--foreground1: #444;--foreground2: #888;--font-size: 16px;--line-height: 1.3;--font-weight-bold: 700;--font-weight-normal: 400;--font-family: monospace;--box-border-color: var(--foreground0);--table-border-color: var(--box-border-color);--separator-color: var(--box-border-color);--separator-background: transparent}[data-webtui-theme=dark]{--background0: #000;--background1: #222;--background2: #444;--background3: #666;--foreground0: #fff;--foreground1: #ccc;--foreground2: #999}body,html{background-color:var(--background0);color:var(--foreground0);font-family:var(--font-family);font-size:var(--font-size);font-weight:var(--font-weight-normal);line-height:var(--line-height, 1.5);font-variant-ligatures:common-ligatures}*{box-sizing:border-box;margin:0;padding:0;outline:none}}
|
||||||
1
public/webtui/theme-catppuccin.css
Normal file
|
Before Width: | Height: | Size: 305 KiB |
BIN
screenshots/home-dark-mobile.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
screenshots/home-dark.png
Normal file
|
After Width: | Height: | Size: 152 KiB |
BIN
screenshots/home-light-mobile.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
screenshots/home-light.png
Normal file
|
After Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 340 KiB |
|
Before Width: | Height: | Size: 355 KiB |
BIN
screenshots/logs-view.png
Normal file
|
After Width: | Height: | Size: 638 KiB |
|
Before Width: | Height: | Size: 364 KiB |
|
Before Width: | Height: | Size: 292 KiB |