diff --git a/.github/workflows/autoprefixer.yml b/.github/workflows/autoprefixer.yml index 76efe0b..9fcc81c 100644 --- a/.github/workflows/autoprefixer.yml +++ b/.github/workflows/autoprefixer.yml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout to latest commit - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 - name: Setup Node - uses: actions/setup-node@v2.4.1 + uses: actions/setup-node@v2.5.0 with: node-version: "15.x" @@ -21,7 +21,7 @@ jobs: npm run autoprefixer - name: Create Pull Request - uses: peter-evans/create-pull-request@v3.10.1 + uses: peter-evans/create-pull-request@v3.12.0 with: branch: autoprefixer branch-suffix: timestamp diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2c0d9df..89971fe 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/md-link-checker.yml b/.github/workflows/md-link-checker.yml index 18b6e6a..e8104c0 100644 --- a/.github/workflows/md-link-checker.yml +++ b/.github/workflows/md-link-checker.yml @@ -8,6 +8,6 @@ jobs: runs-on: ubuntu-latest steps: # checkout to latest commit - - uses: actions/checkout@v2.3.5 + - uses: actions/checkout@v2.4.0 # run markdown linter - uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 diff --git a/.github/workflows/project-automation-issue.yaml b/.github/workflows/project-automation-issue.yaml new file mode 100644 index 0000000..31169c6 --- /dev/null +++ b/.github/workflows/project-automation-issue.yaml @@ -0,0 +1,150 @@ +name: Project Automation (Issue) +on: + issues: + types: + - opened + - reopened + - closed + - labeled + - unlabeled +jobs: + issue_automation: + runs-on: ubuntu-latest + steps: + - name: Get project data + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + ORGANIZATION: hugo-toha + PROJECT_NUMBER: 4 + run: | + gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query=' + query($org: String!, $number: Int!) { + organization(login: $org){ + projectNext(number: $number) { + id + fields(first:20) { + nodes { + id + name + settings + } + } + } + } + }' -f org="$ORGANIZATION" -F number=$PROJECT_NUMBER > project_data.json + + echo 'PROJECT_ID='$(jq -r '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV + + # Read the ID of the "Type" field options + echo 'TYPE_ID='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.id' project_data.json) >> $GITHUB_ENV + echo 'PROJECT_ID='$(jq -r '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_ID='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_BUG='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Bug") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_FEATURE='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Feature") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_ENHANCEMENT='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Enhancement") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_DOCUMENTATION='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Documentation") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_TRANSLATION='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Translation") |.id' project_data.json) >> $GITHUB_ENV + + # Read the id of the "Status" field options + echo 'STATUS_ID='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_TODO='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Todo") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_IN_PROGRESS='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="In Progress") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_READY_FOR_REVIEW='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Ready for Review") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_DONE='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Done") |.id' project_data.json) >> $GITHUB_ENV + + - name: Add Issue to project + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + ISSUE_ID: ${{ github.event.issue.node_id }} + run: | + item_id="$( gh api graphql -f query=' + mutation($project:ID!, $issue:ID!) { + addProjectNextItem(input: {projectId: $project, contentId: $issue}) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f issue="$ISSUE_ID" --jq '.data.addProjectNextItem.projectNextItem.id')" + + echo 'ITEM_ID='$item_id >> $GITHUB_ENV + + - name: Export Labels + env: + ISSUE_DATA: ${{ toJson(github.event.issue) }} + run: | + echo 'LABELS='$(echo "$ISSUE_DATA" | jq -r '[.labels[].name] | join(" ")') >> $GITHUB_ENV + + - name: Set "Type" field + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + run: | + # Only execute this step if the Issue contains at least one label + if [ "${#LABELS[@]}" -gt 0 ]; then + + # Let by default the type is "Bug" + OPTION_ID=$TYPE_BUG + + # If it has "feature" label then set the type to "Feature" + if [[ "${LABELS[*]}" =~ "feature" ]]; then + OPTION_ID=$TYPE_FEATURE + fi + + # If it has "enhancement" label then set the type to "Enhancement" + if [[ "${LABELS[*]}" =~ "enhancement" ]]; then + OPTION_ID=$TYPE_ENHANCEMENT + fi + + # If it has "documentation" label then set the type to "Documentation" + if [[ "${LABELS[*]}" =~ "documentation" ]]; then + OPTION_ID=$TYPE_DOCUMENTATION + fi + + # If it has "translation" label then set the type to "Translation" + if [[ "${LABELS[*]}" =~ "translation" ]]; then + OPTION_ID=$TYPE_TRANSLATION + fi + + # Set the "Type" field to appropriate option + gh api graphql -f query=' + mutation ($project: ID!, $item: ID!, $field: ID!, $opt_id: ID!) { + updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $field + value: $opt_id + }) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f item="$ITEM_ID" -f field="$TYPE_ID" -f opt_id="$OPTION_ID" --silent + fi + + - name: Set "Status" field + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + run: | + STATE=${{github.event.issue.state}} + + echo "State: $STATE" + + OPTION_ID=$STATUS_TODO + + if [[ "${STATE}" == "closed" ]] + then + OPTION_ID=$STATUS_DONE + fi + + gh api graphql -f query=' + mutation ($project: ID!, $item: ID!, $field: ID!, $status_id: ID!) { + updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $field + value: $status_id + }) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f item="$ITEM_ID" -f field="$STATUS_ID" -f status_id="$OPTION_ID" --silent diff --git a/.github/workflows/project-automation-pr.yaml b/.github/workflows/project-automation-pr.yaml new file mode 100644 index 0000000..9d80589 --- /dev/null +++ b/.github/workflows/project-automation-pr.yaml @@ -0,0 +1,219 @@ +name: Project Automation (PR) +on: + pull_request: + types: + - opened + - ready_for_review + - reopened + - review_requested + - closed + - labeled + - unlabeled + - synchronize +jobs: + pr_automation: + runs-on: ubuntu-latest + steps: + - name: Get project data + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + ORGANIZATION: hugo-toha + PROJECT_NUMBER: 4 + run: | + gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query=' + query($org: String!, $number: Int!) { + organization(login: $org){ + projectNext(number: $number) { + id + fields(first:20) { + nodes { + id + name + settings + } + } + } + } + }' -f org="$ORGANIZATION" -F number=$PROJECT_NUMBER > project_data.json + + echo 'PROJECT_ID='$(jq -r '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV + + # Read the ID of the "Type" field options + echo 'TYPE_ID='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.id' project_data.json) >> $GITHUB_ENV + echo 'PROJECT_ID='$(jq -r '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_ID='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_BUG='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Bug") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_FEATURE='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Feature") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_ENHANCEMENT='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Enhancement") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_DOCUMENTATION='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Documentation") |.id' project_data.json) >> $GITHUB_ENV + echo 'TYPE_TRANSLATION='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Type") |.settings | fromjson.options[] | select(.name=="Translation") |.id' project_data.json) >> $GITHUB_ENV + + # Read the id of the "Status" field options + echo 'STATUS_ID='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_TODO='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Todo") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_IN_PROGRESS='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="In Progress") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_READY_FOR_REVIEW='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Ready for Review") |.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_DONE='$(jq -r '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Done") |.id' project_data.json) >> $GITHUB_ENV + + - name: Add PR to project + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + PR_ID: ${{ github.event.pull_request.node_id }} + run: | + item_id="$( gh api graphql -f query=' + mutation($project:ID!, $pr:ID!) { + addProjectNextItem(input: {projectId: $project, contentId: $pr}) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f pr="$PR_ID" --jq '.data.addProjectNextItem.projectNextItem.id')" + + echo 'ITEM_ID='$item_id >> $GITHUB_ENV + + - name: Export Labels + env: + PR_DATA: ${{ toJson(github.event.pull_request) }} + run: | + echo 'LABELS='$(echo "$PR_DATA" | jq -r '[.labels[].name] | join(" ")') >> $GITHUB_ENV + + - name: Set "Type" field + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + run: | + # Only execute this step if the PR contains at least one label + if [ "${#LABELS[@]}" -gt 0 ]; then + + # Let by default the type is "Bug" + OPTION_ID=$TYPE_BUG + + # If it has "feature" label then set the type to "Feature" + if [[ "${LABELS[*]}" =~ "feature" ]]; then + OPTION_ID=$TYPE_FEATURE + fi + + # If it has "enhancement" label then set the type to "Enhancement" + if [[ "${LABELS[*]}" =~ "enhancement" ]]; then + OPTION_ID=$TYPE_ENHANCEMENT + fi + + # If it has "documentation" label then set the type to "Documentation" + if [[ "${LABELS[*]}" =~ "documentation" ]]; then + OPTION_ID=$TYPE_DOCUMENTATION + fi + + # If it has "translation" label then set the type to "Translation" + if [[ "${LABELS[*]}" =~ "translation" ]]; then + OPTION_ID=$TYPE_TRANSLATION + fi + + # Set the "Type" field to appropriate option + gh api graphql -f query=' + mutation ($project: ID!, $item: ID!, $field: ID!, $opt_id: ID!) { + updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $field + value: $opt_id + }) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f item="$ITEM_ID" -f field="$TYPE_ID" -f opt_id="$OPTION_ID" --silent + fi + + - name: Set "Status" field + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + run: | + MERGED=${{github.event.pull_request.merged}} + STATE=${{github.event.pull_request.state}} + REVIEWERS=${{github.event.pull_request.requested_reviewers}} + DRAFT=${{github.event.pull_request.draft}} + + echo "Merged: $MERGED" + echo "State: $STATE" + echo "Draft: $DRAFT" + echo "Reviewer: $REVIEWER" + + OPTION_ID=$STATUS_TODO + + if [[ ("${MERGED}" == "true") || ("${STATE}" == "closed") ]] + then + OPTION_ID=$STATUS_DONE + elif [[ ${#REVIEWERS[@]} -gt 0 ]] + then + OPTION_ID=$STATUS_READY_FOR_REVIEW + else + OPTION_ID=$STATUS_IN_PROGRESS + fi + + # Expose the OPTION_ID so that it can be used in later steps + echo 'PR_STATUS='$OPTION_ID >> $GITHUB_ENV + + gh api graphql -f query=' + mutation ($project: ID!, $item: ID!, $field: ID!, $status_id: ID!) { + updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $field + value: $status_id + }) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f item="$ITEM_ID" -f field="$STATUS_ID" -f status_id="$OPTION_ID" --silent + + - name: Find Linked Issues + id: linked_issues + uses: hossainemruz/linked-issues@main + with: + pr_url: ${{github.event.pull_request.html_url}} + format: IssueNumber + + - name: Update Linked Issues Status + env: + GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} + run: | + declare -a issues=(${{ steps.linked_issues.outputs.issues }}) + + # Loop through the every issues and update their Status to same as the PR Status + for i in "${issues[@]}" + do + # Find the Issue ID + ISSUE_ID="$(gh api graphql -f query=' + query($owner: String!, $name: String!, $issue_number: Int!) { + repository(owner: $owner, name: $name) { + issue(number: $issue_number) { + id + } + } + }' -f owner="${{github.event.pull_request.head.repo.owner.login}}" -f name="${{github.event.pull_request.head.repo.name}}" -F issue_number=$i --jq='.data.repository.issue.id')" + + # Find the id of the Issue at the project board + item_id="$( gh api graphql -f query=' + mutation($project:ID!, $pr:ID!) { + addProjectNextItem(input: {projectId: $project, contentId: $pr}) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f pr="$ISSUE_ID" --jq '.data.addProjectNextItem.projectNextItem.id')" + + # Update the Issue Status + gh api graphql -f query=' + mutation ($project: ID!, $item: ID!, $field: ID!, $status_id: ID!) { + updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $field + value: $status_id + }) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f item="$item_id" -f field="$STATUS_ID" -f status_id="$PR_STATUS" --silent + done diff --git a/README.md b/README.md index abe7f84..38c63ba 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Netlify Status](https://api.netlify.com/api/v1/badges/b1b93b02-f278-440b-ae1b-304e9f4c4ab5/deploy-status)](https://app.netlify.com/sites/toha/deploys) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fhugo-toha%2Ftoha%2Fbadge%3Fref%3Dmain&style=flat)](https://actions-badge.atrox.dev/hugo-toha/toha/goto?ref=main) ![Repository Size](https://img.shields.io/github/repo-size/hugo-toha/toha) -![Lines of Codes](https://img.shields.io/tokei/lines/github/hugo-toha/toha) +![Lines of Codes](https://img.shields.io/tokei/lines/github.com/hugo-toha/toha) ![Contributor](https://img.shields.io/github/contributors/hugo-toha/toha) ![Latest Release](https://img.shields.io/github/v/release/hugo-toha/toha?include_prereleases) ![Last Commit](https://img.shields.io/github/last-commit/hugo-toha/toha) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3bd38b5..633fe1f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -155,10 +155,27 @@
{{ partial "navigators/next-prev-navigator.html" . }}
- - {{ if site.DisqusShortname }} - {{ partial "disqus.html" . }} + + + {{ with site.Params.features.comment }} + {{ if .enable }} + + {{ if .disqus.shortName }} + {{ partial "disqus.html" . }} + + {{ else if .valine }} + {{ partial "valine.html" . }} + + {{ else if .utteranc }} + {{ partial "utteranc.html" . }} + {{ end }} + {{ end }} {{ end }} + + {{ if site.DisqusShortname }} + {{ partial "disqus.html" . }} + {{ end }} + diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html index 71fef21..7235257 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/disqus.html @@ -1,3 +1,8 @@ +{{ $disqusShortName := site.DisqusShortname }} +{{ if site.Params.features.comment.disqus.shortName }} + {{ $disqusShortName = site.Params.features.comment.disqus.shortName }} +{{ end }} +
diff --git a/layouts/partials/valine.html b/layouts/partials/valine.html new file mode 100644 index 0000000..c72e28a --- /dev/null +++ b/layouts/partials/valine.html @@ -0,0 +1,17 @@ + +
+ + + diff --git a/package-lock.json b/package-lock.json index 63897af..2cb9f76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,8 +8,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "autoprefixer": "^10.3.7", - "postcss": "^8.3.9", + "autoprefixer": "^10.4.0", + "postcss": "^8.4.4", "postcss-cli": "^8.3.1" } }, @@ -104,16 +104,16 @@ } }, "node_modules/autoprefixer": { - "version": "10.3.7", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.7.tgz", - "integrity": "sha512-EmGpu0nnQVmMhX8ROoJ7Mx8mKYPlcUHuxkwrRYEYMz85lu7H09v8w6R1P0JPdn/hKU32GjpLBFEOuIlDWCRWvg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.0.tgz", + "integrity": "sha512-7FdJ1ONtwzV1G43GDD0kpVMn/qbiNqyOPMFTX5nRffI+7vgWoFEc6DcXOxHJxrWNDXrZh18eDsZjvZGUljSRGA==", "dev": true, "dependencies": { - "browserslist": "^4.17.3", - "caniuse-lite": "^1.0.30001264", + "browserslist": "^4.17.5", + "caniuse-lite": "^1.0.30001272", "fraction.js": "^4.1.1", "normalize-range": "^0.1.2", - "picocolors": "^0.2.1", + "picocolors": "^1.0.0", "postcss-value-parser": "^4.1.0" }, "bin": { @@ -152,16 +152,16 @@ } }, "node_modules/browserslist": { - "version": "4.17.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.3.tgz", - "integrity": "sha512-59IqHJV5VGdcJZ+GZ2hU5n4Kv3YiASzW6Xk5g9tf5a/MAzGeFwgGWU39fVzNIOVcgB3+Gp+kiQu0HEfTVU/3VQ==", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.5.tgz", + "integrity": "sha512-I3ekeB92mmpctWBoLXe0d5wPS2cBuRvvW0JyyJHMrk9/HmP2ZjrTboNAZ8iuGqaEIlKguljbQY32OkOJIRrgoA==", "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001264", - "electron-to-chromium": "^1.3.857", + "caniuse-lite": "^1.0.30001271", + "electron-to-chromium": "^1.3.878", "escalade": "^3.1.1", - "node-releases": "^1.1.77", - "picocolors": "^0.2.1" + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" }, "bin": { "browserslist": "cli.js" @@ -175,9 +175,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001265", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz", - "integrity": "sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==", + "version": "1.0.30001272", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001272.tgz", + "integrity": "sha512-DV1j9Oot5dydyH1v28g25KoVm7l8MTxazwuiH3utWiAS6iL/9Nh//TGwqFEeqqN8nnWYQ8HHhUq+o4QPt9kvYw==", "dev": true, "funding": { "type": "opencollective", @@ -278,9 +278,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.861", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.861.tgz", - "integrity": "sha512-GZyflmpMnZRdZ1e2yAyvuFwz1MPSVQelwHX4TJZyXypB8NcxdPvPNwy5lOTxnlkrK13EiQzyTPugRSnj6cBgKg==", + "version": "1.3.883", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.883.tgz", + "integrity": "sha512-goyjNx4wB9j911PBteb+AXNbErug7rJVkmDXWdw5SCVn2JlARBwsqucPkvp1h5mXWxHUbBRK3bwXTrqSxSiAIQ==", "dev": true }, "node_modules/emoji-regex": { @@ -603,9 +603,9 @@ } }, "node_modules/nanoid": { - "version": "3.1.29", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.29.tgz", - "integrity": "sha512-dW2pUSGZ8ZnCFIlBIA31SV8huOGCHb6OwzVCc7A69rb/a+SgPBwfmLvK5TKQ3INPbRkcI8a/Owo0XbiTNH19wg==", + "version": "3.1.30", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", + "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" @@ -615,9 +615,9 @@ } }, "node_modules/node-releases": { - "version": "1.1.77", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz", - "integrity": "sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", "dev": true }, "node_modules/normalize-path": { @@ -648,9 +648,9 @@ } }, "node_modules/picocolors": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", - "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, "node_modules/picomatch": { @@ -675,14 +675,14 @@ } }, "node_modules/postcss": { - "version": "8.3.9", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.9.tgz", - "integrity": "sha512-f/ZFyAKh9Dnqytx5X62jgjhhzttjZS7hMsohcI7HEI5tjELX/HxCy3EFhsRxyzGvrzFF+82XPvCS8T9TFleVJw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.4.tgz", + "integrity": "sha512-joU6fBsN6EIer28Lj6GDFoC/5yOZzLCfn0zHAn/MYXI7aPt4m4hK5KC5ovEZXy+lnCjmYIbQWngvju2ddyEr8Q==", "dev": true, "dependencies": { - "nanoid": "^3.1.28", - "picocolors": "^0.2.1", - "source-map-js": "^0.6.2" + "nanoid": "^3.1.30", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -888,9 +888,9 @@ } }, "node_modules/source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -1083,16 +1083,16 @@ "dev": true }, "autoprefixer": { - "version": "10.3.7", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.3.7.tgz", - "integrity": "sha512-EmGpu0nnQVmMhX8ROoJ7Mx8mKYPlcUHuxkwrRYEYMz85lu7H09v8w6R1P0JPdn/hKU32GjpLBFEOuIlDWCRWvg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.0.tgz", + "integrity": "sha512-7FdJ1ONtwzV1G43GDD0kpVMn/qbiNqyOPMFTX5nRffI+7vgWoFEc6DcXOxHJxrWNDXrZh18eDsZjvZGUljSRGA==", "dev": true, "requires": { - "browserslist": "^4.17.3", - "caniuse-lite": "^1.0.30001264", + "browserslist": "^4.17.5", + "caniuse-lite": "^1.0.30001272", "fraction.js": "^4.1.1", "normalize-range": "^0.1.2", - "picocolors": "^0.2.1", + "picocolors": "^1.0.0", "postcss-value-parser": "^4.1.0" } }, @@ -1112,22 +1112,22 @@ } }, "browserslist": { - "version": "4.17.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.3.tgz", - "integrity": "sha512-59IqHJV5VGdcJZ+GZ2hU5n4Kv3YiASzW6Xk5g9tf5a/MAzGeFwgGWU39fVzNIOVcgB3+Gp+kiQu0HEfTVU/3VQ==", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.5.tgz", + "integrity": "sha512-I3ekeB92mmpctWBoLXe0d5wPS2cBuRvvW0JyyJHMrk9/HmP2ZjrTboNAZ8iuGqaEIlKguljbQY32OkOJIRrgoA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001264", - "electron-to-chromium": "^1.3.857", + "caniuse-lite": "^1.0.30001271", + "electron-to-chromium": "^1.3.878", "escalade": "^3.1.1", - "node-releases": "^1.1.77", - "picocolors": "^0.2.1" + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" } }, "caniuse-lite": { - "version": "1.0.30001265", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz", - "integrity": "sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==", + "version": "1.0.30001272", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001272.tgz", + "integrity": "sha512-DV1j9Oot5dydyH1v28g25KoVm7l8MTxazwuiH3utWiAS6iL/9Nh//TGwqFEeqqN8nnWYQ8HHhUq+o4QPt9kvYw==", "dev": true }, "chalk": { @@ -1204,9 +1204,9 @@ } }, "electron-to-chromium": { - "version": "1.3.861", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.861.tgz", - "integrity": "sha512-GZyflmpMnZRdZ1e2yAyvuFwz1MPSVQelwHX4TJZyXypB8NcxdPvPNwy5lOTxnlkrK13EiQzyTPugRSnj6cBgKg==", + "version": "1.3.883", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.883.tgz", + "integrity": "sha512-goyjNx4wB9j911PBteb+AXNbErug7rJVkmDXWdw5SCVn2JlARBwsqucPkvp1h5mXWxHUbBRK3bwXTrqSxSiAIQ==", "dev": true }, "emoji-regex": { @@ -1447,15 +1447,15 @@ } }, "nanoid": { - "version": "3.1.29", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.29.tgz", - "integrity": "sha512-dW2pUSGZ8ZnCFIlBIA31SV8huOGCHb6OwzVCc7A69rb/a+SgPBwfmLvK5TKQ3INPbRkcI8a/Owo0XbiTNH19wg==", + "version": "3.1.30", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", + "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", "dev": true }, "node-releases": { - "version": "1.1.77", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz", - "integrity": "sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", "dev": true }, "normalize-path": { @@ -1477,9 +1477,9 @@ "dev": true }, "picocolors": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", - "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, "picomatch": { @@ -1495,14 +1495,14 @@ "dev": true }, "postcss": { - "version": "8.3.9", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.9.tgz", - "integrity": "sha512-f/ZFyAKh9Dnqytx5X62jgjhhzttjZS7hMsohcI7HEI5tjELX/HxCy3EFhsRxyzGvrzFF+82XPvCS8T9TFleVJw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.4.tgz", + "integrity": "sha512-joU6fBsN6EIer28Lj6GDFoC/5yOZzLCfn0zHAn/MYXI7aPt4m4hK5KC5ovEZXy+lnCjmYIbQWngvju2ddyEr8Q==", "dev": true, "requires": { - "nanoid": "^3.1.28", - "picocolors": "^0.2.1", - "source-map-js": "^0.6.2" + "nanoid": "^3.1.30", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.1" } }, "postcss-cli": { @@ -1620,9 +1620,9 @@ "dev": true }, "source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", "dev": true }, "string-width": { diff --git a/package.json b/package.json index 68b7cf1..04efd45 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ }, "homepage": "https://github.com/hossainemruz/toha#readme", "devDependencies": { - "autoprefixer": "^10.3.7", - "postcss": "^8.3.9", + "autoprefixer": "^10.4.0", + "postcss": "^8.4.4", "postcss-cli": "^8.3.1" } } diff --git a/static/css/sections/about.css b/static/css/sections/about.css index 71d4b17..19fd6ce 100644 --- a/static/css/sections/about.css +++ b/static/css/sections/about.css @@ -87,11 +87,14 @@ background: #3c4858; font-size: 1rem; color: #f9fafc; - line-height: 135px; + line-height: initial; text-align: center; position: absolute; top: 5%; left: 5%; + display: flex; + justify-content: center; + align-items: center; } .circular-progress.blue .circular-progress-bar { diff --git a/static/js/main.js b/static/js/main.js index d1c3689..ff688dd 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -158,18 +158,16 @@ function toggleCourseVisibility(elem) { } // toggle hidden-course class from the third elements - for (var i = 0; i < courses.length; i++) { - if (i > 1 && courses[i].classList !== null) { - courses[i].classList.toggle("hidden-course"); + for (const course of courses) { + if (course.classList.contains("hidden-course") || course.classList.contains("toggled-hidden-course")) { + course.classList.toggle("hidden-course"); + course.classList.add("toggled-hidden-course"); } } - // toggle the current button visibility - elem.classList.toggle("hidden"); - // toggle the alternate button visibility - if (elem.id === "show-more-btn"){ - document.getElementById("show-less-btn").classList.toggle("hidden"); - }else{ - document.getElementById("show-more-btn").classList.toggle("hidden"); + // toggle the buttons visibility + let buttonsToToggle = elem.parentNode.getElementsByClassName("show-more-btn"); + for (const buttonToToggle of buttonsToToggle) { + buttonToToggle.classList.toggle("hidden"); } }