diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..471c0f27a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: gorkemcetin +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 64d8d8ef1..26956309b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,22 +1,26 @@ -**(when sending your PR, only remove this line. Do not remove any lines below. Check all the relevant items before sending your PR)** +**(Please remove this line only before submitting your PR. Ensure that all relevant items are checked before submission.)** ## Describe your changes Briefly describe the changes you made and their purpose. -## Issue number +## Write your issue number after "Fixes " -Mention the issue number(s) this PR addresses (e.g., #123). +Fixes #123 -## Please ensure all items are checked off before requesting a review: +## Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks. -- [ ] I deployed the application locally. -- [ ] I have performed a self-review and testing of my code. +- [ ] (Do not skip this or your PR will be closed) I deployed the application locally. +- [ ] (Do not skip this or your PR will be closed) I have performed a self-review and testing of my code. - [ ] I have included the issue # in the PR. -- [ ] I have labelled the PR correctly. -- [ ] The issue I am working on is assigned to me. +- [ ] I have added i18n support to visible strings (instead of `
Add
`, use): +```Javascript +const { t } = useTranslation(); +
{t('add')}
+``` +- [ ] I have **not** included any files that are not related to my pull request, including package-lock and package-json if dependencies have not changed - [ ] I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application). -- [ ] I made sure font sizes, color choices etc are all referenced from the theme. +- [ ] I made sure font sizes, color choices etc are all referenced from the theme. I have no hardcoded dimensions. - [ ] My PR is granular and targeted to one specific feature. - [ ] I took a screenshot or a video and attached to this PR if there is a UI change. diff --git a/.github/scripts/download-translations.js b/.github/scripts/download-translations.js new file mode 100644 index 000000000..918be97d3 --- /dev/null +++ b/.github/scripts/download-translations.js @@ -0,0 +1,90 @@ +import axios from 'axios'; +import fs from 'fs-extra'; +import path from 'path'; +import { URLSearchParams } from 'url'; + +// POEditor API information +const API_TOKEN = process.env.POEDITOR_API; +const PROJECT_ID = process.env.POEDITOR_PROJECT_ID; +const LANGUAGES = (process.env.LANGUAGES || 'tr,en').split(','); +const EXPORT_FORMAT = process.env.EXPORT_FORMAT || 'key_value_json'; + +// POEditor API endpoint +const API_URL = 'https://api.poeditor.com/v2'; + +// Function to download translations +async function downloadTranslations() { + try { + console.log('Downloading translations from POEditor...'); + console.log(`Using export format: ${EXPORT_FORMAT}`); + + for (const language of LANGUAGES) { + console.log(`Downloading translations for ${language} language...`); + + // Get export URL from POEditor + const exportResponse = await axios.post(`${API_URL}/projects/export`, + new URLSearchParams({ + api_token: API_TOKEN, + id: PROJECT_ID, + language: language, + type: EXPORT_FORMAT + }) + ); + + if (exportResponse.data.response.status !== 'success') { + throw new Error(`Failed to get export URL for ${language} language: ${JSON.stringify(exportResponse.data)}`); + } + + const fileUrl = exportResponse.data.result.url; + console.log(`Export URL obtained for ${language}`); + + // Download translation file + const downloadResponse = await axios.get(fileUrl, { responseType: 'json' }); + const translations = downloadResponse.data; + console.log(`Downloaded translations for ${language}`); + + // Check the format of data returned from POEditor and convert if necessary + let formattedTranslations = translations; + + // If data is in array format, convert it to key-value format + if (Array.isArray(translations)) { + console.log(`Converting array format to key-value format for ${language}`); + formattedTranslations = {}; + translations.forEach(item => { + if (item.term && item.definition) { + formattedTranslations[item.term] = item.definition; + } + }); + } + + // Determine the output filename based on language + const filename = language === 'en' ? 'gb.json' : `${language}.json`; + const outputPath = path.join(process.cwd(), 'temp', filename); + await fs.writeJson(outputPath, formattedTranslations, { spaces: 2 }); + + console.log(`Translations for ${language} language successfully downloaded and saved as: ${filename}`); + } + + console.log('All translations successfully downloaded!'); + } catch (error) { + console.error('An error occurred while downloading translations:', error); + process.exit(1); + } +} + +// Main function +async function main() { + try { + // Clean temp folder + await fs.emptyDir(path.join(process.cwd(), 'temp')); + + // Download translations + await downloadTranslations(); + } catch (error) { + console.error('An error occurred during the process:', error); + process.exit(1); + } +} + +// Run script +main(); \ No newline at end of file diff --git a/.github/scripts/upload-translations.js b/.github/scripts/upload-translations.js new file mode 100644 index 000000000..aa23cf35f --- /dev/null +++ b/.github/scripts/upload-translations.js @@ -0,0 +1,64 @@ +import axios from "axios"; +import FormData from "form-data"; +import fs from "fs-extra"; + +// POEditor API information +const API_TOKEN = process.env.POEDITOR_API; +const PROJECT_ID = process.env.POEDITOR_PROJECT_ID; +const FILE_PATH = process.env.FILE_PATH; +const LANGUAGE = process.env.LANGUAGE; + +// POEditor API endpoint +const API_URL = 'https://api.poeditor.com/v2'; + +// Function to upload translations +async function uploadTranslations() { + try { + console.log(`Uploading translations for ${LANGUAGE} language from ${FILE_PATH}... test1`); + + // Check if file exists + if (!await fs.pathExists(FILE_PATH)) { + throw new Error(`File not found: ${FILE_PATH}`); + } + + // Read file content + const fileContent = await fs.readFile(FILE_PATH, 'utf8'); + + // Validate JSON format + try { + JSON.parse(fileContent); + } catch (error) { + throw new Error(`Invalid JSON format in ${FILE_PATH}: ${error.message}`); + } + + // Create form data for upload + const formData = new FormData(); + formData.append('api_token', API_TOKEN); + formData.append('id', PROJECT_ID); + formData.append('language', LANGUAGE); + formData.append('updating', 'terms_translations'); + formData.append('file', fs.createReadStream(FILE_PATH)); + formData.append('overwrite', '1'); + formData.append('sync_terms', '1'); + + // Upload to POEditor + const response = await axios.post(`${API_URL}/projects/upload`, formData, { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + } + }); + + if (response.data.response.status !== 'success') { + throw new Error(`Failed to upload translations: ${JSON.stringify(response.data)}`); + } + + console.log(`Successfully uploaded translations for ${LANGUAGE} language.`); + console.log(`Statistics: ${JSON.stringify(response.data.result)}`); + } catch (error) { + console.error('An error occurred while uploading translations:', error); + process.exit(1); + } +} + +// Run script +uploadTranslations(); diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 000000000..774a816b3 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,69 @@ +# POEditor Translation Synchronization + +This GitHub Actions workflow automatically downloads translation files from POEditor and integrates them into the project. + +## How It Works + +The workflow can be triggered in two ways: + +1. **Manual Trigger**: You can manually run the "POEditor Translation Synchronization" workflow from the "Actions" tab in the GitHub interface. +2. **Automatic Trigger**: The workflow runs automatically every day at midnight (UTC). + +## Required Settings + +For this workflow to function, you need to define the following secrets in your GitHub repository: + +1. `POEDITOR_API_TOKEN`: Your POEditor API token +2. `POEDITOR_PROJECT_ID`: Your POEditor project ID + +You can add these secrets in the "Settings > Secrets and variables > Actions" section of your GitHub repository. + +## Manual Execution + +When running the workflow manually, you can specify which languages to download. Languages should be entered as comma-separated values (e.g., `tr,gb,es`). + +If you don't specify any languages, the default languages `tr` and `en` will be downloaded. + +## Output + +When the workflow completes successfully: + +1. Translation files for the specified languages are downloaded from POEditor +2. These files are copied to the `src/locales/` directory +3. Changes are automatically committed and pushed to the main branch + +## Troubleshooting + +If the workflow fails: + +1. Check the GitHub Actions logs +2. Make sure your POEditor API token and project ID are correct +3. Ensure that the languages you specified exist in your POEditor project + +# POEditor Upload Workflow + +## Summary of Implemented Translation Workflow + +We have successfully created a GitHub Actions workflow that automatically uploads translation files to POEditor when changes are merged to the develop branch. Here's a summary of what we've implemented: +### Created Files + +1. .github/scripts/upload-translations.js + +- A Node.js script that handles the upload of translation files to POEditor +- Uses the POEditor API to upload JSON translation files +- Validates file existence and JSON format before uploading +- Provides detailed logging of the upload process + +2. .github/workflows/poeditor-upload-on-merge.yml - A GitHub Actions workflow that triggers when PRs are merged to the develop branch - Only runs when changes are made to files in the src/locales directory - Detects which translation files were changed in the PR - Extracts language codes from filenames (e.g., tr.json → "tr") - Calls the upload script for each changed file + ### Workflow Process +1. When a PR is merged to the develop branch, the workflow checks if any files in src/locales were modified. + +1. If translation files were changed, the workflow: + +- Sets up the necessary Node.js environment +- Installs required dependencies +- Identifies which specific translation files were changed +- For each changed file, extracts the language code and uploads to POEditor +- Provides status notifications about the upload process + +This automated workflow ensures that your translations are always in sync between your codebase and POEditor, eliminating the need for manual uploads and reducing the risk of translation inconsistencies. diff --git a/.github/workflows/distribution-deploy.yml b/.github/workflows/distribution-deploy.yml new file mode 100644 index 000000000..b96a0f3d7 --- /dev/null +++ b/.github/workflows/distribution-deploy.yml @@ -0,0 +1,77 @@ +name: Distribution deploy + +on: + push: + branches: ["master"] + workflow_dispatch: +jobs: + docker-build-and-push-client: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Client Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:frontend-dist \ + -f ./docker/dist/client.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Client Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:frontend-dist + + docker-build-and-push-server: + needs: docker-build-and-push-client + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Server Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:backend-dist \ + -f ./docker/dist/server.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Server Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:backend-dist + + - name: Build Mongo Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:mongo-dist \ + -f ./docker/dist/mongoDB.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push MongoDB Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:mongo-dist + + - name: Build Redis Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:redis-dist \ + -f ./docker/dist/redis.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Redis Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:redis-dist diff --git a/.github/workflows/poeditor-sync.yml b/.github/workflows/poeditor-sync.yml new file mode 100644 index 000000000..8446745bc --- /dev/null +++ b/.github/workflows/poeditor-sync.yml @@ -0,0 +1,115 @@ +name: POEditor Translation Synchronization + +on: + # For manual triggering + workflow_dispatch: + inputs: + languages: + description: "Languages to synchronize (comma separated, e.g.: tr,en,es)" + required: false + default: "tr,en" + format: + description: "Export format (key_value_json or json)" + required: false + default: "key_value_json" + + +permissions: + contents: write + pull-requests: write + +jobs: + sync-translations: + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "22" + + - name: Create package.json for scripts + run: | + mkdir -p .github/scripts + cat > .github/scripts/package.json << EOF + { + "name": "poeditor-scripts", + "version": "1.0.0", + "private": true, + "type": "module", + "dependencies": { + "axios": "^1.6.0", + "fs-extra": "^11.1.1" + } + } + EOF + + - name: Install dependencies + run: | + cd .github/scripts + npm install + + - name: Download translations from POEditor + env: + POEDITOR_API: ${{ secrets.POEDITOR_API }} + POEDITOR_PROJECT_ID: ${{ secrets.POEDITOR_PROJECT_ID }} + LANGUAGES: ${{ github.event.inputs.languages || 'tr,en' }} + EXPORT_FORMAT: ${{ github.event.inputs.format || 'key_value_json' }} + run: | + mkdir -p temp + node .github/scripts/download-translations.js + + - name: Verify translation files + run: | + echo "Verifying translation files..." + for file in temp/*.json; do + echo "Checking $file" + if [ ! -s "$file" ]; then + echo "Error: $file is empty or does not exist" + exit 1 + fi + # Validate JSON format + cat "$file" | jq . > /dev/null || { echo "Error: $file is not valid JSON"; exit 1; } + done + echo "All translation files are valid" + + - name: Copy translations to project + run: | + mkdir -p client/src/locales + cp -r temp/* client/src/locales/ + echo "Translation files copied to client/src/locales/" + + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "feat: translations updated from POEditor" + title: "🌐 Updated Translations from POEditor" + body: | + This PR contains the latest translations from POEditor. + + 📅 Update Date: ${{ steps.date.outputs.date }} + 🔄 Updated Languages: ${{ github.event.inputs.languages || 'tr,en' }} + + ⚠️ Please review the translations and approve the PR if everything looks correct. + branch: translation-update-${{ github.run_number }} + delete-branch: true + base: develop + add-paths: | + client/src/locales/*.json + committer: GitHub Action + author: GitHub Action diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml new file mode 100644 index 000000000..6956f5caa --- /dev/null +++ b/.github/workflows/production-deploy.yml @@ -0,0 +1,95 @@ +name: Demo deploy + +on: + push: + branches: ["demo"] + workflow_dispatch: +jobs: + docker-build-and-push-client: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Client Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:frontend-demo \ + -f ./docker/prod/client.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Client Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:frontend-demo + + docker-build-and-push-server: + needs: docker-build-and-push-client + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Server Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:backend-demo \ + -f ./docker/prod/server.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Server Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:backend-demo + + - name: Build Mongo Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:mongo-demo \ + -f ./docker/prod/mongoDB.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push MongoDB Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:mongo-demo + + - name: Build Redis Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:redis-demo \ + -f ./docker/prod/redis.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Redis Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:redis-demo + + deploy-to-demo: + needs: docker-build-and-push-server + runs-on: ubuntu-latest + steps: + - name: SSH into server and restart container using Docker Compose + uses: appleboy/ssh-action@v1.2.2 + with: + host: ${{ secrets.DEMO_SERVER_HOST }} + username: ${{ secrets.DEMO_SERVER_USER }} + key: ${{ secrets.DEMO_SERVER_SSH_KEY }} + script: | + cd checkmate + git pull + cd docker/prod + docker compose down + docker compose pull + docker compose up -d diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml new file mode 100644 index 000000000..34fa243c6 --- /dev/null +++ b/.github/workflows/staging-deploy.yml @@ -0,0 +1,95 @@ +name: Staging deploy + +on: + push: + branches: ["develop"] + +jobs: + docker-build-and-push-client: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Client Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:frontend-staging \ + -f ./docker/staging/client.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Client Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:frontend-staging + + docker-build-and-push-server: + needs: docker-build-and-push-client + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Server Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:backend-staging \ + -f ./docker/staging/server.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Server Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:backend-staging + + - name: Build Mongo Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:mongo-staging \ + -f ./docker/staging/mongoDB.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push MongoDB Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:mongo-staging + + - name: Build Redis Docker image + run: | + docker build \ + -t ghcr.io/bluewave-labs/checkmate:redis-staging \ + -f ./docker/staging/redis.Dockerfile \ + --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ + . + + - name: Push Redis Docker image + run: docker push ghcr.io/bluewave-labs/checkmate:redis-staging + + deploy-to-staging: + needs: docker-build-and-push-server + runs-on: ubuntu-latest + steps: + - name: SSH into server and restart container using Docker Compose + uses: appleboy/ssh-action@v1.2.2 + with: + host: ${{ secrets.STAGING_SERVER_HOST }} + username: ${{ secrets.STAGING_SERVER_USER }} + key: ${{ secrets.STAGING_SERVER_SSH_KEY }} + script: | + cd checkmate + git pull + cd docker/staging + docker compose down + docker compose pull + docker compose up -d diff --git a/.github/workflows/upload-poeditor.yml b/.github/workflows/upload-poeditor.yml new file mode 100644 index 000000000..f695c8bbc --- /dev/null +++ b/.github/workflows/upload-poeditor.yml @@ -0,0 +1,113 @@ +name: Upload Translations to POEditor on PR Merge + +on: + pull_request: + types: [closed] + branches: + - develop + paths: + - "client/src/locales/**" + +jobs: + upload-translations: + # Only run if the PR was merged (not just closed) or manually triggered + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all history to get changed files + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "22" + + - name: Create package.json for scripts + run: | + mkdir -p .github/scripts + cat > .github/scripts/package.json << EOF + { + "name": "poeditor-scripts", + "version": "1.0.0", + "private": true, + "type": "module", + "dependencies": { + "axios": "^1.6.0", + "fs-extra": "^11.1.1", + "form-data": "^4.0.0" + } + } + EOF + + - name: Install dependencies + run: | + cd .github/scripts + npm install + + - name: Get changed locale files + id: changed-files + if: github.event_name == 'pull_request' + run: | + # Get base and head commits + BASE_SHA=${{ github.event.pull_request.base.sha }} + HEAD_SHA=${{ github.event.pull_request.head.sha }} + + echo "Base SHA: $BASE_SHA" + echo "Head SHA: $HEAD_SHA" + + # Get list of changed files in client/src/locales directory + CHANGED_FILES=$(git diff --name-only $BASE_SHA..$HEAD_SHA -- 'client/src/locales/*.json' || git ls-files 'client/src/locales/*.json') + + if [ -z "$CHANGED_FILES" ]; then + echo "No changes detected in locale files" + echo "CHANGED_FILES=" >> $GITHUB_ENV + else + echo "Changed files:" + echo "$CHANGED_FILES" + echo "CHANGED_FILES<> $GITHUB_ENV + echo "$CHANGED_FILES" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + fi + + - name: Upload changed translations to POEditor + if: env.CHANGED_FILES != '' + env: + POEDITOR_API: ${{ secrets.POEDITOR_API }} + POEDITOR_PROJECT_ID: ${{ secrets.POEDITOR_PROJECT_ID }} + run: | + # Process each changed file + for FILE in $CHANGED_FILES; do + if [[ -f "$FILE" ]]; then + # Extract language code from filename (e.g., client/src/locales/en.json -> en) + FILENAME=$(basename "$FILE") + + # Special case: map gb.json to en language code + if [ "$FILENAME" == "gb.json" ]; then + LANG="en" + echo "Found gb.json, mapping to language code 'en'" + else + LANG=$(basename "$FILE" .json) + fi + + echo "Processing $FILE for language $LANG" + + # Upload to POEditor + LANGUAGE=$LANG FILE_PATH=$FILE node .github/scripts/upload-translations.js + fi + done + + - name: Notify on success + if: success() && env.CHANGED_FILES != '' + run: | + echo "Successfully uploaded translation files to POEditor." + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "Manual trigger comment: ${{ github.event.inputs.comment }}" + fi + + - name: Notify on no changes + if: env.CHANGED_FILES == '' + run: | + echo "No translation files were found to upload." diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a0420fec9..000000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.vite -.vscode -*.sh -!uptime.sh -*.idea \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8db035b8a..702436b38 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,98 +1,149 @@ - # Contributing to Checkmate -First off, thanks for taking the time to contribute! ❤️ +Thanks for your interest in contributing! Checkmate is an open-source, friendly project focused on learning and growth. -All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how the Checkmate project handles them. Please make sure to read the relevant section before making your contribution. It will make it much easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 +We truly appreciate all kinds of contributions — code, ideas, translations or documentation. Contributing helps you level up while making the project better for everyone. -> And if you like the project, but don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: -> - Star the project -> - Tweet about it -> - Refer this project in your project's readme -> - Mention the project at local meetups and tell your friends/colleagues +Before you start, please take a moment to read the relevant section. It helps us review and accept contributions faster, and makes the whole process smoother for everyone. 💚 -## Table of Contents +PS: **We work closely with contributors on our [Discord channel](https://discord.com/invite/NAb6H3UTjK)**. You’ll find community members, core maintainers, and first-timers helping each other out. -- [I Have a Question](#i-have-a-question) -- [I Want To Contribute](#i-want-to-contribute) -- [Suggesting Enhancements](#suggesting-enhancements) +--- -## I Have a Question +## Table of contents -If you'd like to ask a question, we assume that you have read the available readme.md files. In the near future we'll come up with a proper installation and usage document. +- [How do I...?](#how-do-i) + - [Get help or ask a question?](#get-help-or-ask-a-question) + - [Report a bug?](#report-a-bug) + - [Suggest a new feature?](#suggest-a-new-feature) + - [Set up Checkmate locally?](#set-up-checkmate-locally) + - [Start contributing code?](#start-contributing-code) + - [Improve the documentation?](#improve-the-documentation) + - [Help with translations?](#help-with-translations) + - [Submit a pull request?](#submit-a-pull-request) +- [Code guidelines](#code-guidelines) +- [Pull request checklist](#pull-request-checklist) +- [Branching model](#branching-model) +- [Thank you](#thank-you) -Before you ask a question, search for existing [Issues](/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. +--- -If you then still feel the need to ask a question and need clarification, we recommend the following: +## How do I... -- Open an [Issue](/issues/new). -- Provide as much context as you can about what you're running into. -- Provide project and platform versions (NodeJs, MongoDB, etc), depending on what seems relevant. +### Get help or ask a question? -We will then take care of the issue as soon as possible. +Ask anything in our [Discord server](https://discord.com/invite/NAb6H3UTjK) — we’re friendly and happy to help. [Our core contributors](https://github.com/bluewave-labs/checkmate?tab=readme-ov-file#-contributing) are active and ready to support you. You can also use [GitHub Discussions](https://github.com/bluewave-labs/Checkmate/discussions) section to ask your questions. + +### Report a bug? + +1. Search [existing issues](https://github.com/bluewave-labs/checkmate/issues). +2. If it’s not listed, open a **new issue**. +3. Include as much detail as possible: what happened, what you expected, and steps to reproduce. Logs and screenshots help. + +### Suggest a new feature? + +1. Open a new issue with the **feature request** template. +2. Share your use case and why it would help. +3. You can discuss it in [Discord](https://discord.com/invite/NAb6H3UTjK) before you code. + +### Set up Checkmate locally? + +Frontend & backend: +```bash +npm install +npm run dev +``` + +By default, the frontend expects the backend on `http://localhost:3001`. Update configs if needed. + +### Start contributing code? + +1. Pick or open an issue (check `good-first-issue`s first) +2. (optional but highly suggested) Read a detailed structure of [Checkmate](https://deepwiki.com/bluewave-labs/Checkmate) if you would like to deep dive into the architecture. +3. Ask to be assigned. If there is alrady someone assigned and it's been more than 7 days, you can raise the flag and ask to be assigned as well. +4. Create a branch from `develop`. +5. Write your code. +6. Run and test locally. +7. Open a PR to `develop`. + +Start with [good first issues](https://github.com/bluewave-labs/checkmate/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). + +### Improve the documentation? + +Docs live in [checkmate-documentation](https://github.com/bluewave-labs/checkmate-documentation). You can fix typos, add guides, or explain features better. + +### Help with translations? + +We use [PoEditor](https://poeditor.com) for translations. You can: +- [Sign up and join your language team](https://poeditor.com/join/project/lRUoGZFCsJ). +- Translate UI strings. +- Ask questions on Discord in the relevant #translations channel. + +Make sure all new UI strings in code use `t('key')`. + +### Submit a pull request? + +Follow the [pull request checklist](#pull-request-checklist). Your PR should: +- Be focused on one issue. +- Be tested locally. +- Use our linting and translation rules. +- Include the related issue (e.g. `Fixes #123`). +- Be opened against the `develop` branch. + +--- + +## Code guidelines + +- Use ESLint and Prettier (`npm run lint`). +- Follow naming conventions: `camelCase` for variables, `PascalCase` for components, `UPPER_CASE` for constants. +- No hard-coded strings — use `t('your.key')` for everything visible. +- Use the shared theme and components. No magic numbers or hardcoded styles. +- Follow structure and patterns already used in the codebase. + +--- + +## Pull request checklist + +Before submitting your pull request, please confirm the following: + +- **You have tested the app locally and confirmed your changes work.** +- You reviewed your code and removed debug logs or leftover code. +- The GitHub issue is assigned to you. +- You included the related issue number in the PR description (e.g. `Fixes #123`). +- All user-facing text uses the translation function `t('key')`; no hardcoded strings. +- You avoided hardcoded URLs, config values, or sensitive data. +- You used the shared theme for any styling — no magic numbers or inline styles. +- The pull request addresses only one issue or topic. +- You added screenshots or a video for any UI-related changes. +- Your code passes linting and has no TypeScript errors. + +If one or more of these are missing, we may ask you to update your pull request before we can merge it. + +--- + +## Branching model -## I Want To Contribute - -> ### Legal Notice -> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. - -### Reporting Bugs - -#### Before Submitting a Bug Report - -A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - -- Make sure that you are using the latest version. -- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions. If you are looking for support, you might want to check [this section](#i-have-a-question)). -- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](issues?q=label%3Abug). -- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. -- Collect information about the bug: -- Stack trace (Traceback) -- OS, Platform and Version (Windows, Linux, macOS, x86, ARM) -- Version of the interpreter, compiler, SDK, runtime environment and package manager, depending on what seems relevant. -- Possibly your input and the output -- Can you reliably reproduce the issue? And can you also reproduce it with older versions? - - -#### How Do I Submit a Good Bug Report? - -> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to security@bluewavelabs.ca - -We use GitHub issues to track bugs and errors. If you run into an issue with the project: - -- Open an [Issue](/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) -- Explain the behaviour you would expect and the actual behaviour. -- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports, you should isolate the problem and create a reduced test case. -- Provide the information you collected in the previous section. - -Once it's filed: - -- The project team will label the issue accordingly. -- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. -- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). - -## Suggesting Enhancements - -This section guides you through submitting an enhancement suggestion for the application, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community understand your enhancements and find related suggestions. - +- Code contributions should go to the `develop` branch. +- `master` is used for stable releases. +- Use descriptive branch names, like `fix/login-error` or `feat/add-alerts`. - Make sure that you are using the latest version. - Make sure you run the code locally. The Checkmate [documentation](https://docs.checkmate.so) covers it. - Find out if the functionality is already covered, maybe by an individual configuration. - Perform a [search](/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. -#### How Do I Submit a Good Enhancement Suggestion? +--- -Enhancement suggestions are tracked as [GitHub issues](/issues). +## Thank you -- Use a **clear and descriptive title** for the issue to identify the suggestion. -- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. -- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. -- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. -- **Explain why this enhancement would be useful** to most CONTRIBUTING.md users. You may also want to point out the other projects that solved it better and which could serve as inspiration. +Thanks for making Checkmate better. We mean it. Whether it’s your first pull request or your 50th, we’re excited to build with you. + + +PS: feel free to introduce yourself on [Discord](https://discord.gg/YOUR-DISCORD-LINK) and say hi. + +-- Checkmate team Also make sure you read the [document about how to make a good pull request](/PULLREQUESTS.md). -## Attribution -This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)! + diff --git a/Client/.env.production b/Client/.env.production deleted file mode 100644 index a5bce84e1..000000000 --- a/Client/.env.production +++ /dev/null @@ -1 +0,0 @@ -VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL diff --git a/Client/README.md b/Client/README.md deleted file mode 100644 index f768e33fc..000000000 --- a/Client/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# React + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh diff --git a/Client/src/Components/BasicTable/index.jsx b/Client/src/Components/BasicTable/index.jsx deleted file mode 100644 index b93c584da..000000000 --- a/Client/src/Components/BasicTable/index.jsx +++ /dev/null @@ -1,360 +0,0 @@ -/* TODO - -Should we delete this? -*/ - -import PropTypes from "prop-types"; -import { useState, useEffect } from "react"; -import { useTheme } from "@emotion/react"; -import { - TableContainer, - Paper, - Table, - TableHead, - TableRow, - TableCell, - TableBody, - TablePagination, - Box, - Typography, - Stack, - Button, -} from "@mui/material"; -import { useDispatch, useSelector } from "react-redux"; -import { setRowsPerPage } from "../../Features/UI/uiSlice"; -import LeftArrowDouble from "../../assets/icons/left-arrow-double.svg?react"; -import RightArrowDouble from "../../assets/icons/right-arrow-double.svg?react"; -import LeftArrow from "../../assets/icons/left-arrow.svg?react"; -import RightArrow from "../../assets/icons/right-arrow.svg?react"; -import SelectorVertical from "../../assets/icons/selector-vertical.svg?react"; -import "./index.css"; -/** - * Component for pagination actions (first, previous, next, last). - * - * @component - * @param {Object} props - * @param {number} props.count - Total number of items. - * @param {number} props.page - Current page number. - * @param {number} props.rowsPerPage - Number of rows per page. - * @param {function} props.onPageChange - Callback function to handle page change. - * - * @returns {JSX.Element} Pagination actions component. - */ -const TablePaginationActions = (props) => { - const { count, page, rowsPerPage, onPageChange } = props; - - const handleFirstPageButtonClick = (event) => { - onPageChange(event, 0); - }; - const handleBackButtonClick = (event) => { - onPageChange(event, page - 1); - }; - const handleNextButtonClick = (event) => { - onPageChange(event, page + 1); - }; - const handleLastPageButtonClick = (event) => { - onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1)); - }; - - return ( - - - - - - - ); -}; - -TablePaginationActions.propTypes = { - count: PropTypes.number.isRequired, - page: PropTypes.number.isRequired, - rowsPerPage: PropTypes.number.isRequired, - onPageChange: PropTypes.func.isRequired, -}; - -/** - * BasicTable Component - * Renders a table with optional pagination. - * - * @component - * @param {Object} props - Component props. - * @param {Object} props.data - Data for the table including columns and rows. - * @param {Array} props.data.cols - Array of objects for column headers. - * @param {number} props.data.cols[].id - Unique identifier for the column. - * @param {string} props.data.cols[].name - Name of the column to display as header. - * @param {Array} props.data.rows - Array of row objects. - * @param {number} props.data.rows[].id - Unique identifier for the row. - * @param {Array} props.data.rows[].data - Array of cell data objects for the row. - * @param {number} props.data.rows[].data[].id - Unique identifier for the cell. - * @param {JSX.Element} props.data.rows[].data[].data - The content to display in the cell. - * @param {function} props.data.rows.data.handleClick - Function to call when the row is clicked. - * @param {boolean} [props.paginated=false] - Flag to enable pagination. - * @param {boolean} [props.reversed=false] - Flag to enable reverse order. - * @param {number} props.rowsPerPage- Number of rows per page (table). - * @param {string} props.emptyMessage - Message to display when there is no data. - * @example - * const data = { - * cols: [ - * { id: 1, name: "First Col" }, - * { id: 2, name: "Second Col" }, - * { id: 3, name: "Third Col" }, - * { id: 4, name: "Fourth Col" }, - * ], - * rows: [ - * { - * id: 1, - * data: [ - * { id: 1, data:
Data for Row 1 Col 1
}, - * { id: 2, data:
Data for Row 1 Col 2
}, - * { id: 3, data:
Data for Row 1 Col 3
}, - * { id: 4, data:
Data for Row 1 Col 4
}, - * ], - * }, - * { - * id: 2, - * data: [ - * { id: 5, data:
Data for Row 2 Col 1
}, - * { id: 6, data:
Data for Row 2 Col 2
}, - * { id: 7, data:
Data for Row 2 Col 3
}, - * { id: 8, data:
Data for Row 2 Col 4
}, - * ], - * }, - * ], - * }; - * - * - */ - -const BasicTable = ({ data, paginated, reversed, table, emptyMessage = "No data" }) => { - const DEFAULT_ROWS_PER_PAGE = 5; - const theme = useTheme(); - const dispatch = useDispatch(); - const uiState = useSelector((state) => state.ui); - let rowsPerPage = uiState?.[table]?.rowsPerPage ?? DEFAULT_ROWS_PER_PAGE; - const [page, setPage] = useState(0); - - useEffect(() => { - setPage(0); - }, [data]); - - const handleChangePage = (event, newPage) => { - setPage(newPage); - }; - - const handleChangeRowsPerPage = (event) => { - dispatch( - setRowsPerPage({ - value: parseInt(event.target.value, 10), - table: table, - }) - ); - setPage(0); - }; - - let displayData = []; - - if (data && data.rows) { - let rows = reversed ? [...data.rows].reverse() : data.rows; - displayData = paginated - ? rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) - : rows; - } - - if (!data || !data.cols || !data.rows) { - return
No data
; - } - - /** - * Helper function to calculate the range of displayed rows. - * @returns {string} - */ - const getRange = () => { - let start = page * rowsPerPage + 1; - let end = Math.min(page * rowsPerPage + rowsPerPage, data.rows.length); - return `${start} - ${end}`; - }; - - return ( - <> - - - - - {data.cols.map((col) => ( - {col.name} - ))} - - - - {displayData.map((row) => { - return ( - - {row.data.map((cell) => { - return {cell.data}; - })} - - ); - })} - {displayData.length === 0 && ( - - - {emptyMessage} - - - )} - -
-
- {paginated && ( - - - Showing {getRange()} of {data.rows.length} monitor(s) - - - `Page ${page + 1} of ${Math.max(0, Math.ceil(count / rowsPerPage))}` - } - slotProps={{ - select: { - MenuProps: { - keepMounted: true, - PaperProps: { - className: "pagination-dropdown", - sx: { - mt: 0, - mb: theme.spacing(2), - }, - }, - transformOrigin: { vertical: "bottom", horizontal: "left" }, - anchorOrigin: { vertical: "top", horizontal: "left" }, - sx: { mt: theme.spacing(-2) }, - }, - inputProps: { id: "pagination-dropdown" }, - IconComponent: SelectorVertical, - sx: { - ml: theme.spacing(4), - mr: theme.spacing(12), - minWidth: theme.spacing(20), - textAlign: "left", - "&.Mui-focused > div": { - backgroundColor: theme.palette.primary.main, - }, - }, - }, - }} - sx={{ - mt: theme.spacing(6), - color: theme.palette.primary.contrastTextSecondary, - "& svg path": { - stroke: theme.palette.primary.contrastTextTertiary, - strokeWidth: 1.3, - }, - "& .MuiSelect-select": { - border: 1, - borderColor: theme.palette.primary.lowContrast, - borderRadius: theme.shape.borderRadius, - }, - }} - /> - - )} - - ); -}; - -BasicTable.propTypes = { - data: PropTypes.object.isRequired, - paginated: PropTypes.bool, - reversed: PropTypes.bool, - rowPerPage: PropTypes.number, - table: PropTypes.string, - emptyMessage: PropTypes.string, -}; - -export default BasicTable; diff --git a/Client/src/Components/Fallback/index.jsx b/Client/src/Components/Fallback/index.jsx deleted file mode 100644 index 61840452f..000000000 --- a/Client/src/Components/Fallback/index.jsx +++ /dev/null @@ -1,92 +0,0 @@ -import PropTypes from "prop-types"; -import { useTheme } from "@emotion/react"; -import { Box, Button, Stack, Typography } from "@mui/material"; -import Skeleton from "../../assets/Images/create-placeholder.svg?react"; -import SkeletonDark from "../../assets/Images/create-placeholder-dark.svg?react"; -import Background from "../../assets/Images/background-grid.svg?react"; -import Check from "../Check/Check"; -import { useNavigate } from "react-router-dom"; -import { useSelector } from "react-redux"; -import "./index.css"; - -/** - * Fallback component to display a fallback UI with a title, a list of checks, and a navigation button. - * - * @param {Object} props - The component props. - * @param {string} props.title - The title to be displayed in the fallback UI. - * @param {Array} props.checks - An array of strings representing the checks to display. - * @param {string} [props.link="/"] - The link to navigate to. - * @param {boolean} [props.vowelStart=false] - Whether the title starts with a vowel. - * @returns {JSX.Element} The rendered fallback UI. - */ - -const Fallback = ({ title, checks, link = "/", isAdmin, vowelStart = false }) => { - const theme = useTheme(); - const navigate = useNavigate(); - const mode = useSelector((state) => state.ui.mode); - - return ( - - {mode === "light" ? ( - - ) : ( - - )} - - - - - - {vowelStart ? "An" : "A"} {title} is used to: - - {checks.map((check, index) => ( - - ))} - - {/* TODO - display a different fallback if user is not an admin*/} - {isAdmin && ( - - )} - - ); -}; - -Fallback.propTypes = { - title: PropTypes.string.isRequired, - checks: PropTypes.arrayOf(PropTypes.string).isRequired, - link: PropTypes.string, - isAdmin: PropTypes.bool, - vowelStart: PropTypes.bool, -}; - -export default Fallback; diff --git a/Client/src/Components/Inputs/Image/index.css b/Client/src/Components/Inputs/Image/index.css deleted file mode 100644 index 7492f8636..000000000 --- a/Client/src/Components/Inputs/Image/index.css +++ /dev/null @@ -1,18 +0,0 @@ -.MuiStack-root:has(#modal-update-picture) h1.MuiTypography-root { - font-weight: 600; -} -.image-field-wrapper h2.MuiTypography-root, -.MuiStack-root:has(#modal-update-picture) button, -.MuiStack-root:has(#modal-update-picture) h1.MuiTypography-root { - font-size: var(--env-var-font-size-medium); -} -.image-field-wrapper h2.MuiTypography-root { - margin-top: 10px; -} -.image-field-wrapper + p.MuiTypography-root { - margin-top: 8px; -} -.image-field-wrapper + p.MuiTypography-root, -.image-field-wrapper p.MuiTypography-root { - font-size: var(--env-var-font-size-small-plus); -} diff --git a/Client/src/Components/Inputs/Image/index.jsx b/Client/src/Components/Inputs/Image/index.jsx deleted file mode 100644 index a955a8ad6..000000000 --- a/Client/src/Components/Inputs/Image/index.jsx +++ /dev/null @@ -1,153 +0,0 @@ -import React, { useState } from "react"; -import PropTypes from "prop-types"; -import { Box, IconButton, Stack, TextField, Typography } from "@mui/material"; -import { useTheme } from "@emotion/react"; -import CloudUploadIcon from "@mui/icons-material/CloudUpload"; -import "./index.css"; -import { checkImage } from "../../../Utils/fileUtils"; - -/** - * @param {Object} props - The component props. - * @param {string} props.id - The unique identifier for the input field. - * @param {string} props.src - The URL of the image to display. - * @param {function} props.onChange - The function to handle file input change. - * @returns {JSX.Element} The rendered component. - */ - -const ImageField = ({ id, src, loading, onChange }) => { - const theme = useTheme(); - - const [isDragging, setIsDragging] = useState(false); - const handleDragEnter = () => { - setIsDragging(true); - }; - const handleDragLeave = () => { - setIsDragging(false); - }; - - return ( - <> - {!checkImage(src) || loading ? ( - <> - - - - - - - - - Click to upload - {" "} - or drag and drop - - - (maximum size: 3MB) - - - - - Supported formats: JPG, PNG - - - ) : ( - - - - )} - - ); -}; - -ImageField.propTypes = { - id: PropTypes.string.isRequired, - src: PropTypes.string, - onChange: PropTypes.func.isRequired, -}; - -export default ImageField; diff --git a/Client/src/Pages/Account/index.jsx b/Client/src/Pages/Account/index.jsx deleted file mode 100644 index 9fd38b5ef..000000000 --- a/Client/src/Pages/Account/index.jsx +++ /dev/null @@ -1,133 +0,0 @@ -import { useState } from "react"; -import PropTypes from "prop-types"; -import { useNavigate } from "react-router"; -import { useSelector } from "react-redux"; -import { Box, Tab, useTheme } from "@mui/material"; -import TabContext from "@mui/lab/TabContext"; -import TabList from "@mui/lab/TabList"; -import ProfilePanel from "../../Components/TabPanels/Account/ProfilePanel"; -import PasswordPanel from "../../Components/TabPanels/Account/PasswordPanel"; -import TeamPanel from "../../Components/TabPanels/Account/TeamPanel"; -import "./index.css"; - -/** - * Account component renders a settings page with tabs for Profile, Password, and Team settings. - * @param {string} [props.open] - Specifies the initially open tab: 'profile', 'password', or 'team'. - * @returns {JSX.Element} - */ -const Account = ({ open = "profile" }) => { - const theme = useTheme(); - const navigate = useNavigate(); - const [focusedTab, setFocusedTab] = useState(null); // Track focused tab - const tab = open; - const handleTabChange = (event, newTab) => { - navigate(`/account/${newTab}`); - }; - const { user } = useSelector((state) => state.auth); - - const requiredRoles = ["superadmin", "admin"]; - let tabList = ["Profile", "Password", "Team"]; - const hideTeams = !requiredRoles.some((role) => user.role.includes(role)); - if (hideTeams) { - tabList = ["Profile", "Password"]; - } - - // Remove password for demo - if (user.role.includes("demo")) { - tabList = ["Profile"]; - } - - const handleKeyDown = (event) => { - const currentIndex = tabList.findIndex((label) => label.toLowerCase() === tab); - if (event.key === "Tab") { - const nextIndex = (currentIndex + 1) % tabList.length; - setFocusedTab(tabList[nextIndex].toLowerCase()); - } else if (event.key === "Enter") { - event.preventDefault(); - navigate(`/account/${focusedTab}`); - } - }; - - const handleFocus = (tabName) => { - setFocusedTab(tabName); - }; - - return ( - - - - - {tabList.map((label, index) => ( - handleFocus(label.toLowerCase())} - tabIndex={index} - sx={{ - fontSize: 13, - color: theme.palette.tertiary.contrastText, - backgroundColor: theme.palette.tertiary.main, - textTransform: "none", - minWidth: "fit-content", - paddingY: theme.spacing(6), - fontWeight: 400, - borderBottom: "2px solid transparent", - borderRight: `1px solid ${theme.palette.primary.lowContrast}`, - "&:first-child": { borderTopLeftRadius: "8px" }, - "&:last-child": { borderTopRightRadius: "8px", borderRight: 0 }, - "&:focus-visible": { - color: theme.palette.primary.contrastText, - borderColor: theme.palette.tertiary.contrastText, - borderRightColor: theme.palette.primary.lowContrast, - }, - "&.Mui-selected": { - backgroundColor: theme.palette.secondary.main, - color: theme.palette.secondary.contrastText, - borderColor: theme.palette.secondary.contrastText, - borderRightColor: theme.palette.primary.lowContrast, - }, - "&:hover": { - borderColor: theme.palette.primary.lowContrast, - }, - }} - /> - ))} - - - - {user.role.includes("superadmin") && } - {!hideTeams && } - - - ); -}; - -Account.propTypes = { - open: PropTypes.oneOf(["profile", "password", "team"]), -}; - -export default Account; diff --git a/Client/src/Pages/Incidents/IncidentTable/Empty/Empty.jsx b/Client/src/Pages/Incidents/IncidentTable/Empty/Empty.jsx deleted file mode 100644 index 78b7e8d6d..000000000 --- a/Client/src/Pages/Incidents/IncidentTable/Empty/Empty.jsx +++ /dev/null @@ -1,32 +0,0 @@ -import { useTheme } from "@emotion/react"; -import PlaceholderLight from "../../../../assets/Images/data_placeholder.svg?react"; -import PlaceholderDark from "../../../../assets/Images/data_placeholder_dark.svg?react"; -import { Box, Typography } from "@mui/material"; -import PropTypes from "prop-types"; - -const Empty = ({ styles, mode }) => { - const theme = useTheme(); - return ( - - - {mode === "light" ? : } - - - No incidents recorded yet. - - - ); -}; - -Empty.propTypes = { - styles: PropTypes.object, - mode: PropTypes.string, -}; - -export { Empty }; diff --git a/Client/src/Pages/Incidents/IncidentTable/Skeleton/Skeleton.jsx b/Client/src/Pages/Incidents/IncidentTable/Skeleton/Skeleton.jsx deleted file mode 100644 index a3a23c14c..000000000 --- a/Client/src/Pages/Incidents/IncidentTable/Skeleton/Skeleton.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Skeleton /* , Stack */ } from "@mui/material"; -const IncidentSkeleton = () => { - return ( - <> - - - - ); -}; - -export { IncidentSkeleton }; diff --git a/Client/src/Pages/Incidents/IncidentTable/index.jsx b/Client/src/Pages/Incidents/IncidentTable/index.jsx deleted file mode 100644 index ae9a3ae2a..000000000 --- a/Client/src/Pages/Incidents/IncidentTable/index.jsx +++ /dev/null @@ -1,185 +0,0 @@ -import PropTypes from "prop-types"; -import { Typography, Box } from "@mui/material"; - -import { useState, useEffect } from "react"; -import { useSelector } from "react-redux"; -import { networkService } from "../../../main"; -import { StatusLabel } from "../../../Components/Label"; -import { logger } from "../../../Utils/Logger"; -import { useTheme } from "@emotion/react"; -import { formatDateWithTz } from "../../../Utils/timeUtils"; -import PlaceholderLight from "../../../assets/Images/data_placeholder.svg?react"; -import PlaceholderDark from "../../../assets/Images/data_placeholder_dark.svg?react"; -import { HttpStatusLabel } from "../../../Components/HttpStatusLabel"; -import { Empty } from "./Empty/Empty"; -import { IncidentSkeleton } from "./Skeleton/Skeleton"; -import DataTable from "../../../Components/Table"; -import Pagination from "../../../Components/Table/TablePagination"; - -const IncidentTable = ({ monitors, selectedMonitor, filter, dateRange }) => { - const uiTimezone = useSelector((state) => state.ui.timezone); - - const theme = useTheme(); - const { authToken, user } = useSelector((state) => state.auth); - const mode = useSelector((state) => state.ui.mode); - const [checks, setChecks] = useState([]); - const [checksCount, setChecksCount] = useState(0); - const [page, setPage] = useState(0); - const [rowsPerPage, setRowsPerPage] = useState(10); - const [isLoading, setIsLoading] = useState(false); - - useEffect(() => { - const fetchPage = async () => { - if (!monitors || Object.keys(monitors).length === 0) { - return; - } - try { - setIsLoading(true); - let res; - if (selectedMonitor === "0") { - res = await networkService.getChecksByTeam({ - authToken: authToken, - teamId: user.teamId, - sortOrder: "desc", - limit: null, - dateRange, - filter: filter, - page: page, - rowsPerPage: rowsPerPage, - }); - } else { - res = await networkService.getChecksByMonitor({ - authToken: authToken, - monitorId: selectedMonitor, - sortOrder: "desc", - limit: null, - dateRange, - filter: filter, - page, - rowsPerPage, - }); - } - - setChecks(res.data.data.checks); - setChecksCount(res.data.data.checksCount); - } catch (error) { - logger.error(error); - } finally { - setIsLoading(false); - } - }; - fetchPage(); - }, [authToken, user, monitors, selectedMonitor, filter, page, rowsPerPage, dateRange]); - - const handlePageChange = (_, newPage) => { - setPage(newPage); - }; - - const handleChangeRowsPerPage = (event) => { - setRowsPerPage(event.target.value); - }; - - const headers = [ - { - id: "monitorName", - content: "Monitor Name", - render: (row) => monitors[row.monitorId]?.name ?? "N/A", - }, - { - id: "status", - content: "Status", - render: (row) => { - const status = row.status === true ? "up" : "down"; - return ( - - ); - }, - }, - { - id: "dateTime", - content: "Date & Time", - render: (row) => { - const formattedDate = formatDateWithTz( - row.createdAt, - "YYYY-MM-DD HH:mm:ss A", - uiTimezone - ); - return formattedDate; - }, - }, - { - id: "statusCode", - content: "Status Code", - render: (row) => , - }, - { id: "message", content: "Message", render: (row) => row.message }, - ]; - - let sharedStyles = { - border: 1, - borderColor: theme.palette.primary.lowContrast, - borderRadius: theme.shape.borderRadius, - backgroundColor: theme.palette.primary.main, - p: theme.spacing(30), - }; - - const hasChecks = checks?.length === 0; - const noIncidentsRecordedYet = hasChecks && selectedMonitor === "0"; - const noIncidentsForThatMonitor = hasChecks && selectedMonitor !== "0"; - - return ( - <> - {isLoading ? ( - - ) : noIncidentsRecordedYet ? ( - - ) : noIncidentsForThatMonitor ? ( - - - {mode === "light" ? : } - - - The monitor you have selected has no recorded incidents yet. - - - ) : ( - <> - - - - )} - - ); -}; - -IncidentTable.propTypes = { - monitors: PropTypes.object.isRequired, - selectedMonitor: PropTypes.string.isRequired, - filter: PropTypes.string.isRequired, - dateRange: PropTypes.string.isRequired, -}; - -export default IncidentTable; diff --git a/Client/src/Pages/Incidents/index.jsx b/Client/src/Pages/Incidents/index.jsx deleted file mode 100644 index 8305ec672..000000000 --- a/Client/src/Pages/Incidents/index.jsx +++ /dev/null @@ -1,213 +0,0 @@ -import { useState, useEffect } from "react"; -import { useSelector } from "react-redux"; -import { ButtonGroup, Stack, Typography, Button } from "@mui/material"; -import { useParams } from "react-router-dom"; - -import { networkService } from "../../main"; -import { useTheme } from "@emotion/react"; -import Select from "../../Components/Inputs/Select"; -import IncidentTable from "./IncidentTable"; -import SkeletonLayout from "./skeleton"; - -const Incidents = () => { - const theme = useTheme(); - const authState = useSelector((state) => state.auth); - const { monitorId } = useParams(); - - const [monitors, setMonitors] = useState({}); - const [selectedMonitor, setSelectedMonitor] = useState("0"); - const [isLoading, setIsLoading] = useState(true); - - // TODO do something with these filters - const [filter, setFilter] = useState("all"); - const [dateRange, setDateRange] = useState("hour"); - - useEffect(() => { - const fetchMonitors = async () => { - try { - setIsLoading(true); - const res = await networkService.getMonitorsByTeamId({ - authToken: authState.authToken, - teamId: authState.user.teamId, - limit: null, - types: null, - status: null, - checkOrder: null, - normalize: null, - page: null, - rowsPerPage: null, - filter: null, - field: null, - order: null, - }); - if (res?.data?.data?.monitors?.length > 0) { - const monitorLookup = res.data.data.monitors.reduce((acc, monitor) => { - acc[monitor._id] = monitor; - return acc; - }, {}); - setMonitors(monitorLookup); - monitorId !== undefined && setSelectedMonitor(monitorId); - } - } catch (error) { - console.info(error); - } finally { - setIsLoading(false); - } - }; - fetchMonitors(); - }, [authState, monitorId]); - - useEffect(() => {}, [monitors]); - - const handleSelect = (event) => { - setSelectedMonitor(event.target.value); - }; - - const isActuallyLoading = isLoading && Object.keys(monitors)?.length === 0; - - return ( - - {isActuallyLoading ? ( - - ) : ( - <> - - - - Incidents for - - { - dispatch(setTimezone({ timezone: e.target.value })); - }} - items={timezones} - /> - - - - - Appearance - - Switch between light and dark mode. - - - - - - - {isAdmin && ( - - - History and monitoring - - Define here for how long you want to keep the data. You can also remove - all past data. - - - - - - Clear all stats. This is irreversible. - - - - setIsOpen(deleteStatsMonitorsInitState)} - confirmationButtonLabel="Yes, clear all stats" - onConfirm={handleClearStats} - isLoading={isLoading || authIsLoading || checksIsLoading} - /> - - )} - {isAdmin && ( - - - Demo monitors - - Here you can add and remove demo monitors. - - - - - Add demo monitors - - Add demo monitors - - - - Remove all monitors - - setIsOpen({ ...deleteStatsMonitorsInitState, deleteMonitors: true }) - } - sx={{ mt: theme.spacing(4) }} - > - Remove all monitors - - - - setIsOpen(deleteStatsMonitorsInitState)} - confirmationButtonLabel="Yes, clear all monitors" - onConfirm={handleDeleteAllMonitors} - isLoading={isLoading || authIsLoading || checksIsLoading} - /> - - )} - - - - About - - - Checkmate {version} - - Developed by Bluewave Labs. - - - - - - 0} - variant="contained" - color="accent" - sx={{ px: theme.spacing(12), mt: theme.spacing(20) }} - onClick={handleSave} - > - Save - - - - - ); -}; - -Settings.propTypes = { - isAdmin: PropTypes.bool, -}; -export default Settings; diff --git a/Client/src/Pages/Status/index.jsx b/Client/src/Pages/Status/index.jsx deleted file mode 100644 index 7ba2c0a8d..000000000 --- a/Client/src/Pages/Status/index.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Box } from "@mui/material"; -import { useTheme } from "@emotion/react"; -import Fallback from "../../Components/Fallback"; - -const Status = () => { - const theme = useTheme(); - - return ( - [class*="fallback__"])': { - position: "relative", - border: 1, - borderColor: theme.palette.primary.lowContrast, - borderRadius: theme.shape.borderRadius, - borderStyle: "dashed", - backgroundColor: theme.palette.primary.main, - overflow: "hidden", - }, - }} - > - - - ); -}; - -export default Status; diff --git a/Client/src/Pages/Uptime/CreateUptime/index.css b/Client/src/Pages/Uptime/CreateUptime/index.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/Client/src/Pages/Uptime/Details/PaginationTable/index.jsx b/Client/src/Pages/Uptime/Details/PaginationTable/index.jsx deleted file mode 100644 index 93e9532c5..000000000 --- a/Client/src/Pages/Uptime/Details/PaginationTable/index.jsx +++ /dev/null @@ -1,163 +0,0 @@ -import PropTypes from "prop-types"; -import { - TableContainer, - Table, - TableHead, - TableRow, - TableCell, - TableBody, - PaginationItem, - Pagination, - Paper, -} from "@mui/material"; - -import { useState, useEffect } from "react"; -import { useSelector } from "react-redux"; -import { networkService } from "../../../../main"; -import { StatusLabel } from "../../../../Components/Label"; -import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded"; -import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded"; -import { logger } from "../../../../Utils/Logger"; -import { formatDateWithTz } from "../../../../Utils/timeUtils"; -import { useTheme } from "@emotion/react"; -const PaginationTable = ({ monitorId, dateRange }) => { - const theme = useTheme(); - const { authToken } = useSelector((state) => state.auth); - const [checks, setChecks] = useState([]); - const [checksCount, setChecksCount] = useState(0); - const [paginationController, setPaginationController] = useState({ - page: 0, - rowsPerPage: 5, - }); - const uiTimezone = useSelector((state) => state.ui.timezone); - - useEffect(() => { - setPaginationController((prevPaginationController) => ({ - ...prevPaginationController, - page: 0, - })); - }, [dateRange]); - - useEffect(() => { - const fetchPage = async () => { - try { - const res = await networkService.getChecksByMonitor({ - authToken: authToken, - monitorId: monitorId, - sortOrder: "desc", - limit: null, - dateRange: dateRange, - filter: null, - page: paginationController.page, - rowsPerPage: paginationController.rowsPerPage, - }); - setChecks(res.data.data.checks); - setChecksCount(res.data.data.checksCount); - } catch (error) { - logger.error(error); - } - }; - fetchPage(); - }, [ - authToken, - monitorId, - dateRange, - paginationController.page, - paginationController.rowsPerPage, - ]); - - const handlePageChange = (_, newPage) => { - setPaginationController({ - ...paginationController, - page: newPage - 1, // 0-indexed - }); - }; - - let paginationComponent = <>; - if (checksCount > paginationController.rowsPerPage) { - paginationComponent = ( - ( - - )} - /> - ); - } - - return ( - <> - - - - - Status - Date & Time - Status Code - Message - - - - {checks.map((check) => { - const status = check.status === true ? "up" : "down"; - - return ( - - - - - - {formatDateWithTz( - check.createdAt, - "ddd, MMMM D, YYYY, HH:mm A", - uiTimezone - )} - - {check.statusCode ? check.statusCode : "N/A"} - {check.message} - - ); - })} - -
-
- {paginationComponent} - - ); -}; - -PaginationTable.propTypes = { - monitorId: PropTypes.string.isRequired, - dateRange: PropTypes.string.isRequired, -}; - -export default PaginationTable; diff --git a/Client/src/Pages/Uptime/Details/index.css b/Client/src/Pages/Uptime/Details/index.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/Client/src/Pages/Uptime/Details/index.jsx b/Client/src/Pages/Uptime/Details/index.jsx deleted file mode 100644 index d5be671d3..000000000 --- a/Client/src/Pages/Uptime/Details/index.jsx +++ /dev/null @@ -1,476 +0,0 @@ -import PropTypes from "prop-types"; -import { useEffect, useState, useCallback } from "react"; -import { Box, Button, Stack, Tooltip, Typography, useTheme } from "@mui/material"; -import { useSelector } from "react-redux"; -import { useNavigate, useParams } from "react-router-dom"; -import { networkService } from "../../../main"; -import { logger } from "../../../Utils/Logger"; -import MonitorDetailsAreaChart from "../../../Components/Charts/MonitorDetailsAreaChart"; -import ButtonGroup from "@mui/material/ButtonGroup"; -import SettingsIcon from "../../../assets/icons/settings-bold.svg?react"; -import UptimeIcon from "../../../assets/icons/uptime-icon.svg?react"; -import ResponseTimeIcon from "../../../assets/icons/response-time-icon.svg?react"; -import AverageResponseIcon from "../../../assets/icons/average-response-icon.svg?react"; -import IncidentsIcon from "../../../assets/icons/incidents.svg?react"; -import HistoryIcon from "../../../assets/icons/history-icon.svg?react"; -import PaginationTable from "./PaginationTable"; -import Breadcrumbs from "../../../Components/Breadcrumbs"; -import PulseDot from "../../../Components/Animated/PulseDot"; -import { ChartBox } from "./styled"; -import SkeletonLayout from "./skeleton"; -import "./index.css"; -import useUtils from "../utils"; -import { formatDateWithTz, formatDurationSplit } from "../../../Utils/timeUtils"; -import { useIsAdmin } from "../../../Hooks/useIsAdmin"; -import IconBox from "../../../Components/IconBox"; -import StatBox from "../../../Components/StatBox"; -import UpBarChart from "./Charts/UpBarChart"; -import DownBarChart from "./Charts/DownBarChart"; -import ResponseGaugeChart from "./Charts/ResponseGaugeChart"; -/** - * Details page component displaying monitor details and related information. - * @component - */ -const DetailsPage = () => { - const theme = useTheme(); - const { statusColor, statusMsg, determineState } = useUtils(); - const isAdmin = useIsAdmin(); - const [monitor, setMonitor] = useState({}); - const { monitorId } = useParams(); - const { authToken } = useSelector((state) => state.auth); - const [dateRange, setDateRange] = useState("day"); - const [certificateExpiry, setCertificateExpiry] = useState("N/A"); - const navigate = useNavigate(); - - const certificateDateFormat = "MMM D, YYYY h A"; - const dateFormat = dateRange === "day" ? "MMM D, h A" : "MMM D"; - const uiTimezone = useSelector((state) => state.ui.timezone); - - const fetchMonitor = useCallback(async () => { - try { - const res = await networkService.getUptimeDetailsById({ - authToken: authToken, - monitorId: monitorId, - dateRange: dateRange, - normalize: true, - }); - setMonitor(res?.data?.data ?? {}); - } catch (error) { - logger.error(error); - navigate("/not-found", { replace: true }); - } - }, [authToken, monitorId, navigate, dateRange]); - - useEffect(() => { - fetchMonitor(); - }, [fetchMonitor]); - - useEffect(() => { - const fetchCertificate = async () => { - if (monitor?.type !== "http") { - return; - } - try { - const res = await networkService.getCertificateExpiry({ - authToken: authToken, - monitorId: monitorId, - }); - if (res?.data?.data?.certificateDate) { - const date = res.data.data.certificateDate; - setCertificateExpiry( - formatDateWithTz(date, certificateDateFormat, uiTimezone) ?? "N/A" - ); - } - } catch (error) { - setCertificateExpiry("N/A"); - console.error(error); - } - }; - fetchCertificate(); - }, [authToken, monitorId, monitor, uiTimezone, dateFormat]); - - const splitDuration = (duration) => { - const { time, format } = formatDurationSplit(duration); - return ( - <> - {time} - {format} - - ); - }; - - let loading = Object.keys(monitor).length === 0; - - const [hoveredUptimeData, setHoveredUptimeData] = useState(null); - const [hoveredIncidentsData, setHoveredIncidentsData] = useState(null); - - const BREADCRUMBS = [ - { name: "uptime", path: "/uptime" }, - { name: "details", path: `/uptime/${monitorId}` }, - ]; - return ( - - {loading ? ( - - ) : ( - <> - - - - - - {monitor.name} - - - {/* TODO there is a tooltip at BarChart component. Wrap the Tooltip on our own component */} - - - - - - - {monitor.url?.replace(/^https?:\/\//, "") || "..."} - - - {/* Checking every {formatDurationRounded(monitor?.interval)}. */} - - - - - {isAdmin && ( - - )} - - - - - - - {monitor?.latestResponseTime} - {"ms"} - - } - /> - - {certificateExpiry} - - } - /> - - - - - Showing statistics for past{" "} - {dateRange === "day" - ? "24 hours" - : dateRange === "week" - ? "7 days" - : "30 days"} - . - - - - - - - - - - - - - - Uptime - - - - Total Checks - - {hoveredUptimeData !== null - ? hoveredUptimeData.totalChecks - : (monitor?.groupedUpChecks?.reduce((count, checkGroup) => { - return count + checkGroup.totalChecks; - }, 0) ?? 0)} - - {hoveredUptimeData !== null && hoveredUptimeData.time !== null && ( - - {formatDateWithTz( - hoveredUptimeData._id, - dateFormat, - uiTimezone - )} - - )} - - - - {hoveredUptimeData !== null - ? "Avg Response Time" - : "Uptime Percentage"} - - - {hoveredUptimeData !== null - ? Math.floor(hoveredUptimeData?.avgResponseTime ?? 0) - : Math.floor( - ((monitor?.upChecks?.totalChecks ?? 0) / - (monitor?.totalChecks ?? 1)) * - 100 - )} - - {hoveredUptimeData !== null ? " ms" : " %"} - - - - - - - - - - - - Incidents - - - Total Incidents - - {hoveredIncidentsData !== null - ? hoveredIncidentsData.totalChecks - : (monitor?.groupedDownChecks?.reduce((count, checkGroup) => { - return count + checkGroup.totalChecks; - }, 0) ?? 0)} - - {hoveredIncidentsData !== null && - hoveredIncidentsData.time !== null && ( - - {formatDateWithTz( - hoveredIncidentsData._id, - dateFormat, - uiTimezone - )} - - )} - - - - - - - - - Average Response Time - - - - - - - - - Response Times - - - - - - - - - - History - - - - - - - - - )} - - ); -}; - -DetailsPage.propTypes = { - isAdmin: PropTypes.bool, -}; -export default DetailsPage; diff --git a/Client/src/Pages/Uptime/Details/skeleton.jsx b/Client/src/Pages/Uptime/Details/skeleton.jsx deleted file mode 100644 index 0bdc03ca8..000000000 --- a/Client/src/Pages/Uptime/Details/skeleton.jsx +++ /dev/null @@ -1,120 +0,0 @@ -import { Box, Skeleton, Stack, useTheme } from "@mui/material"; - -/** - * Renders a skeleton layout. - * - * @returns {JSX.Element} - */ -const SkeletonLayout = () => { - const theme = useTheme(); - - return ( - <> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; - -export default SkeletonLayout; diff --git a/Client/src/Pages/Uptime/Details/styled.jsx b/Client/src/Pages/Uptime/Details/styled.jsx deleted file mode 100644 index 164fee457..000000000 --- a/Client/src/Pages/Uptime/Details/styled.jsx +++ /dev/null @@ -1,45 +0,0 @@ -import { Stack, styled } from "@mui/material"; - -export const ChartBox = styled(Stack)(({ theme }) => ({ - flex: "1 30%", - gap: theme.spacing(8), - height: 300, - minWidth: 250, - padding: theme.spacing(8), - border: 1, - borderStyle: "solid", - borderColor: theme.palette.primary.lowContrast, - borderRadius: 4, - backgroundColor: theme.palette.primary.main, - "& h2": { - color: theme.palette.primary.contrastTextSecondary, - fontSize: 15, - fontWeight: 500, - }, - "& .MuiBox-root:not(.area-tooltip) p": { - color: theme.palette.primary.contrastTextTertiary, - fontSize: 13, - }, - "& .MuiBox-root > span": { - color: theme.palette.primary.contrastText, - fontSize: 20, - "& span": { - opacity: 0.8, - marginLeft: 2, - fontSize: 15, - }, - }, - "& .MuiStack-root": { - flexDirection: "row", - gap: theme.spacing(6), - }, - "& .MuiStack-root:first-of-type": { - alignItems: "center", - }, - "& tspan, & text": { - fill: theme.palette.primary.contrastTextTertiary, - }, - "& path": { - transition: "fill 300ms ease, stroke-width 400ms ease", - }, -})); diff --git a/Client/src/Pages/Uptime/Home/UptimeDataTable/Skeleton/index.jsx b/Client/src/Pages/Uptime/Home/UptimeDataTable/Skeleton/index.jsx deleted file mode 100644 index c17f6d74b..000000000 --- a/Client/src/Pages/Uptime/Home/UptimeDataTable/Skeleton/index.jsx +++ /dev/null @@ -1,47 +0,0 @@ -import { Skeleton } from "@mui/material"; -import DataTable from "../../../../../Components/Table"; -const ROWS_NUMBER = 7; -const ROWS_ARRAY = Array.from({ length: ROWS_NUMBER }, (_, i) => i); - -const TableSkeleton = () => { - /* TODO Skeleton does not follow light and dark theme */ - - const headers = [ - { - id: "name", - - content: "Host", - - render: () => , - }, - { - id: "status", - content: "Status", - render: () => , - }, - { - id: "responseTime", - content: "Response Time", - render: () => , - }, - { - id: "type", - content: "Type", - render: () => , - }, - { - id: "actions", - content: "Actions", - render: () => , - }, - ]; - - return ( - - ); -}; - -export { TableSkeleton }; diff --git a/Client/src/Pages/Uptime/Home/UptimeDataTable/index.jsx b/Client/src/Pages/Uptime/Home/UptimeDataTable/index.jsx deleted file mode 100644 index 6961c6d5c..000000000 --- a/Client/src/Pages/Uptime/Home/UptimeDataTable/index.jsx +++ /dev/null @@ -1,325 +0,0 @@ -// Components -import { Box, Stack, CircularProgress } from "@mui/material"; -import Search from "../../../../Components/Inputs/Search"; -import { Heading } from "../../../../Components/Heading"; -import DataTable from "../../../../Components/Table"; -import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded"; -import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded"; -import Host from "../host"; -import { StatusLabel } from "../../../../Components/Label"; -import BarChart from "../../../../Components/Charts/BarChart"; -import ActionsMenu from "../actionsMenu"; - -// Utils -import { useTheme } from "@emotion/react"; -import useUtils from "../../utils"; -import { useState, memo, useCallback } from "react"; -import { useNavigate } from "react-router-dom"; -import "../index.css"; -import PropTypes from "prop-types"; - -const SearchComponent = memo( - ({ monitors, debouncedSearch, onSearchChange, setIsSearching }) => { - const [localSearch, setLocalSearch] = useState(debouncedSearch); - const handleSearch = useCallback( - (value) => { - setIsSearching(true); - setLocalSearch(value); - onSearchChange(value); - }, - [onSearchChange, setIsSearching] - ); - - return ( - - - - ); - } -); -SearchComponent.displayName = "SearchComponent"; -SearchComponent.propTypes = { - monitors: PropTypes.array, - debouncedSearch: PropTypes.string, - onSearchChange: PropTypes.func, - setIsSearching: PropTypes.func, -}; - -/** - * UptimeDataTable displays a table of uptime monitors with sorting, searching, and action capabilities - * @param {Object} props - Component props - * @param {boolean} props.isAdmin - Whether the current user has admin privileges - * @param {boolean} props.isLoading - Loading state of the table - * @param {Array<{ - * _id: string, - * url: string, - * title: string, - * percentage: number, - * percentageColor: string, - * monitor: { - * _id: string, - * type: string, - * checks: Array - * } - * }>} props.monitors - Array of monitor objects to display - * @param {number} props.monitorCount - Total count of monitors - * @param {Object} props.sort - Current sort configuration - * @param {string} props.sort.field - Field to sort by - * @param {'asc'|'desc'} props.sort.order - Sort direction - * @param {Function} props.setSort - Callback to update sort configuration - * @param {string} props.search - Current search query - * @param {Function} props.setSearch - Callback to update search query - * @param {boolean} props.isSearching - Whether a search is in progress - * @param {Function} props.setIsSearching - Callback to update search state - * @param {Function} props.setIsLoading - Callback to update loading state - * @param {Function} props.triggerUpdate - Callback to trigger a data refresh - * @returns {JSX.Element} Rendered component - */ -const UptimeDataTable = ({ - isAdmin, - isLoading, - monitors, - filteredMonitors, - monitorCount, - sort, - setSort, - debouncedSearch, - setSearch, - isSearching, - setIsSearching, - setIsLoading, - triggerUpdate, -}) => { - const { determineState } = useUtils(); - - const theme = useTheme(); - const navigate = useNavigate(); - - const handleSort = (field) => { - let order = ""; - if (sort.field !== field) { - order = "desc"; - } else { - order = sort.order === "asc" ? "desc" : "asc"; - } - setSort({ field, order }); - }; - - const headers = [ - { - id: "name", - content: ( - handleSort("name")} - > - Host - - {sort.order === "asc" ? ( - - ) : ( - - )} - - - ), - render: (row) => ( - - ), - }, - { - id: "status", - content: ( - handleSort("status")} - > - {" "} - Status - - {sort.order === "asc" ? ( - - ) : ( - - )} - - - ), - render: (row) => { - const status = determineState(row.monitor); - return ( - - ); - }, - }, - { - id: "responseTime", - content: "Response Time", - render: (row) => , - }, - { - id: "type", - content: "Type", - render: (row) => ( - {row.monitor.type} - ), - }, - { - id: "actions", - content: "Actions", - render: (row) => ( - - ), - }, - ]; - - return ( - - - Uptime monitors - {/* TODO Same as the one in Infrastructure. Create component */} - - {monitorCount} - - - - - - {(isSearching || isLoading) && ( - <> - - - - - - )} - { - navigate(`/uptime/${row.id}`); - }, - emptyView: "No monitors found", - }} - /> - - - ); -}; - -const MemoizedUptimeDataTable = memo(UptimeDataTable); -export default MemoizedUptimeDataTable; - -UptimeDataTable.propTypes = { - isAdmin: PropTypes.bool, - isLoading: PropTypes.bool, - monitors: PropTypes.array, - filteredMonitors: PropTypes.array, - monitorCount: PropTypes.number, - sort: PropTypes.shape({ - field: PropTypes.string, - order: PropTypes.oneOf(["asc", "desc"]), - }), - setSort: PropTypes.func, - debouncedSearch: PropTypes.string, - setSearch: PropTypes.func, - isSearching: PropTypes.bool, - setIsSearching: PropTypes.func, - setIsLoading: PropTypes.func, - triggerUpdate: PropTypes.func, -}; diff --git a/Client/src/Pages/Uptime/Home/fallback.jsx b/Client/src/Pages/Uptime/Home/fallback.jsx deleted file mode 100644 index 2606ca95f..000000000 --- a/Client/src/Pages/Uptime/Home/fallback.jsx +++ /dev/null @@ -1,59 +0,0 @@ -import { Box, Button, Stack, Typography } from "@mui/material"; -import { useTheme } from "@emotion/react"; -import { useNavigate } from "react-router-dom"; -import { useSelector } from "react-redux"; -import PlaceholderLight from "../../../assets/Images/data_placeholder.svg?react"; -import PlaceholderDark from "../../../assets/Images/data_placeholder_dark.svg?react"; -import PropTypes from "prop-types"; - -const Fallback = ({ isAdmin }) => { - const theme = useTheme(); - const navigate = useNavigate(); - const mode = useSelector((state) => state.ui.mode); - - return ( - - - {mode === "light" ? : } - - - No monitors found to display - - - It looks like you don’t have any monitors set up yet. - - {isAdmin && ( - - )} - - ); -}; - -Fallback.propTypes = { - isAdmin: PropTypes.bool, -}; - -export default Fallback; diff --git a/Client/src/Pages/Uptime/Home/index.css b/Client/src/Pages/Uptime/Home/index.css deleted file mode 100644 index adb1d8674..000000000 --- a/Client/src/Pages/Uptime/Home/index.css +++ /dev/null @@ -1,6 +0,0 @@ -/* TODO take these from here and declare using emotion. Plus, the values should live in the theme */ -.monitors .MuiStack-root > button:not(.MuiIconButton-root) { - font-size: var(--env-var-font-size-medium); - height: var(--env-var-height-2); - min-width: fit-content; -} diff --git a/Client/src/Pages/Uptime/Home/index.jsx b/Client/src/Pages/Uptime/Home/index.jsx deleted file mode 100644 index 446702ebb..000000000 --- a/Client/src/Pages/Uptime/Home/index.jsx +++ /dev/null @@ -1,244 +0,0 @@ -// Components -import { Box, Stack, Button } from "@mui/material"; -import Greeting from "../../../Utils/greeting"; -import SkeletonLayout from "./skeleton"; -import Fallback from "./fallback"; -import StatusBox from "./StatusBox"; -import UptimeDataTable from "./UptimeDataTable"; -import Pagination from "../../../Components/Table/TablePagination"; - -// Utils -import { useTheme } from "@emotion/react"; -import { useEffect, useState, useCallback, useMemo } from "react"; -import { setRowsPerPage } from "../../../Features/UI/uiSlice"; -import { useIsAdmin } from "../../../Hooks/useIsAdmin"; -import { useSelector, useDispatch } from "react-redux"; -import { useNavigate } from "react-router-dom"; -import { createToast } from "../../../Utils/toastUtils"; -import Breadcrumbs from "../../../Components/Breadcrumbs"; -import useDebounce from "../../../Utils/debounce"; -import { networkService } from "../../../main"; - -const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }]; - -const UptimeMonitors = () => { - // Redux state - const rowsPerPage = useSelector((state) => state.ui.monitors.rowsPerPage); - // Local state - const [sort, setSort] = useState({}); - const [search, setSearch] = useState(""); - const [page, setPage] = useState(0); - const [isSearching, setIsSearching] = useState(false); - const [isLoading, setIsLoading] = useState(false); - const [monitorUpdateTrigger, setMonitorUpdateTrigger] = useState(false); - const [monitors, setMonitors] = useState([]); - const [filteredMonitors, setFilteredMonitors] = useState([]); - const [monitorsSummary, setMonitorsSummary] = useState({}); - - // Utils - const debouncedFilter = useDebounce(search, 500); - const dispatch = useDispatch(); - const theme = useTheme(); - const navigate = useNavigate(); - const isAdmin = useIsAdmin(); - - const authState = useSelector((state) => state.auth); - - const fetchParams = useMemo( - () => ({ - authToken: authState.authToken, - teamId: authState.user.teamId, - sort: { field: sort.field, order: sort.order }, - filter: debouncedFilter, - page, - rowsPerPage, - }), - [authState.authToken, authState.user.teamId, sort, debouncedFilter, page, rowsPerPage] - ); - - const getMonitorWithPercentage = useCallback((monitor, theme) => { - let uptimePercentage = ""; - let percentageColor = ""; - - if (monitor.uptimePercentage !== undefined) { - uptimePercentage = - monitor.uptimePercentage === 0 - ? "0" - : (monitor.uptimePercentage * 100).toFixed(2); - - percentageColor = - monitor.uptimePercentage < 0.25 - ? theme.palette.error.main - : monitor.uptimePercentage < 0.5 - ? theme.palette.warning.main - : monitor.uptimePercentage < 0.75 - ? theme.palette.success.main - : theme.palette.success.main; - } - - return { - id: monitor._id, - name: monitor.name, - url: monitor.url, - title: monitor.name, - percentage: uptimePercentage, - percentageColor, - monitor: monitor, - }; - }, []); - - const fetchMonitors = useCallback(async () => { - try { - setIsLoading(true); - const config = fetchParams; - const res = await networkService.getMonitorsByTeamId({ - authToken: config.authToken, - teamId: config.teamId, - limit: 25, - types: ["http", "ping", "docker", "port"], - page: config.page, - rowsPerPage: config.rowsPerPage, - filter: config.filter, - field: config.sort.field, - order: config.sort.order, - }); - const { monitors, filteredMonitors, summary } = res.data.data; - const mappedMonitors = filteredMonitors.map((monitor) => - getMonitorWithPercentage(monitor, theme) - ); - setMonitors(monitors); - setFilteredMonitors(mappedMonitors); - setMonitorsSummary(summary); - } catch (error) { - createToast({ - body: error.message, - }); - } finally { - setIsLoading(false); - setIsSearching(false); - } - }, [fetchParams, getMonitorWithPercentage, theme]); - - useEffect(() => { - fetchMonitors(); - }, [fetchMonitors, monitorUpdateTrigger]); - - const handleChangePage = (event, newPage) => { - setPage(newPage); - }; - - const handleChangeRowsPerPage = (event) => { - dispatch( - setRowsPerPage({ - value: parseInt(event.target.value, 10), - table: "monitors", - }) - ); - setPage(0); - }; - - const triggerUpdate = useCallback(() => { - setMonitorUpdateTrigger((prev) => !prev); - }, []); - const totalMonitors = monitorsSummary?.totalMonitors ?? 0; - const hasMonitors = totalMonitors > 0; - const canAddMonitor = isAdmin && hasMonitors; - - return ( - - - - - {canAddMonitor && ( - <> - - - )} - - - - { - <> - {!isLoading && !hasMonitors && } - {isLoading ? ( - - ) : ( - hasMonitors && ( - <> - - - - - - - - - ) - )} - - } - - ); -}; - -export default UptimeMonitors; diff --git a/Client/src/Routes/index.jsx b/Client/src/Routes/index.jsx deleted file mode 100644 index b5f4dd376..000000000 --- a/Client/src/Routes/index.jsx +++ /dev/null @@ -1,172 +0,0 @@ -import { Navigate, Route, Routes as LibRoutes } from "react-router"; -import HomeLayout from "../Components/Layouts/HomeLayout"; -import { Infrastructure } from "../Pages/Infrastructure"; -import InfrastructureDetails from "../Pages/Infrastructure/Details"; -import NotFound from "../Pages/NotFound"; -import Login from "../Pages/Auth/Login/Login"; -import Register from "../Pages/Auth/Register/Register"; -import Account from "../Pages/Account"; -import Monitors from "../Pages/Uptime/Home"; -import CreateMonitor from "../Pages/Uptime/CreateUptime"; -import CreateInfrastructureMonitor from "../Pages/Infrastructure/CreateMonitor"; -import Incidents from "../Pages/Incidents"; -import Status from "../Pages/Status"; -import Integrations from "../Pages/Integrations"; -import Settings from "../Pages/Settings"; -import ForgotPassword from "../Pages/Auth/ForgotPassword"; -import CheckEmail from "../Pages/Auth/CheckEmail"; -import SetNewPassword from "../Pages/Auth/SetNewPassword"; -import NewPasswordConfirmed from "../Pages/Auth/NewPasswordConfirmed"; -import ProtectedRoute from "../Components/ProtectedRoute"; -import Details from "../Pages/Uptime/Details"; -import Maintenance from "../Pages/Maintenance"; -import Configure from "../Pages/Uptime/Configure"; -import PageSpeed from "../Pages/PageSpeed"; -import CreatePageSpeed from "../Pages/PageSpeed/CreatePageSpeed"; -import CreateNewMaintenanceWindow from "../Pages/Maintenance/CreateMaintenance"; -import PageSpeedDetails from "../Pages/PageSpeed/Details"; -import PageSpeedConfigure from "../Pages/PageSpeed/Configure"; -import withAdminCheck from "../Components/HOC/withAdminCheck"; - -const Routes = () => { - const AdminCheckedRegister = withAdminCheck(Register); - return ( - - - - - } - > - } - /> - } - /> - - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - - - } - /> - - } - /> - - } - /> - - } - /> - } - /> - } - /> - } - /> - - } - /> - - ); -}; - -export { Routes }; diff --git a/Client/src/Utils/Theme/globalTheme.js b/Client/src/Utils/Theme/globalTheme.js deleted file mode 100644 index 12c377b3e..000000000 --- a/Client/src/Utils/Theme/globalTheme.js +++ /dev/null @@ -1,313 +0,0 @@ -import { typographyLevels } from "./constants"; - -const fontFamilyPrimary = '"Inter" , sans-serif'; -// const fontFamilySecondary = '"Avenir", sans-serif'; - -/* TODO take the color out from here */ -const shadow = - "0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)"; - -const baseTheme = (palette) => ({ - typography: { - fontFamily: fontFamilyPrimary, - fontSize: 14, - h1: { - fontSize: typographyLevels.xl, - color: palette.primary.contrastText, - fontWeight: 500, - }, - h2: { - fontSize: typographyLevels.l, - color: palette.primary.contrastTextSecondary, - fontWeight: 400, - }, - body1: { - fontSize: typographyLevels.m, - color: palette.primary.contrastTextTertiary, - fontWeight: 400, - }, - body2: { - fontSize: typographyLevels.s, - color: palette.primary.contrastTextTertiary, - fontWeight: 400, - }, - }, - /* TODO change to 4 */ - spacing: 2, - /* TODO we can skip using the callback functions on the next lines since we are already accessing it on line 10. That was the last thing I managed to do, so we are sort of doing it twice*/ - /* TODO All these should live inside of a component*/ - components: { - MuiButton: { - defaultProps: { - disableRipple: true, - }, - - styleOverrides: { - root: ({ theme }) => ({ - variants: [ - { - props: (props) => props.color === "accent", - style: { - "&:hover": { - backgroundColor: theme.palette.accent.darker, - }, - }, - }, - { - props: (props) => props.variant === "group", - style: { - /* color: theme.palette.secondary.contrastText, */ - color: theme.palette.primary.contrastText, - backgroundColor: theme.palette.primary.main, - border: 1, - borderStyle: "solid", - borderColor: theme.palette.primary.lowContrast, - }, - }, - { - props: (props) => props.variant === "group" && props.filled === "true", - style: { - backgroundColor: theme.palette.secondary.main, - }, - }, - /* { - props: (props) => props.variant === "contained", - style: { - backgroundColor: `${theme.palette.accent.main} !important`, - }, - }, */ - - { - props: (props) => - props.variant === "contained" && props.color === "secondary", - style: { - border: 1, - borderStyle: "solid", - borderColor: theme.palette.primary.lowContrast, - }, - }, - { - props: (props) => { - return ( - props.variant === "contained" && - props.disabled && - props.classes.loadingIndicator === undefined // Do not apply to loading button - ); - }, - style: { - backgroundColor: `${theme.palette.secondary.main} !important`, - color: `${theme.palette.secondary.contrastText} !important`, - }, - }, - ], - fontWeight: 400, - borderRadius: 4, - boxShadow: "none", - textTransform: "none", - "&:focus": { - outline: "none", - }, - "&:hover": { - boxShadow: "none", - }, - "&.MuiLoadingButton-root": { - "&:disabled": { - backgroundColor: theme.palette.secondary.main, - color: theme.palette.primary.contrastText, - }, - "&.MuiButton-colorAccent:hover": { - boxShadow: `0 0 0 1px ${theme.palette.accent.main}`, // CAIO_REVIEW, this should really have a solid BG color - }, - }, - "&.MuiLoadingButton-loading": { - "& .MuiLoadingButton-label": { - color: "transparent", - }, - "& .MuiLoadingButton-loadingIndicator": { - color: "inherit", - }, - }, - }), - }, - }, - - MuiIconButton: { - styleOverrides: { - root: ({ theme }) => ({ - padding: 4, - transition: "none", - "&:hover": { - backgroundColor: theme.palette.primary.lowContrast, - }, - }), - }, - }, - MuiPaper: { - styleOverrides: { - root: ({ theme }) => { - return { - marginTop: 4, - padding: 0, - border: 1, - borderStyle: "solid", - borderColor: theme.palette.primary.lowContrast, - borderRadius: 4, - boxShadow: shadow, - backgroundColor: theme.palette.primary.main, - backgroundImage: "none", - }; - }, - }, - }, - MuiList: { - styleOverrides: { - root: { - padding: 0, - }, - }, - }, - MuiListItemButton: { - styleOverrides: { - root: { - transition: "none", - }, - }, - }, - MuiMenuItem: { - styleOverrides: { - root: ({ theme }) => ({ - borderRadius: 4, - backgroundColor: "inherit", - padding: "4px 6px", - color: theme.palette.primary.contrastTextSecondary, - fontSize: 13, - margin: 2, - minWidth: 100, - "&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected.Mui-focusVisible": - { - backgroundColor: theme.palette.primary.lowContrast, - }, - }), - }, - }, - MuiTableCell: { - styleOverrides: { - root: ({ theme }) => ({ - borderBottomColor: theme.palette.primary.lowContrast, - }), - }, - }, - MuiTableHead: { - styleOverrides: { - root: ({ theme }) => ({ - backgroundColor: theme.palette.tertiary.main, - }), - }, - }, - MuiPagination: { - styleOverrides: { - root: ({ theme }) => ({ - backgroundColor: theme.palette.primary.main, - border: 1, - borderStyle: "solid", - borderColor: theme.palette.primary.lowContrast, - "& button": { - color: theme.palette.primary.contrastTextTertiary, - borderRadius: 4, - }, - "& li:first-of-type button, & li:last-of-type button": { - border: 1, - borderStyle: "solid", - borderColor: theme.palette.primary.lowContrast, - }, - }), - }, - }, - MuiPaginationItem: { - styleOverrides: { - root: ({ theme }) => ({ - "&:not(.MuiPaginationItem-ellipsis):hover, &.Mui-selected": { - backgroundColor: theme.palette.primary.lowContrast, - }, - }), - }, - }, - MuiSkeleton: { - styleOverrides: { - root: ({ theme }) => ({ - backgroundColor: theme.palette.primary.lowContrast, - }), - }, - }, - MuiTextField: { - styleOverrides: { - root: ({ theme }) => ({ - "& fieldset": { - borderColor: theme.palette.primary.lowContrast, - borderRadius: theme.shape.borderRadius, - }, - "& .MuiInputBase-input": { - padding: ".75em", - minHeight: "var(--env-var-height-2)", - fontSize: "var(--env-var-font-size-medium)", - fontWeight: 400, - color: palette.primary.contrastTextSecondary, - "&.Mui-disabled": { - opacity: 0.3, - WebkitTextFillColor: "unset", - }, - "& .Mui-focused": { - /* color: "#ff0000", */ - /* borderColor: theme.palette.primary.contrastText, */ - }, - }, - "& .MuiInputBase-input:-webkit-autofill": { - transition: "background-color 5000s ease-in-out 0s", - WebkitBoxShadow: `0 0 0px 1000px ${theme.palette.primary.main} inset`, - WebkitTextFillColor: theme.palette.primary.contrastText, - }, - "& .MuiInputBase-input.MuiOutlinedInput-input": { - padding: "0 var(--env-var-spacing-1-minus) !important", - }, - "& .MuiOutlinedInput-root": { - color: theme.palette.primary.contrastTextSecondary, - borderRadius: 4, - }, - "& .MuiOutlinedInput-notchedOutline": { - borderRadius: 4, - }, - - "& .MuiFormHelperText-root": { - color: palette.error.main, - opacity: 0.8, - fontSize: "var(--env-var-font-size-medium)", - - marginLeft: 0, - }, - "& .MuiFormHelperText-root.Mui-error": { - opacity: 0.8, - fontSize: "var(--env-var-font-size-medium)", - color: palette.error.main, - }, - }), - }, - }, - MuiOutlinedInput: { - styleOverrides: { - root: { - color: palette.primary.contrastTextTertiary, - "&.Mui-focused .MuiOutlinedInput-notchedOutline": { - borderColor: palette.primary.contrastTextTertiary, - }, - }, - }, - }, - }, - shape: { - borderRadius: 2, - borderThick: 2, - boxShadow: shadow, - }, -}); - -export { baseTheme }; diff --git a/Client/src/Utils/stringUtils.js b/Client/src/Utils/stringUtils.js deleted file mode 100644 index 43ae5ed54..000000000 --- a/Client/src/Utils/stringUtils.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Helper function to get first letter capitalized string - * @param {string} str String whose first letter is to be capitalized - * @returns A string with first letter capitalized - */ -export const capitalizeFirstLetter = (str) => { - if (str === null || str === undefined) { - return ""; - } - if (typeof str !== "string") { - throw new TypeError("Input must be a string"); - } - if (str.length === 0) { - return ""; - } - return str.charAt(0).toUpperCase() + str.slice(1); -}; diff --git a/Docker/dev/client.Dockerfile b/Docker/dev/client.Dockerfile deleted file mode 100644 index 37b2bae74..000000000 --- a/Docker/dev/client.Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:20-alpine AS build - -WORKDIR /app - -COPY ../../Client/package*.json ./ - -RUN npm install - -COPY ../../Client . - -RUN npm run build-dev - -RUN npm install -g serve - -CMD ["serve","-s", "dist", "-l", "5173"] diff --git a/Docker/dev/docker-compose.yaml b/Docker/dev/docker-compose.yaml deleted file mode 100644 index f8b2c6936..000000000 --- a/Docker/dev/docker-compose.yaml +++ /dev/null @@ -1,40 +0,0 @@ -services: - client: - image: uptime_client:latest - restart: always - ports: - - "5173:5173" - - depends_on: - - server - server: - image: uptime_server:latest - restart: always - ports: - - "5000:5000" - env_file: - - server.env - depends_on: - - redis - - mongodb - redis: - image: uptime_redis:latest - restart: always - ports: - - "6379:6379" - volumes: - - ./redis/data:/data - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 30s - timeout: 10s - retries: 5 - start_period: 5s - mongodb: - image: uptime_database_mongo:latest - restart: always - command: ["mongod", "--quiet"] - ports: - - "27017:27017" - volumes: - - ./mongo/data:/data/db diff --git a/Docker/dist/docker-compose.yaml b/Docker/dist/docker-compose.yaml deleted file mode 100644 index a73b75dc6..000000000 --- a/Docker/dist/docker-compose.yaml +++ /dev/null @@ -1,45 +0,0 @@ -services: - client: - image: bluewaveuptime/uptime_client:latest - restart: always - environment: - UPTIME_APP_API_BASE_URL: "http://localhost:5000/api/v1" - ports: - - "80:80" - - "443:443" - depends_on: - - server - server: - image: bluewaveuptime/uptime_server:latest - restart: always - ports: - - "5000:5000" - depends_on: - - redis - - mongodb - environment: - - DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db - - REDIS_HOST=redis - # volumes: - # - /var/run/docker.sock:/var/run/docker.sock:ro - redis: - image: bluewaveuptime/uptime_redis:latest - restart: always - ports: - - "6379:6379" - volumes: - - ./redis/data:/data - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 30s - timeout: 10s - retries: 5 - start_period: 5s - mongodb: - image: bluewaveuptime/uptime_database_mongo:latest - restart: always - volumes: - - ./mongo/data:/data/db - command: ["mongod", "--quiet"] - ports: - - "27017:27017" diff --git a/Docker/dist/server.Dockerfile b/Docker/dist/server.Dockerfile deleted file mode 100644 index 3a9ed5907..000000000 --- a/Docker/dist/server.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:20-alpine - -WORKDIR /app - -COPY ../../Server/package*.json ./ - -RUN npm install - -COPY ../../Server/ ./ - -EXPOSE 5000 - -CMD ["node", "index.js"] \ No newline at end of file diff --git a/Docker/prod/mongoDB.Dockerfile b/Docker/prod/mongoDB.Dockerfile deleted file mode 100644 index 80c8b9c8f..000000000 --- a/Docker/prod/mongoDB.Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mongo -COPY ./Docker/prod/mongo/init/create_users.js /docker-entrypoint-initdb.d/ -EXPOSE 27017 -CMD ["mongod"] diff --git a/Docker/test/build_images.sh b/Docker/test/build_images.sh deleted file mode 100755 index c879190bc..000000000 --- a/Docker/test/build_images.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Change directory to root directory for correct Docker Context -cd "$(dirname "$0")" -cd ../.. - -# Define an array of services and their Dockerfiles -declare -A services=( - ["uptime_client"]="./Docker/prod/client.Dockerfile" - ["uptime_database_mongo"]="./Docker/prod/mongoDB.Dockerfile" - ["uptime_redis"]="./Docker/prod/redis.Dockerfile" - ["uptime_server"]="./Docker/prod/server.Dockerfile" -) - -# Loop through each service and build the corresponding image -for service in "${!services[@]}"; do - docker build -f "${services[$service]}" -t "$service" . - - # Check if the build succeeded - if [ $? -ne 0 ]; then - echo "Error building $service image. Exiting..." - exit 1 - fi -done - -echo "All images built successfully" \ No newline at end of file diff --git a/Docker/test/mongo/init/create_users.js b/Docker/test/mongo/init/create_users.js deleted file mode 100644 index 67a21f910..000000000 --- a/Docker/test/mongo/init/create_users.js +++ /dev/null @@ -1,16 +0,0 @@ -var username = process.env.USERNAME_ENV_VAR; -var password = process.env.PASSWORD_ENV_VAR; - -db = db.getSiblingDB("uptime_db"); - -db.createUser({ - user: username, - pwd: password, - roles: [ - { - role: "readWrite", - db: "uptime_db", - }, - ], -}); -print("User uptime_user created successfully"); diff --git a/Docker/test/mongoDB.Dockerfile b/Docker/test/mongoDB.Dockerfile deleted file mode 100644 index 80c8b9c8f..000000000 --- a/Docker/test/mongoDB.Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mongo -COPY ./Docker/prod/mongo/init/create_users.js /docker-entrypoint-initdb.d/ -EXPOSE 27017 -CMD ["mongod"] diff --git a/Docker/test/prod/client.Dockerfile b/Docker/test/prod/client.Dockerfile deleted file mode 100644 index 1619b5e41..000000000 --- a/Docker/test/prod/client.Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM node:20-alpine AS build - -WORKDIR /app - -COPY ../../Client/package*.json ./ - -RUN npm install - -COPY ../../Client . - -RUN npm run build - -FROM nginx:1.27.1-alpine - -COPY --from=build /app/dist /usr/share/nginx/html -COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh -RUN chmod +x /docker-entrypoint.d/env.sh -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/Docker/test/prod/docker-compose.yaml b/Docker/test/prod/docker-compose.yaml deleted file mode 100644 index e262ef1a2..000000000 --- a/Docker/test/prod/docker-compose.yaml +++ /dev/null @@ -1,45 +0,0 @@ -services: - client: - image: uptime_client:latest - environment: - UPTIME_APP_API_BASE_URL: "https://checkmate-demo.bluewavelabs.ca/api/v1" - ports: - - "80:80" - - "443:443" - depends_on: - - server - volumes: - - ./nginx/conf.d:/etc/nginx/conf.d/:ro - - ./certbot/www:/var/www/certbot/:ro - - ./certbot/conf/:/etc/nginx/ssl/:ro - - certbot: - image: certbot/certbot:latest - volumes: - - ./certbot/www/:/var/www/certbot/:rw - - ./certbot/conf/:/etc/letsencrypt/:rw - server: - image: uptime_server:latest - ports: - - "5000:5000" - env_file: - - server.env - depends_on: - - redis - - mongodb - redis: - image: uptime_redis:latest - ports: - - "6379:6379" - volumes: - - ./redis/data:/data - mongodb: - image: uptime_database_mongo:latest - command: ["mongod", "--quiet", "--auth"] - ports: - - "27017:27017" - volumes: - - ./mongo/data:/data/db - - ./mongo/init/create_users.js:/docker-entrypoint-initdb.d/create_users.js - env_file: - - mongo.env diff --git a/Docker/test/prod/mongo/init/create_users.js b/Docker/test/prod/mongo/init/create_users.js deleted file mode 100644 index 67a21f910..000000000 --- a/Docker/test/prod/mongo/init/create_users.js +++ /dev/null @@ -1,16 +0,0 @@ -var username = process.env.USERNAME_ENV_VAR; -var password = process.env.PASSWORD_ENV_VAR; - -db = db.getSiblingDB("uptime_db"); - -db.createUser({ - user: username, - pwd: password, - roles: [ - { - role: "readWrite", - db: "uptime_db", - }, - ], -}); -print("User uptime_user created successfully"); diff --git a/Docker/test/prod/mongoDB.Dockerfile b/Docker/test/prod/mongoDB.Dockerfile deleted file mode 100644 index 80c8b9c8f..000000000 --- a/Docker/test/prod/mongoDB.Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mongo -COPY ./Docker/prod/mongo/init/create_users.js /docker-entrypoint-initdb.d/ -EXPOSE 27017 -CMD ["mongod"] diff --git a/Docker/test/prod/nginx/conf.d/default.conf b/Docker/test/prod/nginx/conf.d/default.conf deleted file mode 100644 index 98e1bd97d..000000000 --- a/Docker/test/prod/nginx/conf.d/default.conf +++ /dev/null @@ -1,69 +0,0 @@ -server { - listen 80; - listen [::]:80; - - server_name checkmate-demo.bluewavelabs.ca; - server_tokens off; - - location /.well-known/acme-challenge/ { - root /var/www/certbot; - } - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; - } - - location /api/ { - proxy_pass http://server:5000/api/; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /api-docs/ { - proxy_pass http://server:5000/api-docs/; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } -} - -server { - listen 443 default_server ssl http2; - listen [::]:443 ssl http2; - - server_name checkmate-demo.bluewavelabs.ca; - - ssl_certificate /etc/nginx/ssl/live/checkmate-demo.bluewavelabs.ca/fullchain.pem; - ssl_certificate_key /etc/nginx/ssl/live/checkmate-demo.bluewavelabs.ca/privkey.pem; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; - } - - location /api/ { - proxy_pass http://server:5000/api/; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /api-docs/ { - proxy_pass http://server:5000/api-docs/; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } -} diff --git a/README.md b/README.md index c37adfc6a..0830cc3b7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ - -

bluewave-labs%2Fcheckmate | Trendshift

![](https://img.shields.io/github/license/bluewave-labs/checkmate) @@ -10,7 +8,7 @@ ![](https://img.shields.io/github/issues/bluewave-labs/checkmate) ![](https://img.shields.io/github/issues-pr/bluewave-labs/checkmate) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9901/badge)](https://www.bestpractices.dev/projects/9901) - +[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/bluewave-labs/checkmate)

Checkmate

@@ -18,27 +16,41 @@ ![dashboard](https://github.com/user-attachments/assets/252d6047-522b-4576-8f14-233510e464b8) -Checkmate is an open source monitoring tool used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time. +This repository contains both the frontend and the backend of Checkmate, an open-source, self-hosted monitoring tool for tracking server hardware, uptime, response times, and incidents in real-time with beautiful visualizations. Checkmate regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time. -Checkmate also has an agent, called [Capture](https://github.com/bluewave-labs/capture), to retrieve data from remote servers. While Capture is not required to run Checkmate, it provides additional insigths about your servers' CPU, RAM, disk and temperature status. +Checkmate also has an agent, called [Capture](https://github.com/bluewave-labs/capture), to retrieve data from remote servers. While Capture is not required to run Checkmate, it provides additional insights about your servers' CPU, RAM, disk, and temperature status. -Checkmate has ben stress tested with 1000+ active monitors without any particular issues or performance bottlenecks. +Checkmate has been stress-tested with 1000+ active monitors without any particular issues or performance bottlenecks. -We **love** what we are building here, and we contibuously learn a few things about Reactjs, Nodejs, MongoDB and Docker while building Checkmate. +We **love** what we are building here, and we continuously learn a few things about Reactjs, Nodejs, MongoDB, and Docker while building Checkmate. ## 📦 Demo -See [Checkmate](https://checkmate-demo.bluewavelabs.ca/) in action. The username is uptimedemo@demo.com and the password is Demouser1! (just a note that we update the demo server from time to time, so if it doesn't work for you, please ping us on Discussions channel). +You can see the latest build of [Checkmate](https://checkmate-demo.bluewavelabs.ca/) in action. The username is uptimedemo@demo.com and the password is Demouser1! (just a note that we update the demo server from time to time, so if it doesn't work for you, please ping us on the Discussions channel). ## 🔗 User's guide -Usage instructions can be found [here](https://bluewavelabs.gitbook.io/checkmate). It's still WIP and some of the information there might be outdated. Rest assured, we are doing our best! :) +Usage instructions can be found [here](https://docs.checkmate.so/). It's still WIP and some of the information there might be outdated as we continuously add features weekly. Rest assured, we are doing our best! :) ## 🛠️ Installation -See installation instructions in [Checkmate documentation portal](https://bluewavelabs.gitbook.io/checkmate/quickstart). Alternatively, you can also use [Coolify](https://coolify.io/) for a one click Docker deployment. If you would like to monitor your server infrastructure, you'll need [Capture agent](https://github.com/bluewave-labs/capture). Capture repository also contains the installation instructions. +See installation instructions in [Checkmate documentation portal](https://docs.checkmate.so/quickstart). Alternatively, you can also use [Coolify](https://coolify.io/) or [Elestio](https://elest.io/open-source/checkmate) for a one-click Docker deployment. If you would like to monitor your server infrastructure, you'll need [Capture agent](https://github.com/bluewave-labs/capture). Capture repository also contains the installation instructions. -## 💚 Questions & ideas +## 🏁 Translations + +If you would like to use Checkmate in your language, please [go to this page](https://poeditor.com/join/project/lRUoGZFCsJ) and register for the language you would like to translate Checkmate to. + +## 🚀 Performance + +Thanks to extensive optimizations, Checkmate operates with an exceptionally small memory footprint, requiring minimal memory and CPU resources. Here’s the memory usage of a Node.js instance running on a server that monitors 323 servers every minute: + +![image](https://github.com/user-attachments/assets/37e04a75-d83a-488f-b25c-025511b492c9) + +You can see the memory footprint of MongoDB and Redis on the same server (398Mb and 15Mb) for the same amount of servers: + +![image](https://github.com/user-attachments/assets/3b469e85-e675-4040-a162-3f24c1afc751) + +## 💚 Questions & Ideas If you have any questions, suggestions or comments, please use our [Discord channel](https://discord.gg/NAb6H3UTjK). We've also launched our [Discussions](https://github.com/bluewave-labs/bluewave-uptime/discussions) page! Feel free to ask questions or share your ideas—we'd love to hear from you! @@ -51,24 +63,23 @@ If you have any questions, suggestions or comments, please use our [Discord chan - Docker monitoring - Ping monitoring - SSL monitoring +- Port monitoring - Incidents at a glance - E-mail notifications - Scheduled maintenance **Short term roadmap:** -- Port monitoring (**complete**, waiting to be deployed to stable version) https://github.com/bluewave-labs/Checkmate/issues/1476 -- Global (distributed) uptime checking on Solana network (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1593 -- Status pages (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1131 +- Status pages (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1131 - Translations (i18n) (**in progress**) - Better notification options (Webhooks, Discord, Telegram, Slack) (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1545 -- Command line interface (CLI) (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1558 -- JSON query monitoring https://github.com/bluewave-labs/Checkmate/issues/1573 +- JSON query monitoring (**in progress**) https://github.com/bluewave-labs/Checkmate/issues/1573 - Tagging/grouping monitors https://github.com/bluewave-labs/Checkmate/issues/1546 - More configuration options - DNS monitoring ## 🏗️ Screenshots +

server

@@ -88,23 +99,27 @@ If you have any questions, suggestions or comments, please use our [Discord chan - [Recharts](https://recharts.org) - Lots of other open source components! -## A few links +## A few links -- If you would like to support us, please consider giving it a ⭐ and click on "watch". +- If you would like to support us, please consider giving it a ⭐ and click on "watch". - Have a question or suggestion for the roadmap/featureset? Check our [Discord channel](https://discord.gg/NAb6H3UTjK) or [Discussions](https://github.com/bluewave-labs/checkmate/discussions) forum. - Need a ping when there's a new release? Use [Newreleases](https://newreleases.io/), a free service to track releases. - Watch a Checkmate [installation and usage video](https://www.youtube.com/watch?v=GfFOc0xHIwY) ## 🤝 Contributing -We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 3300 stars and attracted 40+ contributors from around the globe. So, don’t hold back — jump in, contribute and learn with us! +We are [Alex](http://github.com/ajhollid) (team lead), [Vishnu](http://github.com/vishnusn77), [Mohadeseh](http://github.com/mohicody), [Gorkem](http://github.com/gorkem-bwl/), [Owaise](http://github.com/Owaiseimdad), [Aryaman](https://github.com/Br0wnHammer) and [Mert](https://github/com/mertssmnoglu) helping individuals and businesses monitor their infra and servers. + +We pride ourselves on building strong connections with contributors at every level. Despite being a young project, Checkmate has already earned 5000+ stars and attracted 60 contributors from around the globe. + +Our repo is starred by employees from **Google, Microsoft, Intel, Cisco, Tencent, Electronic Arts, ByteDance, JP Morgan Chase, Deloitte, Accenture, Foxconn, Broadcom, China Telecom, Barclays, Capgemini, Wipro, Cloudflare, Dassault Systèmes and NEC**, so don’t hold back — jump in, contribute and learn with us! Here's how you can contribute: 0. Star this repo :) -1. Check [Contributor's guideline](https://github.com/bluewave-labs/bluewave-uptime/blob/master/CONTRIBUTING.md). First timers are encouraged to check `good-first-issue` tag. -2. Optionally, read [project structure](https://bluewavelabs.gitbook.io/checkmate/developers-guide/general-project-structure) and [high level overview](https://bluewavelabs.gitbook.io/checkmate/developers-guide/high-level-overview). -3. Have a look at our Figma designs [here](https://www.figma.com/design/RPSfaw66HjzSwzntKcgDUV/Uptime-Genie?node-id=0-1&t=WqOFv9jqNTFGItpL-1) if you are going to use one of our designs. We encourage you to copy to your own Figma page, then work on it as it is read-only. +1. Check [Contributor's guideline](https://github.com/bluewave-labs/Checkmate/blob/develop/CONTRIBUTING.md). First timers are encouraged to check `good-first-issue` tag. +2. Check [project structure](https://docs.checkmate.so/developers-guide/general-project-structure) and [high level overview](https://bluewavelabs.gitbook.io/checkmate/developers-guide/high-level-overview). +3. Read a detailed structure of [Checkmate](https://deepwiki.com/bluewave-labs/Checkmate) if you would like to deep dive into the architecture. 4. Open an issue if you believe you've encountered a bug. 5. Check for good-first-issue's if you are a newcomer. 6. Make a pull request to add new features/make quality-of-life improvements/fix bugs. @@ -113,19 +128,14 @@ Here's how you can contribute: - +Thanks to [Gitbook](https://gitbook.io/) for giving us a free tier for their documentation platform, and [Poeditor](https://poeditor.com/) providing us a free account to use their i18n services. If you would like to sponsor Checkmate, please send an email to hello@bluewavelabs.ca [![Star History Chart](https://api.star-history.com/svg?repos=bluewave-labs/checkmate&type=Date)](https://star-history.com/#bluewave-labs/bluewave-uptime&Date) Also check other developer and contributor-friendly projects of BlueWave: -- [DataRoom](https://github.com/bluewave-labs/bluewave-dataroom), an secure file sharing application, aka dataroom. -- [BlueWave HRM](https://github.com/bluewave-labs/bluewave-hrm), a complete Human Resource Management platform. -- [Guidefox](https://github.com/bluewave-labs/guidefox), an application that helps new users learn how to use your product via hints, tours, popups and banners. - [VerifyWise](https://github.com/bluewave-labs/verifywise), the first open source AI governance platform. - -![image](https://badges.pufler.dev/visits/bluewave-labs/checkmate) since 14 Jan, 2025 +- [DataRoom](https://github.com/bluewave-labs/bluewave-dataroom), an secure file sharing application, aka dataroom. +- [Guidefox](https://github.com/bluewave-labs/guidefox), an application that helps new users learn how to use your product via hints, tours, popups and banners. diff --git a/SECURITY.md b/SECURITY.md index 6aa64730a..58257c9c4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,4 @@ # Security Policy -If you find a vulnerability, send it to hello@bluewavelabs.ca - -Please do not create an issue for security vulnerabilities. +If you find a vulnerability, [create an issue here](https://github.com/bluewave-labs/checkmate/security/advisories/new). diff --git a/Server/controllers/distributedUptimeController.js b/Server/controllers/distributedUptimeController.js deleted file mode 100644 index ce4ee2df5..000000000 --- a/Server/controllers/distributedUptimeController.js +++ /dev/null @@ -1,18 +0,0 @@ -import { handleError } from "./controllerUtils.js"; -import { successMessages } from "../utils/messages.js"; - -const SERVICE_NAME = "DistributedUptimeQueueController"; - -class DistributedUptimeController { - constructor() {} - - async resultsCallback(req, res, next) { - try { - console.log(req.body); - res.status(200).json({ message: "OK" }); - } catch (error) { - throw handleError(error, SERVICE_NAME, "resultsCallback"); - } - } -} -export default DistributedUptimeController; diff --git a/Server/controllers/statusPageController.js b/Server/controllers/statusPageController.js deleted file mode 100644 index a4ceb8039..000000000 --- a/Server/controllers/statusPageController.js +++ /dev/null @@ -1,54 +0,0 @@ -import { handleError, handleValidationError } from "./controllerUtils.js"; -import { - createStatusPageBodyValidation, - getStatusPageParamValidation, -} from "../validation/joi.js"; -import { successMessages } from "../utils/messages.js"; - -const SERVICE_NAME = "statusPageController"; - -class StatusPageController { - constructor(db) { - this.db = db; - } - - createStatusPage = async (req, res, next) => { - try { - await createStatusPageBodyValidation.validateAsync(req.body); - } catch (error) { - next(handleValidationError(error, SERVICE_NAME)); - return; - } - - try { - const statusPage = await this.db.createStatusPage(req.body); - return res.success({ - msg: successMessages.STATUS_PAGE_CREATE, - data: statusPage, - }); - } catch (error) { - next(handleError(error, SERVICE_NAME, "createStatusPage")); - } - }; - getStatusPageByUrl = async (req, res, next) => { - try { - await getStatusPageParamValidation.validateAsync(req.params); - } catch (error) { - next(handleValidationError(error, SERVICE_NAME)); - return; - } - - try { - const { url } = req.params; - const statusPage = await this.db.getStatusPageByUrl(url); - return res.success({ - msg: successMessages.STATUS_PAGE_BY_URL, - data: statusPage, - }); - } catch (error) { - next(handleError(error, SERVICE_NAME, "getStatusPage")); - } - }; -} - -export default StatusPageController; diff --git a/Server/db/FakeDb.js b/Server/db/FakeDb.js deleted file mode 100644 index 4e9b32992..000000000 --- a/Server/db/FakeDb.js +++ /dev/null @@ -1,138 +0,0 @@ -// ************************** -// The idea here is to provide a layer of abstraction between the database and whoever is using it. -// Instead of directly calling mongoose methods, we can call the methods on the DB object. -// If this were Typescript or Java or Golang an interface would be implemented to ensure the methods are available. -// But we do the best we can with Javascript. -// -// If the methods are consistent all we have to do to swap out one DB for another is simply change the import. -// -// Example: -// We start with the fake DB: -// -// const db = require("../db/FakeDb"); -// const monitors = await db.getAllMonitors(); -// -// And when we want to swtich to a real DB, all we have to do is swap the import -// -// const db = require("../db/MongoDb"); -// const monitors = await db.getAllMonitors(); -// -// The rest of the code is the same, as all the `db` methods are standardized. -// ************************** - -const Monitor = require("./models/Monitor"); -const UserModel = require("./models/User"); -const bcrypt = require("bcrypt"); - -let FAKE_MONITOR_DATA = []; -const USERS = []; - -const connect = async () => { - try { - await console.log("Connected to FakeDB"); - } catch (error) { - console.error(error); - } -}; - -const insertUser = async (req, res) => { - try { - const newUser = new UserModel({ ...req.body }); - const salt = await bcrypt.genSalt(10); //genSalt is asynchronous, need to wait - newUser.password = await bcrypt.hash(newUser.password, salt); // hash is also async, need to eitehr await or use hashSync - USERS.push(newUser); - const userToReturn = { ...newUser._doc }; - delete userToReturn.password; - return userToReturn; - } catch (error) { - throw error; - } -}; - -const getUserByEmail = async (req, res) => { - const email = req.body.email; - try { - const idx = USERS.findIndex((user) => { - return user.email === email; - }); - if (idx === -1) { - return null; - } - return USERS[idx]; - } catch (error) { - throw new Error(`User with email ${email} not found`); - } -}; - -const getAllMonitors = async () => { - return FAKE_MONITOR_DATA; -}; - -const getMonitorById = async (monitorId) => { - const idx = FAKE_MONITOR_DATA.findIndex((monitor) => { - return monitor.id === monitorId; - }); - if (idx === -1) { - throw new Error(`Monitor with id ${monitorId} not found`); - } - return FAKE_MONITOR_DATA[idx]; -}; - -const getMonitorsByUserId = async (userId) => { - const userMonitors = FAKE_MONITOR_DATA.filter((monitor) => { - return monitor.userId === userId; - }); - - if (userMonitors.length === 0) { - throw new Error(`Monitors for user ${userId} not found`); - } - return userMonitors; -}; - -const createMonitor = async (req, res) => { - const monitor = new Monitor(req.body); - monitor.createdAt = Date.now(); - monitor.updatedAt = Date.now(); - FAKE_MONITOR_DATA.push(monitor); - return monitor; -}; - -const deleteMonitor = async (req, res) => { - const monitorId = req.params.monitorId; - try { - const monitor = getMonitorById(monitorId); - FAKE_MONITOR_DATA = FAKE_MONITOR_DATA.filter((monitor) => { - return monitor.id !== monitorId; - }); - return monitor; - } catch (error) { - throw error; - } -}; - -const editMonitor = async (req, res) => { - const monitorId = req.params.monitorId; - const idx = FAKE_MONITOR_DATA.findIndex((monitor) => { - return monitor._id.toString() === monitorId; - }); - const oldMonitor = FAKE_MONITOR_DATA[idx]; - const editedMonitor = new Monitor({ ...req.body }); - editedMonitor._id = oldMonitor._id; - editedMonitor.userId = oldMonitor.userId; - editedMonitor.updatedAt = Date.now(); - editedMonitor.createdAt = oldMonitor.createdAt; - FAKE_MONITOR_DATA[idx] = editedMonitor; - return FAKE_MONITOR_DATA[idx]; -}; - -module.exports = { - connect, - insertUser, - getUserByEmail, - getAllMonitors, - getMonitorById, - getMonitorsByUserId, - createMonitor, - deleteMonitor, - editMonitor, -}; diff --git a/Server/db/models/AppSettings.js b/Server/db/models/AppSettings.js deleted file mode 100644 index c4faa0881..000000000 --- a/Server/db/models/AppSettings.js +++ /dev/null @@ -1,91 +0,0 @@ -import mongoose from "mongoose"; - -const AppSettingsSchema = mongoose.Schema( - { - apiBaseUrl: { - type: String, - required: true, - default: "http://localhost:5000/api/v1", - }, - logLevel: { - type: String, - default: "debug", - enum: ["debug", "none", "error", "warn"], - }, - clientHost: { - type: String, - required: true, - default: "http://localhost:5173", - }, - jwtSecret: { - type: String, - required: true, - default: "my_secret", - }, - refreshTokenSecret: { - type: String, - required: true, - default: "my_refresh_secret", - }, - dbType: { - type: String, - required: true, - default: "MongoDB", - }, - dbConnectionString: { - type: String, - required: true, - default: "mongodb://localhost:27017/uptime_db", - }, - redisHost: { - type: String, - required: true, - default: "127.0.0.1", - }, - redisPort: { - type: Number, - default: "6379", - }, - jwtTTL: { - type: String, - required: true, - default: "2h", - }, - refreshTokenTTL: { - type: String, - required: true, - default: "7d", - }, - pagespeedApiKey: { - type: String, - default: "", - }, - systemEmailHost: { - type: String, - default: "smtp.gmail.com", - }, - systemEmailPort: { - type: Number, - default: 465, - }, - systemEmailAddress: { - type: String, - default: "", - }, - systemEmailPassword: { - type: String, - default: "", - }, - singleton: { - type: Boolean, - required: true, - unique: true, - default: true, - }, - }, - { - timestamps: true, - } -); - -export default mongoose.model("AppSettings", AppSettingsSchema); diff --git a/Server/db/models/DistributedUptimeCheck.js b/Server/db/models/DistributedUptimeCheck.js deleted file mode 100644 index 0c7c25de3..000000000 --- a/Server/db/models/DistributedUptimeCheck.js +++ /dev/null @@ -1,15 +0,0 @@ -import mongoose from "mongoose"; -import { BaseCheckSchema } from "./Check.js"; - -const DistributedUptimeCheckSchema = mongoose.Schema( - { - ...BaseCheckSchema.obj, - }, - { timestamps: true } -); - -DistributedUptimeCheckSchema.index({ createdAt: 1 }); -DistributedUptimeCheckSchema.index({ monitorId: 1, createdAt: 1 }); -DistributedUptimeCheckSchema.index({ monitorId: 1, createdAt: -1 }); - -export default mongoose.model("DistributedUptimeCheck", DistributedUptimeCheckSchema); diff --git a/Server/db/models/StatusPage.js b/Server/db/models/StatusPage.js deleted file mode 100644 index 1169d4661..000000000 --- a/Server/db/models/StatusPage.js +++ /dev/null @@ -1,42 +0,0 @@ -import mongoose from "mongoose"; - -const StatusPageSchema = mongoose.Schema( - { - companyName: { - type: String, - required: true, - default: "", - }, - url: { - type: String, - unique: true, - required: true, - default: "", - }, - timezone: { - type: String, - required: true, - default: "America/Toronto", - }, - color: { - type: String, - required: true, - default: "#4169E1", - }, - theme: { - type: String, - required: true, - default: "light", - }, - monitors: [ - { - type: mongoose.Schema.Types.ObjectId, - ref: "Monitor", - required: true, - }, - ], - }, - { timestamps: true } -); - -export default mongoose.model("StatusPage", StatusPageSchema); diff --git a/Server/db/mongo/modules/monitorModuleQueries.js b/Server/db/mongo/modules/monitorModuleQueries.js deleted file mode 100644 index cdbcd51d8..000000000 --- a/Server/db/mongo/modules/monitorModuleQueries.js +++ /dev/null @@ -1,535 +0,0 @@ -const buildUptimeDetailsPipeline = (monitor, dates, dateString) => { - return [ - { - $match: { - monitorId: monitor._id, - }, - }, - { - $sort: { - createdAt: 1, - }, - }, - { - $facet: { - aggregateData: [ - { - $group: { - _id: null, - avgResponseTime: { - $avg: "$responseTime", - }, - lastCheck: { - $last: "$$ROOT", - }, - totalChecks: { - $sum: 1, - }, - }, - }, - ], - uptimeStreak: [ - { - $sort: { - createdAt: -1, - }, - }, - { - $group: { - _id: null, - checks: { $push: "$$ROOT" }, - }, - }, - { - $project: { - streak: { - $reduce: { - input: "$checks", - initialValue: { checks: [], foundFalse: false }, - in: { - $cond: [ - { - $and: [ - { $not: "$$value.foundFalse" }, // stop reducing if a false check has been found - { $eq: ["$$this.status", true] }, // continue reducing if current check true - ], - }, - // true case - { - checks: { $concatArrays: ["$$value.checks", ["$$this"]] }, - foundFalse: false, // Add the check to the streak - }, - // false case - { - checks: "$$value.checks", - foundFalse: true, // Mark that we found a false - }, - ], - }, - }, - }, - }, - }, - ], - // For the response time chart, should return checks for date window - // Grouped by: {day: hour}, {week: day}, {month: day} - groupedChecks: [ - { - $match: { - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $group: { - _id: { - $dateToString: { - format: dateString, - date: "$createdAt", - }, - }, - avgResponseTime: { - $avg: "$responseTime", - }, - totalChecks: { - $sum: 1, - }, - }, - }, - { - $sort: { - _id: 1, - }, - }, - ], - // Average response time for the date window - groupAvgResponseTime: [ - { - $match: { - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $group: { - _id: null, - avgResponseTime: { - $avg: "$responseTime", - }, - }, - }, - ], - // All UpChecks for the date window - upChecks: [ - { - $match: { - status: true, - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $group: { - _id: null, - avgResponseTime: { - $avg: "$responseTime", - }, - totalChecks: { - $sum: 1, - }, - }, - }, - ], - // Up checks grouped by: {day: hour}, {week: day}, {month: day} - groupedUpChecks: [ - { - $match: { - status: true, - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $group: { - _id: { - $dateToString: { - format: dateString, - date: "$createdAt", - }, - }, - totalChecks: { - $sum: 1, - }, - avgResponseTime: { - $avg: "$responseTime", - }, - }, - }, - { - $sort: { _id: 1 }, - }, - ], - // All down checks for the date window - downChecks: [ - { - $match: { - status: false, - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $group: { - _id: null, - avgResponseTime: { - $avg: "$responseTime", - }, - totalChecks: { - $sum: 1, - }, - }, - }, - ], - // Down checks grouped by: {day: hour}, {week: day}, {month: day} for the date window - groupedDownChecks: [ - { - $match: { - status: false, - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $group: { - _id: { - $dateToString: { - format: dateString, - date: "$createdAt", - }, - }, - totalChecks: { - $sum: 1, - }, - avgResponseTime: { - $avg: "$responseTime", - }, - }, - }, - { - $sort: { _id: 1 }, - }, - ], - }, - }, - { - $project: { - uptimeStreak: { - $cond: [ - { $eq: [{ $size: { $first: "$uptimeStreak.streak.checks" } }, 0] }, - 0, - { - $subtract: [ - new Date(), - { - $last: { $first: "$uptimeStreak.streak.checks.createdAt" }, - }, - ], - }, - ], - }, - avgResponseTime: { - $arrayElemAt: ["$aggregateData.avgResponseTime", 0], - }, - totalChecks: { - $arrayElemAt: ["$aggregateData.totalChecks", 0], - }, - latestResponseTime: { - $arrayElemAt: ["$aggregateData.lastCheck.responseTime", 0], - }, - timeSinceLastCheck: { - $let: { - vars: { - lastCheck: { - $arrayElemAt: ["$aggregateData.lastCheck", 0], - }, - }, - in: { - $cond: [ - { - $ifNull: ["$$lastCheck", false], - }, - { - $subtract: [new Date(), "$$lastCheck.createdAt"], - }, - 0, - ], - }, - }, - }, - groupedChecks: "$groupedChecks", - groupedAvgResponseTime: { - $arrayElemAt: ["$groupAvgResponseTime", 0], - }, - upChecks: { - $arrayElemAt: ["$upChecks", 0], - }, - groupedUpChecks: "$groupedUpChecks", - downChecks: { - $arrayElemAt: ["$downChecks", 0], - }, - groupedDownChecks: "$groupedDownChecks", - }, - }, - ]; -}; - -const buildHardwareDetailsPipeline = (monitor, dates, dateString) => { - return [ - { - $match: { - monitorId: monitor._id, - createdAt: { $gte: dates.start, $lte: dates.end }, - }, - }, - { - $sort: { - createdAt: 1, - }, - }, - { - $facet: { - aggregateData: [ - { - $group: { - _id: null, - latestCheck: { - $last: "$$ROOT", - }, - totalChecks: { - $sum: 1, - }, - }, - }, - ], - upChecks: [ - { - $match: { - status: true, - }, - }, - { - $group: { - _id: null, - totalChecks: { - $sum: 1, - }, - }, - }, - ], - checks: [ - { - $limit: 1, - }, - { - $project: { - diskCount: { - $size: "$disk", - }, - }, - }, - { - $lookup: { - from: "hardwarechecks", - let: { - diskCount: "$diskCount", - }, - pipeline: [ - { - $match: { - $expr: { - $and: [ - { $eq: ["$monitorId", monitor._id] }, - { $gte: ["$createdAt", dates.start] }, - { $lte: ["$createdAt", dates.end] }, - ], - }, - }, - }, - { - $group: { - _id: { - $dateToString: { - format: dateString, - date: "$createdAt", - }, - }, - avgCpuUsage: { - $avg: "$cpu.usage_percent", - }, - avgMemoryUsage: { - $avg: "$memory.usage_percent", - }, - avgTemperatures: { - $push: { - $ifNull: ["$cpu.temperature", [0]], - }, - }, - disks: { - $push: "$disk", - }, - }, - }, - { - $project: { - _id: 1, - avgCpuUsage: 1, - avgMemoryUsage: 1, - avgTemperature: { - $map: { - input: { - $range: [ - 0, - { - $size: { - // Handle null temperatures array - $ifNull: [ - { $arrayElemAt: ["$avgTemperatures", 0] }, - [0], // Default to single-element array if null - ], - }, - }, - ], - }, - as: "index", - in: { - $avg: { - $map: { - input: "$avgTemperatures", - as: "tempArray", - in: { - $ifNull: [ - { $arrayElemAt: ["$$tempArray", "$$index"] }, - 0, // Default to 0 if element is null - ], - }, - }, - }, - }, - }, - }, - disks: { - $map: { - input: { - $range: [0, "$$diskCount"], - }, - as: "diskIndex", - in: { - name: { - $concat: [ - "disk", - { - $toString: "$$diskIndex", - }, - ], - }, - readSpeed: { - $avg: { - $map: { - input: "$disks", - as: "diskArray", - in: { - $arrayElemAt: [ - "$$diskArray.read_speed_bytes", - "$$diskIndex", - ], - }, - }, - }, - }, - writeSpeed: { - $avg: { - $map: { - input: "$disks", - as: "diskArray", - in: { - $arrayElemAt: [ - "$$diskArray.write_speed_bytes", - "$$diskIndex", - ], - }, - }, - }, - }, - totalBytes: { - $avg: { - $map: { - input: "$disks", - as: "diskArray", - in: { - $arrayElemAt: [ - "$$diskArray.total_bytes", - "$$diskIndex", - ], - }, - }, - }, - }, - freeBytes: { - $avg: { - $map: { - input: "$disks", - as: "diskArray", - in: { - $arrayElemAt: ["$$diskArray.free_bytes", "$$diskIndex"], - }, - }, - }, - }, - usagePercent: { - $avg: { - $map: { - input: "$disks", - as: "diskArray", - in: { - $arrayElemAt: [ - "$$diskArray.usage_percent", - "$$diskIndex", - ], - }, - }, - }, - }, - }, - }, - }, - }, - }, - ], - as: "hourlyStats", - }, - }, - { - $unwind: "$hourlyStats", - }, - { - $replaceRoot: { - newRoot: "$hourlyStats", - }, - }, - ], - }, - }, - { - $project: { - aggregateData: { - $arrayElemAt: ["$aggregateData", 0], - }, - upChecks: { - $arrayElemAt: ["$upChecks", 0], - }, - checks: { - $sortArray: { - input: "$checks", - sortBy: { _id: 1 }, - }, - }, - }, - }, - ]; -}; - -export { buildUptimeDetailsPipeline, buildHardwareDetailsPipeline }; diff --git a/Server/db/mongo/modules/statusPageModule.js b/Server/db/mongo/modules/statusPageModule.js deleted file mode 100644 index 194287448..000000000 --- a/Server/db/mongo/modules/statusPageModule.js +++ /dev/null @@ -1,40 +0,0 @@ -import StatusPage from "../../models/StatusPage.js"; -import { errorMessages } from "../../../utils/messages.js"; - -const SERVICE_NAME = "statusPageModule"; - -const createStatusPage = async (statusPageData) => { - try { - const statusPage = new StatusPage({ ...statusPageData }); - await statusPage.save(); - return statusPage; - } catch (error) { - if (error?.code === 11000) { - // Handle duplicate URL errors - error.status = 400; - error.message = errorMessages.STATUS_PAGE_URL_NOT_UNIQUE; - } - error.service = SERVICE_NAME; - error.method = "createStatusPage"; - throw error; - } -}; - -const getStatusPageByUrl = async (url) => { - try { - const statusPage = await StatusPage.findOne({ url }); - if (statusPage === null || statusPage === undefined) { - const error = new Error(errorMessages.STATUS_PAGE_NOT_FOUND); - error.status = 404; - - throw error; - } - return statusPage; - } catch (error) { - error.service = SERVICE_NAME; - error.method = "getStatusPageByUrl"; - throw error; - } -}; - -export { createStatusPage, getStatusPageByUrl }; diff --git a/Server/db/mongo/utils/seedDb.js b/Server/db/mongo/utils/seedDb.js deleted file mode 100644 index cd4abb8d5..000000000 --- a/Server/db/mongo/utils/seedDb.js +++ /dev/null @@ -1,57 +0,0 @@ -import Monitor from "../../models/Monitor.js"; -import Check from "../../models/Check.js"; - -const generateRandomUrl = () => { - const domains = ["example.com", "test.org", "demo.net", "sample.io", "mock.dev"]; - const paths = ["api", "status", "health", "ping", "check"]; - return `https://${domains[Math.floor(Math.random() * domains.length)]}/${paths[Math.floor(Math.random() * paths.length)]}`; -}; - -const generateChecks = (monitorId, teamId, count) => { - const checks = []; - const endTime = new Date(Date.now() - 10 * 60 * 1000); // 10 minutes ago - const startTime = new Date(endTime - count * 60 * 1000); // count minutes before endTime - - for (let i = 0; i < count; i++) { - const timestamp = new Date(startTime.getTime() + i * 60 * 1000); - const status = Math.random() > 0.05; // 95% chance of being up - - checks.push({ - monitorId, - teamId, - status, - responseTime: Math.floor(Math.random() * 1000), // Random response time between 0-1000ms - createdAt: timestamp, - updatedAt: timestamp, - }); - } - - return checks; -}; - -const seedDb = async (userId, teamId) => { - try { - console.log("Deleting all monitors and checks"); - await Monitor.deleteMany({}); - await Check.deleteMany({}); - console.log("Adding monitors"); - for (let i = 0; i < 300; i++) { - const monitor = await Monitor.create({ - name: `Monitor ${i}`, - url: generateRandomUrl(), - type: "http", - userId, - teamId, - interval: 60000, - active: false, - }); - console.log(`Adding monitor and checks for monitor ${i}`); - const checks = generateChecks(monitor._id, teamId, 10000); - await Check.insertMany(checks); - } - } catch (error) { - console.error(error); - } -}; - -export default seedDb; diff --git a/Server/middleware/handleErrors.js b/Server/middleware/handleErrors.js deleted file mode 100644 index fa9af4c0b..000000000 --- a/Server/middleware/handleErrors.js +++ /dev/null @@ -1,20 +0,0 @@ -import logger from "../utils/logger.js"; -import { errorMessages } from "../utils/messages.js"; - -const handleErrors = (error, req, res, next) => { - const status = error.status || 500; - const message = error.message || errorMessages.FRIENDLY_ERROR; - const service = error.service || errorMessages.UNKNOWN_SERVICE; - logger.error({ - message: message, - service: service, - method: error.method, - stack: error.stack, - }); - res.error({ - status, - msg: message, - }); -}; - -export { handleErrors }; diff --git a/Server/middleware/responseHandler.js b/Server/middleware/responseHandler.js deleted file mode 100644 index 061422f50..000000000 --- a/Server/middleware/responseHandler.js +++ /dev/null @@ -1,20 +0,0 @@ -const responseHandler = (req, res, next) => { - res.success = ({ status = 200, msg = "OK", data = null }) => { - return res.status(status).json({ - success: true, - msg: msg, - data: data, - }); - }; - - res.error = ({ status = 500, msg = "Internal server error", data = null }) => { - return res.status(status).json({ - success: false, - msg, - data, - }); - }; - next(); -}; - -export { responseHandler }; diff --git a/Server/middleware/verifyJWT.js b/Server/middleware/verifyJWT.js deleted file mode 100644 index 87fa53bd6..000000000 --- a/Server/middleware/verifyJWT.js +++ /dev/null @@ -1,95 +0,0 @@ -import jwt from "jsonwebtoken"; -import { errorMessages } from "../utils/messages.js"; -import ServiceRegistry from "../service/serviceRegistry.js"; -import SettingsService from "../service/settingsService.js"; -const SERVICE_NAME = "verifyJWT"; -const TOKEN_PREFIX = "Bearer "; - -/** - * Verifies the JWT token - * @function - * @param {express.Request} req - * @param {express.Response} res - * @param {express.NextFunction} next - * @returns {express.Response} - */ -const verifyJWT = (req, res, next) => { - const token = req.headers["authorization"]; - // Make sure a token is provided - if (!token) { - const error = new Error(errorMessages.NO_AUTH_TOKEN); - error.status = 401; - error.service = SERVICE_NAME; - next(error); - return; - } - // Make sure it is properly formatted - if (!token.startsWith(TOKEN_PREFIX)) { - const error = new Error(errorMessages.INVALID_AUTH_TOKEN); // Instantiate a new Error object for improperly formatted token - error.status = 400; - error.service = SERVICE_NAME; - error.method = "verifyJWT"; - next(error); - return; - } - - const parsedToken = token.slice(TOKEN_PREFIX.length, token.length); - // Verify the token's authenticity - const { jwtSecret } = ServiceRegistry.get(SettingsService.SERVICE_NAME).getSettings(); - jwt.verify(parsedToken, jwtSecret, (err, decoded) => { - if (err) { - if (err.name === "TokenExpiredError") { - // token has expired - handleExpiredJwtToken(req, res, next); - } else { - // Invalid token (signature or token altered or other issue) - const errorMessage = errorMessages.INVALID_AUTH_TOKEN; - return res.status(401).json({ success: false, msg: errorMessage }); - } - } else { - // Token is valid and not expired, carry on with request, Add the decoded payload to the request - req.user = decoded; - next(); - } - }); -}; - -function handleExpiredJwtToken(req, res, next) { - // check for refreshToken - const refreshToken = req.headers["x-refresh-token"]; - - if (!refreshToken) { - // No refresh token provided - const error = new Error(errorMessages.NO_REFRESH_TOKEN); - error.status = 401; - error.service = SERVICE_NAME; - error.method = "handleExpiredJwtToken"; - return next(error); - } - - // Verify refresh token - const { refreshTokenSecret } = ServiceRegistry.get( - SettingsService.SERVICE_NAME - ).getSettings(); - jwt.verify(refreshToken, refreshTokenSecret, (refreshErr, refreshDecoded) => { - if (refreshErr) { - // Invalid or expired refresh token, trigger logout - const errorMessage = - refreshErr.name === "TokenExpiredError" - ? errorMessages.EXPIRED_REFRESH_TOKEN - : errorMessages.INVALID_REFRESH_TOKEN; - const error = new Error(errorMessage); - error.status = 401; - error.service = SERVICE_NAME; - return next(error); - } - - // Refresh token is valid and unexpired, request for new access token - res.status(403).json({ - success: false, - msg: errorMessages.REQUEST_NEW_ACCESS_TOKEN, - }); - }); -} - -export { verifyJWT }; diff --git a/Server/routes/distributedUptimeRoute.js b/Server/routes/distributedUptimeRoute.js deleted file mode 100644 index eac4cb675..000000000 --- a/Server/routes/distributedUptimeRoute.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Router } from "express"; - -class DistributedUptimeRoutes { - constructor(distributedUptimeController) { - this.router = Router(); - this.distributedUptimeController = distributedUptimeController; - this.initRoutes(); - } - initRoutes() { - this.router.post("/callback", this.distributedUptimeController.resultsCallback); - } - - getRouter() { - return this.router; - } -} - -export default DistributedUptimeRoutes; diff --git a/Server/routes/queueRoute.js b/Server/routes/queueRoute.js deleted file mode 100644 index af0e9d08e..000000000 --- a/Server/routes/queueRoute.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Router } from "express"; - -class QueueRoutes { - constructor(queueController) { - this.router = Router(); - this.queueController = queueController; - this.initRoutes(); - } - initRoutes() { - this.router.get("/metrics", this.queueController.getMetrics); - this.router.get("/jobs", this.queueController.getJobs); - this.router.post("/jobs", this.queueController.addJob); - this.router.post("/obliterate", this.queueController.obliterateQueue); - } - - getRouter() { - return this.router; - } -} - -export default QueueRoutes; diff --git a/Server/routes/statusPageRoute.js b/Server/routes/statusPageRoute.js deleted file mode 100644 index ff2a2018a..000000000 --- a/Server/routes/statusPageRoute.js +++ /dev/null @@ -1,22 +0,0 @@ -import { Router } from "express"; - -import { verifyJWT } from "../middleware/verifyJWT.js"; - -class StatusPageRoutes { - constructor(statusPageController) { - this.router = Router(); - this.statusPageController = statusPageController; - this.initRoutes(); - } - - initRoutes() { - this.router.get("/:url", this.statusPageController.getStatusPageByUrl); - this.router.post("/:url", verifyJWT, this.statusPageController.createStatusPage); - } - - getRouter() { - return this.router; - } -} - -export default StatusPageRoutes; diff --git a/Server/service/notificationService.js b/Server/service/notificationService.js deleted file mode 100644 index 807640a61..000000000 --- a/Server/service/notificationService.js +++ /dev/null @@ -1,193 +0,0 @@ -const SERVICE_NAME = "NotificationService"; - -class NotificationService { - static SERVICE_NAME = SERVICE_NAME; - /** - * Creates an instance of NotificationService. - * - * @param {Object} emailService - The email service used for sending notifications. - * @param {Object} db - The database instance for storing notification data. - * @param {Object} logger - The logger instance for logging activities. - */ - constructor(emailService, db, logger) { - this.SERVICE_NAME = SERVICE_NAME; - this.emailService = emailService; - this.db = db; - this.logger = logger; - } - - /** - * Sends an email notification for hardware infrastructure alerts - * - * @async - * @function sendHardwareEmail - * @param {Object} networkResponse - Response object containing monitor information - * @param {string} address - Email address to send the notification to - * @param {Array} [alerts=[]] - List of hardware alerts to include in the email - * @returns {Promise} - Indicates whether email was sent successfully - * @throws {Error} - */ - async sendHardwareEmail(networkResponse, address, alerts = []) { - if (alerts.length === 0) return false; - const { monitor, status, prevStatus } = networkResponse; - const template = "hardwareIncidentTemplate"; - const context = { monitor: monitor.name, url: monitor.url, alerts }; - const subject = `Monitor ${monitor.name} infrastructure alerts`; - this.emailService.buildAndSendEmail(template, context, address, subject); - return true; - } - - /** - * Sends an email notification about monitor status change - * - * @async - * @function sendEmail - * @param {Object} networkResponse - Response object containing monitor status information - * @param {string} address - Email address to send the notification to - * @returns {Promise} - Indicates email was sent successfully - */ - async sendEmail(networkResponse, address) { - const { monitor, status, prevStatus } = networkResponse; - const template = prevStatus === false ? "serverIsUpTemplate" : "serverIsDownTemplate"; - const context = { monitor: monitor.name, url: monitor.url }; - const subject = `Monitor ${monitor.name} is ${status === true ? "up" : "down"}`; - this.emailService.buildAndSendEmail(template, context, address, subject); - return true; - } - - async handleStatusNotifications(networkResponse) { - try { - //If status hasn't changed, we're done - if (networkResponse.statusChanged === false) return false; - - // if prevStatus is undefined, monitor is resuming, we're done - if (networkResponse.prevStatus === undefined) return false; - const notifications = await this.db.getNotificationsByMonitorId( - networkResponse.monitorId - ); - - for (const notification of notifications) { - if (notification.type === "email") { - this.sendEmail(networkResponse, notification.address); - } - // Handle other types of notifications here - } - return true; - } catch (error) { - this.logger.warn({ - message: error.message, - service: this.SERVICE_NAME, - method: "handleNotifications", - stack: error.stack, - }); - } - } - /** - * Handles status change notifications for a monitor - * - * @async - * @function handleStatusNotifications - * @param {Object} networkResponse - Response object containing monitor status information - * @returns {Promise} - Indicates whether notifications were processed - * @throws {Error} - */ - async handleHardwareNotifications(networkResponse) { - const thresholds = networkResponse?.monitor?.thresholds; - if (thresholds === undefined) return false; // No thresholds set, we're done - - // Get thresholds from monitor - const { - usage_cpu: cpuThreshold = -1, - usage_memory: memoryThreshold = -1, - usage_disk: diskThreshold = -1, - } = thresholds; - - // Get metrics from response - const metrics = networkResponse?.payload?.data ?? null; - if (metrics === null) return false; - - const { - cpu: { usage_percent: cpuUsage = -1 } = {}, - memory: { usage_percent: memoryUsage = -1 } = {}, - disk = [], - } = metrics; - - const alerts = { - cpu: cpuThreshold !== -1 && cpuUsage > cpuThreshold ? true : false, - memory: memoryThreshold !== -1 && memoryUsage > memoryThreshold ? true : false, - disk: disk.some((d) => diskThreshold !== -1 && d.usage_percent > diskThreshold) - ? true - : false, - }; - - const notifications = await this.db.getNotificationsByMonitorId( - networkResponse.monitorId - ); - for (const notification of notifications) { - const alertsToSend = []; - const alertTypes = ["cpu", "memory", "disk"]; - - for (const type of alertTypes) { - // Iterate over each alert type to see if any need to be decremented - if (alerts[type] === true) { - notification[`${type}AlertThreshold`]--; // Decrement threshold if an alert is triggered - - if (notification[`${type}AlertThreshold`] <= 0) { - // If threshold drops below 0, reset and send notification - notification[`${type}AlertThreshold`] = notification.alertThreshold; - - const formatAlert = { - cpu: () => - `Your current CPU usage (${(cpuUsage * 100).toFixed(0)}%) is above your threshold (${(cpuThreshold * 100).toFixed(0)}%)`, - memory: () => - `Your current memory usage (${(memoryUsage * 100).toFixed(0)}%) is above your threshold (${(memoryThreshold * 100).toFixed(0)}%)`, - disk: () => - `Your current disk usage: ${disk - .map((d, idx) => `(Disk${idx}: ${(d.usage_percent * 100).toFixed(0)}%)`) - .join( - ", " - )} is above your threshold (${(diskThreshold * 100).toFixed(0)}%)`, - }; - alertsToSend.push(formatAlert[type]()); - } - } - } - - await notification.save(); - - if (alertsToSend.length === 0) continue; // No alerts to send, we're done - - if (notification.type === "email") { - this.sendHardwareEmail(networkResponse, notification.address, alertsToSend); - } - } - return true; - } - - /** - * Handles notifications for different monitor types - * - * @async - * @function handleNotifications - * @param {Object} networkResponse - Response object containing monitor information - * @returns {Promise} - Indicates whether notifications were processed successfully - */ - async handleNotifications(networkResponse) { - try { - if (networkResponse.monitor.type === "hardware") { - this.handleHardwareNotifications(networkResponse); - } - this.handleStatusNotifications(networkResponse); - return true; - } catch (error) { - this.logger.warn({ - message: error.message, - service: this.SERVICE_NAME, - method: "handleNotifications", - stack: error.stack, - }); - } - } -} - -export default NotificationService; diff --git a/Server/service/settingsService.js b/Server/service/settingsService.js deleted file mode 100644 index 24931f6ce..000000000 --- a/Server/service/settingsService.js +++ /dev/null @@ -1,84 +0,0 @@ -const SERVICE_NAME = "SettingsService"; -import dotenv from "dotenv"; -dotenv.config(); -const envConfig = { - logLevel: process.env.LOG_LEVEL, - apiBaseUrl: undefined, - clientHost: process.env.CLIENT_HOST, - jwtSecret: process.env.JWT_SECRET, - refreshTokenSecret: process.env.REFRESH_TOKEN_SECRET, - dbType: process.env.DB_TYPE, - dbConnectionString: process.env.DB_CONNECTION_STRING, - redisHost: process.env.REDIS_HOST, - redisPort: process.env.REDIS_PORT, - jwtTTL: process.env.TOKEN_TTL, - refreshTokenTTL: process.env.REFRESH_TOKEN_TTL, - pagespeedApiKey: process.env.PAGESPEED_API_KEY, - systemEmailHost: process.env.SYSTEM_EMAIL_HOST, - systemEmailPort: process.env.SYSTEM_EMAIL_PORT, - systemEmailAddress: process.env.SYSTEM_EMAIL_ADDRESS, - systemEmailPassword: process.env.SYSTEM_EMAIL_PASSWORD, -}; -/** - * SettingsService - * - * This service is responsible for loading and managing the application settings. - * It gives priority to environment variables and will only load settings - * from the database if they are not set in the environment. - */ -class SettingsService { - static SERVICE_NAME = SERVICE_NAME; - /** - * Constructs a new SettingsService - * @constructor - * @throws {Error} - */ constructor(appSettings) { - this.appSettings = appSettings; - this.settings = { ...envConfig }; - } - /** - * Load settings from the database and merge with environment settings. - * If there are any settings that weren't set by environment variables, use user settings from the database. - * @returns {Promise} The merged settings. - * @throws Will throw an error if settings are not found in the database or if settings have not been loaded. - */ async loadSettings() { - try { - const dbSettings = await this.appSettings.findOne(); - if (!this.settings) { - throw new Error("Settings not found"); - } - - // If there are any settings that weren't set by environment variables, use user settings from DB - for (const key in envConfig) { - if (envConfig[key] === undefined && dbSettings[key] !== undefined) { - this.settings[key] = dbSettings[key]; - } - } - return this.settings; - } catch (error) { - error.service === undefined ? (error.service = SERVICE_NAME) : null; - error.method === undefined ? (error.method = "loadSettings") : null; - throw error; - } - } - /** - * Reload settings by calling loadSettings. - * @returns {Promise} The reloaded settings. - */ - async reloadSettings() { - return this.loadSettings(); - } - /** - * Get the current settings. - * @returns {Object} The current settings. - * @throws Will throw an error if settings have not been loaded. - */ - getSettings() { - if (!this.settings) { - throw new Error("Settings have not been loaded"); - } - return this.settings; - } -} - -export default SettingsService; diff --git a/Server/service/statusService.js b/Server/service/statusService.js deleted file mode 100644 index cca443e9e..000000000 --- a/Server/service/statusService.js +++ /dev/null @@ -1,164 +0,0 @@ -const SERVICE_NAME = "StatusService"; - -class StatusService { - static SERVICE_NAME = SERVICE_NAME; - /** - * Creates an instance of StatusService. - * - * @param {Object} db - The database instance. - * @param {Object} logger - The logger instance. - */ - constructor(db, logger) { - this.db = db; - this.logger = logger; - this.SERVICE_NAME = SERVICE_NAME; - } - - getStatusString = (status) => { - if (status === true) return "up"; - if (status === false) return "down"; - return "unknown"; - }; - /** - * Updates the status of a monitor based on the network response. - * - * @param {Object} networkResponse - The network response containing monitorId and status. - * @param {string} networkResponse.monitorId - The ID of the monitor. - * @param {string} networkResponse.status - The new status of the monitor. - * @returns {Promise} - A promise that resolves to an object containing the monitor, statusChanged flag, and previous status if the status changed, or false if an error occurred. - * @returns {Promise} returnObject - The object returned by the function. - * @returns {Object} returnObject.monitor - The monitor object. - * @returns {boolean} returnObject.statusChanged - Flag indicating if the status has changed. - * @returns {boolean} returnObject.prevStatus - The previous status of the monitor - */ - updateStatus = async (networkResponse) => { - this.insertCheck(networkResponse); - try { - const { monitorId, status } = networkResponse; - const monitor = await this.db.getMonitorById(monitorId); - // No change in monitor status, return early - if (monitor.status === status) - return { monitor, statusChanged: false, prevStatus: monitor.status }; - // Monitor status changed, save prev status and update monitor - - this.logger.info({ - service: this.SERVICE_NAME, - message: `${monitor.name} went from ${this.getStatusString(monitor.status)} to ${this.getStatusString(status)}`, - prevStatus: monitor.status, - newStatus: status, - }); - - const prevStatus = monitor.status; - monitor.status = status; - await monitor.save(); - - return { - monitor, - statusChanged: true, - prevStatus: prevStatus, - }; - // - } catch (error) { - this.logger.error({ - service: this.SERVICE_NAME, - message: error.message, - method: "updateStatus", - stack: error.stack, - }); - throw error; - } - }; - - /** - * Builds a check object from the network response. - * - * @param {Object} networkResponse - The network response object. - * @param {string} networkResponse.monitorId - The monitor ID. - * @param {string} networkResponse.type - The type of the response. - * @param {string} networkResponse.status - The status of the response. - * @param {number} networkResponse.responseTime - The response time. - * @param {number} networkResponse.code - The status code. - * @param {string} networkResponse.message - The message. - * @param {Object} networkResponse.payload - The payload of the response. - * @returns {Object} The check object. - */ - buildCheck = (networkResponse) => { - const { monitorId, teamId, type, status, responseTime, code, message, payload } = - networkResponse; - const check = { - monitorId, - teamId, - status, - statusCode: code, - responseTime, - message, - }; - - if (type === "pagespeed") { - const categories = payload.lighthouseResult?.categories; - const audits = payload.lighthouseResult?.audits; - const { - "cumulative-layout-shift": cls = 0, - "speed-index": si = 0, - "first-contentful-paint": fcp = 0, - "largest-contentful-paint": lcp = 0, - "total-blocking-time": tbt = 0, - } = audits; - check.accessibility = (categories.accessibility?.score || 0) * 100; - check.bestPractices = (categories["best-practices"]?.score || 0) * 100; - check.seo = (categories.seo?.score || 0) * 100; - check.performance = (categories.performance?.score || 0) * 100; - check.audits = { cls, si, fcp, lcp, tbt }; - } - - if (type === "hardware") { - const { cpu, memory, disk, host } = payload?.data ?? {}; - const { errors } = payload?.errors ?? []; - check.cpu = cpu ?? {}; - check.memory = memory ?? {}; - check.disk = disk ?? {}; - check.host = host ?? {}; - check.errors = errors ?? []; - } - return check; - }; - - /** - * Inserts a check into the database based on the network response. - * - * @param {Object} networkResponse - The network response object. - * @param {string} networkResponse.monitorId - The monitor ID. - * @param {string} networkResponse.type - The type of the response. - * @param {string} networkResponse.status - The status of the response. - * @param {number} networkResponse.responseTime - The response time. - * @param {number} networkResponse.code - The status code. - * @param {string} networkResponse.message - The message. - * @param {Object} networkResponse.payload - The payload of the response. - * @returns {Promise} A promise that resolves when the check is inserted. - */ - insertCheck = async (networkResponse) => { - try { - const operationMap = { - http: this.db.createCheck, - ping: this.db.createCheck, - pagespeed: this.db.createPageSpeedCheck, - hardware: this.db.createHardwareCheck, - docker: this.db.createCheck, - port: this.db.createCheck, - }; - const operation = operationMap[networkResponse.type]; - - const check = this.buildCheck(networkResponse); - await operation(check); - } catch (error) { - this.logger.error({ - message: error.message, - service: this.SERVICE_NAME, - method: "insertCheck", - details: `Error inserting check for monitor: ${networkResponse?.monitorId}`, - stack: error.stack, - }); - } - }; -} -export default StatusService; diff --git a/Server/templates/hardwareIncident.mjml b/Server/templates/hardwareIncident.mjml deleted file mode 100644 index e27933fb9..000000000 --- a/Server/templates/hardwareIncident.mjml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - Message from BlueWave Infrastructure Monitoring - - - - - Infrastructure Alerts - - - - - - - -

Hello {{name}}!

-

{{monitor}} at {{url}} has the following infrastructure alerts:

- {{#each alerts}} -

• {{this}}

- {{/each}} -
-
- - - View Infrastructure Details - -

This email was sent by BlueWave Infrastructure Monitoring.

-
-
-
-
-
\ No newline at end of file diff --git a/Server/templates/serverIsDown.mjml b/Server/templates/serverIsDown.mjml deleted file mode 100644 index 16df7a0a1..000000000 --- a/Server/templates/serverIsDown.mjml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - Message from Checkmate Service - - - - - {{monitor}} is down - - - - - - - -

Hello {{name}}!

-

- We detected an incident on one of your monitors. Your service is currently - down. We'll send a message to you once it is up again. -

-

Monitor name: {{monitor}}

-

URL: {{url}}

-
-
- - - View incident details - -

This email was sent by Checkmate.

-
-
-
-
-
diff --git a/Server/templates/serverIsUp.mjml b/Server/templates/serverIsUp.mjml deleted file mode 100644 index 8dbaaf011..000000000 --- a/Server/templates/serverIsUp.mjml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - Message from Checkmate Service - - - - - {{monitor}} is up - - - - - - - -

Hello {{name}}!

-

Your latest incident is resolved and your monitored service is up again.

-

Monitor name: {{monitor}}

-

URL: {{url}}

-
-
- - - View incident details - -

This email was sent by Checkmate.

-
-
-
-
-
\ No newline at end of file diff --git a/Server/utils/messages.js b/Server/utils/messages.js deleted file mode 100644 index 5fc3c70bc..000000000 --- a/Server/utils/messages.js +++ /dev/null @@ -1,147 +0,0 @@ -const errorMessages = { - // General Errors: - FRIENDLY_ERROR: "Something went wrong...", - UNKNOWN_ERROR: "An unknown error occurred", - - // Auth Controller - UNAUTHORIZED: "Unauthorized access", - AUTH_ADMIN_EXISTS: "Admin already exists", - AUTH_INVITE_NOT_FOUND: "Invite not found", - - //Error handling middleware - UNKNOWN_SERVICE: "Unknown service", - NO_AUTH_TOKEN: "No auth token provided", - INVALID_AUTH_TOKEN: "Invalid auth token", - EXPIRED_AUTH_TOKEN: "Token expired", - NO_REFRESH_TOKEN: "No refresh token provided", - INVALID_REFRESH_TOKEN: "Invalid refresh token", - EXPIRED_REFRESH_TOKEN: "Refresh token expired", - REQUEST_NEW_ACCESS_TOKEN: "Request new access token", - - //Payload - INVALID_PAYLOAD: "Invalid payload", - - //Ownership Middleware - VERIFY_OWNER_NOT_FOUND: "Document not found", - VERIFY_OWNER_UNAUTHORIZED: "Unauthorized access", - - //Permissions Middleware - INSUFFICIENT_PERMISSIONS: "Insufficient permissions", - - //DB Errors - DB_USER_EXISTS: "User already exists", - DB_USER_NOT_FOUND: "User not found", - DB_TOKEN_NOT_FOUND: "Token not found", - DB_RESET_PASSWORD_BAD_MATCH: "New password must be different from old password", - DB_FIND_MONITOR_BY_ID: (monitorId) => `Monitor with id ${monitorId} not found`, - DB_DELETE_CHECKS: (monitorId) => `No checks found for monitor with id ${monitorId}`, - - //Auth errors - AUTH_INCORRECT_PASSWORD: "Incorrect password", - AUTH_UNAUTHORIZED: "Unauthorized access", - - // Monitor Errors - MONITOR_GET_BY_ID: "Monitor not found", - MONITOR_GET_BY_USER_ID: "No monitors found for user", - - // Job Queue Errors - JOB_QUEUE_WORKER_CLOSE: "Error closing worker", - JOB_QUEUE_DELETE_JOB: "Job not found in queue", - JOB_QUEUE_OBLITERATE: "Error obliterating queue", - - // PING Operations - PING_CANNOT_RESOLVE: "No response", - - // Status Page Errors - STATUS_PAGE_NOT_FOUND: "Status page not found", - STATUS_PAGE_URL_NOT_UNIQUE: "Status page url must be unique", - - // Docker - DOCKER_FAIL: "Failed to fetch Docker container information", - DOCKER_NOT_FOUND: "Docker container not found", - - // Port - PORT_FAIL: "Failed to connect to port", -}; - -const successMessages = { - //Alert Controller - ALERT_CREATE: "Alert created successfully", - ALERT_GET_BY_USER: "Got alerts successfully", - ALERT_GET_BY_MONITOR: "Got alerts by Monitor successfully", - ALERT_GET_BY_ID: "Got alert by Id successfully", - ALERT_EDIT: "Alert edited successfully", - ALERT_DELETE: "Alert deleted successfully", - - // Auth Controller - AUTH_CREATE_USER: "User created successfully", - AUTH_LOGIN_USER: "User logged in successfully", - AUTH_LOGOUT_USER: "User logged out successfully", - AUTH_UPDATE_USER: "User updated successfully", - AUTH_CREATE_RECOVERY_TOKEN: "Recovery token created successfully", - AUTH_VERIFY_RECOVERY_TOKEN: "Recovery token verified successfully", - AUTH_RESET_PASSWORD: "Password reset successfully", - AUTH_ADMIN_CHECK: "Admin check completed successfully", - AUTH_DELETE_USER: "User deleted successfully", - AUTH_TOKEN_REFRESHED: "Auth token is refreshed", - AUTH_GET_ALL_USERS: "Got all users successfully", - - // Invite Controller - INVITE_ISSUED: "Invite sent successfully", - INVITE_VERIFIED: "Invite verified successfully", - - // Check Controller - CHECK_CREATE: "Check created successfully", - CHECK_GET: "Got checks successfully", - CHECK_DELETE: "Checks deleted successfully", - CHECK_UPDATE_TTL: "Checks TTL updated successfully", - - //Monitor Controller - MONITOR_GET_ALL: "Got all monitors successfully", - MONITOR_STATS_BY_ID: "Got monitor stats by Id successfully", - MONITOR_GET_BY_ID: "Got monitor by Id successfully", - MONITOR_GET_BY_TEAM_ID: "Got monitors by Team Id successfully", - MONITOR_GET_BY_USER_ID: (userId) => `Got monitor for ${userId} successfully"`, - MONITOR_CREATE: "Monitor created successfully", - MONITOR_DELETE: "Monitor deleted successfully", - MONITOR_EDIT: "Monitor edited successfully", - MONITOR_CERTIFICATE: "Got monitor certificate successfully", - MONITOR_DEMO_ADDED: "Successfully added demo monitors", - - // Queue Controller - QUEUE_GET_METRICS: "Got metrics successfully", - QUEUE_ADD_JOB: "Job added successfully", - QUEUE_OBLITERATE: "Queue obliterated", - - //Job Queue - JOB_QUEUE_DELETE_JOB: "Job removed successfully", - JOB_QUEUE_OBLITERATE: "Queue OBLITERATED!!!", - JOB_QUEUE_PAUSE_JOB: "Job paused successfully", - JOB_QUEUE_RESUME_JOB: "Job resumed successfully", - - //Maintenance Window Controller - MAINTENANCE_WINDOW_GET_BY_ID: "Got Maintenance Window by Id successfully", - MAINTENANCE_WINDOW_CREATE: "Maintenance Window created successfully", - MAINTENANCE_WINDOW_GET_BY_TEAM: "Got Maintenance Windows by Team successfully", - MAINTENANCE_WINDOW_DELETE: "Maintenance Window deleted successfully", - MAINTENANCE_WINDOW_EDIT: "Maintenance Window edited successfully", - - //Ping Operations - PING_SUCCESS: "Success", - - // App Settings - GET_APP_SETTINGS: "Got app settings successfully", - UPDATE_APP_SETTINGS: "Updated app settings successfully", - - // Status Page - STATUS_PAGE_BY_URL: "Got status page by url successfully", - STATUS_PAGE_CREATE: "Status page created successfully", - - // Docker - DOCKER_SUCCESS: "Docker container status fetched successfully", - - // Port - PORT_SUCCESS: "Port connected successfully", -}; - -export { errorMessages, successMessages }; diff --git a/.coderabbit.yaml b/client/.coderrabbit.yaml similarity index 100% rename from .coderabbit.yaml rename to client/.coderrabbit.yaml diff --git a/.dockerignore b/client/.dockerignore similarity index 100% rename from .dockerignore rename to client/.dockerignore diff --git a/client/.env.production b/client/.env.production new file mode 100644 index 000000000..7a11848c0 --- /dev/null +++ b/client/.env.production @@ -0,0 +1,3 @@ +VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL +VITE_APP_CLIENT_HOST=UPTIME_APP_CLIENT_HOST +VITE_APP_LOG_LEVEL=UPTIME_APP_LOG_LEVEL \ No newline at end of file diff --git a/Client/.eslintrc.cjs b/client/.eslintrc.cjs similarity index 100% rename from Client/.eslintrc.cjs rename to client/.eslintrc.cjs diff --git a/Client/.gitignore b/client/.gitignore similarity index 94% rename from Client/.gitignore rename to client/.gitignore index ebf01f87a..83f6fe9ed 100644 --- a/Client/.gitignore +++ b/client/.gitignore @@ -25,4 +25,7 @@ dist-ssr .env + +# Scripts +*.sh !env.sh \ No newline at end of file diff --git a/.prettierrc b/client/.prettierrc similarity index 100% rename from .prettierrc rename to client/.prettierrc diff --git a/client/README.md b/client/README.md new file mode 100644 index 000000000..ee3ed2de2 --- /dev/null +++ b/client/README.md @@ -0,0 +1,2 @@ + +This directory contains the client side (frontend) of Checkmate. diff --git a/Client/env.sh b/client/env.sh similarity index 100% rename from Client/env.sh rename to client/env.sh diff --git a/Client/index.html b/client/index.html similarity index 99% rename from Client/index.html rename to client/index.html index 2d13bd25d..a667d1ecf 100644 --- a/Client/index.html +++ b/client/index.html @@ -5,6 +5,7 @@ + Checkmate diff --git a/Client/package-lock.json b/client/package-lock.json similarity index 82% rename from Client/package-lock.json rename to client/package-lock.json index f58aa9d46..b7859e0fe 100644 --- a/Client/package-lock.json +++ b/client/package-lock.json @@ -11,24 +11,35 @@ "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@fontsource/roboto": "^5.0.13", - "@mui/icons-material": "6.4.1", - "@mui/lab": "6.0.0-beta.24", - "@mui/material": "6.4.1", + "@hello-pangea/dnd": "^18.0.0", + "@mui/icons-material": "6.4.11", + "@mui/lab": "6.0.0-dev.240424162023-9968b4889d", + "@mui/material": "6.4.11", "@mui/x-charts": "^7.5.1", - "@mui/x-data-grid": "7.24.0", - "@mui/x-date-pickers": "7.24.0", - "@reduxjs/toolkit": "2.5.0", + "@mui/x-data-grid": "7.29.0", + "@mui/x-date-pickers": "7.29.0", + "@reduxjs/toolkit": "2.7.0", "axios": "^1.7.4", "dayjs": "1.11.13", + "flag-icons": "7.3.2", + "html2canvas": "^1.4.1", + "i18next": "^24.2.2", + "immutability-helper": "^3.1.1", "joi": "17.13.3", "jwt-decode": "^4.0.0", - "react": "^18.2.0", + "maplibre-gl": "5.3.1", + "mui-color-input": "^6.0.0", + "react": "18.3.1", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", "react-dom": "^18.2.0", + "react-i18next": "^15.4.0", + "react-icons": "5.5.0", "react-redux": "9.2.0", "react-router": "^6.23.0", "react-router-dom": "^6.23.1", "react-toastify": "^10.0.5", - "recharts": "2.15.0", + "recharts": "2.15.2", "redux-persist": "6.0.0", "vite-plugin-svgr": "^4.2.0" }, @@ -72,30 +83,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.2.tgz", - "integrity": "sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==", + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", - "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.26.0", - "@babel/generator": "^7.26.0", - "@babel/helper-compilation-targets": "^7.25.9", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", "@babel/helper-module-transforms": "^7.26.0", - "@babel/helpers": "^7.26.0", - "@babel/parser": "^7.26.0", - "@babel/template": "^7.25.9", - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -117,13 +128,13 @@ "license": "MIT" }, "node_modules/@babel/generator": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.2.tgz", - "integrity": "sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz", + "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.26.2", - "@babel/types": "^7.26.0", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -133,12 +144,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", - "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.25.9", + "@babel/compat-data": "^7.26.5", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -179,9 +190,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", - "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "dev": true, "license": "MIT", "engines": { @@ -216,25 +227,25 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", - "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", "license": "MIT", "dependencies": { - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.0" + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", - "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.26.0" + "@babel/types": "^7.27.0" }, "bin": { "parser": "bin/babel-parser.js" @@ -276,9 +287,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", - "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", + "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" @@ -288,30 +299,30 @@ } }, "node_modules/@babel/template": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", - "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.9.tgz", - "integrity": "sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.0.tgz", + "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/generator": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/template": "^7.25.9", - "@babel/types": "^7.25.9", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -320,9 +331,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", - "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.25.9", @@ -332,6 +343,14 @@ "node": ">=6.9.0" } }, + "node_modules/@ctrl/tinycolor": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-4.1.0.tgz", + "integrity": "sha512-WyOx8cJQ+FQus4Mm4uPIZA64gbk3Wxh0so5Lcii0aJifqwoVOlfFtorjLE0Hen4OYyHZMXDWqMmaQemBhgxFRQ==", + "engines": { + "node": ">=14" + } + }, "node_modules/@emotion/babel-plugin": { "version": "11.13.5", "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz", @@ -478,262 +497,6 @@ "integrity": "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==", "license": "MIT" }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@esbuild/linux-x64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", @@ -750,102 +513,6 @@ "node": ">=12" } }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", @@ -964,10 +631,13 @@ "license": "MIT" }, "node_modules/@fontsource/roboto": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-5.1.1.tgz", - "integrity": "sha512-XwVVXtERDQIM7HPUIbyDe0FP4SRovpjF7zMI8M7pbqFp3ahLJsJTd18h+E6pkar6UbV3btbwkKjYARr5M+SQow==", - "license": "Apache-2.0" + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-5.2.5.tgz", + "integrity": "sha512-70r2UZ0raqLn5W+sPeKhqlf8wGvUXFWlofaDlcbt/S3d06+17gXKr3VNqDODB0I1ASme3dGT5OJj9NABt7OTZQ==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } }, "node_modules/@hapi/hoek": { "version": "9.3.0", @@ -984,6 +654,23 @@ "@hapi/hoek": "^9.0.0" } }, + "node_modules/@hello-pangea/dnd": { + "version": "18.0.1", + "resolved": "https://registry.npmjs.org/@hello-pangea/dnd/-/dnd-18.0.1.tgz", + "integrity": "sha512-xojVWG8s/TGrKT1fC8K2tIWeejJYTAeJuj36zM//yEm/ZrnZUSFGS15BpO+jGZT1ybWvyXmeDJwPYb4dhWlbZQ==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime": "^7.26.7", + "css-box-model": "^1.2.1", + "raf-schd": "^4.0.3", + "react-redux": "^9.2.0", + "redux": "^5.0.1" + }, + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -1054,6 +741,18 @@ "node": ">=6.0.0" } }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", @@ -1070,42 +769,87 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@mui/base": { - "version": "5.0.0-beta.69", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.69.tgz", - "integrity": "sha512-r2YyGUXpZxj8rLAlbjp1x2BnMERTZ/dMqd9cClKj2OJ7ALAuiv/9X5E9eHfRc9o/dGRuLSMq/WTjREktJVjxVA==", - "license": "MIT", + "node_modules/@mapbox/geojson-rewind": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz", + "integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==", + "license": "ISC", "dependencies": { - "@babel/runtime": "^7.26.0", - "@floating-ui/react-dom": "^2.1.1", - "@mui/types": "^7.2.21", - "@mui/utils": "^6.4.1", - "@popperjs/core": "^2.11.8", - "clsx": "^2.1.1", - "prop-types": "^15.8.1" + "get-stream": "^6.0.1", + "minimist": "^1.2.6" }, + "bin": { + "geojson-rewind": "geojson-rewind" + } + }, + "node_modules/@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==", "engines": { - "node": ">=14.0.0" + "node": ">= 0.6" + } + }, + "node_modules/@mapbox/point-geometry": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", + "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==", + "license": "ISC" + }, + "node_modules/@mapbox/tiny-sdf": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.6.tgz", + "integrity": "sha512-qMqa27TLw+ZQz5Jk+RcwZGH7BQf5G/TrutJhspsca/3SHwmgKQ1iq+d3Jxz5oysPVYTGP6aXxCo5Lk9Er6YBAA==", + "license": "BSD-2-Clause" + }, + "node_modules/@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", + "license": "BSD-2-Clause" + }, + "node_modules/@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "license": "BSD-3-Clause", + "dependencies": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "node_modules/@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", + "license": "ISC", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@maplibre/maplibre-gl-style-spec": { + "version": "23.1.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-23.1.0.tgz", + "integrity": "sha512-R6/ihEuC5KRexmKIYkWqUv84Gm+/QwsOUgHyt1yy2XqCdGdLvlBWVWIIeTZWN4NGdwmY6xDzdSGU2R9oBLNg2w==", + "license": "ISC", + "dependencies": { + "@mapbox/jsonlint-lines-primitives": "~2.0.2", + "@mapbox/unitbezier": "^0.0.1", + "json-stringify-pretty-compact": "^4.0.0", + "minimist": "^1.2.8", + "quickselect": "^3.0.0", + "rw": "^1.3.3", + "tinyqueue": "^3.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } + "bin": { + "gl-style-format": "dist/gl-style-format.mjs", + "gl-style-migrate": "dist/gl-style-migrate.mjs", + "gl-style-validate": "dist/gl-style-validate.mjs" } }, "node_modules/@mui/core-downloads-tracker": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.4.1.tgz", - "integrity": "sha512-SfDLWMV5b5oXgDf3NTa2hCTPC1d2defhDH2WgFKmAiejC4mSfXYbyi+AFCLzpizauXhgBm8OaZy9BHKnrSpahQ==", + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.4.11.tgz", + "integrity": "sha512-CzAQs9CTzlwbsF9ZYB4o4lLwBv1/qNE264NjuYao+ctAXsmlPtYa8RtER4UsUXSMxNN9Qi+aQdYcKl2sUpnmAw==", "license": "MIT", "funding": { "type": "opencollective", @@ -1113,9 +857,9 @@ } }, "node_modules/@mui/icons-material": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-6.4.1.tgz", - "integrity": "sha512-wsxFcUTQxt4s+7Bg4GgobqRjyaHLmZGNOs+HJpbwrwmLbT6mhIJxhpqsKzzWq9aDY8xIe7HCjhpH7XI5UD6teA==", + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-6.4.11.tgz", + "integrity": "sha512-+jjJGIrB1awNbMv4ZVPPdN/p7O1UKFZ+xqRvNIQ8B1KnlID5hPMPBLM6UUbRF4bu3UDCbu79rn9Nye5LGNzmeA==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0" @@ -1128,7 +872,7 @@ "url": "https://opencollective.com/mui-org" }, "peerDependencies": { - "@mui/material": "^6.4.1", + "@mui/material": "^6.4.11", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, @@ -1139,21 +883,21 @@ } }, "node_modules/@mui/lab": { - "version": "6.0.0-beta.24", - "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-6.0.0-beta.24.tgz", - "integrity": "sha512-Off0rx2065TfGu5Z8E4OduNiVAqE9p9A8N1268hoXOcx7HzARxJsDFLRKvWgpPMqmGEvR8DVaHkcF2N90UB15A==", + "version": "6.0.0-dev.240424162023-9968b4889d", + "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-6.0.0-dev.240424162023-9968b4889d.tgz", + "integrity": "sha512-iKFAz7/EeWI4PaFsP4jK2FcYJmUYDBkn3XZwpQSAl5806yYq5J2U2mPQLuZBdhrH50gT2O98p95i3vwL4YBwAg==", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.26.0", - "@mui/base": "5.0.0-beta.69", - "@mui/system": "^6.4.1", - "@mui/types": "^7.2.21", - "@mui/utils": "^6.4.1", - "clsx": "^2.1.1", + "@babel/runtime": "^7.24.4", + "@mui/base": "5.0.0-beta.42", + "@mui/system": "^6.0.0-dev.240424162023-9968b4889d", + "@mui/types": "^7.2.14", + "@mui/utils": "^6.0.0-alpha.3", + "clsx": "^2.1.0", "prop-types": "^15.8.1" }, "engines": { - "node": ">=14.0.0" + "node": ">=12.0.0" }, "funding": { "type": "opencollective", @@ -1162,11 +906,10 @@ "peerDependencies": { "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", - "@mui/material": "^6.4.1", - "@mui/material-pigment-css": "^6.4.1", - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" + "@mui/material": "^6.0.0-dev.240424162023-9968b4889d", + "@types/react": "^17.0.0 || ^18.0.0", + "react": "^17.0.0 || ^18.0.0", + "react-dom": "^17.0.0 || ^18.0.0" }, "peerDependenciesMeta": { "@emotion/react": { @@ -1175,25 +918,55 @@ "@emotion/styled": { "optional": true }, - "@mui/material-pigment-css": { + "@types/react": { "optional": true - }, + } + } + }, + "node_modules/@mui/lab/node_modules/@mui/base": { + "version": "5.0.0-beta.42", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.42.tgz", + "integrity": "sha512-fWRiUJVCHCPF+mxd5drn08bY2qRw3jj5f1SSQdUXmaJ/yKpk23ys8MgLO2KGVTRtbks/+ctRfgffGPbXifj0Ug==", + "deprecated": "This package has been replaced by @base-ui-components/react", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.24.4", + "@floating-ui/react-dom": "^2.0.8", + "@mui/types": "^7.2.14", + "@mui/utils": "^6.0.0-alpha.1", + "@popperjs/core": "^2.11.8", + "clsx": "^2.1.0", + "prop-types": "^15.8.1" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@types/react": "^17.0.0 || ^18.0.0", + "react": "^17.0.0 || ^18.0.0", + "react-dom": "^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { "@types/react": { "optional": true } } }, "node_modules/@mui/material": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.4.1.tgz", - "integrity": "sha512-MFBfia6UiKxyoLeGkAh8M15bkeDmfnsUTMRJd/vTQue6YQ8AQ6lw9HqDthyYghzDEWIvZO/lQQzLrZE8XwNJLA==", + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.4.11.tgz", + "integrity": "sha512-k2D3FLJS+/qD0qnd6ZlAjGFvaaxe1Dl10NyvpeDzIebMuYdn8VqYe6XBgGueEAtnzSJM4V03VD9kb5Fi24dnTA==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", - "@mui/core-downloads-tracker": "^6.4.1", - "@mui/system": "^6.4.1", - "@mui/types": "^7.2.21", - "@mui/utils": "^6.4.1", + "@mui/core-downloads-tracker": "^6.4.11", + "@mui/system": "^6.4.11", + "@mui/types": "~7.2.24", + "@mui/utils": "^6.4.9", "@popperjs/core": "^2.11.8", "@types/react-transition-group": "^4.4.12", "clsx": "^2.1.1", @@ -1212,7 +985,7 @@ "peerDependencies": { "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", - "@mui/material-pigment-css": "^6.4.1", + "@mui/material-pigment-css": "^6.4.11", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" @@ -1233,19 +1006,19 @@ } }, "node_modules/@mui/material/node_modules/react-is": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.0.0.tgz", - "integrity": "sha512-H91OHcwjZsbq3ClIDHMzBShc1rotbfACdWENsmEf0IFvZ3FgGPtdHMcsv45bQ1hAbgdfiA8SnxTKfDS+x/8m2g==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.1.0.tgz", + "integrity": "sha512-Oe56aUPnkHyyDxxkvqtd7KkdQP5uIUfHxd5XTb3wE9d/kRnZLmKbDB0GWk919tdQ+mxxPtG6EAs6RMT6i1qtHg==", "license": "MIT" }, "node_modules/@mui/private-theming": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.4.1.tgz", - "integrity": "sha512-DcT7mwK89owwgcEuiE7w458te4CIjHbYWW6Kn6PiR6eLtxBsoBYphA968uqsQAOBQDpbYxvkuFLwhgk4bxoN/Q==", + "version": "6.4.9", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.4.9.tgz", + "integrity": "sha512-LktcVmI5X17/Q5SkwjCcdOLBzt1hXuc14jYa7NPShog0GBDCDvKtcnP0V7a2s6EiVRlv7BzbWEJzH6+l/zaCxw==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", - "@mui/utils": "^6.4.1", + "@mui/utils": "^6.4.9", "prop-types": "^15.8.1" }, "engines": { @@ -1266,9 +1039,9 @@ } }, "node_modules/@mui/styled-engine": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.4.0.tgz", - "integrity": "sha512-ek/ZrDujrger12P6o4luQIfRd2IziH7jQod2WMbLqGE03Iy0zUwYmckRTVhRQTLPNccpD8KXGcALJF+uaUQlbg==", + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.4.11.tgz", + "integrity": "sha512-74AUmlHXaGNbyUqdK/+NwDJOZqgRQw6BcNvhoWYLq3LGbLTkE+khaJ7soz6cIabE4CPYqO2/QAIU1Z/HEjjpcw==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", @@ -1300,16 +1073,16 @@ } }, "node_modules/@mui/system": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-6.4.1.tgz", - "integrity": "sha512-rgQzgcsHCTtzF9MZ+sL0tOhf2ZBLazpjrujClcb4Siju5lTrK0xX4PsiropActzCemNfM+mOu+0jezAVnfRK8g==", + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-6.4.11.tgz", + "integrity": "sha512-gibtsrZEwnDaT5+I/KloOj/yHluX5G8heknuxBpQOdEQ3Gc0avjSImn5hSeKp8D4thiwZiApuggIjZw1dQguUA==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", - "@mui/private-theming": "^6.4.1", - "@mui/styled-engine": "^6.4.0", - "@mui/types": "^7.2.21", - "@mui/utils": "^6.4.1", + "@mui/private-theming": "^6.4.9", + "@mui/styled-engine": "^6.4.11", + "@mui/types": "~7.2.24", + "@mui/utils": "^6.4.9", "clsx": "^2.1.1", "csstype": "^3.1.3", "prop-types": "^15.8.1" @@ -1340,9 +1113,9 @@ } }, "node_modules/@mui/types": { - "version": "7.2.21", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.21.tgz", - "integrity": "sha512-6HstngiUxNqLU+/DPqlUJDIPbzUBxIVHb1MmXP0eTWDIROiCR2viugXpEif0PPe2mLqqakPzzRClWAnK+8UJww==", + "version": "7.2.24", + "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.24.tgz", + "integrity": "sha512-3c8tRt/CbWZ+pEg7QpSwbdxOk36EfmhbKf6AGZsD1EcLDLTSZoxxJ86FVtcjxvjuhdyBiWKSTGZFaXCnidO2kw==", "license": "MIT", "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0" @@ -1354,13 +1127,13 @@ } }, "node_modules/@mui/utils": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.4.1.tgz", - "integrity": "sha512-iQUDUeYh87SvR4lVojaRaYnQix8BbRV51MxaV6MBmqthecQoxwSbS5e2wnbDJUeFxY2ppV505CiqPLtd0OWkqw==", + "version": "6.4.9", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.4.9.tgz", + "integrity": "sha512-Y12Q9hbK9g+ZY0T3Rxrx9m2m10gaphDuUMgWxyV5kNJevVxXYCLclYUCC9vXaIk1/NdNDTcW2Yfr2OGvNFNmHg==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", - "@mui/types": "^7.2.21", + "@mui/types": "~7.2.24", "@types/prop-types": "^15.7.14", "clsx": "^2.1.1", "prop-types": "^15.8.1", @@ -1390,15 +1163,15 @@ "license": "MIT" }, "node_modules/@mui/x-charts": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.24.0.tgz", - "integrity": "sha512-X/zN0GxPHJC24QckFrtEbIK0HYoGwZgpNC5CV9cvRGvHphDFuNZk9xg9fJwIg1i3PPZHXRO3E+L/ee6fJ9ufhw==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.29.0.tgz", + "integrity": "sha512-sFkMaw4qSQwy9yYlT9/T21c2pOVI3OAqfvy9aQp+GaEbDjTuyWwcWRX4dkN2fb674qofSbRgk5VW9xrnuGuYNQ==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.25.7", - "@mui/utils": "^5.16.6 || ^6.0.0", + "@mui/utils": "^5.16.6 || ^6.0.0 || ^7.0.0", "@mui/x-charts-vendor": "7.20.0", - "@mui/x-internals": "7.24.0", + "@mui/x-internals": "7.29.0", "@react-spring/rafz": "^9.7.5", "@react-spring/web": "^9.7.5", "clsx": "^2.1.1", @@ -1410,8 +1183,8 @@ "peerDependencies": { "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", - "@mui/material": "^5.15.14 || ^6.0.0", - "@mui/system": "^5.15.14 || ^6.0.0", + "@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0", + "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" }, @@ -1448,17 +1221,18 @@ } }, "node_modules/@mui/x-data-grid": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@mui/x-data-grid/-/x-data-grid-7.24.0.tgz", - "integrity": "sha512-goYTKDp+e+dXw7E+WndWUhWXTjX3aTqN8W2dCKhXnmE9Gu8dFwG6Azl7GK9l2m5YHGuqYmpWqcSG9etLdwYaVg==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@mui/x-data-grid/-/x-data-grid-7.29.0.tgz", + "integrity": "sha512-v3HiwcT/oqgv6xkynOd3oxH26IS0OvspgmfHtfPF9WeRsnUHcTTZ7E1EoAKjT9/Ms2f3oKKJAR6rZBZ5ymik1g==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.25.7", - "@mui/utils": "^5.16.6 || ^6.0.0", - "@mui/x-internals": "7.24.0", + "@mui/utils": "^5.16.6 || ^6.0.0 || ^7.0.0", + "@mui/x-internals": "7.29.0", "clsx": "^2.1.1", "prop-types": "^15.8.1", - "reselect": "^5.1.1" + "reselect": "^5.1.1", + "use-sync-external-store": "^1.0.0" }, "engines": { "node": ">=14.0.0" @@ -1470,8 +1244,8 @@ "peerDependencies": { "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", - "@mui/material": "^5.15.14 || ^6.0.0", - "@mui/system": "^5.15.14 || ^6.0.0", + "@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0", + "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" }, @@ -1485,14 +1259,14 @@ } }, "node_modules/@mui/x-date-pickers": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@mui/x-date-pickers/-/x-date-pickers-7.24.0.tgz", - "integrity": "sha512-oBM9Yp2H3tJ7qoHB4APQJYxZG4rz6JD4CwLzbzD9o3r+E1HGpGSLhwK3rDEz9VEjbOq8893Z2TGYLLWoyjeFXQ==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@mui/x-date-pickers/-/x-date-pickers-7.29.0.tgz", + "integrity": "sha512-6jpkbXB1/9/VLvlJ5wLs4M54fi9WeCpJSJ3I76MbZBKtZUDMFsuc3V5Mm4bsTd08xF6py1o+Qx2HapsE2gFhrg==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.25.7", - "@mui/utils": "^5.16.6 || ^6.0.0", - "@mui/x-internals": "7.24.0", + "@mui/utils": "^5.16.6 || ^6.0.0 || ^7.0.0", + "@mui/x-internals": "7.29.0", "@types/react-transition-group": "^4.4.11", "clsx": "^2.1.1", "prop-types": "^15.8.1", @@ -1508,8 +1282,8 @@ "peerDependencies": { "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", - "@mui/material": "^5.15.14 || ^6.0.0", - "@mui/system": "^5.15.14 || ^6.0.0", + "@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0", + "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0", "date-fns": "^2.25.0 || ^3.2.0 || ^4.0.0", "date-fns-jalali": "^2.13.0-0 || ^3.2.0-0 || ^4.0.0-0", "dayjs": "^1.10.7", @@ -1551,13 +1325,13 @@ } }, "node_modules/@mui/x-internals": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.24.0.tgz", - "integrity": "sha512-lYa/XLltxNMY8YAFDopIHrXda2EAoqMCilyGMuPMz+WTG+b+StlUKqtj8cgFPQ/sa5dQ2fR7R3KJdjLREKUrlQ==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.29.0.tgz", + "integrity": "sha512-+Gk6VTZIFD70XreWvdXBwKd8GZ2FlSCuecQFzm6znwqXg1ZsndavrhG9tkxpxo2fM1Zf7Tk8+HcOO0hCbhTQFA==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.25.7", - "@mui/utils": "^5.16.6 || ^6.0.0" + "@mui/utils": "^5.16.6 || ^6.0.0 || ^7.0.0" }, "engines": { "node": ">=14.0.0" @@ -1618,6 +1392,21 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/@react-dnd/asap": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@react-dnd/asap/-/asap-5.0.2.tgz", + "integrity": "sha512-WLyfoHvxhs0V9U+GTsGilGgf2QsPl6ZZ44fnv0/b8T3nQyvzxidxsg/ZltbWssbsRDlYW8UKSQMTGotuTotZ6A==" + }, + "node_modules/@react-dnd/invariant": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@react-dnd/invariant/-/invariant-4.0.2.tgz", + "integrity": "sha512-xKCTqAK/FFauOM9Ta2pswIyT3D8AQlfrYdOi/toTPEhqCuAs1v5tcJ3Y08Izh1cJ5Jchwy9SeAXmMg6zrKs2iw==" + }, + "node_modules/@react-dnd/shallowequal": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@react-dnd/shallowequal/-/shallowequal-4.0.2.tgz", + "integrity": "sha512-/RVXdLvJxLg4QKvMoM5WlwNR9ViO9z8B/qPcc+C0Sa/teJY7QG7kJ441DwzOjMYEY7GmU4dj5EcGHIkKZiQZCA==" + }, "node_modules/@react-spring/animated": { "version": "9.7.5", "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.7.5.tgz", @@ -1691,11 +1480,13 @@ } }, "node_modules/@reduxjs/toolkit": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.0.tgz", - "integrity": "sha512-awNe2oTodsZ6LmRqmkFhtb/KH03hUhxOamEQy411m3Njj3BbFvoBovxo4Q1cBWnV1ErprVj9MlF0UPXkng0eyg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.7.0.tgz", + "integrity": "sha512-XVwolG6eTqwV0N8z/oDlN93ITCIGIop6leXlGJI/4EKy+0POYkR+ABHRSdGXY+0MQvJBP8yAzh+EYFxTuvmBiQ==", "license": "MIT", "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", "immer": "^10.0.3", "redux": "^5.0.1", "redux-thunk": "^3.1.0", @@ -1715,9 +1506,9 @@ } }, "node_modules/@remix-run/router": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.21.1.tgz", - "integrity": "sha512-KeBYSwohb8g4/wCcnksvKTYlg69O62sQeLynn2YE+5z7JWEj95if27kclW9QqbrlsQ2DINI8fjbV3zyuKfwjKg==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.0.tgz", + "integrity": "sha512-O3rHJzAQKamUz1fvE0Qaw0xSFqsA/yafi2iqeE0pvdFtCO1viYx8QL6f3Ln/aCCTLxs68SLf0KPM9eSeM8yBnA==", "license": "MIT", "engines": { "node": ">=14.0.0" @@ -1745,175 +1536,6 @@ } } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.4.tgz", - "integrity": "sha512-2Y3JT6f5MrQkICUyRVCw4oa0sutfAsgaSsb0Lmmy1Wi2y7X5vT9Euqw4gOsCyy0YfKURBg35nhUKZS4mDcfULw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.4.tgz", - "integrity": "sha512-wzKRQXISyi9UdCVRqEd0H4cMpzvHYt1f/C3CoIjES6cG++RHKhrBj2+29nPF0IB5kpy9MS71vs07fvrNGAl/iA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.4.tgz", - "integrity": "sha512-PlNiRQapift4LNS8DPUHuDX/IdXiLjf8mc5vdEmUR0fF/pyy2qWwzdLjB+iZquGr8LuN4LnUoSEvKRwjSVYz3Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.4.tgz", - "integrity": "sha512-o9bH2dbdgBDJaXWJCDTNDYa171ACUdzpxSZt+u/AAeQ20Nk5x+IhA+zsGmrQtpkLiumRJEYef68gcpn2ooXhSQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.4.tgz", - "integrity": "sha512-NBI2/i2hT9Q+HySSHTBh52da7isru4aAAo6qC3I7QFVsuhxi2gM8t/EI9EVcILiHLj1vfi+VGGPaLOUENn7pmw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.4.tgz", - "integrity": "sha512-wYcC5ycW2zvqtDYrE7deary2P2UFmSh85PUpAx+dwTCO9uw3sgzD6Gv9n5X4vLaQKsrfTSZZ7Z7uynQozPVvWA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.4.tgz", - "integrity": "sha512-9OwUnK/xKw6DyRlgx8UizeqRFOfi9mf5TYCw1uolDaJSbUmBxP85DE6T4ouCMoN6pXw8ZoTeZCSEfSaYo+/s1w==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.4.tgz", - "integrity": "sha512-Vgdo4fpuphS9V24WOV+KwkCVJ72u7idTgQaBoLRD0UxBAWTF9GWurJO9YD9yh00BzbkhpeXtm6na+MvJU7Z73A==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.4.tgz", - "integrity": "sha512-pleyNgyd1kkBkw2kOqlBx+0atfIIkkExOTiifoODo6qKDSpnc6WzUY5RhHdmTdIJXBdSnh6JknnYTtmQyobrVg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.4.tgz", - "integrity": "sha512-caluiUXvUuVyCHr5DxL8ohaaFFzPGmgmMvwmqAITMpV/Q+tPoaHZ/PWa3t8B2WyoRcIIuu1hkaW5KkeTDNSnMA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.4.tgz", - "integrity": "sha512-FScrpHrO60hARyHh7s1zHE97u0KlT/RECzCKAdmI+LEoC1eDh/RDji9JgFqyO+wPDb86Oa/sXkily1+oi4FzJQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.4.tgz", - "integrity": "sha512-qyyprhyGb7+RBfMPeww9FlHwKkCXdKHeGgSqmIXw9VSUtvyFZ6WZRtnxgbuz76FK7LyoN8t/eINRbPUcvXB5fw==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.4.tgz", - "integrity": "sha512-PFz+y2kb6tbh7m3A7nA9++eInGcDVZUACulf/KzDtovvdTizHpZaJty7Gp0lFwSQcrnebHOqxF1MaKZd7psVRg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.27.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.4.tgz", @@ -1940,45 +1562,6 @@ "linux" ] }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.4.tgz", - "integrity": "sha512-yOpVsA4K5qVwu2CaS3hHxluWIK5HQTjNV4tWjQXluMiiiu4pJj4BN98CvxohNCpcjMeTXk/ZMJBRbgRg8HBB6A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.4.tgz", - "integrity": "sha512-KtwEJOaHAVJlxV92rNYiG9JQwQAdhBlrjNRp7P9L8Cb4Rer3in+0A+IPhJC9y68WAi9H0sX4AiG2NTsVlmqJeQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.4.tgz", - "integrity": "sha512-3j4jx1TppORdTAoBJRd+/wJRGCPC0ETWkXOecJ6PPZLj6SptXkrXcNqdj0oclbKML6FkQltdz7bBA3rUSirZug==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@sideway/address": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", @@ -2000,6 +1583,18 @@ "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", "license": "BSD-3-Clause" }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "license": "MIT" + }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT" + }, "node_modules/@svgr/babel-plugin-add-jsx-attribute": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", @@ -2359,12 +1954,61 @@ "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "license": "MIT" }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, + "node_modules/@types/geojson-vt": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/geojson-vt/-/geojson-vt-3.2.5.tgz", + "integrity": "sha512-qDO7wqtprzlpe8FfQ//ClPV9xiuoh2nkIgiouIptON9w5jvD/fA4szvP9GBlDVdJ5dldAl0kX/sy3URbWwLx0g==", + "license": "MIT", + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/mapbox__point-geometry": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.4.tgz", + "integrity": "sha512-mUWlSxAmYLfwnRBmgYV86tgYmMIICX4kza8YnE/eIlywGe2XoOxlpVnXWwir92xRLjwyarqwpu2EJKD2pk0IUA==", + "license": "MIT" + }, + "node_modules/@types/mapbox__vector-tile": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@types/mapbox__vector-tile/-/mapbox__vector-tile-1.3.4.tgz", + "integrity": "sha512-bpd8dRn9pr6xKvuEBQup8pwQfD4VUyqO/2deGjfpe6AwC8YRlyEipvefyRJUSiCJTZuCb8Pl1ciVV5ekqJ96Bg==", + "license": "MIT", + "dependencies": { + "@types/geojson": "*", + "@types/mapbox__point-geometry": "*", + "@types/pbf": "*" + } + }, + "node_modules/@types/node": { + "version": "22.13.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.2.tgz", + "integrity": "sha512-Z+r8y3XL9ZpI2EY52YYygAFmo2/oWfNSj4BCpAXE2McAexDk8VcnBMGC9Djn9gTKt4d2T/hhXqmPzo4hfIXtTg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "undici-types": "~6.20.0" + } + }, "node_modules/@types/parse-json": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", "license": "MIT" }, + "node_modules/@types/pbf": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz", + "integrity": "sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA==", + "license": "MIT" + }, "node_modules/@types/prop-types": { "version": "15.7.14", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", @@ -2372,9 +2016,9 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "18.3.18", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz", - "integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==", + "version": "18.3.20", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.20.tgz", + "integrity": "sha512-IPaCZN7PShZK/3t6Q87pfTkRm6oLTd4vztyoj+cbHUF1g3FfVb2tFIL79uCRKEfv16AhqDMBywP2VW3KIZUvcg==", "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -2382,9 +2026,9 @@ } }, "node_modules/@types/react-dom": { - "version": "18.3.5", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.5.tgz", - "integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==", + "version": "18.3.6", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.6.tgz", + "integrity": "sha512-nf22//wEbKXusP6E9pfOCDwFdHAX4u172eaJI4YkDRQEZiorm6KfYnSC2SWLDMVWUOWPERmJnN0ujeAfTBLvrw==", "dev": true, "license": "MIT", "peerDependencies": { @@ -2400,6 +2044,15 @@ "@types/react": "*" } }, + "node_modules/@types/supercluster": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.3.tgz", + "integrity": "sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA==", + "license": "MIT", + "dependencies": { + "@types/geojson": "*" + } + }, "node_modules/@types/use-sync-external-store": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", @@ -2414,17 +2067,17 @@ "license": "ISC" }, "node_modules/@vitejs/plugin-react": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz", - "integrity": "sha512-SCCPBJtYLdE8PX/7ZQAs1QAZ8Jqwih+0VBLum1EGqmCCQal+MIUqLCzj3ZUy8ufbC0cAM4LRlSTm7IQJwWT4ug==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.4.0.tgz", + "integrity": "sha512-x/EztcTKVj+TDeANY1WjNeYsvZjZdfWRMP/KXi5Yn8BoTzpa13ZltaQqKfvWYbX8CE10GOHHdC5v86jY9x8i/g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.26.0", + "@babel/core": "^7.26.10", "@babel/plugin-transform-react-jsx-self": "^7.25.9", "@babel/plugin-transform-react-jsx-source": "^7.25.9", "@types/babel__core": "^7.20.5", - "react-refresh": "^0.14.2" + "react-refresh": "^0.17.0" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -2433,11 +2086,21 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0" } }, + "node_modules/@vitejs/plugin-react/node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/acorn": { "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "dev": true, + "devOptional": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -2664,9 +2327,9 @@ } }, "node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", @@ -2696,6 +2359,14 @@ "dev": true, "license": "MIT" }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2708,9 +2379,9 @@ } }, "node_modules/browserslist": { - "version": "4.24.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", - "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "funding": [ { "type": "opencollective", @@ -2727,9 +2398,9 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001669", - "electron-to-chromium": "^1.5.41", - "node-releases": "^2.0.18", + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.1" }, "bin": { @@ -2739,6 +2410,14 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -2759,9 +2438,9 @@ } }, "node_modules/call-bind-apply-helpers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", - "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2773,14 +2452,14 @@ } }, "node_modules/call-bound": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", - "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "get-intrinsic": "^1.2.6" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -2811,9 +2490,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001684", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001684.tgz", - "integrity": "sha512-G1LRwLIQjBQoyq0ZJGqGIJUXzJ8irpbjHLpVRXDvBEScFJ9b17sgK6vlx0GAJFE21okD7zXl08rRRUfq6HdoEQ==", + "version": "1.0.30001699", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001699.tgz", + "integrity": "sha512-b+uH5BakXZ9Do9iK+CkDmctUSEqZl+SP056vc5usa0PL+ev5OHw003rZXcnjNDv3L8P5j6rwT6C0BPKSikW08w==", "funding": [ { "type": "opencollective", @@ -2932,6 +2611,22 @@ "node": ">= 8" } }, + "node_modules/css-box-model": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz", + "integrity": "sha512-a7Vr4Q/kd/aw96bnJG332W9V9LkJO69JRcaCYDUqjp6/z0w6VcZjgAcTbgFxEPfBgdnAwlh3iwu+hLopa+flJw==", + "dependencies": { + "tiny-invariant": "^1.0.6" + } + }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", @@ -3215,6 +2910,24 @@ "node": ">=0.4.0" } }, + "node_modules/dnd-core": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/dnd-core/-/dnd-core-16.0.1.tgz", + "integrity": "sha512-HK294sl7tbw6F6IeuK16YSBUoorvHpY8RHO+9yFfaJyCDVb6n7PRcezrOEOa2SBCqiYpemh5Jx20ZcjKdFAVng==", + "dependencies": { + "@react-dnd/asap": "^5.0.1", + "@react-dnd/invariant": "^4.0.1", + "redux": "^4.2.0" + } + }, + "node_modules/dnd-core/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3263,10 +2976,16 @@ "node": ">= 0.4" } }, + "node_modules/earcut": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.1.tgz", + "integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==", + "license": "ISC" + }, "node_modules/electron-to-chromium": { - "version": "1.5.65", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.65.tgz", - "integrity": "sha512-PWVzBjghx7/wop6n22vS2MLU8tKGd4Q91aCEGhG/TYmW6PP5OcSXcdnxTe1NNt0T66N8D6jxh4kC8UsdzOGaIw==", + "version": "1.5.99", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.99.tgz", + "integrity": "sha512-77c/+fCyL2U+aOyqfIFi89wYLBeSTCs55xCZL0oFH0KjqsvSvyh6AdQ+UIl1vgpnQQE6g+/KK8hOIupH6VwPtg==", "license": "ISC" }, "node_modules/entities": { @@ -3401,9 +3120,9 @@ } }, "node_modules/es-object-atoms": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", - "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "dev": true, "license": "MIT", "dependencies": { @@ -3573,9 +3292,9 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.37.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.4.tgz", - "integrity": "sha512-BGP0jRmfYyvOyvMoRX/uoUeW+GqNj9y16bPQzqAHf3AYII/tDs+jMN0dBVkl88/OZwNGwrVFxE7riHsXVfy/LQ==", + "version": "7.37.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", + "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", "dev": true, "license": "MIT", "dependencies": { @@ -3589,7 +3308,7 @@ "hasown": "^2.0.2", "jsx-ast-utils": "^2.4.1 || ^3.0.0", "minimatch": "^3.1.2", - "object.entries": "^1.1.8", + "object.entries": "^1.1.9", "object.fromentries": "^2.0.8", "object.values": "^1.2.1", "prop-types": "^15.8.1", @@ -3606,9 +3325,9 @@ } }, "node_modules/eslint-plugin-react-hooks": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.1.0.tgz", - "integrity": "sha512-mpJRtPgHN2tNAvZ35AMfqeB3Xqeo273QxrHJsbBEPWODRM4r0yB6jfoROqKEYrOn27UtRPpcpHc2UqyBSuUNTw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz", + "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==", "dev": true, "license": "MIT", "engines": { @@ -3619,9 +3338,9 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.18.tgz", - "integrity": "sha512-IRGEoFn3OKalm3hjfolEWGqoF/jPqeEYFp+C8B0WMzwGwBMvlRDQd06kghDhF0C61uJ6WfSDhEZE/sAQjduKgw==", + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.19.tgz", + "integrity": "sha512-eyy8pcr/YxSYjBoqIFSrlbn9i/xvxUFa8CjzAYo9cFjgGXqq1hyjihcpZvxRLalpaWmueWR81xn7vuKmAFijDQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -3785,7 +3504,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, "license": "MIT" }, "node_modules/fast-equals": { @@ -3857,6 +3575,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flag-icons": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/flag-icons/-/flag-icons-7.3.2.tgz", + "integrity": "sha512-QkaZ6Zvai8LIjx+UNAHUJ5Dhz9OLZpBDwCRWxF6YErxIcR16jTkIFm3bFu54EkvKQy4+wicW+Gm7/0631wVQyQ==", + "license": "MIT" + }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -3993,23 +3717,29 @@ "node": ">=6.9.0" } }, + "node_modules/geojson-vt": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-4.0.2.tgz", + "integrity": "sha512-AV9ROqlNqoZEIJGfm1ncNjEXfkz2hdFlZf0qkVfmkwdKa8vj7H16YUOT81rJw1rdFhyEDlN2Tds91p/glzbl5A==", + "license": "ISC" + }, "node_modules/get-intrinsic": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.6.tgz", - "integrity": "sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "dunder-proto": "^1.0.0", + "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", + "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", - "math-intrinsics": "^1.0.0" + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4018,6 +3748,32 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-symbol-description": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", @@ -4036,6 +3792,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==", + "license": "MIT" + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -4071,6 +3833,44 @@ "node": ">=10.13.0" } }, + "node_modules/global-prefix": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-4.0.0.tgz", + "integrity": "sha512-w0Uf9Y9/nyHinEk5vMJKRie+wa4kR5hmDbEhGGds/kG1PwGLLHKRoNMeJOyCQjjBkANlnScqgzcFwGHgmgLkVA==", + "license": "MIT", + "dependencies": { + "ini": "^4.1.3", + "kind-of": "^6.0.3", + "which": "^4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/global-prefix/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -4222,6 +4022,77 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "license": "MIT" }, + "node_modules/html-parse-stringify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz", + "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==", + "dependencies": { + "void-elements": "3.1.0" + } + }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/i18next": { + "version": "24.2.3", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.3.tgz", + "integrity": "sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.26.10" + }, + "peerDependencies": { + "typescript": "^5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -4242,6 +4113,11 @@ "url": "https://opencollective.com/immer" } }, + "node_modules/immutability-helper": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/immutability-helper/-/immutability-helper-3.1.1.tgz", + "integrity": "sha512-Q0QaXjPjwIju/28TsugCHNEASwoCcJSyJV3uO1sOIQGI0jKgm9f41Lvz0DZj3n46cNCyAZTsEYoY4C2bVRUzyQ==" + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -4287,6 +4163,15 @@ "dev": true, "license": "ISC" }, + "node_modules/ini": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz", + "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==", + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/internal-slot": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", @@ -4789,6 +4674,12 @@ "dev": true, "license": "MIT" }, + "node_modules/json-stringify-pretty-compact": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-4.0.0.tgz", + "integrity": "sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==", + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -4826,6 +4717,12 @@ "node": ">=18" } }, + "node_modules/kdbush": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz", + "integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==", + "license": "ISC" + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -4836,6 +4733,15 @@ "json-buffer": "3.0.1" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -4915,6 +4821,47 @@ "yallist": "^3.0.2" } }, + "node_modules/maplibre-gl": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-5.3.1.tgz", + "integrity": "sha512-Ihx+oUUSsZkjMou1Cw5J6silE+5OtFFQSPslWF9+7v4yFC/XDHrpsORYO9lWE4KZI0djCEUpZQJpkpnMArAbeA==", + "license": "BSD-3-Clause", + "dependencies": { + "@mapbox/geojson-rewind": "^0.5.2", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.6", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@maplibre/maplibre-gl-style-spec": "^23.1.0", + "@types/geojson": "^7946.0.16", + "@types/geojson-vt": "3.2.5", + "@types/mapbox__point-geometry": "^0.1.4", + "@types/mapbox__vector-tile": "^1.3.4", + "@types/pbf": "^3.0.5", + "@types/supercluster": "^7.1.3", + "earcut": "^3.0.1", + "geojson-vt": "^4.0.2", + "gl-matrix": "^3.4.3", + "global-prefix": "^4.0.0", + "kdbush": "^4.0.2", + "murmurhash-js": "^1.0.0", + "pbf": "^3.3.0", + "potpack": "^2.0.0", + "quickselect": "^3.0.0", + "supercluster": "^8.0.1", + "tinyqueue": "^3.0.0", + "vt-pbf": "^3.1.3" + }, + "engines": { + "node": ">=16.14.0", + "npm": ">=8.1.0" + }, + "funding": { + "url": "https://github.com/maplibre/maplibre-gl-js?sponsor=1" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -4959,12 +4906,49 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/mui-color-input": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/mui-color-input/-/mui-color-input-6.0.0.tgz", + "integrity": "sha512-F9n/RqPLq7fnPWeF53/qssbIHvart7clpOfE+f+dsM+3ddfawwg98+PEhzv3cdAYlJLE9zfVViVTsp/ckUUd3g==", + "license": "MIT", + "dependencies": { + "@ctrl/tinycolor": "^4.1.0" + }, + "peerDependencies": { + "@emotion/react": "^11.13.0", + "@emotion/styled": "^11.13.0", + "@mui/material": "^6.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==", + "license": "MIT" + }, "node_modules/nanoid": { "version": "3.3.8", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", @@ -5000,9 +4984,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", - "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "license": "MIT" }, "node_modules/object-assign": { @@ -5059,15 +5043,16 @@ } }, "node_modules/object.entries": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", - "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" + "es-object-atoms": "^1.1.1" }, "engines": { "node": ">= 0.4" @@ -5246,6 +5231,19 @@ "node": ">=8" } }, + "node_modules/pbf": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.3.0.tgz", + "integrity": "sha512-XDF38WCH3z5OV/OVa8GKUNtLAyneuzbCisx7QUCF8Q6Nutx0WnJrQe5O+kOtBlLfRNUws98Y58Lblp+NJG5T4Q==", + "license": "BSD-3-Clause", + "dependencies": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + }, + "bin": { + "pbf": "bin/pbf" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -5302,6 +5300,12 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/potpack": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-2.0.0.tgz", + "integrity": "sha512-Q+/tYsFU9r7xoOJ+y/ZTtdVQwTWfzjbiXBDMM/JKUux3+QPP02iUuIoeBQ+Ot6oEDlC+/PGjB/5A3K7KKb7hcw==", + "license": "ISC" + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -5313,9 +5317,9 @@ } }, "node_modules/prettier": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", - "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", "dev": true, "license": "MIT", "bin": { @@ -5345,6 +5349,12 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "license": "MIT" }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "license": "MIT" + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -5382,6 +5392,17 @@ ], "license": "MIT" }, + "node_modules/quickselect": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz", + "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==", + "license": "ISC" + }, + "node_modules/raf-schd": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/raf-schd/-/raf-schd-4.0.3.tgz", + "integrity": "sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==" + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -5394,6 +5415,43 @@ "node": ">=0.10.0" } }, + "node_modules/react-dnd": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/react-dnd/-/react-dnd-16.0.1.tgz", + "integrity": "sha512-QeoM/i73HHu2XF9aKksIUuamHPDvRglEwdHL4jsp784BgUuWcg6mzfxT0QDdQz8Wj0qyRKx2eMg8iZtWvU4E2Q==", + "dependencies": { + "@react-dnd/invariant": "^4.0.1", + "@react-dnd/shallowequal": "^4.0.1", + "dnd-core": "^16.0.1", + "fast-deep-equal": "^3.1.3", + "hoist-non-react-statics": "^3.3.2" + }, + "peerDependencies": { + "@types/hoist-non-react-statics": ">= 3.3.1", + "@types/node": ">= 12", + "@types/react": ">= 16", + "react": ">= 16.14" + }, + "peerDependenciesMeta": { + "@types/hoist-non-react-statics": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-dnd-html5-backend": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/react-dnd-html5-backend/-/react-dnd-html5-backend-16.0.1.tgz", + "integrity": "sha512-Wu3dw5aDJmOGw8WjH1I1/yTH+vlXEL4vmjk5p+MHxP8HuHJS1lAGeIdG/hze1AvNeXWo/JgULV87LyQOr+r5jw==", + "dependencies": { + "dnd-core": "^16.0.1" + } + }, "node_modules/react-dom": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", @@ -5407,6 +5465,37 @@ "react": "^18.3.1" } }, + "node_modules/react-i18next": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.4.1.tgz", + "integrity": "sha512-ahGab+IaSgZmNPYXdV1n+OYky95TGpFwnKRflX/16dY04DsYYKHtVLjeny7sBSCREEcoMbAgSkFiGLF5g5Oofw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.0", + "html-parse-stringify": "^3.0.1" + }, + "peerDependencies": { + "i18next": ">= 23.2.3", + "react": ">= 16.8.0" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/react-icons": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz", + "integrity": "sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==", + "license": "MIT", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", @@ -5436,23 +5525,13 @@ } } }, - "node_modules/react-refresh": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", - "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/react-router": { - "version": "6.28.2", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.2.tgz", - "integrity": "sha512-BgFY7+wEGVjHCiqaj2XiUBQ1kkzfg6UoKYwEe0wv+FF+HNPCxtS/MVPvLAPH++EsuCMReZl9RYVGqcHLk5ms3A==", + "version": "6.30.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.0.tgz", + "integrity": "sha512-D3X8FyH9nBcTSHGdEKurK7r8OYE1kKFn3d/CF+CoxbSHkxU7o37+Uh7eAHRXr6k2tSExXYO++07PeXJtA/dEhQ==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.21.1" + "@remix-run/router": "1.23.0" }, "engines": { "node": ">=14.0.0" @@ -5462,13 +5541,13 @@ } }, "node_modules/react-router-dom": { - "version": "6.28.2", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.2.tgz", - "integrity": "sha512-O81EWqNJWqvlN/a7eTudAdQm0TbI7hw+WIi7OwwMcTn5JMyZ0ibTFNGz+t+Lju0df4LcqowCegcrK22lB1q9Kw==", + "version": "6.30.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.0.tgz", + "integrity": "sha512-x30B78HV5tFk8ex0ITwzC9TTZMua4jGyA9IUlH1JLQYQTFyxr/ZxwOJq7evg1JX1qGVUcvhsmQSKdPncQrjTgA==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.21.1", - "react-router": "6.28.2" + "@remix-run/router": "1.23.0", + "react-router": "6.30.0" }, "engines": { "node": ">=14.0.0" @@ -5479,9 +5558,9 @@ } }, "node_modules/react-smooth": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.1.tgz", - "integrity": "sha512-OE4hm7XqR0jNOq3Qmk9mFLyd6p2+j6bvbPJ7qlB7+oo0eNcL2l7WQzG6MBnT3EXY6xzkLMUBec3AfewJdA0J8w==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz", + "integrity": "sha512-gnGKTpYwqL0Iii09gHobNolvX4Kiq4PKx6eWBCYYix+8cdw+cGo3do906l1NBPKkSWx1DghC1dlWG9L2uGd61Q==", "license": "MIT", "dependencies": { "fast-equals": "^5.0.1", @@ -5489,8 +5568,8 @@ "react-transition-group": "^4.4.5" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "node_modules/react-toastify": { @@ -5523,16 +5602,16 @@ } }, "node_modules/recharts": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.0.tgz", - "integrity": "sha512-cIvMxDfpAmqAmVgc4yb7pgm/O1tmmkl/CjrvXuW+62/+7jj/iF9Ykm+hb/UJt42TREHMyd3gb+pkgoa2MxgDIw==", + "version": "2.15.2", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.2.tgz", + "integrity": "sha512-xv9lVztv3ingk7V3Jf05wfAZbM9Q2umJzu5t/cfnAK7LUslNrGT7LPBr74G+ok8kSCeFMaePmWMg0rcYOnczTw==", "license": "MIT", "dependencies": { "clsx": "^2.0.0", "eventemitter3": "^4.0.1", "lodash": "^4.17.21", "react-is": "^18.3.1", - "react-smooth": "^4.0.0", + "react-smooth": "^4.0.4", "recharts-scale": "^0.4.4", "tiny-invariant": "^1.3.1", "victory-vendor": "^36.6.8" @@ -5658,6 +5737,15 @@ "node": ">=4" } }, + "node_modules/resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "license": "MIT", + "dependencies": { + "protocol-buffers-schema": "^3.3.1" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5753,6 +5841,12 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", + "license": "BSD-3-Clause" + }, "node_modules/safe-array-concat": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", @@ -5970,6 +6064,29 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/string.prototype.matchall": { "version": "4.0.12", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", @@ -6100,6 +6217,15 @@ "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==", "license": "MIT" }, + "node_modules/supercluster": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz", + "integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==", + "license": "ISC", + "dependencies": { + "kdbush": "^4.0.2" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -6131,6 +6257,42 @@ "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==", "license": "MIT" }, + "node_modules/terser": { + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", + "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", + "license": "BSD-2-Clause", + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -6144,6 +6306,12 @@ "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", "license": "MIT" }, + "node_modules/tinyqueue": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-3.0.0.tgz", + "integrity": "sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==", + "license": "ISC" + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -6254,6 +6422,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "license": "Apache-2.0", + "optional": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -6273,6 +6456,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/update-browserslist-db": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", @@ -6322,6 +6513,14 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, "node_modules/victory-vendor": { "version": "36.9.2", "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-36.9.2.tgz", @@ -6345,9 +6544,9 @@ } }, "node_modules/vite": { - "version": "5.4.14", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", - "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", + "version": "5.4.18", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.18.tgz", + "integrity": "sha512-1oDcnEp3lVyHCuQ2YFelM4Alm2o91xNoMncRm1U7S+JdYfYOvbiGZ3/CxGttrOu2M/KcGz7cRC2DoNUA6urmMA==", "license": "MIT", "dependencies": { "esbuild": "^0.21.3", @@ -6417,6 +6616,25 @@ "vite": ">=2.6.0" } }, + "node_modules/void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "license": "MIT", + "dependencies": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/Client/package.json b/client/package.json similarity index 54% rename from Client/package.json rename to client/package.json index 247e1fe72..ba745503a 100644 --- a/Client/package.json +++ b/client/package.json @@ -14,27 +14,46 @@ "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@fontsource/roboto": "^5.0.13", - "@mui/icons-material": "6.4.1", - "@mui/lab": "6.0.0-beta.24", - "@mui/material": "6.4.1", + "@hello-pangea/dnd": "^18.0.0", "@mui/x-charts": "^7.5.1", - "@mui/x-data-grid": "7.24.0", - "@mui/x-date-pickers": "7.24.0", - "@reduxjs/toolkit": "2.5.0", + "@mui/x-data-grid": "7.29.0", + "@mui/x-date-pickers": "7.29.0", + "@mui/icons-material": "6.4.11", + "@mui/lab": "6.0.0-dev.240424162023-9968b4889d", + "@mui/material": "6.4.11", + "@reduxjs/toolkit": "2.7.0", "axios": "^1.7.4", "dayjs": "1.11.13", - "joi": "17.13.3", + "flag-icons": "7.3.2", "jwt-decode": "^4.0.0", - "react": "^18.2.0", + "html2canvas": "^1.4.1", + "i18next": "^24.2.2", + "immutability-helper": "^3.1.1", + "joi": "17.13.3", + "maplibre-gl": "5.3.1", + "mui-color-input": "^6.0.0", + "react": "18.3.1", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", "react-dom": "^18.2.0", + "react-i18next": "^15.4.0", + "react-icons": "5.5.0", "react-redux": "9.2.0", "react-router": "^6.23.0", "react-router-dom": "^6.23.1", "react-toastify": "^10.0.5", - "recharts": "2.15.0", + "recharts": "2.15.2", "redux-persist": "6.0.0", "vite-plugin-svgr": "^4.2.0" }, + "unusedDepencies": { + "@solana/wallet-adapter-base": "0.9.25", + "@solana/wallet-adapter-material-ui": "0.16.35", + "@solana/wallet-adapter-react": "0.15.37", + "@solana/wallet-adapter-react-ui": "0.9.37", + "@solana/wallet-adapter-wallets": "0.19.34", + "@solana/web3.js": "1.98.0" + }, "devDependencies": { "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", diff --git a/client/public/bulk_import_monitors_sample.csv b/client/public/bulk_import_monitors_sample.csv new file mode 100644 index 000000000..2a01ea483 --- /dev/null +++ b/client/public/bulk_import_monitors_sample.csv @@ -0,0 +1,6 @@ +type,name,url,interval,port,expectedValue,jsonPath,matchMethod +http,HTTP Monitor,https://www.google.com,60000,,,, +http,API Monitor,http://reqres.in/api/users/2,120000,,Janet,data.first_name,equal +ping,Ping monitor,127.0.0.1,60000,,,, +docker,Docker monitor,bbdd20b4e3757d63e070bc16e04d3f770c4a8f6e62e813de380f23b141e2ca01,60000,,,, +port,Port monitor,127.0.0.1,60000,5000,,, \ No newline at end of file diff --git a/client/public/bulk_import_monitors_template.csv b/client/public/bulk_import_monitors_template.csv new file mode 100644 index 000000000..2902010fc --- /dev/null +++ b/client/public/bulk_import_monitors_template.csv @@ -0,0 +1 @@ +type,name,url,interval,port,expectedValue,jsonPath,matchMethod \ No newline at end of file diff --git a/Client/public/checkmate_favicon.svg b/client/public/checkmate_favicon.svg similarity index 100% rename from Client/public/checkmate_favicon.svg rename to client/public/checkmate_favicon.svg diff --git a/renovate.json b/client/renovate.json similarity index 100% rename from renovate.json rename to client/renovate.json diff --git a/Client/src/App.jsx b/client/src/App.jsx similarity index 55% rename from Client/src/App.jsx rename to client/src/App.jsx index 05822a5f5..7fb63ee61 100644 --- a/Client/src/App.jsx +++ b/client/src/App.jsx @@ -1,27 +1,18 @@ import { useEffect } from "react"; import { useSelector } from "react-redux"; -import { useDispatch } from "react-redux"; import "react-toastify/dist/ReactToastify.css"; import { ToastContainer } from "react-toastify"; import { ThemeProvider } from "@emotion/react"; import lightTheme from "./Utils/Theme/lightTheme"; import darkTheme from "./Utils/Theme/darkTheme"; import { CssBaseline, GlobalStyles } from "@mui/material"; -import { getAppSettings } from "./Features/Settings/settingsSlice"; import { logger } from "./Utils/Logger"; // Import the logger import { networkService } from "./main"; import { Routes } from "./Routes"; +import WalletProvider from "./Components/WalletProvider"; function App() { const mode = useSelector((state) => state.ui.mode); - const { authToken } = useSelector((state) => state.auth); - const dispatch = useDispatch(); - - useEffect(() => { - if (authToken) { - dispatch(getAppSettings({ authToken })); - } - }, [dispatch, authToken]); // Cleanup useEffect(() => { @@ -34,19 +25,21 @@ function App() { return ( /* Extract Themeprovider, baseline and global styles to Styles */ - - { - return { - body: { - backgroundImage: `radial-gradient(circle, ${palette.gradient.color1}, ${palette.gradient.color2}, ${palette.gradient.color3}, ${palette.gradient.color4}, ${palette.gradient.color5})`, - color: palette.primary.contrastText, - }, - }; - }} - /> - - + + + { + return { + body: { + backgroundImage: `radial-gradient(circle, ${palette.gradient.color1}, ${palette.gradient.color2}, ${palette.gradient.color3}, ${palette.gradient.color4}, ${palette.gradient.color5})`, + color: palette.primary.contrastText, + }, + }; + }} + /> + + + ); } diff --git a/Client/src/Pages/Uptime/Home/actionsMenu.jsx b/client/src/Components/ActionsMenu/index.jsx similarity index 88% rename from Client/src/Pages/Uptime/Home/actionsMenu.jsx rename to client/src/Components/ActionsMenu/index.jsx index 493c5f25e..4d5ab7c01 100644 --- a/Client/src/Pages/Uptime/Home/actionsMenu.jsx +++ b/client/src/Components/ActionsMenu/index.jsx @@ -2,40 +2,36 @@ import { useState } from "react"; import { useSelector, useDispatch } from "react-redux"; import { useTheme } from "@emotion/react"; import { useNavigate } from "react-router-dom"; -import { createToast } from "../../../Utils/toastUtils"; -import { logger } from "../../../Utils/Logger"; +import { createToast } from "../../Utils/toastUtils"; +import { logger } from "../../Utils/Logger"; import { IconButton, Menu, MenuItem } from "@mui/material"; import { deleteUptimeMonitor, pauseUptimeMonitor, -} from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; -import Settings from "../../../assets/icons/settings-bold.svg?react"; +} from "../../Features/UptimeMonitors/uptimeMonitorsSlice"; +import Settings from "../../assets/icons/settings-bold.svg?react"; import PropTypes from "prop-types"; -import Dialog from "../../../Components/Dialog"; +import Dialog from "../../Components/Dialog"; const ActionsMenu = ({ monitor, isAdmin, updateRowCallback, pauseCallback, - setIsLoading, + setIsLoading = () => {}, }) => { const [anchorEl, setAnchorEl] = useState(null); const [actions, setActions] = useState({}); const [isOpen, setIsOpen] = useState(false); const dispatch = useDispatch(); const theme = useTheme(); - const authState = useSelector((state) => state.auth); - const authToken = authState.authToken; const { isLoading } = useSelector((state) => state.uptimeMonitors); const handleRemove = async (event) => { event.preventDefault(); event.stopPropagation(); let monitor = { _id: actions.id }; - const action = await dispatch( - deleteUptimeMonitor({ authToken: authState.authToken, monitor }) - ); + const action = await dispatch(deleteUptimeMonitor({ monitor })); if (action.meta.requestStatus === "fulfilled") { setIsOpen(false); // close modal updateRowCallback(); @@ -48,11 +44,9 @@ const ActionsMenu = ({ const handlePause = async () => { try { setIsLoading(true); - const action = await dispatch( - pauseUptimeMonitor({ authToken, monitorId: monitor._id }) - ); + const action = await dispatch(pauseUptimeMonitor({ monitorId: monitor._id })); if (pauseUptimeMonitor.fulfilled.match(action)) { - const state = action?.payload?.data.isActive === false ? "paused" : "resumed"; + const state = action?.payload?.data.isActive === false ? "resumed" : "paused"; createToast({ body: `Monitor ${state} successfully.` }); pauseCallback(); } else { diff --git a/Client/src/Components/Alert/index.css b/client/src/Components/Alert/index.css similarity index 100% rename from Client/src/Components/Alert/index.css rename to client/src/Components/Alert/index.css diff --git a/Client/src/Components/Alert/index.jsx b/client/src/Components/Alert/index.jsx similarity index 95% rename from Client/src/Components/Alert/index.jsx rename to client/src/Components/Alert/index.jsx index a52761ca4..921d4fd6e 100644 --- a/Client/src/Components/Alert/index.jsx +++ b/client/src/Components/Alert/index.jsx @@ -36,8 +36,8 @@ const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => { */ const text = theme.palette.secondary.contrastText; - const bg = theme.palette.secondary.main; - const border = theme.palette.secondary.contrastText; + const border = theme.palette.alert.contrastText; + const bg = theme.palette.alert.main; const icon = icons[variant]; return ( @@ -111,7 +111,7 @@ const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => { Alert.propTypes = { variant: PropTypes.oneOf(["info", "error", "warning"]).isRequired, title: PropTypes.string, - body: PropTypes.string, + body: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), isToast: PropTypes.bool, hasIcon: PropTypes.bool, onClick: function (props, propName, componentName) { diff --git a/Client/src/Components/Animated/PulseDot.jsx b/client/src/Components/Animated/PulseDot.jsx similarity index 100% rename from Client/src/Components/Animated/PulseDot.jsx rename to client/src/Components/Animated/PulseDot.jsx diff --git a/Client/src/Components/Avatar/index.css b/client/src/Components/Avatar/index.css similarity index 100% rename from Client/src/Components/Avatar/index.css rename to client/src/Components/Avatar/index.css diff --git a/Client/src/Components/Avatar/index.jsx b/client/src/Components/Avatar/index.jsx similarity index 100% rename from Client/src/Components/Avatar/index.jsx rename to client/src/Components/Avatar/index.jsx diff --git a/Client/src/Components/Breadcrumbs/index.css b/client/src/Components/Breadcrumbs/index.css similarity index 100% rename from Client/src/Components/Breadcrumbs/index.css rename to client/src/Components/Breadcrumbs/index.css diff --git a/Client/src/Components/Breadcrumbs/index.jsx b/client/src/Components/Breadcrumbs/index.jsx similarity index 100% rename from Client/src/Components/Breadcrumbs/index.jsx rename to client/src/Components/Breadcrumbs/index.jsx diff --git a/client/src/Components/Buttons/RoundGradientButton.jsx b/client/src/Components/Buttons/RoundGradientButton.jsx new file mode 100644 index 000000000..f9e14735c --- /dev/null +++ b/client/src/Components/Buttons/RoundGradientButton.jsx @@ -0,0 +1,30 @@ +import React from "react"; +import Button from "@mui/material/Button"; +import { styled } from "@mui/material/styles"; + +const RoundGradientButton = styled(Button)(({ theme }) => ({ + position: "relative", + border: "5px solid transparent", + backgroundClip: "padding-box", + borderRadius: 30, + fontSize: "1.2rem", + color: theme.palette.primary.contrastText, + backgroundColor: theme.palette.background.main, + + "&:after": { + position: "absolute", + top: -3, + left: -3, + right: -3, + bottom: -3, + background: + theme.palette.mode === "dark" + ? "linear-gradient(90deg, #842bd2, #ff5451, #8c52ff)" + : "linear-gradient(90deg, #842bd2, #ff5451, #8c52ff)", + content: '""', + zIndex: -1, + borderRadius: 30, + }, +})); + +export default RoundGradientButton; diff --git a/Client/src/Components/Charts/AreaChart/index.jsx b/client/src/Components/Charts/AreaChart/index.jsx similarity index 100% rename from Client/src/Components/Charts/AreaChart/index.jsx rename to client/src/Components/Charts/AreaChart/index.jsx diff --git a/Client/src/Components/Charts/BarChart/index.css b/client/src/Components/Charts/BarChart/index.css similarity index 100% rename from Client/src/Components/Charts/BarChart/index.css rename to client/src/Components/Charts/BarChart/index.css diff --git a/Client/src/Components/Charts/BarChart/index.jsx b/client/src/Components/Charts/BarChart/index.jsx similarity index 99% rename from Client/src/Components/Charts/BarChart/index.jsx rename to client/src/Components/Charts/BarChart/index.jsx index 101afe648..375773b94 100644 --- a/Client/src/Components/Charts/BarChart/index.jsx +++ b/client/src/Components/Charts/BarChart/index.jsx @@ -58,7 +58,7 @@ const BarChart = ({ checks = [] }) => { <> {formatDateWithTz( - check.createdAt, + check.updatedAt, "ddd, MMMM D, YYYY, HH:mm A", uiTimezone )} diff --git a/client/src/Components/Charts/ChartBox/EmptyView.jsx b/client/src/Components/Charts/ChartBox/EmptyView.jsx new file mode 100644 index 000000000..94b1af7b0 --- /dev/null +++ b/client/src/Components/Charts/ChartBox/EmptyView.jsx @@ -0,0 +1,108 @@ +// Components +import { Typography, Stack } from "@mui/material"; +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import IconBox from "../../IconBox"; + +/** + * `EmptyView` is a functional React component that displays an empty state view with an optional icon, header, and message. + * + * @component + * @param {Object} props - The properties that define the `EmptyView` component. + * @param {React.ReactNode} [props.icon] - An optional icon to display at the top of the empty view. + * @param {string} [props.header] - An optional header text displayed next to the icon. + * @param {string} [props.message="No Data"] - The message to be displayed in the empty view. + * @param {'h1' | 'h2' | 'h3'} [props.headingLevel="h2"] - The heading level for the message text. + * @param {string} [props.justifyContent="flex-start"] - The CSS `justify-content` value to align elements vertically. + * @param {string} [props.height="100%"] - The height of the empty view container. + * + * @example + * // Example usage of EmptyView component: + * } + * header="Average Response Time" + * message="No Response Time Available" + * headingLevel="h2" + * justifyContent="center" + * height="50%" + * /> + * + * @returns {React.Element} The `EmptyView` component with customizable icon, header, and message. + */ + +const EmptyView = ({ + icon, + header, + message = "No Data", + headingLevel = "h2", + justifyContent = "flex-start", + height = "100%" +}) => { + const theme = useTheme(); + return ( + + + + {icon && {icon}} + {header && {header}} + + + + {message} + + + + + ); +}; + +EmptyView.propTypes = { + message: PropTypes.string, + icon: PropTypes.node, + header: PropTypes.string, + headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3']), + justifyContent: PropTypes.string, + height: PropTypes.string +}; + +export default EmptyView; diff --git a/client/src/Components/Charts/ChartBox/index.jsx b/client/src/Components/Charts/ChartBox/index.jsx new file mode 100644 index 000000000..4b72fe16a --- /dev/null +++ b/client/src/Components/Charts/ChartBox/index.jsx @@ -0,0 +1,99 @@ +import { Stack, Typography } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import IconBox from "../../IconBox"; +import EmptyView from "./EmptyView"; +import PropTypes from "prop-types"; + +const ChartBox = ({ + children, + icon, + header, + height = "300px", + justifyContent = "space-between", + Legend, + borderRadiusRight = 4, + sx, + noDataMessage, + isEmpty = false, +}) => { + const theme = useTheme(); + if (isEmpty) { + return ; + } + return ( + + span": { + color: theme.palette.primary.contrastText, + fontSize: 20, + "& span": { + opacity: 0.8, + marginLeft: 2, + fontSize: 15, + }, + }, + + "& tspan, & text": { + fill: theme.palette.primary.contrastTextTertiary, + }, + "& path": { + transition: "fill 300ms ease, stroke-width 400ms ease", + }, + }} + > + + {icon && {icon}} + {header && {header}} + + {children} + + {Legend && Legend} + + ); +}; + +export default ChartBox; + +ChartBox.propTypes = { + children: PropTypes.node, + icon: PropTypes.node, + header: PropTypes.string, + height: PropTypes.string, + noDataMessage: PropTypes.string, + isEmpty: PropTypes.bool +}; diff --git a/Client/src/Components/Charts/CustomGauge/index.css b/client/src/Components/Charts/CustomGauge/index.css similarity index 100% rename from Client/src/Components/Charts/CustomGauge/index.css rename to client/src/Components/Charts/CustomGauge/index.css diff --git a/Client/src/Components/Charts/CustomGauge/index.jsx b/client/src/Components/Charts/CustomGauge/index.jsx similarity index 93% rename from Client/src/Components/Charts/CustomGauge/index.jsx rename to client/src/Components/Charts/CustomGauge/index.jsx index d29663004..3c7e13610 100644 --- a/Client/src/Components/Charts/CustomGauge/index.jsx +++ b/client/src/Components/Charts/CustomGauge/index.jsx @@ -62,6 +62,7 @@ const CustomGauge = ({ progress = 0, radius = 70, strokeWidth = 15, threshold = className="radial-chart" width={radius} height={radius} + sx={{ backgroundColor: theme.palette.primary.main, borderRadius: "50%" }} > {`${progressWithinRange.toFixed(1)}%`} diff --git a/client/src/Components/Charts/DePINStatusPageBarChart/index.jsx b/client/src/Components/Charts/DePINStatusPageBarChart/index.jsx new file mode 100644 index 000000000..65c6278f1 --- /dev/null +++ b/client/src/Components/Charts/DePINStatusPageBarChart/index.jsx @@ -0,0 +1,181 @@ +// Components +import { Stack, Box, Tooltip, Typography } from "@mui/material"; + +// Utils +import { useTheme } from "@emotion/react"; +import { useState, useEffect } from "react"; +import PropTypes from "prop-types"; +import { formatDateWithTz } from "../../../Utils/timeUtils"; +import { useSelector } from "react-redux"; + +const PlaceholderCheck = ({ daysToShow }) => { + const theme = useTheme(); + + return ( + + ); +}; + +PlaceholderCheck.propTypes = { + daysToShow: PropTypes.number, +}; + +const Check = ({ check, daysToShow }) => { + const [animate, setAnimate] = useState(false); + + const theme = useTheme(); + useEffect(() => { + setAnimate(true); + }, []); + const uiTimezone = useSelector((state) => state.ui.timezone); + + return ( + + + {formatDateWithTz(check._id, "ddd, MMMM D, YYYY", uiTimezone)} + + + + + Uptime percentage + + + {check.upPercentage.toFixed(2)} + + {" "} + % + + + + + + } + placement="top" + key={`check-${check?._id}`} + slotProps={{ + popper: { + className: "bar-tooltip", + modifiers: [ + { + name: "offset", + options: { + offset: [0, -10], + }, + }, + ], + sx: { + "& .MuiTooltip-tooltip": { + backgroundColor: theme.palette.secondary.main, + border: 1, + borderColor: theme.palette.primary.lowContrast, + borderRadius: theme.shape.borderRadius, + boxShadow: theme.shape.boxShadow, + px: theme.spacing(4), + py: theme.spacing(3), + }, + "& .MuiTooltip-tooltip p": { + /* TODO Font size should point to theme */ + fontSize: 12, + color: theme.palette.secondary.contrastText, + fontWeight: 500, + }, + "& .MuiTooltip-tooltip span": { + /* TODO Font size should point to theme */ + fontSize: 11, + color: theme.palette.secondary.contrastText, + fontWeight: 600, + }, + }, + }, + }} + > + + + + + ); +}; + +Check.propTypes = { + check: PropTypes.object, + daysToShow: PropTypes.number, +}; + +const DePINStatusPageBarChart = ({ checks = [], daysToShow = 30 }) => { + if (checks.length !== daysToShow) { + const placeholders = Array(daysToShow - checks.length).fill("placeholder"); + checks = [...checks, ...placeholders]; + } + return ( + + {checks.map((check) => { + if (check === "placeholder") { + return ( + + ); + } + return ( + + ); + })} + + ); +}; + +DePINStatusPageBarChart.propTypes = { + checks: PropTypes.array, + daysToShow: PropTypes.number, +}; + +export default DePINStatusPageBarChart; diff --git a/client/src/Components/Charts/LegendBox/index.jsx b/client/src/Components/Charts/LegendBox/index.jsx new file mode 100644 index 000000000..ac14669e3 --- /dev/null +++ b/client/src/Components/Charts/LegendBox/index.jsx @@ -0,0 +1,42 @@ +import { Stack, Typography } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import IconBox from "../../IconBox"; +import PropTypes from "prop-types"; + +const LegendBox = ({ children, icon, header, sx }) => { + const theme = useTheme(); + return ( + + + {icon} + {header} + + {children} + + ); +}; + +LegendBox.propTypes = { + children: PropTypes.node, + icon: PropTypes.node, + header: PropTypes.string, +}; + +export default LegendBox; diff --git a/Client/src/Components/Charts/MonitorDetailsAreaChart/index.css b/client/src/Components/Charts/MonitorDetailsAreaChart/index.css similarity index 100% rename from Client/src/Components/Charts/MonitorDetailsAreaChart/index.css rename to client/src/Components/Charts/MonitorDetailsAreaChart/index.css diff --git a/Client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx b/client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx similarity index 97% rename from Client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx rename to client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx index 0b959a392..a1ead3cf9 100644 --- a/Client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx +++ b/client/src/Components/Charts/MonitorDetailsAreaChart/index.jsx @@ -73,9 +73,12 @@ const CustomToolTip = ({ active, payload, label, dateRange }) => { component="span" sx={{ opacity: 0.8 }} > - Response Time - {" "} - + Response time: + + {Math.floor(responseTime)} { + const theme = useTheme(); + + return ( + + {children} + + ); +}; + +Bar.propTypes = { + width: PropTypes.string.isRequired, + height: PropTypes.string.isRequired, + backgroundColor: PropTypes.string.isRequired, + borderRadius: PropTypes.string, + children: PropTypes.node, +}; + +/* TODO add prop validation and jsdocs */ +const StatusPageBarChart = ({ checks = [] }) => { + const theme = useTheme(); + const [animate, setAnimate] = useState(false); + const uiTimezone = useSelector((state) => state.ui.timezone); + + const barWidth = { + xs: "calc(60% / 25)", + xl: "calc(40% / 25)", + }; + + useEffect(() => { + setAnimate(true); + }, []); + + // set responseTime to average if there's only one check + if (checks.length === 1) { + checks[0] = { ...checks[0], responseTime: 50 }; + } + + if (checks.length !== 25) { + const placeholders = Array(25 - checks.length).fill("placeholder"); + checks = [...checks, ...placeholders]; + } + + return ( + event.stopPropagation()} + sx={{ + cursor: "default", + }} + > + {checks.map((check, index) => + check === "placeholder" ? ( + /* TODO what is the purpose of this box? */ + // CAIO_REVIEW the purpose of this box is to make sure there are always at least 25 bars + // even if there are less than 25 checks + + ) : ( + + + {formatDateWithTz( + check.createdAt, + "ddd, MMMM D, YYYY, HH:mm A", + uiTimezone + )} + + + + + + Response Time + + + {check.originalResponseTime} + + {" "} + ms + + + + + + } + placement="top" + key={`check-${check?._id}`} + slotProps={{ + popper: { + className: "bar-tooltip", + modifiers: [ + { + name: "offset", + options: { + offset: [0, -10], + }, + }, + ], + sx: { + "& .MuiTooltip-tooltip": { + backgroundColor: theme.palette.secondary.main, + border: 1, + borderColor: theme.palette.primary.lowContrast, + borderRadius: theme.shape.borderRadius, + boxShadow: theme.shape.boxShadow, + px: theme.spacing(4), + py: theme.spacing(3), + }, + "& .MuiTooltip-tooltip p": { + /* TODO Font size should point to theme */ + fontSize: 12, + color: theme.palette.secondary.contrastText, + fontWeight: 500, + }, + "& .MuiTooltip-tooltip span": { + /* TODO Font size should point to theme */ + fontSize: 11, + color: theme.palette.secondary.contrastText, + fontWeight: 600, + }, + }, + }, + }} + > + + + + + ) + )} + + ); +}; + +export default StatusPageBarChart; diff --git a/Client/src/Components/Charts/Utils/chartUtilFunctions.js b/client/src/Components/Charts/Utils/chartUtilFunctions.js similarity index 96% rename from Client/src/Components/Charts/Utils/chartUtilFunctions.js rename to client/src/Components/Charts/Utils/chartUtilFunctions.js index 70f5ac9c3..d8ec6cdb6 100644 --- a/Client/src/Components/Charts/Utils/chartUtilFunctions.js +++ b/client/src/Components/Charts/Utils/chartUtilFunctions.js @@ -13,6 +13,7 @@ export const tooltipDateFormatLookup = (dateRange) => { export const tickDateFormatLookup = (dateRange) => { const tickFormatLookup = { + recent: "h:mm A", day: "h:mm A", week: "MM/D, h:mm A", month: "ddd. M/D", diff --git a/Client/src/Components/Charts/Utils/chartUtils.jsx b/client/src/Components/Charts/Utils/chartUtils.jsx similarity index 100% rename from Client/src/Components/Charts/Utils/chartUtils.jsx rename to client/src/Components/Charts/Utils/chartUtils.jsx diff --git a/Client/src/Components/Charts/Utils/gradientUtils.jsx b/client/src/Components/Charts/Utils/gradientUtils.jsx similarity index 100% rename from Client/src/Components/Charts/Utils/gradientUtils.jsx rename to client/src/Components/Charts/Utils/gradientUtils.jsx diff --git a/Client/src/Components/Check/Check.jsx b/client/src/Components/Check/Check.jsx similarity index 100% rename from Client/src/Components/Check/Check.jsx rename to client/src/Components/Check/Check.jsx diff --git a/Client/src/Components/Check/check.css b/client/src/Components/Check/check.css similarity index 100% rename from Client/src/Components/Check/check.css rename to client/src/Components/Check/check.css diff --git a/client/src/Components/CircularCount/index.jsx b/client/src/Components/CircularCount/index.jsx new file mode 100644 index 000000000..8350a8c44 --- /dev/null +++ b/client/src/Components/CircularCount/index.jsx @@ -0,0 +1,29 @@ +import { Box } from "@mui/material"; +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +const CircularCount = ({ count }) => { + const theme = useTheme(); + return ( + + {count} + + ); +}; + +CircularCount.propTypes = { + count: PropTypes.number, +}; + +export default CircularCount; diff --git a/client/src/Components/Common/AppBar.jsx b/client/src/Components/Common/AppBar.jsx new file mode 100644 index 000000000..df0660cf5 --- /dev/null +++ b/client/src/Components/Common/AppBar.jsx @@ -0,0 +1,216 @@ +import { useState } from "react"; +import { styled, alpha } from "@mui/material/styles"; +import Box from "@mui/material/Box"; +import AppBar from "@mui/material/AppBar"; +import Toolbar from "@mui/material/Toolbar"; +import Button from "@mui/material/Button"; +import IconButton from "@mui/material/IconButton"; +import Container from "@mui/material/Container"; +import MenuItem from "@mui/material/MenuItem"; +import Drawer from "@mui/material/Drawer"; +import MenuIcon from "@mui/icons-material/Menu"; +import CloseRoundedIcon from "@mui/icons-material/CloseRounded"; +import ThemeSwitch from "../ThemeSwitch"; +import { useTheme } from "@mui/material/styles"; +import { useSelector } from "react-redux"; +import { useLocation, useNavigate } from "react-router-dom"; + +const StyledToolbar = styled(Toolbar)(({ theme, mode }) => ({ + display: "flex", + alignItems: "center", + justifyContent: "space-between", + flexShrink: 0, + borderRadius: `calc(${theme.shape.borderRadius}px + 4px)`, + backdropFilter: "blur(24px)", + border: "1px solid", + borderColor: + mode === "light" + ? alpha(theme.palette.common.black, 0.1) + : alpha(theme.palette.common.white, 0.1), + backgroundColor: + mode === "light" + ? alpha(theme.palette.common.white, 0.4) + : alpha(theme.palette.common.black, 0.4), + boxShadow: theme.shadows[3], + padding: "8px 12px", +})); + +const StyledMenuItem = styled(MenuItem)(({ theme }) => ({ + fontSize: "1.1rem", + margin: theme.spacing(4, 2), +})); + +const AppAppBar = () => { + const [open, setOpen] = useState(false); + const theme = useTheme(); + const mode = useSelector((state) => state.ui.mode); + const location = useLocation(); + const navigate = useNavigate(); + + // Debugging: Log the current theme mode + console.log("Current theme mode:", mode); + + const logoSrc = + mode === "light" ? "/images/prism-black.png" : "/images/prism-white.png"; + + const toggleDrawer = (newOpen) => () => { + setOpen(newOpen); + }; + + const handleScroll = (id) => { + if (location.pathname === "/") { + const element = document.getElementById(id); + if (element) { + element.scrollIntoView({ behavior: "smooth" }); + } + } else { + navigate(`/#${id}`); + } + }; + + return ( + + + + + Prism Logo + + + + + + + + + {/* + */} + + + + + + + + + + + + + + Features + Testimonials + Highlights + FAQ + + Blog + + {/* + + + + + */} + + + + + + + + ); +}; + +export default AppAppBar; diff --git a/client/src/Components/Common/Footer.jsx b/client/src/Components/Common/Footer.jsx new file mode 100644 index 000000000..4c33512be --- /dev/null +++ b/client/src/Components/Common/Footer.jsx @@ -0,0 +1,214 @@ +import * as React from 'react'; +import Box from '@mui/material/Box'; +import Container from '@mui/material/Container'; +import IconButton from '@mui/material/IconButton'; +import Link from '@mui/material/Link'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; +import { FaFacebook, FaLinkedin, FaGithub, FaTwitter, FaEnvelope } from 'react-icons/fa'; + + +function Copyright() { + return ( + + {'Copyright © '} + + UpRock + +   + {new Date().getFullYear()} + + ); +} + +export default function Footer() { + return ( + + + +
+ + Privacy Policy + + +  •  + + + Terms of Service + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + Made with ❤️ by  + + UpRock  + + &  + + Bluewave Labs + + + + + Built on  + + + + + + + + + + + + + + + + + + + + +  Solana + + + +
+ ); +} diff --git a/Client/src/Components/ConfigBox/index.jsx b/client/src/Components/ConfigBox/index.jsx similarity index 92% rename from Client/src/Components/ConfigBox/index.jsx rename to client/src/Components/ConfigBox/index.jsx index 8f7eb7b24..9b64712fc 100644 --- a/Client/src/Components/ConfigBox/index.jsx +++ b/client/src/Components/ConfigBox/index.jsx @@ -29,10 +29,7 @@ const ConfigBox = styled(Stack)(({ theme }) => ({ }, "& h1, & h2": { color: theme.palette.primary.contrastTextSecondary, - }, - "& p": { - color: theme.palette.primary.contrastTextTertiary, - }, + } })); export default ConfigBox; diff --git a/client/src/Components/ConfigRow/index.jsx b/client/src/Components/ConfigRow/index.jsx new file mode 100644 index 000000000..c19d9ac5a --- /dev/null +++ b/client/src/Components/ConfigRow/index.jsx @@ -0,0 +1,49 @@ +import { Box, Stack, Typography } from "@mui/material"; +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import ConfigBox from "../ConfigBox"; + +/** + * ConfigRow is a styled container used to layout content in a row format with specific padding, border, and spacing. + * It serves as the wrapper for ConfigBox, with the left section displaying the title and description, + * and the right section displaying the children. + * + * @component + * @example + * return ( + * + *
Left content (Title + Description)
+ *
Right content (Children)
+ *
+ * ); + */ + +const ConfigRow = ({ title, description, children }) => { + const theme = useTheme(); + + return ( + + + + {title} + + {description && ( + + {description} + + )} + + + {children} + + + ); +}; + +ConfigRow.propTypes = { + title: PropTypes.string.isRequired, + description: PropTypes.string, + children: PropTypes.node, +}; + +export default ConfigRow; diff --git a/Client/src/Components/Dialog/genericDialog.jsx b/client/src/Components/Dialog/genericDialog.jsx similarity index 98% rename from Client/src/Components/Dialog/genericDialog.jsx rename to client/src/Components/Dialog/genericDialog.jsx index 871b3f329..b2cbe1299 100644 --- a/Client/src/Components/Dialog/genericDialog.jsx +++ b/client/src/Components/Dialog/genericDialog.jsx @@ -21,7 +21,7 @@ const GenericDialog = ({ title, description, open, onClose, theme, children }) = top: "50%", left: "50%", transform: "translate(-50%, -50%)", - width: 400, + minWidth: 400, bgcolor: theme.palette.primary.main, border: 1, borderColor: theme.palette.primary.lowContrast, diff --git a/Client/src/Components/Dialog/index.jsx b/client/src/Components/Dialog/index.jsx similarity index 80% rename from Client/src/Components/Dialog/index.jsx rename to client/src/Components/Dialog/index.jsx index 97d822e84..e07597df4 100644 --- a/Client/src/Components/Dialog/index.jsx +++ b/client/src/Components/Dialog/index.jsx @@ -1,18 +1,21 @@ import PropTypes from "prop-types"; -import LoadingButton from "@mui/lab/LoadingButton"; import { Button, Stack } from "@mui/material"; import { GenericDialog } from "./genericDialog"; +import { useTheme } from "@emotion/react"; +import { useTranslation } from "react-i18next"; const Dialog = ({ title, description, open, - theme, onCancel, confirmationButtonLabel, onConfirm, isLoading, }) => { + const theme = useTheme(); + const { t } = useTranslation(); + return ( - {confirmationButtonLabel} - + ); @@ -51,7 +54,6 @@ Dialog.propTypes = { title: PropTypes.string.isRequired, description: PropTypes.string, open: PropTypes.bool.isRequired, - theme: PropTypes.object.isRequired, onCancel: PropTypes.func.isRequired, confirmationButtonLabel: PropTypes.string.isRequired, onConfirm: PropTypes.func.isRequired, diff --git a/client/src/Components/Dot/index.jsx b/client/src/Components/Dot/index.jsx new file mode 100644 index 000000000..0676d0a6f --- /dev/null +++ b/client/src/Components/Dot/index.jsx @@ -0,0 +1,24 @@ +import PropTypes from "prop-types"; + +const Dot = ({ color = "gray", size = "4px", style }) => { + return ( + + ); +}; + +Dot.propTypes = { + color: PropTypes.string, + size: PropTypes.string, +}; + +export default Dot; diff --git a/Client/src/Components/Fallback/index.css b/client/src/Components/Fallback/index.css similarity index 66% rename from Client/src/Components/Fallback/index.css rename to client/src/Components/Fallback/index.css index 9b4d6f653..cad46300b 100644 --- a/Client/src/Components/Fallback/index.css +++ b/client/src/Components/Fallback/index.css @@ -19,6 +19,22 @@ font-size: var(--env-var-font-size-medium); } +[class*="fallback__"] .background-pattern-svg { + position: absolute; + top: 0; + left: 50%; + transform: translate(-50%, -50%); + z-index: 0; + + width: 100%; + max-width: 800px; + height: 100%; + max-height: 800px; + + background-position: center; + background-size: cover; + background-repeat: no-repeat; +} .fallback__status > .MuiStack-root { margin-left: var(--env-var-spacing-2); } diff --git a/client/src/Components/Fallback/index.jsx b/client/src/Components/Fallback/index.jsx new file mode 100644 index 000000000..b00ddbecc --- /dev/null +++ b/client/src/Components/Fallback/index.jsx @@ -0,0 +1,186 @@ +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import { Box, Button, Stack, Typography, Link } from "@mui/material"; +import { Link as RouterLink } from "react-router-dom"; +import Skeleton from "../../assets/Images/create-placeholder.svg?react"; +import SkeletonDark from "../../assets/Images/create-placeholder-dark.svg?react"; +import Background from "../../assets/Images/background-grid.svg?react"; +import Check from "../Check/Check"; +import { useNavigate } from "react-router-dom"; +import { useSelector } from "react-redux"; +import Alert from "../Alert"; +import { useTranslation } from "react-i18next"; +import "./index.css"; +import { useFetchSettings } from "../../Hooks/useFetchSettings"; +import { useState } from "react"; +/** + * Fallback component to display a fallback UI with a title, a list of checks, and a navigation button. + * + * @param {Object} props - The component props. + * @param {string} props.title - The title to be displayed in the fallback UI. + * @param {Array} props.checks - An array of strings representing the checks to display. + * @param {string} [props.link="/"] - The link to navigate to. + * @param {boolean} [props.vowelStart=false] - Whether the title starts with a vowel. + * @param {boolean} [props.showPageSpeedWarning=false] - Whether to show the PageSpeed API warning. + * @returns {JSX.Element} The rendered fallback UI. + */ + +const Fallback = ({ + title, + checks, + link = "/", + isAdmin, + vowelStart = false, + showPageSpeedWarning = false, +}) => { + const theme = useTheme(); + const navigate = useNavigate(); + const mode = useSelector((state) => state.ui.mode); + const { t } = useTranslation(); + const [settingsData, setSettingsData] = useState(undefined); + + const [isLoading, error] = useFetchSettings({ setSettingsData }); + // Custom warning message with clickable link + const renderWarningMessage = () => { + return ( + <> + {t("pageSpeedWarning")}{" "} + + {t("pageSpeedLearnMoreLink")} + {" "} + {t("pageSpeedAddApiKey")} + + ); + }; + + return ( + + + {mode === "light" ? ( + + ) : ( + + )} + + + + + + {vowelStart ? "An" : "A"} {title} is used to: + + {checks?.map((check, index) => ( + + ))} + + {/* TODO - display a different fallback if user is not an admin*/} + {isAdmin && ( + <> + + {/* Bulk create of uptime monitors */} + {title === "uptime monitor" && ( + + )} + + {/* Warning box for PageSpeed monitor */} + {title === "pagespeed monitor" && showPageSpeedWarning && ( + + svg": { + color: theme.palette.warningSecondary.contrastText, + }, + }, + }} + > + {settingsData?.pagespeedKeySet === false && ( + + )} + + + )} + + )} + + + ); +}; + +Fallback.propTypes = { + title: PropTypes.string.isRequired, + checks: PropTypes.arrayOf(PropTypes.string).isRequired, + link: PropTypes.string, + isAdmin: PropTypes.bool, + vowelStart: PropTypes.bool, + showPageSpeedWarning: PropTypes.bool, +}; + +export default Fallback; diff --git a/client/src/Components/FilterHeader/index.jsx b/client/src/Components/FilterHeader/index.jsx new file mode 100644 index 000000000..de438da96 --- /dev/null +++ b/client/src/Components/FilterHeader/index.jsx @@ -0,0 +1,95 @@ +import { Checkbox, FormControl, ListItemText, MenuItem, Select } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import PropTypes from "prop-types"; +import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline"; + +/** + * A reusable filter header component that displays a dropdown menu with selectable options. + * + * @component + * @param {Object} props - The component props. + * @param {string} props.header - The header text to display when no options are selected. + * @param {Array} props.options - An array of options to display in the dropdown menu. Each option should have a `value` and `label`. + * @param {Array} [props.value] - The currently selected values. + * @param {Function} props.onChange - The callback function to handle changes in the selected values. + * @param {boolean} [props.multiple=true] - Whether multiple options can be selected. + * @returns {JSX.Element} The rendered FilterHeader component. + */ + +const FilterHeader = ({ header, options, value, onChange, multiple = true }) => { + const theme = useTheme(); + + const controlledValue = value === undefined ? [] : value; // Ensure value is always treated as an array for controlled component purposes + + return ( + + + + ); +}; + +FilterHeader.propTypes = { + header: PropTypes.string.isRequired, + options: PropTypes.arrayOf( + PropTypes.shape({ + value: PropTypes.string.isRequired, + label: PropTypes.string.isRequired, + }) + ).isRequired, + value: PropTypes.arrayOf(PropTypes.string), + onChange: PropTypes.func.isRequired, + multiple: PropTypes.bool, +}; + +export default FilterHeader; diff --git a/client/src/Components/GenericFallback/NetworkError.jsx b/client/src/Components/GenericFallback/NetworkError.jsx new file mode 100644 index 000000000..b26037a57 --- /dev/null +++ b/client/src/Components/GenericFallback/NetworkError.jsx @@ -0,0 +1,20 @@ +import { Typography } from "@mui/material"; +import { useTheme } from "@emotion/react"; + +const NetworkError = () => { + const theme = useTheme(); + return ( + <> + + Network error + + Please check your connection + + ); +}; + +export default NetworkError; diff --git a/client/src/Components/GenericFallback/index.jsx b/client/src/Components/GenericFallback/index.jsx new file mode 100644 index 000000000..af9ed2ea4 --- /dev/null +++ b/client/src/Components/GenericFallback/index.jsx @@ -0,0 +1,78 @@ +import { useTheme } from "@emotion/react"; +import { Box, Stack } from "@mui/material"; +import Skeleton from "../../assets/Images/create-placeholder.svg?react"; +import SkeletonDark from "../../assets/Images/create-placeholder-dark.svg?react"; +import Background from "../../assets/Images/background-grid.svg?react"; +import { useSelector } from "react-redux"; + +/** + * Fallback component to display a fallback UI for network errors + * + * @returns {JSX.Element} The rendered fallback UI. + */ + +const GenericFallback = ({ children }) => { + const theme = useTheme(); + const mode = useSelector((state) => state.ui.mode); + + return ( + + + {mode === "light" ? ( + + ) : ( + + )} + + + + + {children} + + + + ); +}; + +export default GenericFallback; diff --git a/Client/src/Components/HOC/withAdminCheck.jsx b/client/src/Components/HOC/withAdminCheck.jsx similarity index 100% rename from Client/src/Components/HOC/withAdminCheck.jsx rename to client/src/Components/HOC/withAdminCheck.jsx diff --git a/Client/src/Components/Heading/index.jsx b/client/src/Components/Heading/index.jsx similarity index 100% rename from Client/src/Components/Heading/index.jsx rename to client/src/Components/Heading/index.jsx diff --git a/Client/src/Pages/Uptime/Home/host.jsx b/client/src/Components/Host/index.jsx similarity index 52% rename from Client/src/Pages/Uptime/Home/host.jsx rename to client/src/Components/Host/index.jsx index ec78875f4..051e60331 100644 --- a/Client/src/Pages/Uptime/Home/host.jsx +++ b/client/src/Components/Host/index.jsx @@ -1,5 +1,7 @@ -import { Box, Typography } from "@mui/material"; +import { Stack, Typography } from "@mui/material"; import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import Dot from "../Dot"; /** * Host component. * This subcomponent receives a params object and displays the host details. @@ -13,44 +15,33 @@ import PropTypes from "prop-types"; * @returns {React.ElementType} Returns a div element with the host details. */ const Host = ({ url, title, percentageColor, percentage }) => { - const noTitle = title === undefined || title === url; + const theme = useTheme(); return ( - - + {title} - - {percentageColor && percentage && ( - - {percentage}% - - )} - {!noTitle && {url}} - + {percentageColor && percentage && ( + <> + + + {percentage}% + + + )} + + {url} + ); }; diff --git a/Client/src/Components/HttpStatusLabel/index.jsx b/client/src/Components/HttpStatusLabel/index.jsx similarity index 100% rename from Client/src/Components/HttpStatusLabel/index.jsx rename to client/src/Components/HttpStatusLabel/index.jsx diff --git a/Client/src/Components/IconBox/index.jsx b/client/src/Components/IconBox/index.jsx similarity index 100% rename from Client/src/Components/IconBox/index.jsx rename to client/src/Components/IconBox/index.jsx diff --git a/client/src/Components/Image/index.jsx b/client/src/Components/Image/index.jsx new file mode 100644 index 000000000..8f30f8a9e --- /dev/null +++ b/client/src/Components/Image/index.jsx @@ -0,0 +1,72 @@ +import { Box } from "@mui/material"; +import PropTypes from "prop-types"; + +const isValidBase64Image = (data) => { + return /^[A-Za-z0-9+/=]+$/.test(data); +}; + +const Image = ({ + shouldRender = true, + src, + alt, + width = "auto", + height = "auto", + minWidth = "auto", + minHeight = "auto", + maxWidth = "auto", + maxHeight = "auto", + base64, + placeholder, + sx, +}) => { + if (shouldRender === false) { + return null; + } + + if (typeof src !== "undefined" && typeof base64 !== "undefined") { + console.warn("base64 takes precedence over src and overwrites it"); + } + + if (typeof base64 !== "undefined" && isValidBase64Image(base64)) { + src = `data:image/png;base64,${base64}`; + } + + if ( + typeof src === "undefined" && + typeof base64 === "undefined" && + typeof placeholder !== "undefined" + ) { + src = placeholder; + } + + return ( + + ); +}; + +Image.propTypes = { + shouldRender: PropTypes.bool, + src: PropTypes.string, + alt: PropTypes.string.isRequired, + width: PropTypes.string, + height: PropTypes.string, + minWidth: PropTypes.string, + minHeight: PropTypes.string, + maxWidth: PropTypes.string, + maxHeight: PropTypes.string, + base64: PropTypes.string, + sx: PropTypes.object, +}; + +export default Image; diff --git a/client/src/Components/InfoBox/index.jsx b/client/src/Components/InfoBox/index.jsx new file mode 100644 index 000000000..6797d6c9c --- /dev/null +++ b/client/src/Components/InfoBox/index.jsx @@ -0,0 +1,42 @@ +import { RowContainer } from "../StandardContainer"; +import { Stack, Typography } from "@mui/material"; +import Image from "../Image"; + +import { useTheme } from "@mui/material/styles"; + +const InfoBox = ({ + img, + icon: Icon, + alt, + heading, + headingLevel = 2, + subHeading, + subHeadingLevel = "", + sx, +}) => { + const theme = useTheme(); + return ( + + {img && ( + {alt} + )} + {Icon && ( + + )} + + {heading} + + {subHeading} + + + + ); +}; + +export default InfoBox; diff --git a/Client/src/Components/Inputs/Checkbox/index.css b/client/src/Components/Inputs/Checkbox/index.css similarity index 100% rename from Client/src/Components/Inputs/Checkbox/index.css rename to client/src/Components/Inputs/Checkbox/index.css diff --git a/Client/src/Components/Inputs/Checkbox/index.jsx b/client/src/Components/Inputs/Checkbox/index.jsx similarity index 98% rename from Client/src/Components/Inputs/Checkbox/index.jsx rename to client/src/Components/Inputs/Checkbox/index.jsx index b3a036d57..58b83c7c7 100644 --- a/Client/src/Components/Inputs/Checkbox/index.jsx +++ b/client/src/Components/Inputs/Checkbox/index.jsx @@ -75,7 +75,6 @@ const Checkbox = ({ sx={{ "&:hover": { backgroundColor: "transparent" }, "& svg": { width: sizes[size], height: sizes[size] }, - alignSelf: "flex-start", }} /> } @@ -111,7 +110,7 @@ Checkbox.propTypes = { label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired, size: PropTypes.oneOf(["small", "medium", "large"]), isChecked: PropTypes.bool.isRequired, - value: PropTypes.string, + value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), onChange: PropTypes.func, isDisabled: PropTypes.bool, }; diff --git a/client/src/Components/Inputs/ColorPicker/index.jsx b/client/src/Components/Inputs/ColorPicker/index.jsx new file mode 100644 index 000000000..e64c936fc --- /dev/null +++ b/client/src/Components/Inputs/ColorPicker/index.jsx @@ -0,0 +1,63 @@ +import PropTypes from "prop-types"; +import { Stack, Typography } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import { MuiColorInput } from "mui-color-input"; + +/** + * + * @param {*} id The ID of the component + * @param {*} value The color value of the component + * @param {*} error The error of the component + * @param {*} onChange The Change handler function + * @param {*} onBlur The Blur handler function + * @returns The ColorPicker component + * Example usage: + * + * + */ +const ColorPicker = ({ id, name, value, error, onChange, onBlur }) => { + const theme = useTheme(); + return ( + + onChange({ target: { name, value: color } })} + onBlur={onBlur} + /> + {error && ( + + {error} + + )} + + ); +}; + +ColorPicker.propTypes = { + id: PropTypes.string.isRequired, + value: PropTypes.string, + error: PropTypes.string, + onChange: PropTypes.func.isRequired, + onBlur: PropTypes.func, + name: PropTypes.string, +}; + +export default ColorPicker; diff --git a/client/src/Components/Inputs/ImageUpload/index.jsx b/client/src/Components/Inputs/ImageUpload/index.jsx new file mode 100644 index 000000000..a49dc4860 --- /dev/null +++ b/client/src/Components/Inputs/ImageUpload/index.jsx @@ -0,0 +1,243 @@ +// Components +import { Box, Stack, Typography } from "@mui/material"; +import CloudUploadIcon from "@mui/icons-material/CloudUpload"; +import Image from "../../../Components/Image"; +import TextField from "@mui/material/TextField"; +import IconButton from "@mui/material/IconButton"; +import ProgressUpload from "../../ProgressBars"; +import ImageIcon from "@mui/icons-material/Image"; + +// Utils +import PropTypes from "prop-types"; +import { useCallback, useState, useRef, useEffect } from "react"; +import { useTheme } from "@emotion/react"; +import { useTranslation } from "react-i18next"; + +/** + * ImageUpload component allows users to upload images with drag-and-drop functionality. + * It supports file size and format validation. + * + * @component + * @param {Object} props - Component props + * @param {boolean} [props.previewIsRound=false] - Determines if the image preview should be round + * @param {string} [props.src] - Source URL of the image to display + * @param {function} props.onChange - Callback function to handle file change, takes a file as an argument + * @param {number} [props.maxSize=3145728] - Maximum file size allowed in bytes (default is 3MB) + * @param {Array} [props.accept=['jpg', 'jpeg', 'png']] - Array of accepted file formats + * @param {Object} [props.errors] - Object containing error messages + * @returns {JSX.Element} The rendered component + */ +const ImageUpload = ({ + previewIsRound = false, + src, + onChange, + maxSize = 3 * 1024 * 1024, + accept = ["jpg", "jpeg", "png"], + error, +}) => { + const theme = useTheme(); + const { t } = useTranslation(); + const [uploadComplete, setUploadComplete] = useState(false); + const [completedFile, setCompletedFile] = useState(null); + const [file, setFile] = useState(null); + const [progress, setProgress] = useState({ value: 0, isLoading: false }); + const intervalRef = useRef(null); + const [localError, setLocalError] = useState(null); + const [isDragging, setIsDragging] = useState(false); + + const roundStyle = previewIsRound ? { borderRadius: "50%" } : {}; + + const handleImageChange = useCallback( + (file) => { + if (!file) return; + + const isValidType = accept.some((type) => + file.type.includes(type) + ); + const isValidSize = file.size <= maxSize; + + if (!isValidType) { + setLocalError(t('invalidFileFormat')); + return; + } + if (!isValidSize) { + setLocalError(t('invalidFileSize')); + return; + } + + setLocalError(null); + + const previewFile = { + src: URL.createObjectURL(file), + name: file.name, + file, + }; + + setFile(previewFile); + setProgress({ value: 0, isLoading: true }); + + intervalRef.current = setInterval(() => { + setProgress((prev) => { + const buffer = 12; + if (prev.value + buffer >= 100) { + clearInterval(intervalRef.current); + setUploadComplete(true); + setCompletedFile(previewFile); + return { value: 100, isLoading: false }; + } + return { value: prev.value + buffer, isLoading: true }; + }); + }, 120); + }, + [maxSize, accept] + ); + + useEffect(() => { + if (uploadComplete && completedFile) { + onChange?.(completedFile); + setUploadComplete(false); + setCompletedFile(null); + } + }, [uploadComplete, completedFile, onChange]); + + + return ( + <> + {src ? ( + + Uploaded preview + + ) : ( + <> + setIsDragging(true)} + onDragLeave={() => setIsDragging(false)} + onDrop={() => setIsDragging(false)} + sx={{ + position: "relative", + height: "fit-content", + border: "dashed", + borderRadius: theme.shape.borderRadius, + borderColor: isDragging + ? theme.palette.primary.main + : theme.palette.primary.lowContrast, + backgroundColor: isDragging + ? "hsl(215, 87%, 51%, 0.05)" + : "transparent", + borderWidth: "2px", + transition: "0.2s", + "&:hover": { + borderColor: theme.palette.primary.main, + backgroundColor: "hsl(215, 87%, 51%, 0.05)", + }, + }} + > + handleImageChange(e?.target?.files?.[0])} + sx={{ + width: "100%", + "& .MuiInputBase-input[type='file']": { + opacity: 0, + cursor: "pointer", + maxWidth: "500px", + minHeight: "175px", + zIndex: 1, + }, + "& fieldset": { + padding: 0, + border: "none", + }, + }} + /> + + + + + + + {t('ClickUpload')} + {" "} + or {t('DragandDrop')} + + ({t('MaxSize')}: {Math.round(maxSize / 1024 / 1024)}MB) + + + + {(localError || progress.isLoading || progress.value !== 0) && ( + } + label={file?.name || "Upload failed"} + size={file?.size} + progress={progress.value} + onClick={() => { + clearInterval(intervalRef.current); + setFile(null); + setProgress({ value: 0, isLoading: false }); + setLocalError(null); + onChange(undefined); + }} + error={localError || error} + /> + )} + + {t('SupportedFormats')}: {accept.join(", ").toUpperCase()} + + + )} + + ); +}; + +ImageUpload.propTypes = { + previewIsRound: PropTypes.bool, + src: PropTypes.string, + onChange: PropTypes.func, + maxSize: PropTypes.number, + accept: PropTypes.array, + error: PropTypes.string, +}; + +export default ImageUpload; \ No newline at end of file diff --git a/Client/src/Components/Inputs/Radio/index.css b/client/src/Components/Inputs/Radio/index.css similarity index 100% rename from Client/src/Components/Inputs/Radio/index.css rename to client/src/Components/Inputs/Radio/index.css diff --git a/Client/src/Components/Inputs/Radio/index.jsx b/client/src/Components/Inputs/Radio/index.jsx similarity index 100% rename from Client/src/Components/Inputs/Radio/index.jsx rename to client/src/Components/Inputs/Radio/index.jsx diff --git a/Client/src/Components/Inputs/Search/index.jsx b/client/src/Components/Inputs/Search/index.jsx similarity index 83% rename from Client/src/Components/Inputs/Search/index.jsx rename to client/src/Components/Inputs/Search/index.jsx index 1dff6b532..a3b75161c 100644 --- a/Client/src/Components/Inputs/Search/index.jsx +++ b/client/src/Components/Inputs/Search/index.jsx @@ -12,6 +12,7 @@ import SearchIcon from "../../../assets/icons/search.svg?react"; * @param {string} props.filteredBy - Key to access the option label from the options * @param {string} props.value - Current input value for the Autocomplete * @param {Function} props.handleChange - Function to call when the input changes + * @param {Function} Prop.onBlur - Function to call when the input is blured * @param {Object} props.sx - Additional styles to apply to the component * @returns {JSX.Element} The rendered Search component */ @@ -54,10 +55,14 @@ const Search = ({ isAdorned = true, error, disabled, + startAdornment, + endAdornment, + onBlur, }) => { const theme = useTheme(); return ( { - handleChange && handleChange(newValue); + handleChange(newValue); }} fullWidth freeSolo @@ -74,6 +79,7 @@ const Search = ({ disableClearable options={options} getOptionLabel={(option) => option[filteredBy]} + isOptionEqualToValue={(option, value) => option._id === value._id} // Compare by unique identifier renderInput={(params) => ( }), + slotProps={{ + input: { + ...params.InputProps, + ...(isAdorned && { startAdornment: }), + ...(startAdornment && { startAdornment: startAdornment }), + ...(endAdornment && { endAdornment: endAdornment }), + }, }} sx={{ "& fieldset": { @@ -118,7 +128,7 @@ const Search = ({ option.id} + getOptionKey={(option) => { + return option._id; + }} renderOption={(props, option) => { const { key, ...optionProps } = props; + const hasSecondaryLabel = secondaryLabel && option[secondaryLabel] !== undefined; return ( - {option[filteredBy] + (secondaryLabel ? ` (${option[secondaryLabel]})` : "")} + {option[filteredBy] + + (hasSecondaryLabel ? ` (${option[secondaryLabel]})` : "")} ); }} @@ -176,8 +190,8 @@ const Search = ({ color: "red", }, "& li.MuiAutocomplete-option:hover:not([aria-selected='true'])": { - color: theme.palette.primary.main, - backgroundColor: theme.palette.primary.contrastTextSecondary, + color: theme.palette.secondary.contrastText, + backgroundColor: theme.palette.secondary.main, }, "& .MuiAutocomplete-noOptions": { px: theme.spacing(6), @@ -196,6 +210,7 @@ const Search = ({ }; Search.propTypes = { + label: PropTypes.string, id: PropTypes.string, multiple: PropTypes.bool, options: PropTypes.array.isRequired, @@ -209,6 +224,9 @@ Search.propTypes = { sx: PropTypes.object, error: PropTypes.string, disabled: PropTypes.bool, + startAdornment: PropTypes.object, + endAdornment: PropTypes.object, + onBlur: PropTypes.func, }; export default Search; diff --git a/Client/src/Components/Inputs/Select/index.css b/client/src/Components/Inputs/Select/index.css similarity index 100% rename from Client/src/Components/Inputs/Select/index.css rename to client/src/Components/Inputs/Select/index.css diff --git a/Client/src/Components/Inputs/Select/index.jsx b/client/src/Components/Inputs/Select/index.jsx similarity index 79% rename from Client/src/Components/Inputs/Select/index.jsx rename to client/src/Components/Inputs/Select/index.jsx index f0a1d11c0..927247d77 100644 --- a/Client/src/Components/Inputs/Select/index.jsx +++ b/client/src/Components/Inputs/Select/index.jsx @@ -18,6 +18,7 @@ import "./index.css"; * @param {string} props.items.name - The display name of each item. * @param {function} props.onChange - The function to handle onChange event. * @param {object} props.sx - The custom styles object for MUI Select component. + * @param {number} props.maxWidth - Maximum width in pixels for the select component. Enables responsive text truncation. * @returns {JSX.Element} * * @example @@ -50,6 +51,7 @@ const Select = ({ sx, name = "", labelControlSpacing = 2, + maxWidth, }) => { const theme = useTheme(); const itemStyles = { @@ -59,6 +61,13 @@ const Select = ({ margin: theme.spacing(2), }; + const responsiveMaxWidth = { + xs: `${maxWidth * 0.5}px`, + sm: `${maxWidth * 0.75}px`, + md: `${maxWidth * 0.9}px`, + lg: `${maxWidth}px`, + }; + return ( { + const selectedItem = items.find((item) => item._id === selected); + const displayName = selectedItem ? selectedItem.name : placeholder; + return ( + + {displayName} + + ); + }} > {placeholder && ( { const theme = useTheme(); return ( @@ -23,7 +25,7 @@ export const HttpAdornment = ({ https }) => { color={theme.palette.primary.contrastTextSecondary} sx={{ lineHeight: 1, opacity: 0.8 }} > - {https ? "https" : "http"}:// + {https ? "https" : "http"} ); @@ -31,6 +33,7 @@ export const HttpAdornment = ({ https }) => { HttpAdornment.propTypes = { https: PropTypes.bool.isRequired, + prefix: PropTypes.string, }; export const PasswordEndAdornment = ({ fieldType, setFieldType }) => { diff --git a/Client/src/Components/Inputs/TextInput/index.jsx b/client/src/Components/Inputs/TextInput/index.jsx similarity index 86% rename from Client/src/Components/Inputs/TextInput/index.jsx rename to client/src/Components/Inputs/TextInput/index.jsx index 38a6b6161..bb2df5d21 100644 --- a/Client/src/Components/Inputs/TextInput/index.jsx +++ b/client/src/Components/Inputs/TextInput/index.jsx @@ -6,18 +6,6 @@ import PropTypes from "prop-types"; const getSx = (theme, type, maxWidth) => { const sx = { maxWidth: maxWidth, - "& .MuiOutlinedInput-root ": { - "&:hover .MuiOutlinedInput-notchedOutline": { - borderColor: theme.palette.primary.contrastText, // Adjust hover border color - }, - "&.Mui-focused .MuiOutlinedInput-notchedOutline": { - borderColor: theme.palette.accent.main, // Adjust focus border color - }, - "&.Mui-disabled .MuiOutlinedInput-notchedOutline": { - borderColor: theme.palette.primary.contrastText, // CAIO_REVIEW - opacity: 0.5, - }, - }, "& .MuiFormHelperText-root": { position: "absolute", @@ -116,6 +104,7 @@ const TextInput = forwardRef( fontSize={"var(--env-var-font-size-medium)"} color={theme.palette.primary.contrastTextSecondary} fontWeight={500} + mb={theme.spacing(2)} > {label} {isRequired && } @@ -152,9 +141,9 @@ TextInput.displayName = "TextInput"; TextInput.propTypes = { type: PropTypes.string, - id: PropTypes.string.isRequired, + id: PropTypes.string, name: PropTypes.string, - value: PropTypes.string, + value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), placeholder: PropTypes.string, isRequired: PropTypes.bool, isOptional: PropTypes.bool, diff --git a/Client/src/Components/Label/index.css b/client/src/Components/Label/index.css similarity index 100% rename from Client/src/Components/Label/index.css rename to client/src/Components/Label/index.css diff --git a/Client/src/Components/Label/index.jsx b/client/src/Components/Label/index.jsx similarity index 94% rename from Client/src/Components/Label/index.jsx rename to client/src/Components/Label/index.jsx index c651b93e7..6ba55e81c 100644 --- a/Client/src/Components/Label/index.jsx +++ b/client/src/Components/Label/index.jsx @@ -114,7 +114,7 @@ ColoredLabel.propTypes = { /** * @component * @param {Object} props - * @param { 'up' | 'down' | 'cannot resolve'} props.status - The status for the label + * @param {'up' | 'down' | 'paused' | 'pending' | 'cannot resolve' | 'published' | 'unpublished'} props.status - The status for the label * @param {string} props.text - The text of the label * @returns {JSX.Element} * @example @@ -128,6 +128,8 @@ const statusToTheme = { paused: "warning", pending: "warning", "cannot resolve": "error", + published: "success", + unpublished: "error", }; const StatusLabel = ({ status, text, customStyles }) => { @@ -156,7 +158,7 @@ const StatusLabel = ({ status, text, customStyles }) => { }; StatusLabel.propTypes = { - status: PropTypes.oneOf(["up", "down", "paused", "pending", "cannot resolve"]), + status: PropTypes.oneOf(["up", "down", "paused", "pending", "cannot resolve", "published", "unpublished"]), text: PropTypes.string, customStyles: PropTypes.object, }; diff --git a/client/src/Components/LanguageSelector.jsx b/client/src/Components/LanguageSelector.jsx new file mode 100644 index 000000000..70c41e640 --- /dev/null +++ b/client/src/Components/LanguageSelector.jsx @@ -0,0 +1,136 @@ +import { useTranslation } from "react-i18next"; +import { Box, MenuItem, Select, Stack } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import "flag-icons/css/flag-icons.min.css"; +import { useSelector } from "react-redux"; + +const LanguageSelector = () => { + const { i18n } = useTranslation(); + const theme = useTheme(); + const { language } = useSelector((state) => state.ui); + + const handleChange = (event) => { + const newLang = event.target.value; + i18n.changeLanguage(newLang); + }; + + const languages = Object.keys(i18n.options.resources || {}); + + return ( + + ); +}; + +export default LanguageSelector; diff --git a/Client/src/Components/Layouts/HomeLayout/index.css b/client/src/Components/Layouts/HomeLayout/index.css similarity index 56% rename from Client/src/Components/Layouts/HomeLayout/index.css rename to client/src/Components/Layouts/HomeLayout/index.css index e08904f8e..28ac340f8 100644 --- a/Client/src/Components/Layouts/HomeLayout/index.css +++ b/client/src/Components/Layouts/HomeLayout/index.css @@ -1,9 +1,8 @@ .home-layout { position: relative; min-height: 100vh; - max-width: 1400px; margin: 0 auto; - padding: var(--env-var-spacing-2); + padding: 0; } /* TODO go for this approach for responsiveness. The aside needs to be taken care of */ @@ -15,10 +14,9 @@ .home-layout aside { position: sticky; - top: var(--env-var-spacing-2); + top: 0; left: 0; - - height: calc(100vh - var(--env-var-spacing-2) * 2); + height: 100vh; max-width: var(--env-var-side-bar-width); } @@ -27,19 +25,9 @@ flex: 1; } -.home-layout > div:has(> [class*="fallback__"]) .background-pattern-svg { - position: absolute; - top: 0; - left: 50%; - transform: translate(-50%, -50%); - z-index: 0; - - width: 100%; - max-width: 800px; - height: 100%; - max-height: 800px; - - background-position: center; - background-size: cover; - background-repeat: no-repeat; -} +.home-content-wrapper { + padding: var(--env-var-spacing-2); + max-width: 1400px; + margin: 0 auto; + flex: 1; +} \ No newline at end of file diff --git a/Client/src/Components/Layouts/HomeLayout/index.jsx b/client/src/Components/Layouts/HomeLayout/index.jsx similarity index 81% rename from Client/src/Components/Layouts/HomeLayout/index.jsx rename to client/src/Components/Layouts/HomeLayout/index.jsx index b605a0d53..55b612522 100644 --- a/Client/src/Components/Layouts/HomeLayout/index.jsx +++ b/client/src/Components/Layouts/HomeLayout/index.jsx @@ -12,7 +12,9 @@ const HomeLayout = () => { gap={14} > - + + + ); }; diff --git a/Client/src/Components/Link/index.jsx b/client/src/Components/Link/index.jsx similarity index 89% rename from Client/src/Components/Link/index.jsx rename to client/src/Components/Link/index.jsx index 6a317502b..7a623a3b0 100644 --- a/Client/src/Components/Link/index.jsx +++ b/client/src/Components/Link/index.jsx @@ -14,7 +14,14 @@ const Link = ({ level, label, url }) => { const theme = useTheme(); const levelConfig = { - primary: {}, + primary: { + color: theme.palette.primary.contrastTextTertiary, + sx: { + ":hover": { + color: theme.palette.primary.contrastTextSecondary, + }, + }, + }, secondary: { color: theme.palette.primary.contrastTextSecondary, sx: { diff --git a/Client/src/Components/Link/link.css b/client/src/Components/Link/link.css similarity index 100% rename from Client/src/Components/Link/link.css rename to client/src/Components/Link/link.css diff --git a/client/src/Components/MonitorCountHeader/index.jsx b/client/src/Components/MonitorCountHeader/index.jsx new file mode 100644 index 000000000..0b3478df5 --- /dev/null +++ b/client/src/Components/MonitorCountHeader/index.jsx @@ -0,0 +1,52 @@ +import { Stack, Typography } from "@mui/material"; +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import SkeletonLayout from "./skeleton"; + +const MonitorCountHeader = ({ + shouldRender = true, + monitorCount, + heading = "monitors", + sx, + children, +}) => { + const theme = useTheme(); + if (!shouldRender) return ; + + if (monitorCount === 1) { + heading = "monitor"; + } + + return ( + + {monitorCount} {heading} + {children} + + ); +}; + +MonitorCountHeader.propTypes = { + shouldRender: PropTypes.bool, + monitorCount: PropTypes.number, + heading: PropTypes.string, + children: PropTypes.node, + sx: PropTypes.object, +}; + +export default MonitorCountHeader; diff --git a/client/src/Components/MonitorCountHeader/skeleton.jsx b/client/src/Components/MonitorCountHeader/skeleton.jsx new file mode 100644 index 000000000..9b4971c32 --- /dev/null +++ b/client/src/Components/MonitorCountHeader/skeleton.jsx @@ -0,0 +1,26 @@ +import { Stack, Skeleton } from "@mui/material"; +import { useTheme } from "@emotion/react"; + +const SkeletonLayout = () => { + const theme = useTheme(); + return ( + + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Components/MonitorCreateHeader/index.jsx b/client/src/Components/MonitorCreateHeader/index.jsx new file mode 100644 index 000000000..15d6d5c0f --- /dev/null +++ b/client/src/Components/MonitorCreateHeader/index.jsx @@ -0,0 +1,61 @@ +import { Stack, Button } from "@mui/material"; +import { useNavigate } from "react-router-dom"; +import PropTypes from "prop-types"; +import { useTranslation } from "react-i18next"; +import { useTheme } from "@emotion/react"; + +const CreateMonitorHeader = ({ + isAdmin, + label, + isLoading = true, + path, + bulkPath, +}) => { + const navigate = useNavigate(); + const { t } = useTranslation(); + const theme = useTheme(); + + // Use the provided label or fall back to the translated default + + if (!isAdmin) return null; + + return ( + + + {bulkPath && ( + + )} + + ); +}; + +export default CreateMonitorHeader; + +CreateMonitorHeader.propTypes = { + isAdmin: PropTypes.bool.isRequired, + isLoading: PropTypes.bool, + path: PropTypes.string.isRequired, + label: PropTypes.string, + bulkPath: PropTypes.string, +}; diff --git a/client/src/Components/MonitorCreateHeader/skeleton.jsx b/client/src/Components/MonitorCreateHeader/skeleton.jsx new file mode 100644 index 000000000..7583f7849 --- /dev/null +++ b/client/src/Components/MonitorCreateHeader/skeleton.jsx @@ -0,0 +1,19 @@ +import { Stack, Skeleton } from "@mui/material"; + +const SkeletonLayout = () => { + return ( + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Components/MonitorStatusHeader/ConfigButton/index.jsx b/client/src/Components/MonitorStatusHeader/ConfigButton/index.jsx new file mode 100644 index 000000000..c966abf33 --- /dev/null +++ b/client/src/Components/MonitorStatusHeader/ConfigButton/index.jsx @@ -0,0 +1,41 @@ +import { Button, Box } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import { useNavigate } from "react-router-dom"; +import SettingsIcon from "../../../assets/icons/settings-bold.svg?react"; +import PropTypes from "prop-types"; +const ConfigButton = ({ shouldRender = true, monitorId, path }) => { + const theme = useTheme(); + const navigate = useNavigate(); + + if (!shouldRender) return null; + + return ( + + + + ); +}; + +ConfigButton.propTypes = { + shouldRender: PropTypes.bool, + monitorId: PropTypes.string.isRequired, + path: PropTypes.string.isRequired, +}; + +export default ConfigButton; diff --git a/client/src/Components/MonitorStatusHeader/index.jsx b/client/src/Components/MonitorStatusHeader/index.jsx new file mode 100644 index 000000000..a3cb5edfe --- /dev/null +++ b/client/src/Components/MonitorStatusHeader/index.jsx @@ -0,0 +1,58 @@ +import { Stack, Typography } from "@mui/material"; +import PulseDot from "../Animated/PulseDot"; +import Dot from "../Dot"; +import { useTheme } from "@emotion/react"; +import useUtils from "../../Pages/Uptime/Monitors/Hooks/useUtils"; +import { formatDurationRounded } from "../../Utils/timeUtils"; +import ConfigButton from "./ConfigButton"; +import SkeletonLayout from "./skeleton"; +import PropTypes from "prop-types"; + +const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => { + const theme = useTheme(); + const { statusColor, determineState } = useUtils(); + if (isLoading) { + return ; + } + + return ( + + + {monitor?.name} + + + + {monitor?.url?.replace(/^https?:\/\//, "") || "..."} + + + + Checking every {formatDurationRounded(monitor?.interval)}. + + + + + + ); +}; + +MonitorStatusHeader.propTypes = { + path: PropTypes.string.isRequired, + isLoading: PropTypes.bool, + isAdmin: PropTypes.bool, + monitor: PropTypes.object, +}; + +export default MonitorStatusHeader; diff --git a/client/src/Components/MonitorStatusHeader/skeleton.jsx b/client/src/Components/MonitorStatusHeader/skeleton.jsx new file mode 100644 index 000000000..64dc0547f --- /dev/null +++ b/client/src/Components/MonitorStatusHeader/skeleton.jsx @@ -0,0 +1,23 @@ +import { Stack, Skeleton } from "@mui/material"; + +const SkeletonLayout = () => { + return ( + + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Components/MonitorTimeFrameHeader/index.jsx b/client/src/Components/MonitorTimeFrameHeader/index.jsx new file mode 100644 index 000000000..3958d507c --- /dev/null +++ b/client/src/Components/MonitorTimeFrameHeader/index.jsx @@ -0,0 +1,85 @@ +import { Stack, Typography, Button, ButtonGroup } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import SkeletonLayout from "./skeleton"; +import PropTypes from "prop-types"; + +const MonitorTimeFrameHeader = ({ + isLoading = false, + hasDateRange = true, + dateRange, + setDateRange, +}) => { + const theme = useTheme(); + + if (isLoading) { + return ; + } + + let timeFramePicker = null; + + if (hasDateRange) { + timeFramePicker = ( + + + + + + + ); + } + + return ( + + + Showing statistics for past{" "} + {dateRange === "recent" + ? "2 hours" + : dateRange === "day" + ? "24 hours" + : dateRange === "week" + ? "7 days" + : "30 days"} + . + + {timeFramePicker} + + ); +}; + +MonitorTimeFrameHeader.propTypes = { + isLoading: PropTypes.bool, + hasDateRange: PropTypes.bool, + dateRange: PropTypes.string, + setDateRange: PropTypes.func, +}; + +export default MonitorTimeFrameHeader; diff --git a/client/src/Components/MonitorTimeFrameHeader/skeleton.jsx b/client/src/Components/MonitorTimeFrameHeader/skeleton.jsx new file mode 100644 index 000000000..d7c395d54 --- /dev/null +++ b/client/src/Components/MonitorTimeFrameHeader/skeleton.jsx @@ -0,0 +1,23 @@ +import { Stack, Skeleton } from "@mui/material"; + +const SkeletonLayout = () => { + return ( + + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx b/client/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx new file mode 100644 index 000000000..dc94ee731 --- /dev/null +++ b/client/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx @@ -0,0 +1,419 @@ +import { useState, useMemo, useEffect, useCallback } from "react"; +import { useTranslation } from "react-i18next"; +import PropTypes from "prop-types"; + +import { + Dialog, + DialogContent, + DialogActions, + Button, + Typography, + Box, + Tabs, + Tab, + Stack, +} from "@mui/material"; +import { useTheme } from "@emotion/react"; +import TabPanel from "./TabPanel"; +import TabComponent from "./TabComponent"; +import useNotifications from "../Hooks/useNotification"; + +// Define constants for notification types to avoid magic values +const NOTIFICATION_TYPES = { + SLACK: "slack", + DISCORD: "discord", + TELEGRAM: "telegram", + WEBHOOK: "webhook", +}; + +// Define constants for field IDs +const FIELD_IDS = { + WEBHOOK: "webhook", + TOKEN: "token", + CHAT_ID: "chatId", + URL: "url", +}; + +const NotificationIntegrationModal = ({ + open, + onClose, + monitor, + setMonitor, + // Optional prop to configure available notification types + notificationTypes = null, +}) => { + const { t } = useTranslation(); + const theme = useTheme(); + const [tabValue, setTabValue] = useState(0); + + const [loading, _, sendTestNotification] = useNotifications(); + + // Helper to get the field state key with error handling + const getFieldKey = useCallback( + (typeId, fieldId) => { + if (typeof typeId !== "string" || typeId === "") { + throw new Error(t("errorInvalidTypeId")); + } + + if (typeof fieldId !== "string" || fieldId === "") { + throw new Error(t("errorInvalidFieldId")); + } + + return `${typeId}${fieldId.charAt(0).toUpperCase() + fieldId.slice(1)}`; + }, + [t] + ); + + // Define notification types + const DEFAULT_NOTIFICATION_TYPES = [ + { + id: NOTIFICATION_TYPES.SLACK, + label: t("notifications.slack.label"), + description: t("notifications.slack.description"), + fields: [ + { + id: FIELD_IDS.WEBHOOK, + label: t("notifications.slack.webhookLabel"), + placeholder: t("notifications.slack.webhookPlaceholder"), + type: "text", + }, + ], + }, + { + id: NOTIFICATION_TYPES.DISCORD, + label: t("notifications.discord.label"), + description: t("notifications.discord.description"), + fields: [ + { + id: FIELD_IDS.WEBHOOK, + label: t("notifications.discord.webhookLabel"), + placeholder: t("notifications.discord.webhookPlaceholder"), + type: "text", + }, + ], + }, + { + id: NOTIFICATION_TYPES.TELEGRAM, + label: t("notifications.telegram.label"), + description: t("notifications.telegram.description"), + fields: [ + { + id: FIELD_IDS.TOKEN, + label: t("notifications.telegram.tokenLabel"), + placeholder: t("notifications.telegram.tokenPlaceholder"), + type: "text", + }, + { + id: FIELD_IDS.CHAT_ID, + label: t("notifications.telegram.chatIdLabel"), + placeholder: t("notifications.telegram.chatIdPlaceholder"), + type: "text", + }, + ], + }, + { + id: NOTIFICATION_TYPES.WEBHOOK, + label: t("notifications.webhook.label"), + description: t("notifications.webhook.description"), + fields: [ + { + id: FIELD_IDS.URL, + label: t("notifications.webhook.urlLabel"), + placeholder: t("notifications.webhook.urlPlaceholder"), + type: "text", + }, + ], + }, + ]; + + // Use provided notification types or default to our translated ones + const activeNotificationTypes = notificationTypes || DEFAULT_NOTIFICATION_TYPES; + + // Memoized function to initialize integrations state + const initialIntegrationsState = useMemo(() => { + const state = {}; + + activeNotificationTypes.forEach((type) => { + // Add enabled flag for each notification type + state[type.id] = false; + + // Add state for each field in the notification type + type.fields.forEach((field) => { + const fieldKey = getFieldKey(type.id, field.id); + state[fieldKey] = ""; + }); + }); + + return state; + }, [activeNotificationTypes, getFieldKey]); // Only recompute when these dependencies change + + const [integrations, setIntegrations] = useState(initialIntegrationsState); + + useEffect(() => { + if (open) { + const extractNotificationValues = () => { + const values = {}; + + if (!monitor?.notifications || !Array.isArray(monitor.notifications)) { + return values; + } + + monitor.notifications.forEach((notification) => { + // Handle notification based on its structure + if (notification.type === "webhook" && notification.platform) { + if (typeof notification.config === "undefined") return; + const platform = notification.platform; + values[platform] = true; // Set platform as enabled + + // Extract configuration based on platform + switch (platform) { + case NOTIFICATION_TYPES.SLACK: + case NOTIFICATION_TYPES.DISCORD: + if (notification.config.webhookUrl) { + values[getFieldKey(platform, FIELD_IDS.WEBHOOK)] = + notification.config.webhookUrl; + } + break; + case NOTIFICATION_TYPES.TELEGRAM: + if (notification.config.botToken) { + values[getFieldKey(platform, FIELD_IDS.TOKEN)] = + notification.config.botToken; + } + if (notification.config.chatId) { + values[getFieldKey(platform, FIELD_IDS.CHAT_ID)] = + notification.config.chatId; + } + break; + case NOTIFICATION_TYPES.WEBHOOK: + if (notification.config.webhookUrl) { + values[getFieldKey(platform, FIELD_IDS.URL)] = + notification.config.webhookUrl; + } + break; + } + } + }); + + return values; + }; + + const extractedValues = extractNotificationValues(); + setIntegrations((prev) => ({ + ...prev, + ...extractedValues, + })); + } + }, [open, monitor, getFieldKey]); + + const handleChangeTab = (event, newValue) => { + setTabValue(newValue); + }; + + const handleIntegrationChange = (type, checked) => { + setIntegrations((prev) => ({ + ...prev, + [type]: checked, + })); + }; + + const handleInputChange = (type, value) => { + setIntegrations((prev) => ({ + ...prev, + [type]: value, + })); + }; + + const handleTestNotification = async (type) => { + // Get the notification type details + const notificationType = activeNotificationTypes.find((t) => t.id === type); + + if (typeof notificationType === "undefined") { + return; + } + + // Prepare config object based on notification type + const config = {}; + + // Add each field value to the config object + notificationType.fields.forEach((field) => { + const fieldKey = getFieldKey(type, field.id); + config[field.id] = integrations[fieldKey]; + }); + + await sendTestNotification(type, config); + }; + + // In NotificationIntegrationModal.jsx, update the handleSave function: + + const handleSave = () => { + // Get existing notifications + const notifications = [...(monitor?.notifications || [])]; + + // Get all notification types IDs + const existingTypes = activeNotificationTypes.map((type) => type.id); + + // Filter out notifications that are configurable in this modal + const filteredNotifications = notifications.filter((notification) => { + if (notification.platform) { + return !existingTypes.includes(notification.platform); + } + + return !existingTypes.includes(notification.type); + }); + + // Add each enabled notification with its configured fields + activeNotificationTypes.forEach((type) => { + if (integrations[type.id]) { + let notificationObject = { + type: "webhook", + platform: type.id, // Set platform to identify the specific service + config: {}, + }; + + // Configure based on notification type + switch (type.id) { + case "slack": + case "discord": + notificationObject.config.webhookUrl = + integrations[getFieldKey(type.id, "webhook")]; + break; + case "telegram": + notificationObject.config.botToken = + integrations[getFieldKey(type.id, "token")]; + notificationObject.config.chatId = + integrations[getFieldKey(type.id, "chatId")]; + break; + case "webhook": + notificationObject.config.webhookUrl = + integrations[getFieldKey(type.id, "url")]; + break; + } + + filteredNotifications.push(notificationObject); + } + }); + + // Update monitor with new notifications + setMonitor((prev) => ({ + ...prev, + notifications: filteredNotifications, + })); + + onClose(); + }; + + return ( + + + + {/* Left sidebar with tabs */} + + + {t("notifications.addOrEditNotifications")} + + + + {activeNotificationTypes.map((type) => ( + + ))} + + + + {/* Right side content */} + + {activeNotificationTypes.map((type, index) => ( + + + + ))} + + + + + + + + ); +}; + +NotificationIntegrationModal.propTypes = { + open: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired, + monitor: PropTypes.object.isRequired, + setMonitor: PropTypes.func.isRequired, + notificationTypes: PropTypes.array, +}; + +export default NotificationIntegrationModal; diff --git a/client/src/Components/NotificationIntegrationModal/Components/TabComponent.jsx b/client/src/Components/NotificationIntegrationModal/Components/TabComponent.jsx new file mode 100644 index 000000000..e46a8cdd5 --- /dev/null +++ b/client/src/Components/NotificationIntegrationModal/Components/TabComponent.jsx @@ -0,0 +1,109 @@ +import React from "react"; +import { + Typography, + Box, + Button, + CircularProgress +} from "@mui/material"; +import { useTranslation } from "react-i18next"; +import { useTheme } from "@emotion/react"; +import TextInput from "../../../Components/Inputs/TextInput"; +import Checkbox from "../../../Components/Inputs/Checkbox"; + +const TabComponent = ({ + type, + integrations, + handleIntegrationChange, + handleInputChange, + handleTestNotification, + isLoading +}) => { + const theme = useTheme(); + const { t } = useTranslation(); + + // Helper to get the field state key (e.g., slackWebhook, telegramToken) + const getFieldKey = (typeId, fieldId) => { + return `${typeId}${fieldId.charAt(0).toUpperCase() + fieldId.slice(1)}`; + }; + + // Check if all fields have values to enable test button + const areAllFieldsFilled = () => { + return type.fields.every(field => { + const fieldKey = getFieldKey(type.id, field.id); + return integrations[fieldKey]; + }); + }; + + return ( + <> + + {type.label} + + + + {type.description} + + + + handleIntegrationChange(type.id, e.target.checked)} + disabled={isLoading} + /> + + + {type.fields.map(field => { + const fieldKey = getFieldKey(type.id, field.id); + + return ( + + + {field.label} + + + handleInputChange(fieldKey, e.target.value)} + disabled={!integrations[type.id] || isLoading} + /> + + ); + })} + + + + + + ); +}; + +export default TabComponent; \ No newline at end of file diff --git a/client/src/Components/NotificationIntegrationModal/Components/TabPanel.jsx b/client/src/Components/NotificationIntegrationModal/Components/TabPanel.jsx new file mode 100644 index 000000000..a9252e710 --- /dev/null +++ b/client/src/Components/NotificationIntegrationModal/Components/TabPanel.jsx @@ -0,0 +1,46 @@ +import React from "react"; +import PropTypes from "prop-types"; +import { Box } from "@mui/material"; +import { useTheme } from "@emotion/react"; + +/** + * TabPanel component that displays content for the selected tab. + * + * @component + * @param {Object} props - The component props. + * @param {React.ReactNode} props.children - The content to be displayed when this tab panel is selected. + * @param {number} props.value - The currently selected tab value. + * @param {number} props.index - The index of this specific tab panel. + * @param {Object} props.other - Any additional props to be spread to the root element. + * @returns {React.ReactElement|null} The rendered tab panel or null if not selected. + */ +function TabPanel({ children, value, index, ...other }) { + const theme = useTheme(); + + return ( + + ); +} + +TabPanel.propTypes = { + + children: PropTypes.node, + + index: PropTypes.number.isRequired, + + value: PropTypes.number.isRequired +}; + +export default TabPanel; \ No newline at end of file diff --git a/client/src/Components/NotificationIntegrationModal/Hooks/useNotification.js b/client/src/Components/NotificationIntegrationModal/Hooks/useNotification.js new file mode 100644 index 000000000..3547873e8 --- /dev/null +++ b/client/src/Components/NotificationIntegrationModal/Hooks/useNotification.js @@ -0,0 +1,128 @@ +import { useState } from 'react'; +import { useTranslation } from "react-i18next"; +import { networkService } from '../../../Utils/NetworkService'; +import { createToast } from '../../../Utils/toastUtils'; + +// Define constants for notification types to avoid magic values +const NOTIFICATION_TYPES = { + SLACK: 'slack', + DISCORD: 'discord', + TELEGRAM: 'telegram', + WEBHOOK: 'webhook' +}; + +// Define constants for field IDs +const FIELD_IDS = { + WEBHOOK: 'webhook', + TOKEN: 'token', + CHAT_ID: 'chatId', + URL: 'url' +}; + +/** + * Custom hook for notification-related operations + */ +const useNotifications = () => { + const [loading, setLoading] = useState(false); + const [error, setError] = useState(undefined); + const { t } = useTranslation(); + + /** + * Send a test notification + * @param {string} type - The notification type (slack, discord, telegram, webhook) + * @param {object} config - Configuration object with necessary params + */ + const sendTestNotification = async (type, config) => { + setLoading(true); + setError(undefined); + + // Validation based on notification type + let payload = { platform: type }; + let isValid = true; + let errorMessage = ''; + + switch(type) { + case NOTIFICATION_TYPES.SLACK: + payload.webhookUrl = config.webhook; + if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') { + isValid = false; + errorMessage = t('notifications.slack.webhookRequired'); + } + break; + + case NOTIFICATION_TYPES.DISCORD: + payload.webhookUrl = config.webhook; + if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') { + isValid = false; + errorMessage = t('notifications.discord.webhookRequired'); + } + break; + + case NOTIFICATION_TYPES.TELEGRAM: + payload.botToken = config.token; + payload.chatId = config.chatId; + if (typeof payload.botToken === 'undefined' || payload.botToken === '' || + typeof payload.chatId === 'undefined' || payload.chatId === '') { + isValid = false; + errorMessage = t('notifications.telegram.fieldsRequired'); + } + break; + + case NOTIFICATION_TYPES.WEBHOOK: + payload.webhookUrl = config.url; + payload.platform = NOTIFICATION_TYPES.SLACK; + if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') { + isValid = false; + errorMessage = t('notifications.webhook.urlRequired'); + } + break; + + default: + isValid = false; + errorMessage = t('notifications.unsupportedType'); + } + + // If validation fails, show error and return + if (isValid === false) { + createToast({ + body: errorMessage, + variant: "error" + }); + setLoading(false); + return; + } + + try { + const response = await networkService.testNotification({ + platform: type, + payload: payload + }); + + if (response.data.success === true) { + createToast({ + body: t('notifications.testSuccess'), + variant: "info" + }); + } else { + throw new Error(response.data.msg || t('notifications.testFailed')); + } + } catch (error) { + const errorMsg = error.response?.data?.msg || error.message || t('notifications.networkError'); + createToast({ + body: `${t('notifications.testFailed')}: ${errorMsg}`, + variant: "error" + }); + setError(errorMsg); + } finally { + setLoading(false); + } + }; + + return [ + loading, + error, + sendTestNotification + ]; +}; + +export default useNotifications; \ No newline at end of file diff --git a/Client/src/Components/ProgressBars/index.css b/client/src/Components/ProgressBars/index.css similarity index 100% rename from Client/src/Components/ProgressBars/index.css rename to client/src/Components/ProgressBars/index.css diff --git a/Client/src/Components/ProgressBars/index.jsx b/client/src/Components/ProgressBars/index.jsx similarity index 97% rename from Client/src/Components/ProgressBars/index.jsx rename to client/src/Components/ProgressBars/index.jsx index abb896844..4f5515d3a 100644 --- a/Client/src/Components/ProgressBars/index.jsx +++ b/client/src/Components/ProgressBars/index.jsx @@ -93,6 +93,7 @@ const ProgressUpload = ({ icon, label, size, progress = 0, onClick, error }) => {error ? error : label} @@ -168,7 +169,7 @@ const ProgressUpload = ({ icon, label, size, progress = 0, onClick, error }) => ProgressUpload.propTypes = { icon: PropTypes.element, // JSX element for the icon (optional) - label: PropTypes.string.isRequired, // Label text for the progress item + label: PropTypes.string, // Label text for the progress item size: PropTypes.string.isRequired, // Size information for the progress item progress: PropTypes.number.isRequired, // Current progress value (0-100) onClick: PropTypes.func.isRequired, // Function to handle click events on the remove button diff --git a/Client/src/Components/ProgressStepper/index.css b/client/src/Components/ProgressStepper/index.css similarity index 100% rename from Client/src/Components/ProgressStepper/index.css rename to client/src/Components/ProgressStepper/index.css diff --git a/Client/src/Components/ProgressStepper/index.jsx b/client/src/Components/ProgressStepper/index.jsx similarity index 100% rename from Client/src/Components/ProgressStepper/index.jsx rename to client/src/Components/ProgressStepper/index.jsx diff --git a/client/src/Components/ProtectedDistributedUptimeRoute/index.jsx b/client/src/Components/ProtectedDistributedUptimeRoute/index.jsx new file mode 100644 index 000000000..4a59859fe --- /dev/null +++ b/client/src/Components/ProtectedDistributedUptimeRoute/index.jsx @@ -0,0 +1,30 @@ +import { Navigate } from "react-router-dom"; +import { useSelector } from "react-redux"; +import PropTypes from "prop-types"; + +/** + * @param {Object} props - The props passed to the ProtectedDistributedUptimeRoute component. + * @param {React.ReactNode} props.children - The children to render if the user is authenticated. + * @returns {React.ReactElement} The children wrapped in a protected route or a redirect to the login page. + */ + +const ProtectedDistributedUptimeRoute = ({ children }) => { + const distributedUptimeEnabled = useSelector( + (state) => state.ui.distributedUptimeEnabled + ); + + return distributedUptimeEnabled === true ? ( + children + ) : ( + + ); +}; + +ProtectedDistributedUptimeRoute.propTypes = { + children: PropTypes.node.isRequired, +}; + +export default ProtectedDistributedUptimeRoute; diff --git a/Client/src/Components/ProtectedRoute/index.jsx b/client/src/Components/ProtectedRoute/index.jsx similarity index 100% rename from Client/src/Components/ProtectedRoute/index.jsx rename to client/src/Components/ProtectedRoute/index.jsx diff --git a/client/src/Components/ShareComponent/index.jsx b/client/src/Components/ShareComponent/index.jsx new file mode 100644 index 000000000..073ed2243 --- /dev/null +++ b/client/src/Components/ShareComponent/index.jsx @@ -0,0 +1,67 @@ +import html2canvas from "html2canvas"; +import ShareIcon from "@mui/icons-material/Share"; +import { Button } from "@mui/material"; +import { useTheme } from "@emotion/react"; + +const ShareComponent = ({ elementToCapture, fileName = "screenshot" }) => { + const theme = useTheme(); + const captureAndShare = async () => { + try { + // Temporarily apply styles directly to the element + const originalBackground = elementToCapture.current.style.background; + const originalPadding = elementToCapture.current.style.padding; + + elementToCapture.current.style.background = `radial-gradient(circle, ${theme.palette.gradient.color1}, ${theme.palette.gradient.color2}, ${theme.palette.gradient.color3}, ${theme.palette.gradient.color4}, ${theme.palette.gradient.color5})`; + elementToCapture.current.style.padding = `${theme.spacing(20)}`; + + // Capture the element directly + const canvas = await html2canvas(elementToCapture.current, { + useCORS: true, + scale: 2, + allowTaint: true, + backgroundColor: null, + }); + + // Restore original styles + elementToCapture.current.style.background = originalBackground; + elementToCapture.current.style.padding = originalPadding; + + const imageBlob = await new Promise((resolve) => + canvas.toBlob(resolve, "image/png") + ); + + const file = new File([imageBlob], `${fileName}.png`, { + type: "image/png", + }); + + if (navigator.share) { + await navigator.share({ + files: [file], + title: "Screenshot", + text: "Check out this screenshot!", + }); + } else { + const url = URL.createObjectURL(imageBlob); + const a = document.createElement("a"); + a.href = url; + a.download = `${fileName}.png`; + a.click(); + URL.revokeObjectURL(url); + } + } catch (error) { + console.error(error); + } + }; + return ( + + ); +}; + +export default ShareComponent; diff --git a/Client/src/Components/Sidebar/index.css b/client/src/Components/Sidebar/index.css similarity index 91% rename from Client/src/Components/Sidebar/index.css rename to client/src/Components/Sidebar/index.css index 58805c7f8..ef921acca 100644 --- a/Client/src/Components/Sidebar/index.css +++ b/client/src/Components/Sidebar/index.css @@ -79,6 +79,17 @@ aside .MuiListSubheader-root { transition: padding 200ms ease; } +.sidebar-delay-fade { + opacity: 0; + visibility: hidden; + transition: opacity 0.3s ease; +} + +aside.expanded.sidebar-ready .sidebar-delay-fade { + opacity: 1; + visibility: visible; +} + @keyframes fadeIn { 0% { opacity: 0; diff --git a/Client/src/Components/Sidebar/index.jsx b/client/src/Components/Sidebar/index.jsx similarity index 52% rename from Client/src/Components/Sidebar/index.jsx rename to client/src/Components/Sidebar/index.jsx index 3821306ad..b0f99cd2f 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/client/src/Components/Sidebar/index.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef } from "react"; import { Box, Collapse, @@ -15,14 +15,9 @@ import { Tooltip, Typography, } from "@mui/material"; -import { useLocation, useNavigate } from "react-router"; -import { useTheme } from "@emotion/react"; -import { useDispatch, useSelector } from "react-redux"; -import { clearAuthState } from "../../Features/Auth/authSlice"; -import { toggleSidebar } from "../../Features/UI/uiSlice"; -import { clearUptimeMonitorState } from "../../Features/UptimeMonitors/uptimeMonitorsSlice"; import ThemeSwitch from "../ThemeSwitch"; import Avatar from "../Avatar"; +import StarPrompt from "../StarPrompt"; import LockSvg from "../../assets/icons/lock.svg?react"; import UserSvg from "../../assets/icons/user.svg?react"; import TeamSvg from "../../assets/icons/user-two.svg?react"; @@ -43,46 +38,56 @@ import DotsVertical from "../../assets/icons/dots-vertical.svg?react"; import ChangeLog from "../../assets/icons/changeLog.svg?react"; import Docs from "../../assets/icons/docs.svg?react"; import Folder from "../../assets/icons/folder.svg?react"; -import ChatBubbleOutlineRoundedIcon from "@mui/icons-material/ChatBubbleOutlineRounded"; - +import StatusPages from "../../assets/icons/status-pages.svg?react"; +import Discussions from "../../assets/icons/discussions.svg?react"; +import DistributedUptimeIcon from "../../assets/icons/distributed-uptime.svg?react"; import "./index.css"; -const menu = [ - { name: "Uptime", path: "uptime", icon: }, - { name: "Pagespeed", path: "pagespeed", icon: }, - { name: "Infrastructure", path: "infrastructure", icon: }, - { name: "Incidents", path: "incidents", icon: }, - // { name: "Status pages", path: "status", icon: }, - { name: "Maintenance", path: "maintenance", icon: }, - // { name: "Integrations", path: "integrations", icon: }, +// Utils +import { useLocation, useNavigate } from "react-router"; +import { useTheme } from "@emotion/react"; +import { useDispatch, useSelector } from "react-redux"; +import { useTranslation } from "react-i18next"; +import { clearAuthState } from "../../Features/Auth/authSlice"; +import { toggleSidebar } from "../../Features/UI/uiSlice"; +import { clearUptimeMonitorState } from "../../Features/UptimeMonitors/uptimeMonitorsSlice"; + +const getMenu = (t) => [ + { name: t("menu.uptime"), path: "uptime", icon: }, + { name: t("menu.pagespeed"), path: "pagespeed", icon: }, + { name: t("menu.infrastructure"), path: "infrastructure", icon: }, { - name: "Account", - icon: , - nested: [ - { name: "Profile", path: "account/profile", icon: }, - { name: "Password", path: "account/password", icon: }, - { name: "Team", path: "account/team", icon: }, - ], + name: t("menu.distributedUptime"), + path: "distributed-uptime", + icon: , }, + { name: t("menu.incidents"), path: "incidents", icon: }, + + { name: t("menu.statusPages"), path: "status", icon: }, + { name: t("menu.maintenance"), path: "maintenance", icon: }, + // { name: t("menu.integrations"), path: "integrations", icon: }, { - name: "Settings", + name: t("menu.settings"), icon: , path: "settings", }, +]; + +const getOtherMenuItems = (t) => [ + { name: t("menu.support"), path: "support", icon: }, { - name: "Other", - icon: , - nested: [ - { name: "Support", path: "support", icon: }, - { - name: "Discussions", - path: "discussions", - icon: , - }, - { name: "Docs", path: "docs", icon: }, - { name: "Changelog", path: "changelog", icon: }, - ], + name: t("menu.discussions"), + path: "discussions", + icon: , }, + { name: t("menu.docs"), path: "docs", icon: }, + { name: t("menu.changelog"), path: "changelog", icon: }, +]; + +const getAccountMenuItems = (t) => [ + { name: t("menu.profile"), path: "account/profile", icon: }, + { name: t("menu.password"), path: "account/password", icon: }, + { name: t("menu.team"), path: "account/team", icon: }, ]; /* TODO this could be a key in nested Path would be the link */ @@ -97,6 +102,7 @@ const PATH_MAP = { monitors: "Dashboard", pagespeed: "Dashboard", infrastructure: "Dashboard", + ["distributed-uptime"]: "Dashboard", account: "Account", settings: "Settings", }; @@ -113,19 +119,71 @@ function Sidebar() { const navigate = useNavigate(); const location = useLocation(); const dispatch = useDispatch(); + const { t } = useTranslation(); const authState = useSelector((state) => state.auth); + + const menu = getMenu(t); + const otherMenuItems = getOtherMenuItems(t); + const accountMenuItems = getAccountMenuItems(t); const collapsed = useSelector((state) => state.ui.sidebar.collapsed); const [open, setOpen] = useState({ Dashboard: false, Account: false, Other: false }); const [anchorEl, setAnchorEl] = useState(null); const [popup, setPopup] = useState(); const { user } = useSelector((state) => state.auth); + const distributedUptimeEnabled = useSelector( + (state) => state.ui.distributedUptimeEnabled + ); + const sidebarRef = useRef(null); + const [sidebarReady, setSidebarReady] = useState(false); + const TRANSITION_DURATION = 200; - const accountMenuItem = menu.find((item) => item.name === "Account"); - if (user.role?.includes("demo") && accountMenuItem) { - accountMenuItem.nested = accountMenuItem.nested.filter((item) => { - return item.name !== "Password"; - }); - } + useEffect(() => { + if (!collapsed) { + setSidebarReady(false); + const timeout = setTimeout(() => { + setSidebarReady(true); + }, TRANSITION_DURATION); + return () => clearTimeout(timeout); + } else { + setSidebarReady(false); + } + }, [collapsed]); + + const renderAccountMenuItems = () => { + let filteredAccountMenuItems = [...accountMenuItems]; + + // If the user is in demo mode, remove the "Password" option + if (user.role?.includes("demo")) { + filteredAccountMenuItems = filteredAccountMenuItems.filter( + (item) => item.name !== "Password" + ); + } + + // If the user is NOT a superadmin, remove the "Team" option + if (user.role && !user.role.includes("superadmin")) { + filteredAccountMenuItems = filteredAccountMenuItems.filter( + (item) => item.name !== "Team" + ); + } + + return filteredAccountMenuItems.map((item) => ( + { + closePopup() + navigate(item.path) + }} + sx={{ + gap: theme.spacing(2), + borderRadius: theme.shape.borderRadius, + pl: theme.spacing(4), + }} + > + {item.icon} + {item.name} + + )); + }; const openPopup = (event, id) => { setAnchorEl(event.currentTarget); @@ -157,12 +215,14 @@ function Sidebar() { }, [location]); const iconColor = theme.palette.primary.contrastTextTertiary; + const sidebarClassName = `${collapsed ? "collapsed" : "expanded"} ${sidebarReady ? "sidebar-ready" : ""}`; /* TODO refactor this, there are a some ternaries and comments in the return */ return ( {collapsed ? : } - {/* TODO Alignment done using padding. Use single source of truth to that*/} - - Menu - - } + - {menu.map((item) => - item.path ? ( - /* If item has a path */ + + {menu.map((item) => { + if ( + item.path === "distributed-uptime" && + distributedUptimeEnabled === false + ) { + return null; + } + return item.path ? ( + /* If item has a path */ + + navigate(`/${item.path}`)} + sx={{ + height: "37px", + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + px: theme.spacing(4), + pl: theme.spacing(5), + }} + > + {item.icon} + {item.name} + + + ) : collapsed ? ( + /* TODO Do we ever get here? If item does not have a path and collapsed state is true */ + + + openPopup(event, item.name)} + sx={{ + position: "relative", + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + px: theme.spacing(4), + }} + > + {item.icon} + {item.name} + + + + {item.nested.map((child) => { + if ( + child.name === "Team" && + authState.user?.role && + !authState.user.role.includes("superadmin") + ) { + return null; + } + + return ( + { + const url = URL_MAP[child.path]; + if (url) { + window.open(url, "_blank", "noreferrer"); + } else { + navigate(`/${child.path}`); + } + closePopup(); + }} + sx={{ + gap: theme.spacing(4), + opacity: 0.9, + /* TODO this has no effect? */ + "& svg": { + "& path": { + stroke: theme.palette.primary.contrastTextTertiary, + strokeWidth: 1.1, + }, + }, + }} + > + {child.icon} + {child.name} + + ); + })} + + + ) : ( + /* TODO Do we ever get here? If item does not have a path and collapsed state is false */ + + + setOpen((prev) => ({ + ...Object.fromEntries(Object.keys(prev).map((key) => [key, false])), + [item.name]: !prev[item.name], + })) + } + sx={{ + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + px: theme.spacing(4), + }} + > + {item.icon} + {item.name} + {open[`${item.name}`] ? : } + + + + {item.nested.map((child) => { + if ( + child.name === "Team" && + authState.user?.role && + !authState.user.role.includes("superadmin") + ) { + return null; + } + + return ( + { + const url = URL_MAP[child.path]; + if (url) { + window.open(url, "_blank", "noreferrer"); + } else { + navigate(`/${child.path}`); + } + }} + sx={{ + gap: theme.spacing(4), + borderRadius: theme.shape.borderRadius, + pl: theme.spacing(4), + "&::before": { + content: `""`, + position: "absolute", + top: 0, + left: "-7px", + height: "100%", + borderLeft: 1, + borderLeftColor: theme.palette.primary.lowContrast, + }, + "&:last-child::before": { + height: "50%", + }, + "&::after": { + content: `""`, + position: "absolute", + top: "45%", + left: "-8px", + height: "3px", + width: "3px", + borderRadius: "50%", + backgroundColor: theme.palette.primary.lowContrast, + }, + "&.selected-path::after": { + /* TODO what is this selector doing? */ + backgroundColor: theme.palette.primary.contrastTextTertiary, + transform: "scale(1.2)", + }, + }} + > + {child.icon} + {child.name} + + ); + })} + + + + ); + })} + + + + {!collapsed && } + + + {otherMenuItems.map((item) => { + return item.path ? ( navigate(`/${item.path}`)} - sx={{ - /* - TODO we do not need this height - minHeight: "37px", */ - p: theme.spacing(5), - gap: theme.spacing(4), - borderRadius: theme.shape.borderRadius, - }} - > - {item.icon} - {item.name} - - - ) : collapsed ? ( - /* TODO Do we ever get here? If item does not have a path and collapsed state is true */ - - - openPopup(event, item.name)} - sx={{ - position: "relative", - gap: theme.spacing(4), - borderRadius: theme.shape.borderRadius, - px: theme.spacing(4), - }} - > - {item.icon} - {item.name} - - - - {item.nested.map((child) => { - if ( - child.name === "Team" && - authState.user?.role && - !authState.user.role.includes("superadmin") - ) { - return null; - } - - return ( - { - const url = URL_MAP[child.path]; - if (url) { - window.open(url, "_blank", "noreferrer"); - } else { - navigate(`/${child.path}`); - } - closePopup(); - }} - sx={{ - gap: theme.spacing(4), - opacity: 0.9, - /* TODO this has no effect? */ - "& svg": { - "& path": { - stroke: theme.palette.primary.contrastTextTertiary, - strokeWidth: 1.1, - }, - }, - }} - > - {child.icon} - {child.name} - - ); - })} - - - ) : ( - /* TODO Do we ever get here? If item does not have a path and collapsed state is false */ - - - setOpen((prev) => ({ - ...Object.fromEntries(Object.keys(prev).map((key) => [key, false])), - [item.name]: !prev[item.name], - })) + className={ + location.pathname.startsWith(`/${item.path}`) ? "selected-path" : "" } + onClick={() => { + const url = URL_MAP[item.path]; + if (url) { + window.open(url, "_blank", "noreferrer"); + } else { + navigate(`/${item.path}`); + } + }} sx={{ + height: "37px", gap: theme.spacing(4), borderRadius: theme.shape.borderRadius, px: theme.spacing(4), + pl: theme.spacing(5), }} > - {item.icon} - {item.name} - {open[`${item.name}`] ? : } + {item.icon} + {item.name} {" "} - - - {item.nested.map((child) => { - if ( - child.name === "Team" && - authState.user?.role && - !authState.user.role.includes("superadmin") - ) { - return null; - } - - return ( - { - const url = URL_MAP[child.path]; - if (url) { - window.open(url, "_blank", "noreferrer"); - } else { - navigate(`/${child.path}`); - } - }} - sx={{ - gap: theme.spacing(4), - borderRadius: theme.shape.borderRadius, - pl: theme.spacing(4), - "&::before": { - content: `""`, - position: "absolute", - top: 0, - left: "-7px", - height: "100%", - borderLeft: 1, - borderLeftColor: theme.palette.primary.lowContrast, - }, - "&:last-child::before": { - height: "50%", - }, - "&::after": { - content: `""`, - position: "absolute", - top: "45%", - left: "-8px", - height: "3px", - width: "3px", - borderRadius: "50%", - backgroundColor: theme.palette.primary.lowContrast, - }, - "&.selected-path::after": { - /* TODO what is this selector doing? */ - backgroundColor: theme.palette.primary.contrastTextTertiary, - transform: "scale(1.2)", - }, - }} - > - {child.icon} - {child.name} - - ); - })} - - - - ) - )} + + ) : null; + })} - - + - + {authState.user?.firstName} {authState.user?.lastName} - {authState.user?.role} + {authState.user?.role?.includes("superadmin") ? t("roles.superAdmin") : + authState.user?.role?.includes("admin") ? t("roles.admin") : + authState.user?.role?.includes("user") ? t("roles.teamMember") : + authState.user?.role?.includes("demo") ? t("roles.demoUser") : + authState.user?.role} {collapsed && ( - - + + {authState.user?.firstName} {authState.user?.lastName} - + {authState.user?.role} @@ -687,7 +847,8 @@ function Sidebar() { )} {/* TODO Do we need two dividers? */} {collapsed && } - + {/* */} + {renderAccountMenuItems()} - Log out + {t("menu.logOut", "Log out")} diff --git a/client/src/Components/Skeletons/FullPage/index.jsx b/client/src/Components/Skeletons/FullPage/index.jsx new file mode 100644 index 000000000..233fc3c06 --- /dev/null +++ b/client/src/Components/Skeletons/FullPage/index.jsx @@ -0,0 +1,14 @@ +import { Stack, Skeleton } from "@mui/material"; + +export const SkeletonLayout = () => { + return ( + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Components/StandardContainer/index.jsx b/client/src/Components/StandardContainer/index.jsx new file mode 100644 index 000000000..c736b3ecc --- /dev/null +++ b/client/src/Components/StandardContainer/index.jsx @@ -0,0 +1,51 @@ +// Components +import { Stack } from "@mui/material"; + +// Utils +import { useTheme } from "@emotion/react"; + +const Container = ({ children, direction, backgroundColor, sx }) => { + const theme = useTheme(); + let bgColor = + typeof backgroundColor !== "undefined" + ? backgroundColor + : theme.palette.background.main; + return ( + + {children} + + ); +}; + +export const ColContainer = ({ children, backgroundColor, sx }) => { + return ( + + {children} + + ); +}; + +export const RowContainer = ({ children, backgroundColor, sx }) => { + return ( + + {children} + + ); +}; diff --git a/client/src/Components/StarPrompt/index.jsx b/client/src/Components/StarPrompt/index.jsx new file mode 100644 index 000000000..8cbdd9da9 --- /dev/null +++ b/client/src/Components/StarPrompt/index.jsx @@ -0,0 +1,101 @@ +import React from 'react'; +import { Typography, IconButton, Stack, Box } from '@mui/material'; +import CloseIcon from '@mui/icons-material/Close'; +import { useTheme } from '@emotion/react'; +import { useSelector, useDispatch } from 'react-redux'; +import { useTranslation } from 'react-i18next'; +import { setStarPromptOpen } from '../../Features/UI/uiSlice'; + +const StarPrompt = ({ + repoUrl = 'https://github.com/bluewave-labs/checkmate' +}) => { + const theme = useTheme(); + const dispatch = useDispatch(); + const { t } = useTranslation(); + const isOpen = useSelector((state) => state.ui?.starPromptOpen ?? true); + const mode = useSelector((state) => state.ui.mode); + + const handleClose = () => { + dispatch(setStarPromptOpen(false)); + }; + + const handleStarClick = () => { + window.open(repoUrl, '_blank'); + }; + + if (!isOpen) return null; + + return ( + + + + {t('starPromptTitle')} + + + + + + + + {t('starPromptDescription')} + + + + + ); +}; + +export default StarPrompt; diff --git a/Client/src/Components/StatBox/index.jsx b/client/src/Components/StatBox/index.jsx similarity index 69% rename from Client/src/Components/StatBox/index.jsx rename to client/src/Components/StatBox/index.jsx index 953d378ec..ed0b6694a 100644 --- a/Client/src/Components/StatBox/index.jsx +++ b/client/src/Components/StatBox/index.jsx @@ -1,7 +1,8 @@ -import { Box, Typography } from "@mui/material"; +import { Stack, Typography } from "@mui/material"; +import Image from "../Image"; import { useTheme } from "@mui/material/styles"; import PropTypes from "prop-types"; -import useUtils from "../../Pages/Uptime/utils"; +import useUtils from "../../Pages/Uptime/Monitors/Hooks/useUtils"; /** * StatBox Component @@ -29,7 +30,16 @@ import useUtils from "../../Pages/Uptime/utils"; * @returns {React.ReactElement} A styled box containing the statistic */ -const StatBox = ({ heading, subHeading, gradient = false, status = "", sx }) => { +const StatBox = ({ + img, + icon: Icon, + alt, + heading, + subHeading, + gradient = false, + status = "", + sx, +}) => { const theme = useTheme(); const { statusToTheme } = useUtils(); const themeColor = statusToTheme[status]; @@ -40,7 +50,7 @@ const StatBox = ({ heading, subHeading, gradient = false, status = "", sx }) => borderColor: theme.palette[themeColor].lowContrast, } : { - background: `linear-gradient(340deg, ${theme.palette.tertiary.main} 20%, ${theme.palette.primary.main} 45%)`, + background: `linear-gradient(340deg, ${theme.palette.tertiary.main} 10%, ${theme.palette.primary.main} 45%)`, borderColor: theme.palette.primary.lowContrast, }; @@ -52,7 +62,7 @@ const StatBox = ({ heading, subHeading, gradient = false, status = "", sx }) => color: theme.palette.primary.contrastTextSecondary, }; - const spanFixedStyles = { marginLeft: theme.spacing(2), fontSize: 15 }; + const spanFixedStyles = { marginLeft: theme.spacing(2), fontSize: 15, fontWeight: 600 }; const detailTextStyles = gradient ? { color: theme.palette[themeColor].contrastText, @@ -69,13 +79,23 @@ const StatBox = ({ heading, subHeading, gradient = false, status = "", sx }) => }, }; + const responsiveWidths = { + default: `calc(25% - (3 * ${theme.spacing(8)} / 4))`, + md: `calc(50% - (1 * ${theme.spacing(8)} / 2))`, + }; + return ( - ...sx, }} > - {heading} - {subHeading} - + {img && ( + {alt} + )} + {Icon && ( + + )} + + {heading} + {subHeading} + + ); }; @@ -107,6 +141,9 @@ StatBox.propTypes = { gradient: PropTypes.bool, status: PropTypes.string, sx: PropTypes.object, + icon: PropTypes.elementType, + img: PropTypes.node, + alt: PropTypes.string, }; export default StatBox; diff --git a/client/src/Components/StatusBoxes/index.jsx b/client/src/Components/StatusBoxes/index.jsx new file mode 100644 index 000000000..40ea2d182 --- /dev/null +++ b/client/src/Components/StatusBoxes/index.jsx @@ -0,0 +1,37 @@ +// Components +import { Stack } from "@mui/material"; +import SkeletonLayout from "./skeleton"; +// Utils +import { useTheme } from "@mui/material/styles"; +import PropTypes from "prop-types"; +const StatusBoxes = ({ shouldRender, flexWrap = "nowrap", children }) => { + const theme = useTheme(); + if (!shouldRender) { + return ( + + ); + } + + return ( + + {children} + + ); +}; + +StatusBoxes.propTypes = { + shouldRender: PropTypes.bool, + flexWrap: PropTypes.string, + children: PropTypes.node, +}; + +export default StatusBoxes; diff --git a/client/src/Components/StatusBoxes/skeleton.jsx b/client/src/Components/StatusBoxes/skeleton.jsx new file mode 100644 index 000000000..bc8b18251 --- /dev/null +++ b/client/src/Components/StatusBoxes/skeleton.jsx @@ -0,0 +1,33 @@ +import { Stack, Skeleton } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import PropTypes from "prop-types"; +const SkeletonLayout = ({ numBoxes, flexWrap }) => { + const theme = useTheme(); + return ( + + {Array.from({ length: numBoxes }).map((_, index) => { + const width = `${200 / numBoxes}%`; + return ( + + ); + })} + + ); +}; + +SkeletonLayout.propTypes = { + flexWrap: PropTypes.string, + numBoxes: PropTypes.number, +}; + +export default SkeletonLayout; diff --git a/client/src/Components/Subheader/index.jsx b/client/src/Components/Subheader/index.jsx new file mode 100644 index 000000000..a76696567 --- /dev/null +++ b/client/src/Components/Subheader/index.jsx @@ -0,0 +1,83 @@ +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import { Stack, Typography } from "@mui/material"; + +/** + + * + * @component + * @example + * + * @param {boolean} props.shouldRender - Whether to render the subheader + * @param {string} props.direction - Direction of the subheader + * @param {string} props.headerText - Header text + * @param {number} props.headerLevel - Font characteristic of the header + * @param {string} props.subHeaderText - Subheader text + * @param {number} props.subHeaderLevel - Font characteristic of the subheader + * @param {string} props.alignItems - Align items + * @param {node} props.children - Children + * @returns {JSX.Element} The rendered component + */ + +const SubHeader = ({ + shouldRender = true, + direction = "row", + headerText, + headerLevel = 1, + subHeaderText, + subHeaderLevel = 1, + alignItems = "center", + children, + ...props +}) => { + const theme = useTheme(); + + if (!shouldRender) { + return null; + } + + return ( + + + + + {headerText} + + + + {subHeaderText} + + + {children} + + ); +}; + +SubHeader.propTypes = { + shouldRender: PropTypes.bool, + direction: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), + headerText: PropTypes.string, + headerLevel: PropTypes.number, + subHeaderText: PropTypes.string, + subHeaderLevel: PropTypes.number, + alignItems: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), + children: PropTypes.node, +}; + +export default SubHeader; diff --git a/client/src/Components/Tab/index.jsx b/client/src/Components/Tab/index.jsx new file mode 100644 index 000000000..97bb25c7f --- /dev/null +++ b/client/src/Components/Tab/index.jsx @@ -0,0 +1,36 @@ +import { Box, useTheme } from "@mui/material"; +import { TabList } from "@mui/lab"; +import PropTypes from "prop-types"; + +/** + * CustomTabList component + * @param {string} value - The currently selected tab's value. + * @param {function} onChange - Callback when a different tab is selected. + * @param {React.ReactNode} children - Tab components to render inside the TabList. + * @param {object} props - Additional props passed to the TabList component. + */ + +const CustomTabList = ({ value, onChange, children, ...props }) => { + const theme = useTheme(); + + return ( + + + {children} + + + ); +}; + +CustomTabList.propTypes = { + value: PropTypes.string, + onChange: PropTypes.func, + children: PropTypes.node, +}; + +export default CustomTabList; diff --git a/Client/src/Components/TabPanels/Account/PasswordPanel.jsx b/client/src/Components/TabPanels/Account/PasswordPanel.jsx similarity index 82% rename from Client/src/Components/TabPanels/Account/PasswordPanel.jsx rename to client/src/Components/TabPanels/Account/PasswordPanel.jsx index 3c11affa6..94991ab09 100644 --- a/Client/src/Components/TabPanels/Account/PasswordPanel.jsx +++ b/client/src/Components/TabPanels/Account/PasswordPanel.jsx @@ -1,8 +1,7 @@ import TabPanel from "@mui/lab/TabPanel"; import { useState } from "react"; import { useTheme } from "@emotion/react"; -import { Box, Stack, Typography } from "@mui/material"; -import LoadingButton from "@mui/lab/LoadingButton"; +import { Box, Stack, Typography, Button } from "@mui/material"; import { PasswordEndAdornment } from "../../Inputs/TextInput/Adornments"; import TextInput from "../../Inputs/TextInput"; import { credentials } from "../../../Validation/validation"; @@ -11,6 +10,7 @@ import { update } from "../../../Features/Auth/authSlice"; import { useDispatch, useSelector } from "react-redux"; import { createToast } from "../../../Utils/toastUtils"; import { getTouchedFieldErrors } from "../../../Validation/error"; +import { useTranslation } from "react-i18next"; const defaultPasswordsState = { password: "", @@ -27,11 +27,12 @@ const defaultPasswordsState = { const PasswordPanel = () => { const theme = useTheme(); const dispatch = useDispatch(); + const { t } = useTranslation(); const SPACING_GAP = theme.spacing(12); //redux state - const { authToken, isLoading } = useSelector((state) => state.auth); + const { isLoading } = useSelector((state) => state.auth); const idToName = { "edit-current-password": "password", @@ -90,10 +91,10 @@ const PasswordPanel = () => { }); setErrors(newErrors); } else { - const action = await dispatch(update({ authToken, localData })); + const action = await dispatch(update({ localData })); if (action.payload.success) { createToast({ - body: "Your password was changed successfully.", + body: t("passwordPanel.passwordChangedSuccess", "Your password was changed successfully."), }); setLocalData({ password: "", @@ -103,7 +104,7 @@ const PasswordPanel = () => { } else { // TODO: Check for other errors? createToast({ - body: "Your password input was incorrect.", + body: t("passwordPanel.passwordInputIncorrect", "Your password input was incorrect."), }); setErrors({ password: "*" + action.payload.msg + "." }); } @@ -147,12 +148,12 @@ const PasswordPanel = () => { component="h1" width="20ch" > - Current password + {t("passwordPanel.currentPassword", "Current password")}
{ component="h1" width="20ch" > - New password + {t("passwordPanel.newPassword", "New password")}
{ component="h1" width="20ch" > - Confirm new password + {t("passwordPanel.confirmNewPassword", "Confirm new password")} { )} @@ -226,12 +227,12 @@ const PasswordPanel = () => { direction="row" justifyContent="flex-end" > - 0 || Object.values(localData).filter((value) => value === "").length > 0 @@ -241,8 +242,8 @@ const PasswordPanel = () => { mt: theme.spacing(20), }} > - Save - + {t("commonSave", "Save")} + diff --git a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx b/client/src/Components/TabPanels/Account/ProfilePanel.jsx similarity index 68% rename from Client/src/Components/TabPanels/Account/ProfilePanel.jsx rename to client/src/Components/TabPanels/Account/ProfilePanel.jsx index e20cb13a4..bdf52de3a 100644 --- a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx +++ b/client/src/Components/TabPanels/Account/ProfilePanel.jsx @@ -1,22 +1,19 @@ import { useTheme } from "@emotion/react"; -import { useRef, useState } from "react"; +import { useState } from "react"; import TabPanel from "@mui/lab/TabPanel"; import { Box, Button, Divider, Stack, Typography } from "@mui/material"; import Avatar from "../../Avatar"; import TextInput from "../../Inputs/TextInput"; -import ImageField from "../../Inputs/Image"; -import { credentials, imageValidation } from "../../../Validation/validation"; +import ImageUpload from "../../Inputs/ImageUpload"; +import { credentials } from "../../../Validation/validation"; import { useDispatch, useSelector } from "react-redux"; import { clearAuthState, deleteUser, update } from "../../../Features/Auth/authSlice"; -import ImageIcon from "@mui/icons-material/Image"; -import ProgressUpload from "../../ProgressBars"; -import { formatBytes } from "../../../Utils/fileUtils"; import { clearUptimeMonitorState } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; import { createToast } from "../../../Utils/toastUtils"; import { logger } from "../../../Utils/Logger"; -import LoadingButton from "@mui/lab/LoadingButton"; import { GenericDialog } from "../../Dialog/genericDialog"; import Dialog from "../../Dialog"; +import { useTranslation } from "react-i18next"; /** * ProfilePanel component displays a form for editing user profile information @@ -29,11 +26,11 @@ import Dialog from "../../Dialog"; const ProfilePanel = () => { const theme = useTheme(); const dispatch = useDispatch(); - + const { t } = useTranslation(); const SPACING_GAP = theme.spacing(12); //redux state - const { user, authToken, isLoading } = useSelector((state) => state.auth); + const { user, isLoading } = useSelector((state) => state.auth); const idToName = { "edit-first-name": "firstName", @@ -50,8 +47,6 @@ const ProfilePanel = () => { }); const [errors, setErrors] = useState({}); const [file, setFile] = useState(); - const intervalRef = useRef(null); - const [progress, setProgress] = useState({ value: 0, isLoading: false }); // Handles input field changes and performs validation const handleChange = (event) => { @@ -66,33 +61,6 @@ const ProfilePanel = () => { validateField({ [name]: value }, credentials, name); }; - // Handles image file - const handlePicture = (event) => { - const pic = event.target.files[0]; - let error = validateField({ type: pic.type, size: pic.size }, imageValidation); - if (error) return; - - setProgress((prev) => ({ ...prev, isLoading: true })); - setFile({ - src: URL.createObjectURL(pic), - name: pic.name, - size: formatBytes(pic.size), - delete: false, - }); - - //TODO - potentitally remove, will revisit in the future - intervalRef.current = setInterval(() => { - const buffer = 12; - setProgress((prev) => { - if (prev.value + buffer >= 100) { - clearInterval(intervalRef.current); - return { value: 100, isLoading: false }; - } - return { ...prev, value: prev.value + buffer }; - }); - }, 120); - }; - // Validates input against provided schema and updates error state const validateField = (toValidate, schema, name = "picture") => { const { error } = schema.validate(toValidate, { abortEarly: false }); @@ -117,55 +85,58 @@ const ProfilePanel = () => { // Resets picture-related states and clears interval const removePicture = () => { errors["picture"] && clearError("picture"); - setFile({ delete: true }); - clearInterval(intervalRef.current); // interrupt interval if image upload is canceled prior to completing the process - setProgress({ value: 0, isLoading: false }); - }; + setFile(undefined); + setLocalData((prev) => ({ + ...prev, + file: undefined, + deleteProfileImage: true, + })); + }; // Opens the picture update modal const openPictureModal = () => { setIsOpen("picture"); - setFile({ delete: localData.deleteProfileImage }); + setFile(undefined); }; // Closes the picture update modal and resets related states const closePictureModal = () => { - errors["picture"] && clearError("picture"); - setFile(); //reset file - clearInterval(intervalRef.current); // interrupt interval if image upload is canceled prior to completing the process - setProgress({ value: 0, isLoading: false }); - setIsOpen(""); - }; + if (errors["picture"]) clearError("picture"); + setFile(undefined); + setIsOpen(""); + }; // Updates profile image displayed on UI const handleUpdatePicture = () => { - setProgress({ value: 0, isLoading: false }); setLocalData((prev) => ({ ...prev, - file: file.src, + file: file?.src, deleteProfileImage: false, })); setIsOpen(""); - errors["unchanged"] && clearError("unchanged"); + if (errors["unchanged"]) clearError("unchanged"); }; - + // Handles form submission to update user profile const handleSaveProfile = async (event) => { event.preventDefault(); - if ( - localData.firstName === user.firstName && - localData.lastName === user.lastName && - localData.deleteProfileImage === undefined && - localData.file === undefined - ) { - createToast({ - body: "Unable to update profile — no changes detected.", - }); - setErrors({ unchanged: "unable to update profile" }); - return; + const nameChanged = + localData.firstName !== user.firstName || + localData.lastName !== user.lastName; + + const avatarChanged = + localData.deleteProfileImage === true || + (localData.file && localData.file !== `data:image/png;base64,${user.avatarImage}`); + + if (!nameChanged && !avatarChanged) { + createToast({ + body: "Unable to update profile — no changes detected.", + }); + setErrors({ unchanged: "unable to update profile" }); + return; } - const action = await dispatch(update({ authToken, localData })); + const action = await dispatch(update({ localData })); if (action.payload.success) { createToast({ body: "Your profile data was changed successfully.", @@ -183,12 +154,13 @@ const ProfilePanel = () => { ...prev, deleteProfileImage: true, })); + setFile(undefined); errors["unchanged"] && clearError("unchanged"); }; // Initiates the account deletion process const handleDeleteAccount = async () => { - const action = await dispatch(deleteUser(authToken)); + const action = await dispatch(deleteUser()); if (action.payload.success) { dispatch(clearAuthState()); dispatch(clearUptimeMonitorState()); @@ -233,7 +205,7 @@ const ProfilePanel = () => { > {/* This 0.9 is a bit magic numbering, refactor */} - First name + {t('FirstName')} { gap={SPACING_GAP} > - Last name + {t('LastName')} { gap={SPACING_GAP} > - Email + {t('email')} - This is your current email address — it cannot be changed. + {t('EmailDescriptionText')} { gap={SPACING_GAP} > - Your photo + {t('YourPhoto')} - This photo will be displayed in your profile page. + {t('PhotoDescriptionText')} { color="error" onClick={handleDeletePicture} > - Delete + {t('delete')} @@ -344,7 +316,7 @@ const ProfilePanel = () => { justifyContent="flex-end" > - { disabled={Object.keys(errors).length !== 0 && !errors?.picture && true} sx={{ px: theme.spacing(12) }} > - Save - + {t('save')} + @@ -372,13 +344,12 @@ const ProfilePanel = () => { spellCheck="false" > - Delete account + {t('DeleteAccountTitle')} - Note that deleting your account will remove all data from the server. This - is permanent and non-recoverable. + {t('DeleteDescriptionText')} )} setIsOpen("")} - confirmationButtonLabel={"Delete account"} + confirmationButtonLabel={t('DeleteAccountButton')} onConfirm={handleDeleteAccount} isLoading={isLoading} /> @@ -409,34 +378,27 @@ const ProfilePanel = () => { onClose={closePictureModal} theme={theme} > - { + if (newFile) { + setFile(newFile); + clearError("unchanged"); + } + }} + previewIsRound + maxSize={3 * 1024 * 1024} /> - {progress.isLoading || progress.value !== 0 || errors["picture"] ? ( - } - label={file?.name} - size={file?.size} - progress={progress.value} - onClick={removePicture} - error={errors["picture"]} - /> - ) : ( - "" - )} { color="info" onClick={removePicture} > - Remove + {t('remove')} diff --git a/Client/src/Components/TabPanels/Account/TeamPanel.jsx b/client/src/Components/TabPanels/Account/TeamPanel.jsx similarity index 75% rename from Client/src/Components/TabPanels/Account/TeamPanel.jsx rename to client/src/Components/TabPanels/Account/TeamPanel.jsx index 7b8143356..fe4b201dd 100644 --- a/Client/src/Components/TabPanels/Account/TeamPanel.jsx +++ b/client/src/Components/TabPanels/Account/TeamPanel.jsx @@ -2,15 +2,15 @@ import { useTheme } from "@emotion/react"; import TabPanel from "@mui/lab/TabPanel"; import { Button, ButtonGroup, Stack, Typography } from "@mui/material"; import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; import TextInput from "../../Inputs/TextInput"; import { credentials } from "../../../Validation/validation"; import { networkService } from "../../../main"; import { createToast } from "../../../Utils/toastUtils"; -import { useSelector } from "react-redux"; import Select from "../../Inputs/Select"; -import LoadingButton from "@mui/lab/LoadingButton"; import { GenericDialog } from "../../Dialog/genericDialog"; import DataTable from "../../Table/"; +import { useGetInviteToken } from "../../../Hooks/inviteHooks"; /** * TeamPanel component manages the organization and team members, * providing functionalities like renaming the organization, managing team members, @@ -21,13 +21,12 @@ import DataTable from "../../Table/"; const TeamPanel = () => { const theme = useTheme(); - + const { t } = useTranslation(); const SPACING_GAP = theme.spacing(12); - const { authToken } = useSelector((state) => state.auth); const [toInvite, setToInvite] = useState({ email: "", - role: ["0"], + role: ["user"], }); const [data, setData] = useState([]); const [members, setMembers] = useState([]); @@ -36,10 +35,12 @@ const TeamPanel = () => { const [errors, setErrors] = useState({}); const [isSendingInvite, setIsSendingInvite] = useState(false); + const [getInviteToken, clearToken, isLoading, error, token] = useGetInviteToken(); + const headers = [ { id: "name", - content: "Name", + content: t("teamPanel.table.name"), render: (row) => { return ( @@ -47,16 +48,16 @@ const TeamPanel = () => { {row.firstName + " " + row.lastName} - Created {new Date(row.createdAt).toLocaleDateString()} + {t("teamPanel.table.created")} {new Date(row.createdAt).toLocaleDateString()} ); }, }, - { id: "email", content: "Email", render: (row) => row.email }, + { id: "email", content: t("teamPanel.table.email"), render: (row) => row.email }, { id: "role", - content: "Role", + content: t("teamPanel.table.role"), render: (row) => row.role, }, ]; @@ -64,9 +65,7 @@ const TeamPanel = () => { useEffect(() => { const fetchTeam = async () => { try { - const response = await networkService.getAllUsers({ - authToken: authToken, - }); + const response = await networkService.getAllUsers(); setMembers(response.data.data); } catch (error) { createToast({ @@ -76,14 +75,14 @@ const TeamPanel = () => { }; fetchTeam(); - }, [authToken]); + }, []); useEffect(() => { const ROLE_MAP = { - superadmin: "Super admin", - admin: "Admin", - user: "Team member", - demo: "Demo User", + superadmin: t("roles.superAdmin"), + admin: t("roles.admin"), + user: t("roles.teamMember"), + demo: t("roles.demoUser"), }; let team = members; if (filter !== "all") @@ -100,7 +99,7 @@ const TeamPanel = () => { role: member.role.map((role) => ROLE_MAP[role]).join(","), })); setData(team); - }, [filter, members]); + }, [members, filter, t]); useEffect(() => { setIsDisabled(Object.keys(errors).length !== 0 || toInvite.email === ""); @@ -109,12 +108,13 @@ const TeamPanel = () => { const handleChange = (event) => { const { value } = event.target; + const newEmail = value?.toLowerCase() || value; setToInvite((prev) => ({ ...prev, - email: value, + email: newEmail, })); - const validation = credentials.validate({ email: value }, { abortEarly: false }); + const validation = credentials.validate({ email: newEmail }, { abortEarly: false }); setErrors((prev) => { const updatedErrors = { ...prev }; @@ -128,6 +128,10 @@ const TeamPanel = () => { }); }; + const handleGetToken = async () => { + await getInviteToken({ email: toInvite.email, role: toInvite.role }); + }; + const handleInviteMember = async () => { if (!toInvite.email) { setErrors((prev) => ({ ...prev, email: "Email is required." })); @@ -150,8 +154,7 @@ const TeamPanel = () => { } try { - await networkService.requestInvitationToken({ - authToken: authToken, + await networkService.sendInvitationToken({ email: toInvite.email, role: toInvite.role, }); @@ -170,6 +173,7 @@ const TeamPanel = () => { const closeInviteModal = () => { setIsOpen(false); + clearToken(); setToInvite({ email: "", role: ["0"] }); setErrors({}); }; @@ -194,7 +198,7 @@ const TeamPanel = () => { spellCheck="false" gap={SPACING_GAP} > - Team members + {t("teamPanel.teamMembers")} { filled={(filter === "all").toString()} onClick={() => setFilter("all")} > - All + {t("teamPanel.filter.all")} - setIsOpen(true)} > - Invite a team member - + {t("teamPanel.inviteTeamMember")} + { marginBottom={SPACING_GAP} type="email" id="input-team-member" - placeholder="Email" + placeholder={t("teamPanel.email")} value={toInvite.email} onChange={handleChange} error={errors.email ? true : false} @@ -267,7 +268,7 @@ const TeamPanel = () => { /> + + + + + + + + ); +}; + +export default CreateDistributedUptime; diff --git a/client/src/Pages/DistributedUptime/Details/Components/Chatbot/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/Chatbot/index.jsx new file mode 100644 index 000000000..899c0fcc3 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/Chatbot/index.jsx @@ -0,0 +1,50 @@ +// Components +import { Stack, Typography } from "@mui/material"; +import { ColContainer } from "../../../../../Components/StandardContainer"; +import SmartToyIcon from "@mui/icons-material/SmartToy"; +import Dot from "../../../../../Components/Dot"; +// Utils +import { useTheme } from "@emotion/react"; +import { useTranslation } from "react-i18next"; + +const MESSAGES = [ + "I've checked the network status, and we're seeing excellent performance across all regions.", + "The network is stable and functioning optimally. All connections are active and stable.", + "I've reviewed the network status, and everything looks great. No issues detected.", + "The network is up and running smoothly. All connections are active and stable.", + "I've checked the network status, and everything is looking good. No issues detected.", +]; + +const ChatBot = ({ sx }) => { + const theme = useTheme(); + const { t } = useTranslation(); + return ( + + + + Status Bot + + + {t("now")} + + + {MESSAGES[Math.floor(Math.random() * MESSAGES.length)]} + + ); +}; + +export default ChatBot; diff --git a/client/src/Pages/DistributedUptime/Details/Components/ControlsHeader/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/ControlsHeader/index.jsx new file mode 100644 index 000000000..e9b42c4b9 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/ControlsHeader/index.jsx @@ -0,0 +1,92 @@ +// Components +import { Box, Stack, Button } from "@mui/material"; +import Image from "../../../../../Components/Image"; +import SettingsIcon from "../../../../../assets/icons/settings-bold.svg?react"; + +//Utils +import { useTheme } from "@mui/material/styles"; +import { useNavigate } from "react-router-dom"; +import PropTypes from "prop-types"; +import { useTranslation } from "react-i18next"; + +const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting, monitorId }) => { + const theme = useTheme(); + const navigate = useNavigate(); + const { t } = useTranslation(); + + return ( + + + + + + + + + ); +}; + +Controls.propTypes = { + isDeleting: PropTypes.bool, + monitorId: PropTypes.string, + isDeleteOpen: PropTypes.bool.isRequired, + setIsDeleteOpen: PropTypes.func.isRequired, +}; + +const ControlsHeader = ({ isDeleting, isDeleteOpen, setIsDeleteOpen, monitorId }) => { + const theme = useTheme(); + + return ( + + + + ); +}; + +ControlsHeader.propTypes = { + monitorId: PropTypes.string, + isDeleting: PropTypes.bool, + isDeleteOpen: PropTypes.bool.isRequired, + setIsDeleteOpen: PropTypes.func.isRequired, +}; + +export default ControlsHeader; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DeviceTicker/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/DeviceTicker/index.jsx new file mode 100644 index 000000000..4afba9e52 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DeviceTicker/index.jsx @@ -0,0 +1,96 @@ +// Components +import { Stack, Typography } from "@mui/material"; +import PulseDot from "../../../../../Components/Animated/PulseDot"; +import "flag-icons/css/flag-icons.min.css"; +import { ColContainer } from "../../../../../Components/StandardContainer"; + +// Utils +import { useTheme } from "@emotion/react"; +import { useTranslation } from "react-i18next"; + +const DeviceTicker = ({ data, width = "100%", connectionStatus }) => { + const theme = useTheme(); + const { t } = useTranslation(); + const statusColor = { + up: theme.palette.success.main, + down: theme.palette.error.main, + undefined: theme.palette.warning.main, + }; + + return ( + + + + + + {connectionStatus === "up" ? "Connected" : "Connecting..."} + + +
+ + + + + + + + + + + {data.map((dataPoint) => { + const countryCode = dataPoint?.countryCode?.toLowerCase() ?? null; + const flag = countryCode ? `fi fi-${countryCode}` : null; + const city = dataPoint?.city !== "" ? dataPoint?.city : "Unknown"; + return ( + + + + + + + ); + })} + +
+ {t("country")} + + {t("city")} + + {t("response")} + + {"UPT BURNED"} +
+ + {flag ? : null}{" "} + {countryCode?.toUpperCase() ?? "N/A"} + + + {city} + + {Math.floor(dataPoint.responseTime)} {t("ms")} + + + +{dataPoint.uptBurnt} + +
+
+
+ ); +}; + +export default DeviceTicker; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/DistributedUptimeMapStyle.json b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/DistributedUptimeMapStyle.json new file mode 100644 index 000000000..86ca8204d --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/DistributedUptimeMapStyle.json @@ -0,0 +1,169 @@ +{ + "id": "43f36e14-e3f5-43c1-84c0-50a9c80dc5c7", + "name": "MapLibre", + "zoom": 0.861983335785597, + "pitch": 0, + "center": [17.6543171043124, 32.9541203267468], + "glyphs": "https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "#121217" + }, + "filter": ["all"], + "layout": { + "visibility": "visible" + }, + "maxzoom": 24 + }, + { + "id": "coastline", + "type": "line", + "paint": { + "line-blur": 0.5, + "line-color": "#000000", + "line-width": { + "stops": [ + [0, 2], + [6, 6], + [14, 9], + [22, 18] + ] + } + }, + "filter": ["all"], + "layout": { + "line-cap": "round", + "line-join": "round", + "visibility": "visible" + }, + "source": "maplibre", + "maxzoom": 24, + "minzoom": 0, + "source-layer": "countries" + }, + { + "id": "countries-fill", + "type": "fill", + "paint": { + "fill-color": "#292929" + }, + "filter": ["all"], + "layout": { + "visibility": "visible" + }, + "source": "maplibre", + "maxzoom": 24, + "source-layer": "countries" + }, + { + "id": "countries-boundary", + "type": "line", + "paint": { + "line-color": "#484848", + "line-width": { + "stops": [ + [1, 1], + [6, 2], + [14, 6], + [22, 12] + ] + }, + "line-opacity": { + "stops": [ + [3, 0.5], + [6, 1] + ] + } + }, + "layout": { + "line-cap": "round", + "line-join": "round", + "visibility": "visible" + }, + "source": "maplibre", + "maxzoom": 24, + "source-layer": "countries" + }, + { + "id": "countries-label", + "type": "symbol", + "paint": { + "text-color": "rgba(8, 37, 77, 1)", + "text-halo-blur": { + "stops": [ + [2, 0.2], + [6, 0] + ] + }, + "text-halo-color": "rgba(255, 255, 255, 1)", + "text-halo-width": { + "stops": [ + [2, 1], + [6, 1.6] + ] + } + }, + "filter": ["all"], + "layout": { + "text-font": ["Open Sans Semibold"], + "text-size": { + "stops": [ + [2, 10], + [4, 12], + [6, 16] + ] + }, + "text-field": { + "stops": [ + [2, "{ABBREV}"], + [4, "{NAME}"] + ] + }, + "visibility": "visible", + "text-max-width": 10, + "text-transform": { + "stops": [ + [0, "uppercase"], + [2, "none"] + ] + } + }, + "source": "maplibre", + "maxzoom": 24, + "minzoom": 2, + "source-layer": "centroids" + }, + { + "id": "data-dots", + "type": "circle", + "source": "data-dots", + "paint": { + "circle-radius": 3, + "circle-color": ["get", "color"], + "circle-opacity": 0.5 + } + } + ], + "bearing": 0, + "sources": { + "maplibre": { + "url": "https://demotiles.maplibre.org/tiles/tiles.json", + "type": "vector" + }, + "data-dots": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [] + } + } + }, + "version": 8, + "metadata": { + "maptiler:copyright": "This style was generated on MapTiler Cloud. Usage is governed by the license terms in https://github.com/maplibre/demotiles/blob/gh-pages/LICENSE", + "openmaptiles:version": "3.x" + } +} diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/buildStyle.js b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/buildStyle.js new file mode 100644 index 000000000..e4aaa49ce --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/buildStyle.js @@ -0,0 +1,33 @@ +import baseStyle from "./DistributedUptimeMapStyle.json"; + +const buildStyle = (theme, mode) => { + const style = JSON.parse(JSON.stringify(baseStyle)); + + if (mode === "dark") { + return baseStyle; + } + + if (style.layers) { + const newLayers = style.layers.map((layer) => { + if (layer.id === "background") { + layer.paint["background-color"] = theme.palette.map.main; + } + + if (layer.id === "countries-fill") { + layer.paint["fill-color"] = theme.palette.map.lowContrast; + } + + if (layer.id === "coastline") { + layer.paint["line-color"] = theme.palette.map.highContrast; + } + if (layer.id === "countries-boundary") { + layer.paint["line-color"] = theme.palette.map.highContrast; + } + return layer; + }); + style.layers = newLayers; + } + return style; +}; + +export default buildStyle; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx new file mode 100644 index 000000000..03993dcc3 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeMap/index.jsx @@ -0,0 +1,118 @@ +import "maplibre-gl/dist/maplibre-gl.css"; +import PropTypes from "prop-types"; +import { useRef, useState, useEffect } from "react"; +import { useTheme } from "@mui/material/styles"; +import maplibregl from "maplibre-gl"; +import { useSelector } from "react-redux"; +import buildStyle from "./buildStyle"; + +const DistributedUptimeMap = ({ + width = "100%", + checks, + height, + minHeight = "350px", +}) => { + const mapContainer = useRef(null); + const map = useRef(null); + const theme = useTheme(); + const [mapLoaded, setMapLoaded] = useState(false); + const mode = useSelector((state) => state.ui.mode); + const initialTheme = useRef(theme); + const initialMode = useRef(mode); + + const colorLookup = (avgResponseTime) => { + if (avgResponseTime <= 150) { + return "#00FF00"; // Green + } else if (avgResponseTime <= 250) { + return "#FFFF00"; // Yellow + } else { + return "#FF0000"; // Red + } + }; + + useEffect(() => { + if (mapContainer.current && !map.current) { + const initialStyle = buildStyle(initialTheme.current, initialMode.current); + + map.current = new maplibregl.Map({ + container: mapContainer.current, + style: initialStyle, + center: [0, 20], + zoom: 0.8, + attributionControl: false, + canvasContextAttributes: { + antialias: true, + preserveDrawingBuffer: true, + }, + }); + } + map.current.on("load", () => { + setMapLoaded(true); + }); + + return () => { + if (map.current) { + map.current.remove(); + map.current = null; + } + }; + }, []); + + useEffect(() => { + const style = buildStyle(theme, mode); + if (map.current && mapLoaded) { + map.current.setStyle(style); + } + }, [theme, mode, mapLoaded]); + + useEffect(() => { + if (map.current && checks?.length > 0) { + // Convert dots to GeoJSON + const geojson = { + type: "FeatureCollection", + features: checks.map((check) => { + return { + type: "Feature", + geometry: { + type: "Point", + coordinates: [check._id.lng, check._id.lat], + }, + properties: { + color: theme.palette.accent.main, + // color: colorLookup(check.avgResponseTime) || "blue", // Default to blue if no color specified + }, + }; + }), + }; + + // Update the source with new dots + const source = map.current.getSource("data-dots"); + if (source) { + source.setData(geojson); + } + } + }, [checks, theme, mapLoaded]); + return ( +
+ ); +}; + +DistributedUptimeMap.propTypes = { + checks: PropTypes.array, + width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + minHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), +}; + +export default DistributedUptimeMap; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Area/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Area/index.jsx new file mode 100644 index 000000000..1102f72b8 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Area/index.jsx @@ -0,0 +1,95 @@ +import { useState } from "react"; +import { useTheme } from "@emotion/react"; +import { + AreaChart, + Area, + XAxis, + Tooltip, + CartesianGrid, + ResponsiveContainer, +} from "recharts"; +import CustomTick from "../Helpers/Tick"; +import CustomToolTip from "../Helpers/ToolTip"; +import PropTypes from "prop-types"; + +const DistributedUptimeResponseAreaChart = ({ checks }) => { + const theme = useTheme(); + const [isHovered, setIsHovered] = useState(false); + return ( + + setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} + > + + + + + + + + } + minTickGap={0} + axisLine={false} + tickLine={false} + height={20} + /> + } + wrapperStyle={{ pointerEvents: "none" }} + /> + + + + ); +}; + +DistributedUptimeResponseAreaChart.propTypes = { + checks: PropTypes.array, +}; + +export default DistributedUptimeResponseAreaChart; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Bar/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Bar/index.jsx new file mode 100644 index 000000000..a6d3d455b --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Bar/index.jsx @@ -0,0 +1,95 @@ +import { + BarChart, + Bar, + CartesianGrid, + ResponsiveContainer, + Tooltip, + XAxis, +} from "recharts"; +import { useTheme } from "@emotion/react"; +import PropTypes from "prop-types"; +import CustomToolTip from "../Helpers/ToolTip"; +import CustomTick from "../Helpers/Tick"; + +const DistributedUptimeResponseBarChart = ({ checks }) => { + const theme = useTheme(); + return ( + + + + + + + + + + } + wrapperStyle={{ pointerEvents: "none" }} + /> + } + minTickGap={0} + axisLine={false} + tickLine={false} + height={20} + /> + + + + ); +}; + +DistributedUptimeResponseBarChart.propTypes = { + checks: PropTypes.array, +}; + +export default DistributedUptimeResponseBarChart; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Helpers/Tick.jsx b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Helpers/Tick.jsx new file mode 100644 index 000000000..15efd5dfa --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Helpers/Tick.jsx @@ -0,0 +1,31 @@ +import { useTheme } from "@emotion/react"; +import { useSelector } from "react-redux"; +import { formatDateWithTz } from "../../../../../../Utils/timeUtils"; +import PropTypes from "prop-types"; +import { Text } from "recharts"; +const CustomTick = ({ x, y, payload, index }) => { + const theme = useTheme(); + + const uiTimezone = useSelector((state) => state.ui.timezone); + return ( + + {formatDateWithTz(payload?.value, "h:mm a", uiTimezone)} + + ); +}; + +CustomTick.propTypes = { + x: PropTypes.number, + y: PropTypes.number, + payload: PropTypes.object, + index: PropTypes.number, +}; + +export default CustomTick; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Helpers/ToolTip.jsx b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Helpers/ToolTip.jsx new file mode 100644 index 000000000..737b26106 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/Helpers/ToolTip.jsx @@ -0,0 +1,89 @@ +import { Box, Stack, Typography } from "@mui/material"; +import { useSelector } from "react-redux"; +import { formatDateWithTz } from "../../../../../../Utils/timeUtils"; +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import AccessTimeIcon from "@mui/icons-material/AccessTime"; +import { useTranslation } from "react-i18next"; + +const CustomToolTip = ({ active, payload, label }) => { + const uiTimezone = useSelector((state) => state.ui.timezone); + const theme = useTheme(); + const { t } = useTranslation(); + if (active && payload && payload.length) { + const responseTime = payload[0]?.payload?.originalAvgResponseTime + ? payload[0]?.payload?.originalAvgResponseTime + : (payload[0]?.payload?.avgResponseTime ?? 0); + return ( + + + {formatDateWithTz(label, "ddd, MMMM D, YYYY, h:mm A", uiTimezone)} + + + + + + + {t("responseTime")} + + + {Math.floor(responseTime)} + + {t("ms")} + + + + + ); + } + return null; +}; + +CustomToolTip.propTypes = { + active: PropTypes.bool, + payload: PropTypes.arrayOf( + PropTypes.shape({ + value: PropTypes.number, + payload: PropTypes.shape({ + _id: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), + avgResponseTime: PropTypes.number, + originalAvgResponseTime: PropTypes.number, + }), + }) + ), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), +}; +export default CustomToolTip; diff --git a/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/index.jsx new file mode 100644 index 000000000..90a7671db --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/DistributedUptimeResponseChart/index.jsx @@ -0,0 +1,53 @@ +//Components +import { Stack, Switch, Typography } from "@mui/material"; +import { useState } from "react"; +import DistributedUptimeResponseAreaChart from "./Area"; +import DistributedUptimeResponseBarChart from "./Bar"; +import ChartBox from "../../../../../Components/Charts/ChartBox"; +import ResponseTimeIcon from "../../../../../assets/icons/response-time-icon.svg?react"; + +// Utils +import PropTypes from "prop-types"; +import { useTranslation } from "react-i18next"; + +const DistributedUptimeResponseChart = ({ checks }) => { + const [chartType, setChartType] = useState("bar"); + const { t } = useTranslation(); + let Chart = null; + if (chartType === "area") { + Chart = DistributedUptimeResponseAreaChart; + } + if (chartType === "bar") { + Chart = DistributedUptimeResponseBarChart; + } + return ( + + + {t("bar")} + setChartType(e.target.checked ? "area" : "bar")} + /> + {t("area")} + + } + header="Response Times" + sx={{ padding: 0 }} + > + + + + ); +}; + +DistributedUptimeResponseChart.propTypes = { + checks: PropTypes.array, + type: PropTypes.string, +}; + +export default DistributedUptimeResponseChart; diff --git a/client/src/Pages/DistributedUptime/Details/Components/Footer/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/Footer/index.jsx new file mode 100644 index 000000000..62a1f465a --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/Footer/index.jsx @@ -0,0 +1,34 @@ +import { Stack, Typography, Box } from "@mui/material"; +import SolanaLogo from "../../../../../assets/icons/solana_logo.svg?react"; +import { useTheme } from "@mui/material/styles"; +import { useTranslation } from "react-i18next"; + +const Footer = () => { + const theme = useTheme(); + const { t } = useTranslation(); + return ( + + {t("distributedUptimeDetailsFooterHeading")} + + {t("distributedUptimeDetailsFooterBuilt")} + + {t("distributedUptimeDetailsFooterSolana")} + + + ); +}; + +export default Footer; diff --git a/client/src/Pages/DistributedUptime/Details/Components/LastUpdate/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/LastUpdate/index.jsx new file mode 100644 index 000000000..a095b5feb --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/LastUpdate/index.jsx @@ -0,0 +1,15 @@ +import { useState, useEffect } from "react"; +const LastUpdate = ({ suffix, lastUpdateTime, trigger }) => { + const [elapsedMs, setElapsedMs] = useState(lastUpdateTime); + + useEffect(() => { + setElapsedMs(lastUpdateTime); + const timer = setInterval(() => { + setElapsedMs((prev) => prev + 1000); + }, 1000); + return () => clearInterval(timer); + }, [lastUpdateTime, trigger]); + + return `${Math.floor(elapsedMs / 1000)} ${suffix}`; +}; +export default LastUpdate; diff --git a/client/src/Pages/DistributedUptime/Details/Components/MonitorHeader/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/MonitorHeader/index.jsx new file mode 100644 index 000000000..9e2c4e87e --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/MonitorHeader/index.jsx @@ -0,0 +1,25 @@ +import { Stack, Typography } from "@mui/material"; +import { useTheme } from "@mui/material/styles"; +import PropTypes from "prop-types"; +import { useTranslation } from "react-i18next"; + +const MonitorHeader = ({ monitor }) => { + const theme = useTheme(); + const { t } = useTranslation(); + return ( + + + {monitor.name} + + {t("distributedUptimeDetailsMonitorHeader")} + + + + ); +}; + +MonitorHeader.propTypes = { + monitor: PropTypes.object, +}; + +export default MonitorHeader; diff --git a/client/src/Pages/DistributedUptime/Details/Components/NextExpectedCheck/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/NextExpectedCheck/index.jsx new file mode 100644 index 000000000..03949a9f7 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/NextExpectedCheck/index.jsx @@ -0,0 +1,30 @@ +import { LinearProgress } from "@mui/material"; +import { useState, useEffect } from "react"; + +const NextExpectedCheck = ({ lastUpdateTime, interval, trigger }) => { + const [elapsedMs, setElapsedMs] = useState(lastUpdateTime); + + useEffect(() => { + setElapsedMs(lastUpdateTime); + const timer = setInterval(() => { + setElapsedMs((prev) => { + const newElapsedMs = prev + 100; + return newElapsedMs; + }); + }, 100); + return () => clearInterval(timer); + }, [interval, trigger]); + + return ( + + ); +}; + +export default NextExpectedCheck; diff --git a/client/src/Pages/DistributedUptime/Details/Components/Skeleton/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/Skeleton/index.jsx new file mode 100644 index 000000000..233fc3c06 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/Skeleton/index.jsx @@ -0,0 +1,14 @@ +import { Stack, Skeleton } from "@mui/material"; + +export const SkeletonLayout = () => { + return ( + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Pages/DistributedUptime/Details/Components/StatBoxes/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/StatBoxes/index.jsx new file mode 100644 index 000000000..97513bb4f --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/StatBoxes/index.jsx @@ -0,0 +1,60 @@ +// Components +import { Stack } from "@mui/material"; +import InfoBox from "../../../../../Components/InfoBox"; +import LastUpdate from "../LastUpdate"; + +// Utils +import { useTheme } from "@mui/material/styles"; +import PropTypes from "prop-types"; + +const StatBoxes = ({ monitor, lastUpdateTrigger }) => { + const theme = useTheme(); + + return ( + + + + + } + /> + + } + /> + + ); +}; + +StatBoxes.propTypes = { + monitor: PropTypes.object, + lastUpdateTrigger: PropTypes.number, +}; + +export default StatBoxes; diff --git a/client/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx b/client/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx new file mode 100644 index 000000000..22a56bd7e --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Components/StatusHeader/index.jsx @@ -0,0 +1,94 @@ +// Components +import { ColContainer } from "../../../../../Components/StandardContainer"; +import { Stack, Typography } from "@mui/material"; +import PulseDot from "../../../../../Components/Animated/PulseDot"; +import LastUpdate from "../LastUpdate"; +import ChatBot from "../Chatbot"; +import ShareComponent from "../../../../../Components/ShareComponent"; + +// Utils +import { useTheme } from "@emotion/react"; +import PropTypes from "prop-types"; +import { useTranslation } from "react-i18next"; + +const StatusHeader = ({ monitor, connectionStatus, elementToCapture }) => { + const theme = useTheme(); + const { t } = useTranslation(); + const COLOR_MAP = { + up: theme.palette.successSecondary.main, + down: theme.palette.error.lowContrast, + }; + + const MSG_MAP = { + up: "All Systems Operational", + down: "Last Check Failed", + }; + + const PULSE_COLOR = { + up: theme.palette.success.main, + down: theme.palette.error.main, + }; + + let bgColor = COLOR_MAP[connectionStatus]; + return ( + + + + + + + + {MSG_MAP[connectionStatus]} + + + {t("distributedUptimeDetailsStatusHeaderUptime")}{" "} + {(monitor.uptimePercentage * 100).toFixed(2)}% + + + + {t("distributedUptimeDetailsStatusHeaderLastUpdate")}{" "} + + + + + + + + + ); +}; + +StatusHeader.propTypes = { + monitor: PropTypes.object, + connectionStatus: PropTypes.string, +}; + +export default StatusHeader; diff --git a/client/src/Pages/DistributedUptime/Details/Hooks/useDeleteMonitor.jsx b/client/src/Pages/DistributedUptime/Details/Hooks/useDeleteMonitor.jsx new file mode 100644 index 000000000..a26de2a5e --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/Hooks/useDeleteMonitor.jsx @@ -0,0 +1,25 @@ +import { useState } from "react"; +import { networkService } from "../../../../main"; +import { createToast } from "../../../../Utils/toastUtils"; + +const useDeleteMonitor = ({ monitorId }) => { + const [isLoading, setIsLoading] = useState(false); + const deleteMonitor = async () => { + try { + setIsLoading(true); + await networkService.deleteMonitorById({ monitorId }); + return true; + } catch (error) { + createToast({ + body: error.message, + }); + return false; + } finally { + setIsLoading(false); + } + }; + + return [deleteMonitor, isLoading]; +}; + +export { useDeleteMonitor }; diff --git a/client/src/Pages/DistributedUptime/Details/index.jsx b/client/src/Pages/DistributedUptime/Details/index.jsx new file mode 100644 index 000000000..27b39b600 --- /dev/null +++ b/client/src/Pages/DistributedUptime/Details/index.jsx @@ -0,0 +1,148 @@ +//Components +import DistributedUptimeMap from "./Components/DistributedUptimeMap"; +import Breadcrumbs from "../../../Components/Breadcrumbs"; +import { Stack, Typography } from "@mui/material"; +import DeviceTicker from "./Components/DeviceTicker"; +import ResponseTimeChart from "./Components/DistributedUptimeResponseChart"; +import NextExpectedCheck from "./Components/NextExpectedCheck"; +import Footer from "./Components/Footer"; +import StatBoxes from "./Components/StatBoxes"; +import MonitorHeader from "./Components/MonitorHeader"; +import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader"; +import GenericFallback from "../../../Components/GenericFallback"; +import MonitorCreateHeader from "../../../Components/MonitorCreateHeader"; +import SkeletonLayout from "./Components/Skeleton"; +import ControlsHeader from "./Components/ControlsHeader"; +import Dialog from "../../../Components/Dialog"; +//Utils +import { useTheme } from "@mui/material/styles"; +import { useState } from "react"; +import { useParams } from "react-router-dom"; +import { useIsAdmin } from "../../../Hooks/useIsAdmin"; +import { useSubscribeToDepinDetails } from "../../../Hooks/useSubscribeToDepinDetails"; +import { useDeleteMonitor } from "./Hooks/useDeleteMonitor"; +import { useNavigate } from "react-router-dom"; +import { useTranslation } from "react-i18next"; + +const DistributedUptimeDetails = () => { + const { monitorId } = useParams(); + // Local State + const [dateRange, setDateRange] = useState("recent"); + const [isDeleteOpen, setIsDeleteOpen] = useState(false); + + // Utils + const theme = useTheme(); + const isAdmin = useIsAdmin(); + const { t } = useTranslation(); + const navigate = useNavigate(); + const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] = + useSubscribeToDepinDetails({ monitorId, dateRange }); + + const [deleteMonitor, isDeleting] = useDeleteMonitor({ monitorId }); + // Constants + const BREADCRUMBS = [ + { name: "Distributed Uptime", path: "/distributed-uptime" }, + { name: "Details", path: `/distributed-uptime/${monitorId}` }, + ]; + + if (isLoading) { + return ; + } + + if (networkError) { + return ( + + + {t("networkError")} + + {t("checkConnection")} + + ); + } + if ( + typeof monitor === "undefined" || + typeof monitor?.totalChecks === "undefined" || + monitor?.totalChecks === 0 + ) { + return ( + + + + {t("distributedUptimeDetailsNoMonitorHistory")} + + + ); + } + return ( + + + + + + + + + + + + + + +