From 96654dc388d6e3ac6555e75818d3132140479470 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sat, 3 Feb 2024 10:47:47 +0530 Subject: [PATCH 01/16] Bug Fix --- .github/ISSUE_TEMPLATE/feature-request.yaml | 16 +++++----------- CONTRIBUTING.md | 6 +++++- src/app/layout.tsx | 5 +++-- src/assets/aws/index.ts | 4 ++++ src/components/canvas/canvas.tsx | 1 - src/components/drag/index.tsx | 3 +-- src/components/header/header.tsx | 5 ++--- src/components/sidebar/sidebar.tsx | 4 ++-- src/components/sidebar/sidebarDrag.tsx | 6 +++--- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index 84408ab..0d26ae8 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -1,31 +1,27 @@ name: Feature request -description: Suggest a feature to improve Keploy +description: Suggest a feature to improve InfraBoard title: '[feature]: ' labels: [Enhancement] body: - type: markdown attributes: value: | - Thank you for taking the time to request a feature for Keploy. + Thank you for taking the time to request a feature for InfraBoard. - type: checkboxes attributes: label: Is there an existing feature request for this? - description: Please search to see if an issue related to this feature request/feature request already exists. + description: Please search to see if an issue related to this feature request already exists. options: - label: I have searched the existing issues required: true - type: textarea attributes: label: Detailed Description - description: Please provide a more detailed explanation of the feature - validations: - required: false + description: Please provide a more detailed explanation of the feature. - type: textarea attributes: label: Use Cases and Benefits - description: Describe specific use cases and potential benefits of this feature - validations: - required: false + description: Describe specific use cases and potential benefits of this feature. - type: dropdown id: priority attributes: @@ -34,8 +30,6 @@ body: - Low - Medium - High - validations: - required: false - type: markdown attributes: value: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d0acd9..98d0b65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,10 @@ Contributions to InfraBoard can take many forms. Here are some ways you can help 8. **Open a Pull Request**: Go to the InfraBoard repository and open a pull request from your branch. +##### Notes : + +To contribute to InfraBoard, always push new features or bug fixes to a feature/bug branch first. Then, raise a pull request (PR) from your feature/bug branch to the test branch for review. It's crucial to target the test branch with your PRs to ensure changes are tested before merging into the master/stage codebase. This approach helps maintain the stability and quality of the project. + ## Coding Guidelines - Ensure your code adheres to the project's coding standards. @@ -46,7 +50,7 @@ If you are adding new features or making changes that require documentation upda ## Code of Conduct -Please note that this project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms. +Please note that this project is released with a Contributor [Code of Conduct](./CODE_OF_CONDUCT.md). By participating in this project, you agree to abide by its terms. ## Questions? diff --git a/src/app/layout.tsx b/src/app/layout.tsx index bb46d6d..7aa0499 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,9 +4,10 @@ import { MantineProvider } from '@mantine/core' import '@mantine/core/styles.css' import './globals.css' const inter = Inter({ subsets: ['latin'] }) + export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + title: 'InfraBoard', + description: 'Visual Cloud Infrastructure Management', } export default function RootLayout({ diff --git a/src/assets/aws/index.ts b/src/assets/aws/index.ts index 295eef8..3458d45 100644 --- a/src/assets/aws/index.ts +++ b/src/assets/aws/index.ts @@ -8,9 +8,11 @@ import ElasticBeanStalkIcon from './compute/elasticBeanStalkIcon' import ImageBuilderIcon from './compute/imageBuilderIcon' import LambdaIcon from './compute/lambdaIcon' import LightSailIcon from './compute/sailIcon' + // Network import GateWayIcon from './network/gateWayIcon' import VpcIcon from './network/vpcIcon' + //Tools import BudgetIcon from './tools/budgetIcon' import CostExplorerIcon from './tools/costExplorerIcon' @@ -41,9 +43,11 @@ const AWSIcons = { ImageBuilderIcon, LambdaIcon, LightSailIcon, + // Network GateWayIcon, VpcIcon, + // Tools BudgetIcon, CostExplorerIcon, diff --git a/src/components/canvas/canvas.tsx b/src/components/canvas/canvas.tsx index 61b9ed1..cb5696f 100644 --- a/src/components/canvas/canvas.tsx +++ b/src/components/canvas/canvas.tsx @@ -10,7 +10,6 @@ const Canvas = () => { const [_initX, _setInitX] = useState(0) const [_initY, _setInitY] = useState(0) const [showBackgroundImage, setShowBackgroundImage] = useState(true) - // const [backgroundSize, setBackgroundSize] = useState('16px'); const [backgroundSizeX, setBackgroundSizeX] = useState('16px') const [backgroundSizeY, setBackgroundSizeY] = useState('16px') diff --git a/src/components/drag/index.tsx b/src/components/drag/index.tsx index 761ea0d..69e5eba 100644 --- a/src/components/drag/index.tsx +++ b/src/components/drag/index.tsx @@ -8,8 +8,7 @@ import { TfiLocationArrow } from 'react-icons/tfi' import { MdGridOn } from 'react-icons/md' import { RiZoomInLine, RiZoomOutLine } from 'react-icons/ri' import { HiOutlineViewfinderCircle } from 'react-icons/hi2' -import { LuRedo, LuUndo, LuKeyboard } from 'react-icons/lu' -import { FiFileText } from 'react-icons/fi' +import { LuRedo, LuUndo } from 'react-icons/lu' import { Tooltip } from '@mantine/core' import Draggable from 'react-draggable' import { BsPlusSquareDotted } from 'react-icons/bs' diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 6ee76ca..d40631b 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,8 +1,7 @@ 'use client' import { useState } from 'react' -import { Avatar, Button, Tooltip } from '@mantine/core' -import { IoAddCircleOutline, IoHelpBuoyOutline } from 'react-icons/io5' -import { RiGraduationCapFill, RiArrowDropDownLine } from 'react-icons/ri' +import { Button, Tooltip } from '@mantine/core' +import { IoAddCircleOutline } from 'react-icons/io5' import { IoIosRocket } from 'react-icons/io' import { FiPenTool } from 'react-icons/fi' diff --git a/src/components/sidebar/sidebar.tsx b/src/components/sidebar/sidebar.tsx index ed01ba0..b4de483 100644 --- a/src/components/sidebar/sidebar.tsx +++ b/src/components/sidebar/sidebar.tsx @@ -61,9 +61,9 @@ export default function SideBar() { } const [{ isDragging }, drag] = useDrag({ - type: 'SUBTAB', // Define a type for the drag operation + type: 'SUBTAB', item: { - subTab: activeSubList, // Pass the subtab information as the item being dragged + subTab: activeSubList, }, collect: (monitor) => ({ isDragging: !!monitor.isDragging(), diff --git a/src/components/sidebar/sidebarDrag.tsx b/src/components/sidebar/sidebarDrag.tsx index 69936cf..6d36ab0 100644 --- a/src/components/sidebar/sidebarDrag.tsx +++ b/src/components/sidebar/sidebarDrag.tsx @@ -1,8 +1,8 @@ // Import necessary packages -import React, { useState } from 'react' +import React from 'react' import { useDrag } from 'react-dnd' -import { IoCubeOutline, IoCalculatorOutline, IoSearch } from 'react-icons/io5' -import { Tooltip, Select } from '@mantine/core' +import { IoCalculatorOutline } from 'react-icons/io5' +import { Tooltip } from '@mantine/core' interface SubTabInterface { id?: string From 59e808fcb7f13e03dbd5d3245e7aa8dc10acaa43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 10:39:43 +0000 Subject: [PATCH 02/16] Bump kentaro-m/auto-assign-action from 1.2.6 to 2.0.0 Bumps [kentaro-m/auto-assign-action](https://github.com/kentaro-m/auto-assign-action) from 1.2.6 to 2.0.0. - [Release notes](https://github.com/kentaro-m/auto-assign-action/releases) - [Commits](https://github.com/kentaro-m/auto-assign-action/compare/v1.2.6...v2.0.0) --- updated-dependencies: - dependency-name: kentaro-m/auto-assign-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/assign_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign_pr.yml b/.github/workflows/assign_pr.yml index f544c70..80c0982 100644 --- a/.github/workflows/assign_pr.yml +++ b/.github/workflows/assign_pr.yml @@ -7,6 +7,6 @@ jobs: add-reviews: runs-on: ubuntu-latest steps: - - uses: kentaro-m/auto-assign-action@v1.2.6 + - uses: kentaro-m/auto-assign-action@v2.0.0 with: repo-token: ${{ GITHUB }} From 75f29591298b9f423e9fb74d25b2232fc8236854 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sat, 3 Feb 2024 22:10:15 +0530 Subject: [PATCH 03/16] update --- .github/workflows/assign_pr.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/assign_pr.yml b/.github/workflows/assign_pr.yml index 80c0982..d378d89 100644 --- a/.github/workflows/assign_pr.yml +++ b/.github/workflows/assign_pr.yml @@ -1,12 +1,19 @@ -name: 'Auto Assign PR' - +name: Auto Assign on: + issues: + types: [opened] pull_request: - + types: [opened] jobs: - add-reviews: + run: runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write steps: - - uses: kentaro-m/auto-assign-action@v2.0.0 + - name: 'Auto-assign issue' + uses: pozil/auto-assign-issue@v1 with: - repo-token: ${{ GITHUB }} + repo-token: ${{ secrets.GITHUB }} + assignees: aryasoni98 + numOfAssignee: 1 From 26dec8f28e88ffc05ff99da25b1142af6df6c522 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 01:43:43 +0530 Subject: [PATCH 04/16] Added Workflow --- .github/SCORES.md | 6 ++++ .github/workflows/issue-score-handler.yml | 33 ++++++++++++++++++++ .github/workflows/pr-merge-score-updater.yml | 24 ++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .github/SCORES.md create mode 100644 .github/workflows/issue-score-handler.yml create mode 100644 .github/workflows/pr-merge-score-updater.yml diff --git a/.github/SCORES.md b/.github/SCORES.md new file mode 100644 index 0000000..ea41da2 --- /dev/null +++ b/.github/SCORES.md @@ -0,0 +1,6 @@ +# Contributor Scores + +This file tracks the scores for contributors based on resolved issues and merged PRs. + +Format: `Username: Score` + diff --git a/.github/workflows/issue-score-handler.yml b/.github/workflows/issue-score-handler.yml new file mode 100644 index 0000000..3ef736a --- /dev/null +++ b/.github/workflows/issue-score-handler.yml @@ -0,0 +1,33 @@ +name: Issue Score Handler + +on: + issues: + types: [opened] + +jobs: + label-and-comment: + runs-on: ubuntu-latest + steps: + - name: Add label + uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['Score 5, InfraBoard, XeroCodee'] + }) + + - name: Comment on issue + uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Thank you for submitting an issue! Each issue will be manually reviewed for scoring.' + }) diff --git a/.github/workflows/pr-merge-score-updater.yml b/.github/workflows/pr-merge-score-updater.yml new file mode 100644 index 0000000..8a9d027 --- /dev/null +++ b/.github/workflows/pr-merge-score-updater.yml @@ -0,0 +1,24 @@ +name: PR Merge Score Updater + +on: + pull_request: + types: [closed] + +jobs: + update-score: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Update Score in Markdown File + run: | + SCORE=5 + USER=${{ github.event.pull_request.user.login }} + FILE_PATH="./SCORES.md" + if ! grep -q $USER $FILE_PATH; then + echo "$USER: $SCORE" >> $FILE_PATH + else + sed -i "s/\($USER: \)\([0-9]*\)/echo \1\$((\2+SCORE))/e" $FILE_PATH + shell: bash From ae66182245eca7479cd04a56fb874167f31a04e7 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 01:53:21 +0530 Subject: [PATCH 05/16] Bug Fix --- .github/workflows/issue-score-handler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-score-handler.yml b/.github/workflows/issue-score-handler.yml index 3ef736a..5567fca 100644 --- a/.github/workflows/issue-score-handler.yml +++ b/.github/workflows/issue-score-handler.yml @@ -17,7 +17,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ['Score 5, InfraBoard, XeroCodee'] + {"labels": ["Score 5", "InfraBoard", "XeroCodee"]} }) - name: Comment on issue From b3f2444da7ad2110e69f8fe11cdd86367a90083a Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 01:55:49 +0530 Subject: [PATCH 06/16] Bug Fix --- .github/workflows/issue-score-handler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-score-handler.yml b/.github/workflows/issue-score-handler.yml index 5567fca..f0ed05e 100644 --- a/.github/workflows/issue-score-handler.yml +++ b/.github/workflows/issue-score-handler.yml @@ -17,7 +17,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - {"labels": ["Score 5", "InfraBoard", "XeroCodee"]} + labels: ['Score 5', 'InfraBoard', 'XeroCodee'] }) - name: Comment on issue From 2e82b6bf7ff5c6af644643324d55d397d7dcef17 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 01:59:30 +0530 Subject: [PATCH 07/16] Bug Fix --- .github/workflows/issue-score-handler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-score-handler.yml b/.github/workflows/issue-score-handler.yml index f0ed05e..46deb12 100644 --- a/.github/workflows/issue-score-handler.yml +++ b/.github/workflows/issue-score-handler.yml @@ -17,7 +17,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ['Score 5', 'InfraBoard', 'XeroCodee'] + labels: ['Score5', 'InfraBoard', 'XeroCodee'] }) - name: Comment on issue From 98b513cfae5b7b18a7aeca8dc011c4b8621cd538 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:05:27 +0530 Subject: [PATCH 08/16] Bug Fix --- .github/workflows/issue-score-handler.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/issue-score-handler.yml b/.github/workflows/issue-score-handler.yml index 46deb12..339da5d 100644 --- a/.github/workflows/issue-score-handler.yml +++ b/.github/workflows/issue-score-handler.yml @@ -1,24 +1,28 @@ -name: Issue Score Handler - +name: Add Labels on Issue Creation on: issues: types: [opened] jobs: - label-and-comment: + add-labels: runs-on: ubuntu-latest steps: - - name: Add label + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Add labels to issue uses: actions/github-script@v5 with: github-token: ${{secrets.GITHUB}} script: | + const issueNumber = context.issue.number; + const labels = ['score-5', 'infraboard', 'xerocodee']; github.rest.issues.addLabels({ - issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ['Score5', 'InfraBoard', 'XeroCodee'] - }) + issue_number: issueNumber, + labels: labels + }); - name: Comment on issue uses: actions/github-script@v5 From f96596439dcf8a0fb2794cf78120903ab5063a37 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:17:12 +0530 Subject: [PATCH 09/16] Bug Fix --- .github/ISSUE_TEMPLATE/bug-report.yaml | 7 +++---- .github/ISSUE_TEMPLATE/feature-request.yaml | 2 +- .github/labeler.yml | 4 ---- 3 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 .github/labeler.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index 9c8bf42..8962ce8 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -40,10 +40,9 @@ body: attributes: label: Environment options: - - Stage - - Production - - Release - - Deploy preview + - Stage ( Stage Branch ) + - Production ( Master Branch ) + - Deploy preview ( Test Branch ) validations: required: false - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index 0d26ae8..57ab108 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -1,7 +1,7 @@ name: Feature request description: Suggest a feature to improve InfraBoard title: '[feature]: ' -labels: [Enhancement] +labels: [feature] body: - type: markdown attributes: diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index c6208cb..0000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,4 +0,0 @@ -bug: - - .github/ISSUE_TEMPLATE/bug_report.md -feature: - - .github/ISSUE_TEMPLATE/feature_request.md From 77a1fa37a425050fb7145d56436dcac1a1082bb6 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:26:16 +0530 Subject: [PATCH 10/16] Bug Fix --- .github/workflows/pr-merge-score-updater.yml | 26 ++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-merge-score-updater.yml b/.github/workflows/pr-merge-score-updater.yml index 8a9d027..068b816 100644 --- a/.github/workflows/pr-merge-score-updater.yml +++ b/.github/workflows/pr-merge-score-updater.yml @@ -1,24 +1,36 @@ name: PR Merge Score Updater on: - pull_request: + pull_request_target: types: [closed] jobs: update-score: - if: github.event.pull_request.merged == true + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + ref: 'master' - name: Update Score in Markdown File run: | SCORE=5 - USER=${{ github.event.pull_request.user.login }} + USER="${{ github.event.pull_request.user.login }}" FILE_PATH="./SCORES.md" - if ! grep -q $USER $FILE_PATH; then - echo "$USER: $SCORE" >> $FILE_PATH + touch $FILE_PATH + if grep -q "^$USER: " $FILE_PATH; then + awk -v user="$USER" -v score=$SCORE 'BEGIN{FS=OFS=": "}{if ($1 == user) $2 += score; print}' $FILE_PATH > temp && mv temp $FILE_PATH else - sed -i "s/\($USER: \)\([0-9]*\)/echo \1\$((\2+SCORE))/e" $FILE_PATH + echo "$USER: $SCORE" >> $FILE_PATH + fi shell: bash + + - name: Commit and push if SCORES.md has changes + run: | + git config --local user.email "aryasoni98@gmail.com" + git config --local user.name "Arya Soni" + git add SCORES.md + git commit -m "Update scores" || exit 0 + git push From 000a758237a6dd3f76f0243b13ed7fd122d53c83 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:31:52 +0530 Subject: [PATCH 11/16] Bug Fix --- .github/workflows/pr-merge-score-updater.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr-merge-score-updater.yml b/.github/workflows/pr-merge-score-updater.yml index 068b816..99daeed 100644 --- a/.github/workflows/pr-merge-score-updater.yml +++ b/.github/workflows/pr-merge-score-updater.yml @@ -16,15 +16,16 @@ jobs: - name: Update Score in Markdown File run: | - SCORE=5 - USER="${{ github.event.pull_request.user.login }}" - FILE_PATH="./SCORES.md" - touch $FILE_PATH - if grep -q "^$USER: " $FILE_PATH; then - awk -v user="$USER" -v score=$SCORE 'BEGIN{FS=OFS=": "}{if ($1 == user) $2 += score; print}' $FILE_PATH > temp && mv temp $FILE_PATH - else - echo "$USER: $SCORE" >> $FILE_PATH - fi + SCORE=5 + USER="${{ github.event.pull_request.user.login }}" + FILE_PATH="./SCORES.md" + touch $FILE_PATH + if grep -q "^$USER: " $FILE_PATH; then + awk -v user="$USER" -v score=$SCORE 'BEGIN{FS=OFS=": "}{if ($1 == user) $2 += score; print}' $FILE_PATH > temp && mv temp $FILE_PATH + else + echo "$USER: $SCORE" >> $FILE_PATH + fi + shell: bash - name: Commit and push if SCORES.md has changes From aabaa271a0305cf58c51cd4d56822de4e661375b Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:33:10 +0530 Subject: [PATCH 12/16] Bug Fix --- .github/workflows/pr-merge-score-updater.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr-merge-score-updater.yml b/.github/workflows/pr-merge-score-updater.yml index 99daeed..0828849 100644 --- a/.github/workflows/pr-merge-score-updater.yml +++ b/.github/workflows/pr-merge-score-updater.yml @@ -16,16 +16,16 @@ jobs: - name: Update Score in Markdown File run: | - SCORE=5 - USER="${{ github.event.pull_request.user.login }}" - FILE_PATH="./SCORES.md" - touch $FILE_PATH - if grep -q "^$USER: " $FILE_PATH; then - awk -v user="$USER" -v score=$SCORE 'BEGIN{FS=OFS=": "}{if ($1 == user) $2 += score; print}' $FILE_PATH > temp && mv temp $FILE_PATH - else - echo "$USER: $SCORE" >> $FILE_PATH - fi - + SCORE=5 + USER="${{ github.event.pull_request.user.login }}" + FILE_PATH="./SCORES.md" + touch $FILE_PATH + if grep -q "^$USER: " $FILE_PATH; then + awk -v user="$USER" -v score=$SCORE 'BEGIN{FS=OFS=": "}{if ($1 == user) $2 += score; print}' $FILE_PATH > temp && mv temp $FILE_PATH + else + echo "$USER: $SCORE" >> $FILE_PATH + fi + shell: bash - name: Commit and push if SCORES.md has changes From f1fb4c73ec27623b43eab4d6a87b2f53e914f625 Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:39:12 +0530 Subject: [PATCH 13/16] Bug Fix --- .github/workflows/pr-merge-score-updater.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-merge-score-updater.yml b/.github/workflows/pr-merge-score-updater.yml index 0828849..b4b9868 100644 --- a/.github/workflows/pr-merge-score-updater.yml +++ b/.github/workflows/pr-merge-score-updater.yml @@ -35,3 +35,4 @@ jobs: git add SCORES.md git commit -m "Update scores" || exit 0 git push + git push https://${{ secrets.GITHUB }}@github.com/xerocodee/InfraBoard.git master \ No newline at end of file From 5e1c32a2ac06bd9eca60b98f524881f80b5498ed Mon Sep 17 00:00:00 2001 From: Arya Soni Date: Sun, 4 Feb 2024 02:41:19 +0530 Subject: [PATCH 14/16] Bug Fix --- .github/workflows/pr-merge-score-updater.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-merge-score-updater.yml b/.github/workflows/pr-merge-score-updater.yml index b4b9868..e1c5a6b 100644 --- a/.github/workflows/pr-merge-score-updater.yml +++ b/.github/workflows/pr-merge-score-updater.yml @@ -35,4 +35,4 @@ jobs: git add SCORES.md git commit -m "Update scores" || exit 0 git push - git push https://${{ secrets.GITHUB }}@github.com/xerocodee/InfraBoard.git master \ No newline at end of file + git push https://${{ secrets.GITHUB }}@github.com/xerocodee/InfraBoard.git master From 02480d44df4f7ede7be8d710a8c8a5a4ecf59fba Mon Sep 17 00:00:00 2001 From: Pratik Pimpalkar Date: Thu, 8 Feb 2024 15:55:34 +0530 Subject: [PATCH 15/16] Add code editor --- TEMPLATE.md | 50 ++++ package.json | 8 +- src/app/globals.css | 2 +- src/app/page.tsx | 20 +- src/components/canvas/canvas.tsx | 38 ++- src/components/code_editor/codeEditor.tsx | 35 +++ src/components/drag/index.tsx | 2 +- src/components/header/header.tsx | 2 +- ...{sidebarDrag.tsx => draggableTabsList.tsx} | 2 +- src/components/sidebar/searchResults.tsx | 58 +++++ src/components/sidebar/sidebar.tsx | 229 +++++++----------- src/components/sidebar/subTabs.tsx | 42 ++++ src/store/aws/compute.ts | 1 + src/types/types.ts | 8 + tsconfig.json | 10 +- 15 files changed, 328 insertions(+), 179 deletions(-) create mode 100644 TEMPLATE.md create mode 100644 src/components/code_editor/codeEditor.tsx rename src/components/sidebar/{sidebarDrag.tsx => draggableTabsList.tsx} (92%) create mode 100644 src/components/sidebar/searchResults.tsx create mode 100644 src/components/sidebar/subTabs.tsx create mode 100644 src/types/types.ts diff --git a/TEMPLATE.md b/TEMPLATE.md new file mode 100644 index 0000000..cbf9aba --- /dev/null +++ b/TEMPLATE.md @@ -0,0 +1,50 @@ + +# Templates Tutorial + +- `src/assets/`: + - `aws/`: This directory contains all the icons related to AWS services. The icons are the `.tsx` file. + - `compute/`: contains icons for aws compute services. + - `network/`: contains icons for aws networking services. + - ... + - `gcp/`: This directory contains all the icons related to GCP services. The icons are the `.tsx` file. + - `compute/`: contains icons for gcp compute services. + - `network/`: contains icons for gcp networking services. + - ... + + + +## Steps to create .tsx file from svg file. + +- Copy the svg code. +- [Go to this link](https://react-svgr.com/playground/?dimensions=false&jsxRuntime=automatic) +- Paste the SVG code here. The site will generate the React component. Create the icon file in the project and use proper naming conventions. +- import the tsx component you create earlier in `src/assets/index.ts` file. +- Add icon in icon object. + +## How to use this icon/image component. + +- import {`AWSIcons`} from `@/assets/aws` +- const {`YourIconComponentName`} = `AWSIcons` +- `` use this when required. + + + +## Store Folder `src/store` + +- `aws/`: contains data file about aws services. + - `compute` + - `network` + - `applications` + - `others` + - ... + +- `gcp/`: contains data file about gcp services. + - `compute` + - `ai` + - `applications` + - `others` + - ... + +The subdirectories (eg: compute, ai, applications, etc.) object files are then imported into `store/gcp/index.ts` and `store/aws/index.ts`. The subdirectories object files may contains react icons or custom tsx icon files. + +- `leftSidebarData` : The file that is responsible for rendering the tabs in the left sidebar You can easily add and remove the tabs from this file. \ No newline at end of file diff --git a/package.json b/package.json index b77dcf3..69a61b6 100644 --- a/package.json +++ b/package.json @@ -13,19 +13,23 @@ }, "dependencies": { "@heroicons/react": "^2.1.1", - "@mantine/core": "^7.5.0", + "@mantine/core": "^7.5.1", + "@mantine/hooks": "^7.5.1", "next": "14.1.0", "react": "^18", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", "react-dom": "^18", "react-draggable": "^4.4.6", - "react-icons": "^5.0.1" + "react-icons": "^5.0.1", + "react-monaco-editor": "^0.55.0", + "react-resizable": "^3.0.5" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", + "@types/react-resizable": "^3.0.7", "autoprefixer": "^10.0.1", "eslint": "^8.56.0", "eslint-config-next": "14.1.0", diff --git a/src/app/globals.css b/src/app/globals.css index 973dbca..90d735a 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -4,7 +4,7 @@ * { scrollbar-color: #464646 #282c34; - scrollbar-width: thin; + scrollbar-width: none; } *::-webkit-scrollbar { diff --git a/src/app/page.tsx b/src/app/page.tsx index c214eb8..a63de88 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -4,13 +4,31 @@ import Header from '@/components/header/header' import SideBar from '@/components/sidebar/sidebar' import { HTML5Backend } from 'react-dnd-html5-backend' import { DndProvider } from 'react-dnd' +import CodeEditor from '@/components/code_editor/codeEditor' +import { useState } from 'react' + +interface DroppedItem { + subTab: { + title: string; + icon?: any; + subList: any[]; + }; + position: { x: number; y: number }; +} + export default function Home() { + const [droppedItems, setDroppedItems] = useState([]); + + const handleItemDrop = (newItem: DroppedItem) => { + setDroppedItems((prevItems) => [...prevItems, newItem]); + }; return (
- + +
) diff --git a/src/components/canvas/canvas.tsx b/src/components/canvas/canvas.tsx index cb5696f..4870859 100644 --- a/src/components/canvas/canvas.tsx +++ b/src/components/canvas/canvas.tsx @@ -1,9 +1,14 @@ 'use client' - import React, { useState } from 'react' import Drag from '../drag' import { useDrop } from 'react-dnd' -const Canvas = () => { +import { DroppedItem } from '@/types/types'; + +interface CanvasProps { + onItemDrop: (newItem: DroppedItem) => void; + droppedItems: DroppedItem[]; +} +const Canvas: React.FC = ({ onItemDrop, droppedItems }) => { const [_scale, _setScale] = useState(1) const [_left, _setLeft] = useState(0) const [_top, _setTop] = useState(0) @@ -49,27 +54,16 @@ const Canvas = () => { })) } - const [droppedItems, setDroppedItems] = useState([]) - interface DroppedItem { - subTab: { - title: string - icon?: any - subList: any[] - } - position: { x: number; y: number } - } const [, drop] = useDrop({ accept: 'SUBTAB', drop: (item, monitor) => { if (!monitor) { - return + return; } - const clientOffset = monitor.getClientOffset() - console.log(clientOffset) - + const clientOffset = monitor.getClientOffset(); if (!clientOffset) { - return + return; } const newItem: DroppedItem = { @@ -78,11 +72,12 @@ const Canvas = () => { x: clientOffset.x, y: clientOffset.y, }, - } + }; - setDroppedItems((prevItems) => [...prevItems, newItem]) + // Call the callback to update the common state + onItemDrop(newItem); }, - }) + }); return (
{ handleZoomOut={handleZoomOut} handleFitContent={handleFitContent} /> -
+
{droppedItems.map((droppedItem, index) => (
= ({ droppedItems }) => { + // Extract relevant data from droppedItems and format it as needed + const code = droppedItems + .map( + (item) => + `// Position: x=${item.position.x}, y=${item.position.y}\n` + + `// SubTab Title: ${item.subTab.title}\n` + + `// SubTab Icon: ${item.subTab.icon}\n` + + `// SubList: ${JSON.stringify(item.subTab.subList)}\n\n` + ) + .join(''); + + return ( +
+ +
+ ); +}; + +export default CodeEditor; diff --git a/src/components/drag/index.tsx b/src/components/drag/index.tsx index 69e5eba..07bd001 100644 --- a/src/components/drag/index.tsx +++ b/src/components/drag/index.tsx @@ -65,7 +65,7 @@ const Drag = ({ return ( -
+
{ return ( <> -
+