diff --git a/.env.docker b/.env.docker index 954e674da19..48bb909a67f 100644 --- a/.env.docker +++ b/.env.docker @@ -10,3 +10,8 @@ BIODROP_API_SECRET="development" GITHUB_API_TOKEN="" RANDOM_USERS="eddiejaoude,SaraJaoude" ADMIN_USERS="eddiejaoude,SaraJaoude" + +STRIPE_SECRET_KEY="" +STRIPE_PREMIUM_PRICING_ID="" +STRIPE_WEBHOOK_SECRET="" +NEXT_PUBLIC_PREMIUM_SUPPORT_URL="" diff --git a/.env.example b/.env.example index fbf5f7a14d1..69fc5b62fad 100644 --- a/.env.example +++ b/.env.example @@ -11,3 +11,12 @@ BIODROP_API_SECRET="development" GITHUB_API_TOKEN="" RANDOM_USERS="eddiejaoude,sarajaoude" ADMIN_USERS="eddiejaoude,SaraJaoude,_test-admin-user" + +STRIPE_SECRET_KEY="" +STRIPE_PREMIUM_PRICING_ID="" +STRIPE_WEBHOOK_SECRET="" +NEXT_PUBLIC_PREMIUM_SUPPORT_URL="" + +VERCEL_PROJECT_ID="" +VERCEL_TEAM_ID="" +VERCEL_AUTH_TOKEN="" diff --git a/.eslintrc.json b/.eslintrc.json index 52cba9912ef..6f440a27232 100755 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,9 +18,7 @@ "ecmaVersion": 2020, "sourceType": "module" }, - "plugins": [ - "react" - ], + "plugins": ["react"], "settings": { "react": { "version": "detect" diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index fab67e036e5..0d9e415c268 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,13 +1,55 @@ name: 🐛 Bug description: Report an issue to help improve the project. title: "[BUG] " -labels: ["🛠 goal: fix","🚦 status: awaiting triage"] +labels: ["🛠 goal: fix", "🚦 status: awaiting triage"] body: + - type: checkboxes + id: duplicates + attributes: + label: Has this bug been raised before? + description: Increase the chances of your issue being accepted by making sure it has not been raised before. + options: + - label: I have checked "open" AND "closed" issues and this is not a duplicate + required: true + - type: input + attributes: + label: Where did you find this bug? + description: Local dev environment or production on biodrop.io + validations: + required: true + - type: input + attributes: + label: Version of BioDrop (for example "v1.2.3") + description: Can be found in the lower right corner of the web interface in the footer. + validations: + required: true - type: textarea id: description attributes: label: Description - description: A brief description of the question or issue, also include what you tried and what didn't work + description: A clear description of the bug you have found. Please include relevant information and resources (for example the steps to reproduce the bug) + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to Reproduce + description: To help us recreate the bug, provide a numbered list of the exact steps taken to trigger the buggy behavior. + value: | + If you know the steps, follow the below format and provide steps to reproduce + + For example: + + 1. Go to page. + 1. On top right side, close to the menu + 1. Some menu are not working properly. + 1. Continue... + + If you don't know exact steps, include any relevant details like: + + - What page you were on... + - What you were trying to do... + - What went wrong... validations: required: true - type: textarea @@ -17,15 +59,25 @@ body: description: Please add screenshots if applicable validations: required: false + - type: dropdown + id: assignee + attributes: + label: Do you want to work on this issue? + multiple: false + options: + - "No" + - "Yes" + default: 0 + validations: + required: false - type: textarea id: extrainfo attributes: - label: Additional information - description: Is there anything else we should know about this bug? + label: If "yes" to above, please explain how you would technically implement this + description: For example reference any existing code validations: required: false - type: markdown attributes: value: | You can also join our Discord community [here](http://discord.eddiehub.org) - Feel free to check out other cool repositories of the EddieHub Community [here](https://github.com/EddieHubCommunity) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 84fad230d8f..59bb7af70fe 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: Question? - url: http://discord.eddiehub.org - about: Feel free to ask your question on our Discord channel. + url: https://www.biodrop.io/docs/faqs + about: If your question is not covered by the FAQs, please ask your question in our GitHub Discussions. diff --git a/.github/ISSUE_TEMPLATE/docs.yml b/.github/ISSUE_TEMPLATE/docs.yml deleted file mode 100644 index b59d0e69fc7..00000000000 --- a/.github/ISSUE_TEMPLATE/docs.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: 📄 Documentation issue -description: Found an issue in the documentation? You can use this one! -title: "[DOCS] " -labels: ["📄 aspect: text","🚦 status: awaiting triage"] -body: - - type: textarea - id: description - attributes: - label: Description - description: A brief description of the question or issue, also include what you tried and what didn't work - validations: - required: true - - type: textarea - id: screenshots - attributes: - label: Screenshots - description: Please add screenshots if applicable - validations: - required: false - - type: textarea - id: extrainfo - attributes: - label: Additional information - description: Is there anything else we should know about this issue? - validations: - required: false - - type: markdown - attributes: - value: | - You can also join our Discord community [here](http://discord.eddiehub.org) - Feel free to check out other cool repositories of the EddieHub Community [here](https://github.com/EddieHubCommunity) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 95ca1c7e1c7..d7c225abfdd 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,31 +1,55 @@ name: 💡 General Feature Request -description: Have a new idea/feature for BioDrop? Please suggest! +description: Have a new idea/feature for BioDrop? Let us know... title: "[FEATURE] " labels: ["⭐ goal: addition", "🚦 status: awaiting triage"] body: + - type: checkboxes + id: duplicates + attributes: + label: Is this a unique feature? + description: Increase the chances of your issue being accepted by making sure it has not been raised before. + options: + - label: I have checked "open" AND "closed" issues and this is not a duplicate + required: true + - type: textarea + attributes: + label: Is your feature request related to a problem/unavailable functionality? Please describe. + description: A clear and concise description of what the problem is (for example "I'm always frustrated when [...]"). + validations: + required: true - type: textarea id: description attributes: - label: Description - description: A brief description of the enhancement you propose, also include what you tried and what worked. + label: Proposed Solution + description: A clear description of the enhancement you propose. Please include relevant information and resources (for example another project's implementation of this feature). validations: required: true - type: textarea id: screenshots attributes: label: Screenshots - description: Please add screenshots if applicable + description: Please add screenshots of the before and/or after the proposed changes. + validations: + required: false + - type: dropdown + id: assignee + attributes: + label: Do you want to work on this issue? + multiple: false + options: + - "No" + - "Yes" + default: 0 validations: required: false - type: textarea id: extrainfo attributes: - label: Additional information - description: Is there anything else we should know about this idea? + label: If "yes" to above, please explain how you would technically implement this + description: For example reference any existing code validations: required: false - type: markdown attributes: value: | You can also join our Discord community [here](http://discord.eddiehub.org) - Feel free to check out other cool repositories of the EddieHub Community [here](https://github.com/EddieHubCommunity) diff --git a/.github/ISSUE_TEMPLATE/other.yml b/.github/ISSUE_TEMPLATE/other.yml deleted file mode 100644 index e6db7cfdd0f..00000000000 --- a/.github/ISSUE_TEMPLATE/other.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Other -description: Use this for any other issues. Please do NOT create blank issues -title: "[OTHER] " -labels: ["🚦 status: awaiting triage"] -body: - - type: markdown - attributes: - value: "# Other issue" - - type: textarea - id: issuedescription - attributes: - label: What would you like to share? - description: Provide a clear and concise explanation of your issue. - validations: - required: true - - type: textarea - id: extrainfo - attributes: - label: Additional information - description: Is there anything else we should know about this issue? - validations: - required: false - - type: markdown - attributes: - value: | - You can also join our Discord community [here](http://discord.eddiehub.org) - Feel free to check out other cool repositories of the EddieHub Community [here](https://github.com/EddieHubCommunity) diff --git a/.github/config/labeler.yml b/.github/config/labeler.yml index 485c8a27257..9d0003f99d8 100644 --- a/.github/config/labeler.yml +++ b/.github/config/labeler.yml @@ -1,20 +1,23 @@ -'✍ chore: profile': - - 'data/**' +"✍ chore: profile": + - "data/**" + +"invalid": + - "data/**" tests: - - 'tests/**' + - "tests/**" storybook: - - 'stories/**' + - "stories/**" dependencies: - - 'package.*' + - "package.*" -'CI/CD': - - '.github/**' +"CI/CD": + - ".github/**" -'📖 docs': - - 'pages/docs/**' +"📖 docs": + - "pages/docs/**" -'models': - - 'models/**' +"models": + - "models/**" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ba8256548be..9861ce4d011 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,4 +10,4 @@ updates: # set commit message to work with Angular conventional commit style commit-message: prefix: "fix(deps)" - prefix-development: "chore(deps)" \ No newline at end of file + prefix-development: "chore(deps)" diff --git a/.github/scripts/check-filenames.js b/.github/scripts/check-filenames.js index b0dbf74150d..43f686fedca 100644 --- a/.github/scripts/check-filenames.js +++ b/.github/scripts/check-filenames.js @@ -1,36 +1,42 @@ -let fileNames = process.env.FILENAMES.split(' '); -const baseFileNames = process.env.BASE_FILENAMES.split(' '); -const user = process.env.USERNAME; -let exitCode = 0; - -// Remove files not changed in this PR from list -if (baseFileNames.length > 0) { - fileNames = fileNames.filter(file => !baseFileNames.includes(file)); -} - -if (fileNames.length > 0) { - fileNames.forEach(file => { - const splitFile = file.split('/'); - const userPart = splitFile[1]; - // Files not in data directory produce a warning - if(splitFile[0] !== 'data') { - console.log(`::warning ::${file} included in Pull Request with profile changes but not in data directory.`); - return; - } - if (!file.endsWith('.json')){ - exitCode = 1; - console.log(`::error ::Filename ${file} does not end with '.json'`); - return; - } - if ((userPart !== user ) && (userPart !== `${user}.json`)){ - // Allow for testimonials - if((splitFile.length == 4) && (splitFile[2] === 'testimonials') && (splitFile[3] === `${user}.json`)) { - return; - } - exitCode = 1; - console.log(`::error ::Filename ${file} does not match user ${user}`); - } - }); -} - -process.exit(exitCode); +let fileNames = process.env.FILENAMES.split(" "); +const baseFileNames = process.env.BASE_FILENAMES.split(" "); +const user = process.env.USERNAME; +let exitCode = 0; + +// Remove files not changed in this PR from list +if (baseFileNames.length > 0) { + fileNames = fileNames.filter((file) => !baseFileNames.includes(file)); +} + +if (fileNames.length > 0) { + fileNames.forEach((file) => { + const splitFile = file.split("/"); + const userPart = splitFile[1]; + // Files not in data directory produce a warning + if (splitFile[0] !== "data") { + console.log( + `::warning ::${file} included in Pull Request with profile changes but not in data directory.`, + ); + return; + } + if (!file.endsWith(".json")) { + exitCode = 1; + console.log(`::error ::Filename ${file} does not end with '.json'`); + return; + } + if (userPart !== user && userPart !== `${user}.json`) { + // Allow for testimonials + if ( + splitFile.length == 4 && + splitFile[2] === "testimonials" && + splitFile[3] === `${user}.json` + ) { + return; + } + exitCode = 1; + console.log(`::error ::Filename ${file} does not match user ${user}`); + } + }); +} + +process.exit(exitCode); diff --git a/.github/scripts/testimonial.mjs b/.github/scripts/testimonial.mjs index 9e2e2595316..9643164b064 100644 --- a/.github/scripts/testimonial.mjs +++ b/.github/scripts/testimonial.mjs @@ -1,19 +1,19 @@ -import fs from 'fs'; - -const fileName = process.env.FILE_NAME; -const title = process.env.DATA_TITLE; -const description = process.env.DATA_DESCRIPTION; -const date = process.env.DATA_DATE; - -const output = { - title, - description, - date -} - -try { - fs.writeFileSync(fileName, JSON.stringify(output, null, 2)); -} catch(e) { - console.log(`::error ::Error writing ${fileName}`); - process.exit(1); -} +import fs from "fs"; + +const fileName = process.env.FILE_NAME; +const title = process.env.DATA_TITLE; +const description = process.env.DATA_DESCRIPTION; +const date = process.env.DATA_DATE; + +const output = { + title, + description, + date, +}; + +try { + fs.writeFileSync(fileName, JSON.stringify(output, null, 2)); +} catch (e) { + console.log(`::error ::Error writing ${fileName}`); + process.exit(1); +} diff --git a/.github/workflows/check-assignee.yml b/.github/workflows/check-assignee.yml new file mode 100644 index 00000000000..c1c896622b2 --- /dev/null +++ b/.github/workflows/check-assignee.yml @@ -0,0 +1,45 @@ +name: Check Assignee's Issues + +on: + issue_comment: + types: + - created + +jobs: + check-assignee-issues: + permissions: + issues: write + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Check if the author has issues assigned + id: check-assignee + run: | + COMMENT_AUTHOR=$(jq -r .comment.user.login "$GITHUB_EVENT_PATH") + ISSUES=$(curl \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -s "https://api.github.com/search/issues?q=repo:${{ github.repository }}+is:open+is:issue+assignee:$COMMENT_AUTHOR" | jq .total_count) + echo "Found $ISSUES issues assigned to $COMMENT_AUTHOR" + echo "has_issues=$(test $ISSUES -gt 0 && echo true || echo false)" >> $GITHUB_OUTPUT + + - name: Update comment if author has issues + if: steps.check-assignee.outputs.has_issues == 'true' + run: | + COMMENT_ID=$(jq -r .comment.id "$GITHUB_EVENT_PATH") + COMMENT_AUTHOR=$(jq -r .comment.user.login "$GITHUB_EVENT_PATH") + CURRENT_COMMENT=$(jq -r .comment.body "$GITHUB_EVENT_PATH") + ISSUE_URL="https://github.com/$GITHUB_REPOSITORY/issues?q=is%3Aopen+is%3Aissue+assignee%3A$COMMENT_AUTHOR" + MESSAGE="$CURRENT_COMMENT\n\nℹ️ **$COMMENT_AUTHOR** has some opened assigned issues: 🔧[View assigned issues]($ISSUE_URL)" + echo "Updating comment with message: $MESSAGE" + curl -L \ + -X PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/$GITHUB_REPOSITORY/issues/comments/$COMMENT_ID \ + -d "{\"body\":\"$MESSAGE\"}" diff --git a/.github/workflows/check-author-issues.yml b/.github/workflows/check-author-issues.yml new file mode 100644 index 00000000000..18078b7eb0d --- /dev/null +++ b/.github/workflows/check-author-issues.yml @@ -0,0 +1,47 @@ +name: "check author issues" + +on: + issues: + types: [opened, edited] + +jobs: + check-issue-author: + permissions: + issues: write + runs-on: ubuntu-latest + steps: + - name: check author issue assignment choice + run: | + CHOICE=$(echo "${{ github.event.issue.body }}" | grep -A 3 "Do you want to work on this issue?\(\s*\)" | ( grep -oiE "yes" || echo "No" )) + echo "CHOICE=$CHOICE" >> $GITHUB_ENV + + - name: check if issue author has assigned issues + if: env.CHOICE == 'Yes' + id: check-assignee + run: | + ISSUE_AUTHOR=${{ github.event.issue.user.login }} + ISSUES=$(curl \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -s "https://api.github.com/search/issues?q=repo:${{ github.repository }}+is:open+is:issue+assignee:$ISSUE_AUTHOR" | jq .total_count) + echo "issue author $ISSUE_AUTHOR" + echo "has_issues=$(test $ISSUES -gt 0 && echo true || echo false)" >> $GITHUB_OUTPUT + + - name: Update issue if author has assigned issues + if: steps.check-assignee.outputs.has_issues == 'true' + run: | + ISSUE_AUTHOR=${{ github.event.issue.user.login }} + ISSUE_NUMBER=${{ github.event.issue.number }} + ISSUE_URL="https://github.com/$GITHUB_REPOSITORY/issues/$ISSUE_NUMBER" + ASSIGNED_ISSUES_URL="https://github.com/$GITHUB_REPOSITORY/issues?q=is%3Aopen+is%3Aissue+assignee%3A$ISSUE_AUTHOR" + UPDATE_TEXT="ℹ️ **$ISSUE_AUTHOR** has some opened assigned issues: 🔧[View assigned issues]($ASSIGNED_ISSUES_URL)" + OLD_BODY="${{ github.event.issue.body }}" + BODY=$(jq --arg old_body "$OLD_BODY" --arg update_text "$UPDATE_TEXT" -n '{ body: ($old_body + "\n\n" + $update_text) }') + curl -L \ + -X PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$ISSUE_NUMBER \ + -s -d "$BODY" diff --git a/.github/workflows/check-profile.yml b/.github/workflows/check-profile.yml new file mode 100644 index 00000000000..a7092472135 --- /dev/null +++ b/.github/workflows/check-profile.yml @@ -0,0 +1,38 @@ +name: JSON Profile API check + +on: + pull_request: + paths: + - "data/**.json" + +jobs: + api-response-source: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # Make the API request corresponding to the pull request author and outputs the data of the user as JSON string + - name: Make API request + id: myRequest + uses: fjogeleit/http-request-action@main + with: + url: "https://biodrop.io/api/profiles/${{ github.event.pull_request.user.login }}" + preventFailureOnNoResponse: "true" + ignoreStatusCodes: "404" + method: "GET" + + # fail the job if the source is database + - name: If 404 pass the job + if: steps.myRequest.outputs.response == '' + run: | + echo "${{ github.event.pull_request.user.login }}'s Profile does not exist in database" + exit 0 + + # fail the job if the source is database + - name: Check if source is database + if: steps.myRequest.outputs.response != '' && fromJson(steps.myRequest.outputs.response).source == 'database' + run: | + echo "${{ github.event.pull_request.user.login }}'s Profile is already in database" + exit 1 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 36eb553277b..32122d6ed7f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,13 +13,14 @@ name: "CodeQL" on: push: - branches: [ "main" ] + branches: ["main"] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ["main"] paths-ignore: - - '**/*.md' - - '**/*.json' + - "**/*.md" + - "**/*.json" + - "**/*.yml" jobs: analyze: @@ -39,45 +40,44 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ["javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] # Use only 'java' to analyze code written in Java, Kotlin or both # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/data-filenames.yml b/.github/workflows/data-filenames.yml index a988531e4bc..35bc81f0f46 100644 --- a/.github/workflows/data-filenames.yml +++ b/.github/workflows/data-filenames.yml @@ -1,36 +1,36 @@ -name: Data Filenames Check - -on: - pull_request: - paths: - - "data/**" - -jobs: - build: - runs-on: ubuntu-latest - name: Test changed-files - steps: - - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "18" - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35.5.0 - - - name: Get changed files between base & head - id: base-changed-files - uses: tj-actions/changed-files@v35.5.0 - with: - base_sha: ${{ github.event.pull_request.head.sha }} - - - name: Check changed files - env: - BASE_FILENAMES: ${{ steps.base-changed-files.outputs.all_changed_files }} - FILENAMES: ${{ steps.changed-files.outputs.all_changed_files }} - USERNAME: ${{ github.actor }} - run: | - node .github/scripts/check-filenames.js +name: Data Filenames Check + +on: + pull_request: + paths: + - "data/**" + +jobs: + build: + runs-on: ubuntu-latest + name: Test changed-files + steps: + - uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35.5.0 + + - name: Get changed files between base & head + id: base-changed-files + uses: tj-actions/changed-files@v35.5.0 + with: + base_sha: ${{ github.event.pull_request.head.sha }} + + - name: Check changed files + env: + BASE_FILENAMES: ${{ steps.base-changed-files.outputs.all_changed_files }} + FILENAMES: ${{ steps.changed-files.outputs.all_changed_files }} + USERNAME: ${{ github.actor }} + run: | + node .github/scripts/check-filenames.js diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index db340944ac1..76e14553bca 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -24,7 +24,7 @@ jobs: - run: npm ci - name: Prettier - run: npx prettier --write data/*.json + run: npx prettier --write data/**/*.json env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml deleted file mode 100644 index eeafc8667c6..00000000000 --- a/.github/workflows/publish-ghcr.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Publish Image - GHCR -on: - workflow_dispatch: - #Runs at 01:01 UTC - schedule: - - cron: "1 1 * * *" - -jobs: - build: - if: github.repository == 'EddieHubCommunity/BioDrop' - runs-on: ubuntu-latest - services: - mongo: - image: mongo - ports: - - 27017:27017 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: "18" - cache: "npm" - - name: install dependencies - run: npm ci - - name: run build - run: npm run build - - push_to_registry: - if: github.repository == 'EddieHubCommunity/BioDrop' - name: Push Docker image to GitHub Packages - needs: build - permissions: - contents: read - packages: write - runs-on: ubuntu-latest - steps: - - name: check out the repo - uses: actions/checkout@v3 - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@v1.3.1 - - name: set up Docker builder - uses: docker/setup-buildx-action@v2 - - name: log into GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.CR_PAT }} - - name: Copy Environment Variables - run: cp .env.example /tmp/.env - - name: Add Mongo Connection String - run: echo "BIODROP_MONGO_CONNECTION_STRING=${{ secrets.BIODROP_MONGO_CONNECTION_STRING }}" >> /tmp/.env - - name: Build and push to GHCR - uses: docker/build-push-action@v3 - with: - context: . - file: Dockerfile - push: true - secrets: | - 'GH_TOKEN=${{ secrets.GITHUB_TOKEN }}' - secret-files: "MONGO=/tmp/.env" - build-args: "github_token=${{ secrets.GITHUB_TOKEN }}" - tags: | - ghcr.io/eddiehubcommunity/biodrop:${{ steps.package-version.outputs.current-version}} - ghcr.io/eddiehubcommunity/biodrop:latest diff --git a/.github/workflows/vercel-pr-preview.yml b/.github/workflows/vercel-pr-preview.yml deleted file mode 100644 index 18cd670f89d..00000000000 --- a/.github/workflows/vercel-pr-preview.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Deploy PR to Preview -env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - -on: - workflow_dispatch: - pull_request: - branches-ignore: - - revert-logger - paths: - - "**.js" - -jobs: - deploy: - runs-on: ubuntu-latest - outputs: - url: ${{ steps.deploy-preview.outputs.url }} - steps: - - uses: actions/checkout@v3 - - name: install Vercel CLI - run: npm install --global vercel@latest - - name: pull Vercel environment information - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - - name: build project artifacts - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - - name: deploy preview - id: deploy-preview - run: | - du --inodes -d 5 .vercel/output - ls -l .vercel/output/functions - preview_url="$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" - echo "url=$preview_url" >> $GITHUB_OUTPUT - echo "deployed to $preview_url" - - load-data: - runs-on: ubuntu-latest - needs: deploy - steps: - - name: load json files - run: curl -f ${{ needs.deploy.outputs.url }}/api/system/reload?secret=${{ secrets.BIODROP_API_SECRET_PREVIEW }} diff --git a/.github/workflows/vercel-preview.yml b/.github/workflows/vercel-preview.yml index 23d70597876..79f254e1669 100644 --- a/.github/workflows/vercel-preview.yml +++ b/.github/workflows/vercel-preview.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: push: branches: - - rebrand + - feat-reload-pwa jobs: deploy: @@ -37,4 +37,7 @@ jobs: steps: - name: load json files if: steps.changes.outputs.data == 'true' - run: curl -f https://biodrop-preview.vercel.app/api/system/reload?secret=${{ secrets.BIODROP_API_SECRET_PREVIEW }} + run: curl -L -f https://biodrop-preview.vercel.app/api/system/reload?secret=${{ secrets.BIODROP_API_SECRET_PREVIEW }} + - name: load testimonial files + if: steps.changes.outputs.data == 'true' + run: curl -L -f https://biodrop-preview.vercel.app/api/system/testimonials-forms?secret=${{ secrets.BIODROP_API_SECRET_PREVIEW }} diff --git a/.github/workflows/vercel.yml b/.github/workflows/vercel.yml index 135740ce207..d008efce331 100644 --- a/.github/workflows/vercel.yml +++ b/.github/workflows/vercel.yml @@ -49,4 +49,7 @@ jobs: - 'data/**' - name: load json files if: steps.changes.outputs.data == 'true' - run: curl -f https://biodrop.io/api/system/reload?secret=${{ secrets.BIODROP_API_SECRET }} + run: curl -L -f https://biodrop.io/api/system/reload?secret=${{ secrets.BIODROP_API_SECRET }} + - name: load testimonials json files for db managed profiles + if: steps.changes.outputs.data == 'true' + run: curl -L -f https://biodrop.io/api/system/testimonials-forms?secret=${{ secrets.BIODROP_API_SECRET }} diff --git a/.gitignore b/.gitignore index 7636e276cac..ac6899b45ec 100755 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # misc .DS_Store +.idea/ *.pem # debug @@ -37,3 +38,10 @@ test-results/ # vscode .vscode + +# Sentry Auth Token +.sentryclirc + +# PWA +public/sw.js* +public/workbox-*.js* diff --git a/.gitpod.yml b/.gitpod.yml index 35e558a5137..ea91e6ce3d3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,13 +1,15 @@ --- # List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ tasks: + - name: Environment + command: | + cp .env.example .env + sed -i "s|http://localhost:3000|$(gp url 3000)|" .env - name: Database command: | mkdir -p /workspace/data && mongod --dbpath /workspace/data - name: Server - init: | - npm ci - PLAYWRIGHT_BROWSERS_PATH=0 npx playwright install chromium + init: npm ci command: | gp env PLAYWRIGHT_BROWSERS_PATH=0 eval $(gp env -e) @@ -15,6 +17,12 @@ tasks: nvm install 18 npm run dev +ports: + - port: 3000 + onOpen: open-preview + name: BioDrop + description: The BioDrop website + github: prebuilds: master: true diff --git a/.prettierignore b/.prettierignore index 1b763b1bae0..b6e5a93848b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ CHANGELOG.md +pages/docs/environments/environment-variables.mdx diff --git a/.prettierrc b/.prettierrc index 9e26dfeeb6e..0967ef424bc 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/.storybook/main.js b/.storybook/main.js index 084c0c8ebee..b917e519e33 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -11,7 +11,7 @@ const config = { "@tomfreudenberg/next-auth-mock/storybook", "storybook-dark-mode", { - name: '@storybook/addon-docs', + name: "@storybook/addon-docs", options: { mdxPluginOptions: { mdxCompileOptions: { @@ -32,4 +32,4 @@ const config = { }), }; -export default config \ No newline at end of file +export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js index 4f70fd38bcd..bb340c0cd68 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -3,16 +3,21 @@ import { ThemeProvider } from "next-themes"; import { useDarkMode } from "storybook-dark-mode"; import { themes } from "@storybook/theming"; -function ThemeWrapper({children}) { +function ThemeWrapper({ children }) { // render your custom theme provider return ( - + {children} ); } -export const decorators = [(renderStory => {renderStory()})]; +export const decorators = [ + (renderStory) => {renderStory()}, +]; export const parameters = { actions: { argTypesRegex: "^on[A-Z].*" }, @@ -24,19 +29,19 @@ export const parameters = { }, nextjs: { router: { - basePath: '.' + basePath: ".", }, }, a11y: { options: { runOnly: { - type: 'tag', - values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'] - } - } + type: "tag", + values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"], + }, + }, }, darkMode: { dark: themes.dark, - light: themes.normal - } + light: themes.normal, + }, }; diff --git a/CHANGELOG.md b/CHANGELOG.md index b62033cf99a..fd78dfdcafe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,45 +1,45 @@ -## [2.4.1](https://github.com/EddieHubCommunity/BioDrop/compare/v2.4.0...v2.4.1) (2023-08-29) +# [2.96.0](https://github.com/EddieHubCommunity/BioDrop/compare/v2.95.2...v2.96.0) (2023-12-13) -### Bug Fixes +### Features -* reduce api data for daily stats ([#8834](https://github.com/EddieHubCommunity/BioDrop/issues/8834)) ([603ddfd](https://github.com/EddieHubCommunity/BioDrop/commit/603ddfd3742e8f925bb6c748dd6fe8fc1876920c)) +* progress bar background ([#9896](https://github.com/EddieHubCommunity/BioDrop/issues/9896)) ([7f6bb01](https://github.com/EddieHubCommunity/BioDrop/commit/7f6bb016637f529fd705e3620f7e32f39772f8c3)) -# [2.4.0](https://github.com/EddieHubCommunity/BioDrop/compare/v2.3.0...v2.4.0) (2023-08-29) +## [2.95.2](https://github.com/EddieHubCommunity/BioDrop/compare/v2.95.1...v2.95.2) (2023-12-12) -### Features +### Bug Fixes -* improved landing page ([#8842](https://github.com/EddieHubCommunity/BioDrop/issues/8842)) ([de180df](https://github.com/EddieHubCommunity/BioDrop/commit/de180df1f3115e9c024a972d68fb5ce4cb389c79)) +* ui screenshots at homepage ([#9872](https://github.com/EddieHubCommunity/BioDrop/issues/9872)) ([cd475b0](https://github.com/EddieHubCommunity/BioDrop/commit/cd475b0aedf880af3583041d99c0bbd7419d7017)) -# [2.3.0](https://github.com/EddieHubCommunity/BioDrop/compare/v2.2.0...v2.3.0) (2023-08-28) +## [2.95.1](https://github.com/EddieHubCommunity/BioDrop/compare/v2.95.0...v2.95.1) (2023-12-12) -### Features +### Bug Fixes -* allow images to change based on theme ([#8826](https://github.com/EddieHubCommunity/BioDrop/issues/8826)) ([8efeb2a](https://github.com/EddieHubCommunity/BioDrop/commit/8efeb2a066919b8ca6d959f38e3ea84259f337c9)) +* docs for premium features ([#9895](https://github.com/EddieHubCommunity/BioDrop/issues/9895)) ([067f763](https://github.com/EddieHubCommunity/BioDrop/commit/067f7632b8f9a014406bae3cdb7e2e231ddc90ca)) -# [2.2.0](https://github.com/EddieHubCommunity/BioDrop/compare/v2.1.1...v2.2.0) (2023-08-28) +# [2.95.0](https://github.com/EddieHubCommunity/BioDrop/compare/v2.94.3...v2.95.0) (2023-12-07) ### Features -* profile rank ([#8808](https://github.com/EddieHubCommunity/BioDrop/issues/8808)) ([64ba0d5](https://github.com/EddieHubCommunity/BioDrop/commit/64ba0d52e642dd12f0adc6333967a016585ca4bb)) +* admin stats active users ([#9857](https://github.com/EddieHubCommunity/BioDrop/issues/9857)) ([29a142b](https://github.com/EddieHubCommunity/BioDrop/commit/29a142bf56044481da030f85fe47eefba3e8a661)) -## [2.1.1](https://github.com/EddieHubCommunity/BioDrop/compare/v2.1.0...v2.1.1) (2023-08-28) +## [2.94.3](https://github.com/EddieHubCommunity/BioDrop/compare/v2.94.2...v2.94.3) (2023-12-07) ### Bug Fixes -* link vercel analytics ([#8822](https://github.com/EddieHubCommunity/BioDrop/issues/8822)) ([6a913fd](https://github.com/EddieHubCommunity/BioDrop/commit/6a913fd01e49bffc4048aee2303a0d15c496e41e)) +* milestone icons ([#9870](https://github.com/EddieHubCommunity/BioDrop/issues/9870)) ([61a5c35](https://github.com/EddieHubCommunity/BioDrop/commit/61a5c35019c5dea184a3876709665783bf76ee68)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21eb6b66525..1154a511f66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,13 +21,14 @@ Before **creating** an Issue for `features`/`bugs`/`improvements` please follow Before working on an existing Issue please follow these steps: -1. only ask to be assigned 1 issue at a time +1. only ask to be assigned 1 **open** issue at a time 1. look out for the Issue label `status: ready for dev` (if it does not have this label, your work might not be accepted) 1. comment asking for the issue to be assigned to you (do not tag maintainers on GitHub or Discord as all maintainers receive your comment notifications) 1. after the Issue is assigned to you, you can start working on it 1. **only** start working on this Issue (and open a Pull Request) when it has been assigned to you - this will prevent confusion, multiple people working on the same issue and work not being used 1. do **not** enable GitHub Actions on your fork 1. reference the Issue in your Pull Request (for example `closes #123`) +1. please do **not** force push to your PR branch, this makes it very difficult to re-review - commits will be squashed when merged > Notes: > diff --git a/README.md b/README.md index 429930677e4..6f2836ed9e5 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -[![Open in GitPod](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/EddieHubCommunity/BioDrop) -![Uptime](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FEddieHubCommunity%2Fmonitoring%2Fmaster%2Fapi%2Fbio-drop-biodrop-io%2Fuptime.json) -[![GitHub release (latest by date)](https://img.shields.io/github/v/release/EddieHubCommunity/BioDrop)](https://github.com/EddieHubCommunity/BioDrop/releases) -![GitHub repo size](https://img.shields.io/github/repo-size/EddieHubCommunity/BioDrop) +[![Open in Gitpod](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/EddieHubCommunity/BioDrop) +![Uptime](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FEddieHubCommunity%2Fmonitoring%2Fmaster%2Fapi%2Fbio-drop-biodrop-io%2Fuptime.json) +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/EddieHubCommunity/BioDrop)](https://github.com/EddieHubCommunity/BioDrop/releases) +![GitHub repo size](https://img.shields.io/github/repo-size/EddieHubCommunity/BioDrop) **Project renamed from `LinkFree` to `BioDrop`**(please update your local git clones with the new remote name) +![BioDrop logo on a sticker](https://github.com/EddieHubCommunity/BioDrop/assets/624760/31adec45-3dc3-4353-b37a-9b316a217261) + # What is BioDrop? A platform where people in tech can have a single hub to showcase their content in order to accelerate their career, whilst contributing to an Open Source project and being part of a community that has a say in where the project is going. @@ -15,6 +17,16 @@ Here is an example of a BioDrop Profile https://biodrop.io/eddiejaoude ![Example profile and statistics page on BioDrop with light and dark mode](https://user-images.githubusercontent.com/624760/230707268-1f8f1487-6524-4c89-aae2-ab45f0e17f39.png) +## Hacktoberfest + +> [!IMPORTANT] +> Creating/Changing/Deleting your JSON Profile do **not** count towards hacktoberfest and will automatically be marked with the label `invalid` so that Hacktoberfest ignores your Pull Request +> But this does not affect your Pull Request being accepted and merged into BioDrop + +All other Pull Requests will count towards Hacktoberfest. + +If you are a new contributor to this project, have a look out for issues that have the [Hacktoberfest](https://github.com/EddieHubCommunity/BioDrop/issues?q=is%3Aissue+is%3Aopen+label%3AHacktoberfest) label. + ## Tech Stack BioDrop is built using the following technologies: @@ -54,7 +66,7 @@ Read more in the official documentation - https://biodrop.io/docs/environments/g In the cloud-free development environment which will have all the dependencies you need (for example MongoDB). -You can use Gitpod in the cloud [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/EddieHubCommunity/BioDrop/) +[![Open BioDrop in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/EddieHubCommunity/BioDrop) Read more in the official documentation - https://biodrop.io/docs/environments/gitpod @@ -67,7 +79,7 @@ This environment is fully on your computer and requires each dependency (for exa Before contributing or adding a new feature, please make sure you have already installed the following tools: - [NodeJs](https://nodejs.org/en/download/) (Works with Node LTS version v18.16.1) -- [MongoDB](https://www.mongodb.com/home) +- [MongoDB](https://www.mongodb.com/home) (v6+) - Optional [NVM](https://github.com/nvm-sh/nvm): Switch Node version by using `nvm use` (on Windows, use `nvm use v18.16.1`). If this is not installed, run `nvm install v18.16.1`. #### Commands diff --git a/components/Badge.js b/components/Badge.js index 1bf94195450..a66bf0405a0 100644 --- a/components/Badge.js +++ b/components/Badge.js @@ -42,7 +42,7 @@ export default function Badge({ disable ? "text-primary-medium bg-primary-low" : "text-black bg-tertiary-medium", - `absolute inline-block rotate-0 skew-x-0 skew-y-0 scale-x-100 scale-y-100 p-2 text-xs leading-none text-center whitespace-nowrap align-baseline font-bold rounded-full z-10 ${css} ${badgeClassName}` + `absolute inline-block rotate-0 skew-x-0 skew-y-0 scale-x-100 scale-y-100 p-2 text-xs leading-none text-center whitespace-nowrap align-baseline font-bold rounded-full z-10 ${css} ${badgeClassName}`, )} onClick={() => (onClick ? onClick() : null)} > @@ -59,7 +59,7 @@ export default function Badge({
{children} diff --git a/components/Bulb.js b/components/Bulb.js new file mode 100644 index 00000000000..51914e57276 --- /dev/null +++ b/components/Bulb.js @@ -0,0 +1,16 @@ +import { classNames } from "@services/utils/classNames"; + +export default function Bulb({ isEnabled }) { + return ( +
+
+
+ ); +} diff --git a/components/Button.js b/components/Button.js index 33cc46161dc..6376cfd2394 100644 --- a/components/Button.js +++ b/components/Button.js @@ -1,29 +1,45 @@ +import { classNames } from "@services/utils/classNames"; import Link from "./Link"; export default function Button({ primary = false, - disable, + disabled = false, + className, + overrideClassNames = false, children, ...restProps }) { - let className = - "w-full inline-flex items-center flex-1 justify-center rounded-md border-2 border-primary-high dark:border-white hover:border-transparent px-5 py-3 text-base font-medium first-letter:bg-white transition duration-400 ease-in-out"; - !disable - ? (className += primary + let defaultClassName = classNames( + "w-full inline-flex items-center flex-1 justify-center rounded-md border-2 border-primary-high dark:border-white hover:border-transparent px-5 py-3 text-base font-medium first-letter:bg-white transition duration-400 ease-in-out", + !disabled + ? primary ? " text-primary-medium bg-secondary-medium hover:bg-tertiary-medium" - : " text-secondary-high dark:text-secondary-high-high hover:text-white dark:hover:text-white dark:bg-primary-low hover:bg-secondary-medium dark:hover:bg-secondary-medium") - : (className += disable - ? " border-2 border-red border shadow-sm bg-primary-low text-primary-medium cursor-not-allowed " - : " cursor-pointer"); + : " text-secondary-high dark:text-secondary-high-high hover:text-white dark:hover:text-white dark:bg-primary-low hover:bg-secondary-medium dark:hover:bg-secondary-medium" + : disabled + ? " border-2 border-red border shadow-sm bg-primary-low text-primary-medium cursor-not-allowed " + : " cursor-pointer", + ); const link = ( - + {children} ); const button = ( - ); diff --git a/components/Card.js b/components/Card.js new file mode 100644 index 00000000000..af3fc72b427 --- /dev/null +++ b/components/Card.js @@ -0,0 +1,17 @@ +import { classNames } from "@services/utils/classNames"; +import Link from "./Link"; + +export default function Card({ href, className, active = false, children }) { + return ( + + {children} + + ); +} diff --git a/components/ConfirmDialog.js b/components/ConfirmDialog.js index f1c1379ff40..19ac63252d7 100644 --- a/components/ConfirmDialog.js +++ b/components/ConfirmDialog.js @@ -15,7 +15,7 @@ export default function ConfirmDialog({ diff --git a/components/DataList.js b/components/DataList.js new file mode 100644 index 00000000000..e2973dea8ae --- /dev/null +++ b/components/DataList.js @@ -0,0 +1,31 @@ +export default function DataList({ title, subtitle, data }) { + return ( +
+
+

+ {title} +

+

+ {subtitle} +

+
+
+
+ {data.map((row) => ( +
+
+ {row.name} +
+
+ {row.value} +
+
+ ))} +
+
+
+ ); +} diff --git a/components/EditOnGithub.js b/components/EditOnGithub.js index d365f8be620..5febb30b9a2 100644 --- a/components/EditOnGithub.js +++ b/components/EditOnGithub.js @@ -11,7 +11,9 @@ export default function EditOnGitHub() { const { asPath } = router; const githubUrl = `https://github.com/EddieHubCommunity/BioDrop/edit/main/pages${ - asPath === "/docs" ? `/docs/index.js` : `${asPath}.mdx` + asPath === "/docs" || asPath === "/docs/open-source-roadmap" + ? `${asPath}/index.js` + : `${asPath}.mdx` }`; return ( diff --git a/components/Footer.js b/components/Footer.js index 815ac85d6ed..4218acabdf8 100644 --- a/components/Footer.js +++ b/components/Footer.js @@ -4,9 +4,9 @@ import { FaLinkedin, FaGithub, FaInstagram, - FaTwitter, + FaXTwitter, FaYoutube, -} from "react-icons/fa"; +} from "react-icons/fa6"; import RocketLaunchIcon from "@heroicons/react/20/solid/RocketLaunchIcon"; import Link from "@components/Link"; @@ -21,6 +21,11 @@ export default function Footer() { { name: "Events", href: "/events", external: false }, { name: "Map", href: "/map", external: false }, { name: "Login", href: "/auth/signin", external: false }, + { + name: "Open Source Roadmap", + href: "/docs/open-source-roadmap", + external: false, + }, ], support: [ { name: "Documentation", href: "/docs", external: false }, @@ -40,7 +45,7 @@ export default function Footer() { href: BASE_GITHUB_PROJECT_URL + "/blob/main/CONTRIBUTING.md", external: true, }, - { name: "Road map", href: "/roadmap", external: false }, + { name: "BioDrop Roadmap", href: "/roadmap", external: false }, ], community: [ { @@ -53,13 +58,18 @@ export default function Footer() { href: "/maintainers", external: false, }, - { name: "Resources", href: "/docs/community-resources", external: false }, + { name: "Contributors", href: BASE_GITHUB_PROJECT_URL + "/graphs/contributors", external: true, }, - { name: `v${app.version}`, href: "/roadmap", external: false }, + { name: "Resources", href: "/docs/community-resources", external: false }, + { + name: "Blog & Newsletter", + href: "https://biodrop.substack.com/", + external: true, + }, ], legal: [ { @@ -80,7 +90,7 @@ export default function Footer() { name: "Twitter", href: "https://twitter.com/biodrop_io/", external: true, - icon: FaTwitter, + icon: FaXTwitter, }, { name: "Instagram", @@ -195,22 +205,24 @@ export default function Footer() {
-
-

+

+

100% Open Source on GitHub

- {navigation.social.map((item) => ( - va.track(`socials`, { link: item.name })} - > - {item.name} -
va.track(`footer`, { link: "powered by EddieHub" })} >
diff --git a/components/Icon.js b/components/Icon.js index 00fecb76a9b..eacd65e568e 100644 --- a/components/Icon.js +++ b/components/Icon.js @@ -1,20 +1,24 @@ import dynamic from "next/dynamic"; function defaultIcon() { - return dynamic(() => import("react-icons/fa").then((mod) => mod.FaGlobe)); + return dynamic(() => import("react-icons/fa6").then((mod) => mod.FaGlobe)); } export default function getIcon(name = "FaGlobe") { let icon; + if (!name) { + return defaultIcon(); + } + switch (name.slice(0, 2)) { case "Fa": icon = dynamic(() => - import("react-icons/fa").then((mod) => { + import("react-icons/fa6").then((mod) => { let node = mod[name]; if (!node) node = defaultIcon(); return node; - }) + }), ); break; case "Si": @@ -23,7 +27,7 @@ export default function getIcon(name = "FaGlobe") { let node = mod[name]; if (!node) node = defaultIcon(); return node; - }) + }), ); break; } diff --git a/components/IconSearch.js b/components/IconSearch.js index 6843ec66b8d..1fdc01251f5 100644 --- a/components/IconSearch.js +++ b/components/IconSearch.js @@ -1,8 +1,9 @@ import { useState } from "react"; import { Combobox } from "@headlessui/react"; -import * as FaIcons from "react-icons/fa"; +import * as FaIcons from "react-icons/fa6"; import * as SiIcons from "react-icons/si"; import getIcon from "./Icon"; +import Label from "./form/Label"; function IconSearch({ selectedIcon, handleSelectedIcon }) { const [query, setQuery] = useState(""); @@ -21,9 +22,7 @@ function IconSearch({ selectedIcon, handleSelectedIcon }) { return ( - + setQuery(event.target.value)} diff --git a/components/Link.js b/components/Link.js index c0240ce103e..8ac6282974e 100644 --- a/components/Link.js +++ b/components/Link.js @@ -3,12 +3,11 @@ import NextLink from "next/link"; export default function Link({ children, className, rel, ...restProps }) { return ( - - -
- - -
-
- - -
- -
-
{children}
- -
- {title} -
-
-
-
-
-
- - ); -} +import { Fragment } from "react"; +import { Dialog, Transition } from "@headlessui/react"; +import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon"; + +export default function Modal({ + show = false, + setShow, + title, + children, + styles = "", +}) { + return ( + + + +
+ + +
+
+ + +
+ +
+
{children}
+ +
+ {title} +
+
+
+
+
+
+
+ ); +} diff --git a/components/PageHead.js b/components/PageHead.js index ad6e4887b9c..96db6338a33 100644 --- a/components/PageHead.js +++ b/components/PageHead.js @@ -24,6 +24,8 @@ export default function PageHead(props) { + + {children} ); diff --git a/components/Pagination.js b/components/Pagination.js index 82111edcaba..137de62a696 100644 --- a/components/Pagination.js +++ b/components/Pagination.js @@ -86,7 +86,7 @@ const Pagination = ({ className={classNames( currentPage === pNumber && "text-white bg-tertiary-medium border-tertiary-medium rounded-full", - "w-6 h-6 sm:w-8 sm:h-8 text-xs sm:text-base cursor-pointer border-2 rounded-full p-1 flex items-center justify-center hover:border-tertiary-medium transition-all" + "w-6 h-6 sm:w-8 sm:h-8 text-xs sm:text-base cursor-pointer border-2 rounded-full p-1 flex items-center justify-center hover:border-tertiary-medium transition-all", )} onClick={() => paginate(pNumber)} > diff --git a/components/Tabs.js b/components/Tabs.js index d18a6d30b7d..f6b792fa202 100644 --- a/components/Tabs.js +++ b/components/Tabs.js @@ -1,16 +1,17 @@ -import Link from "@components/Link"; import Select from "@components/form/Select"; import { classNames } from "@services/utils/classNames"; -export default function Tabs({ tabs, setTabs }) { + +export default function Tabs({ tabs, setTabs, selectedTab }) { return (
{tabs.length > 1 && ( { + const handleKeydown = (e) => { + if (e.key === "ArrowRight" || e.key === "ArrowLeft") { + e.stopPropagation(); + } + }; + let inputClassName = ""; + switch (type) { + case "color": + inputClassName = classNames( + disabled + ? "bg-primary-low-medium dark:bg-primary-medium-low hover:border-primary-medium-low focus:ring-0 focus:border-primary-medium focus:outline-0 cursor-not-allowed" + : "dark:bg-primary-high hover:border-tertiary-medium focus:ring-0 focus:border-tertiary-medium focus:outline-0", + "border-2 transition-all duration-250 ease-linear rounded px-1 mb-2 block w-[100px]", + ); + break; + default: + inputClassName = classNames( disabled ? "bg-primary-low-medium dark:bg-primary-medium-low hover:border-primary-medium-low focus:ring-0 focus:border-primary-medium focus:outline-0 cursor-not-allowed" : "dark:bg-primary-high hover:border-tertiary-medium focus:ring-0 focus:border-tertiary-medium focus:outline-0", - "border-2 transition-all duration-250 ease-linear rounded px-6 py-2 mb-2 block w-full" - )} - id={name} - name={name} - value={value} - onKeyDown={handleKeydown} - {...restProps} - /> - - ); -} + "border-2 transition-all duration-250 ease-linear rounded px-6 py-2 mb-2 block w-full", + ); + } + + return ( + <> + {label && } + + + + ); + }, +); + +Input.displayName = "Input"; +export default Input; diff --git a/components/form/Label.js b/components/form/Label.js new file mode 100644 index 00000000000..29bfd838701 --- /dev/null +++ b/components/form/Label.js @@ -0,0 +1,13 @@ +import { classNames } from "@services/utils/classNames"; + +export default function Label({ htmlFor, className = "", ...restProps }) { + return ( + + ); +} diff --git a/components/form/Select.js b/components/form/Select.js index 66dadfd6001..b3592ea1f2d 100644 --- a/components/form/Select.js +++ b/components/form/Select.js @@ -1,3 +1,6 @@ +import { classNames } from "@services/utils/classNames"; +import Label from "./Label"; + export default function Select({ value, onChange, @@ -8,19 +11,20 @@ export default function Select({ ...restProps }) { return ( - <> +
{label && ( - )} - +
); } diff --git a/components/form/Textarea.js b/components/form/Textarea.js index e25ff210d41..695d71fe2ff 100644 --- a/components/form/Textarea.js +++ b/components/form/Textarea.js @@ -1,22 +1,17 @@ +import Label from "./Label"; + export default function Textarea({ name, value, label, ...restProps }) { return (
- -
-