From 3612317f89e6ef606dd0ed470c92e2c38a4843f2 Mon Sep 17 00:00:00 2001 From: aXenDeveloper Date: Sun, 20 Oct 2024 10:06:09 +0200 Subject: [PATCH 1/2] feat(frontend): Add different icons based on error code in error view --- .github/workflows/publish.yaml | 64 +++++++++---------- .../eslint.shared.mjs | 1 + .../views/theme/views/error/error-view.tsx | 13 +++- 3 files changed, 44 insertions(+), 34 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 404656b5c..c4ca3e4ee 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -56,8 +56,8 @@ jobs: - name: Build Projects run: pnpm run build --filter=vitnode-backend --filter=vitnode-frontend --filter=vitnode-backend-email-resend --filter=vitnode-backend-email-smtp --filter=vitnode-backend-ai-google --filter=vitnode-backend-ai-open-ai - - name: Run script to bump version - if: github.event.inputs.skip_bump_version == false + - name: Run script to bump version & copy files + if: github.event.inputs.skip_bump_version == 'false' run: pnpm run release id: version-bump env: @@ -65,8 +65,8 @@ jobs: RELEASE_TYPE: ${{ github.event.inputs.release }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run script to bump version - if: github.event.inputs.skip_bump_version == true + - name: Run script to only copy files + if: github.event.inputs.skip_bump_version == 'true' run: pnpm run release --without-bump-version id: version-bump-without-bump-version env: @@ -74,35 +74,35 @@ jobs: RELEASE_TYPE: ${{ github.event.inputs.release }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Pre-release - if: github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate' && github.event.inputs.skip_bump_version == false - run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes --prerelease - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Create Pre-release + # if: github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate' && github.event.inputs.skip_bump_version == false + # run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes --prerelease + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - if: github.event.inputs.release == 'stable' && github.event.inputs.skip_bump_version == false - run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Create Release + # if: github.event.inputs.release == 'stable' && github.event.inputs.skip_bump_version == false + # run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish canary - if: github.event.inputs.release == 'canary' - run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag canary --no-git-checks - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_PROVENANCE: true + # - name: Publish canary + # if: github.event.inputs.release == 'canary' + # run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag canary --no-git-checks + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # NPM_CONFIG_PROVENANCE: true - - name: Publish release candidate - if: github.event.inputs.release == 'release-candidate' - run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag rc --no-git-checks - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_PROVENANCE: true + # - name: Publish release candidate + # if: github.event.inputs.release == 'release-candidate' + # run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag rc --no-git-checks + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # NPM_CONFIG_PROVENANCE: true - - name: Publish stable - if: github.event.inputs.release == 'stable' - run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --no-git-checks - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_PROVENANCE: true + # - name: Publish stable + # if: github.event.inputs.release == 'stable' + # run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --no-git-checks + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # NPM_CONFIG_PROVENANCE: true diff --git a/packages/eslint-config-typescript-vitnode/eslint.shared.mjs b/packages/eslint-config-typescript-vitnode/eslint.shared.mjs index 111d4dbab..78306bf78 100644 --- a/packages/eslint-config-typescript-vitnode/eslint.shared.mjs +++ b/packages/eslint-config-typescript-vitnode/eslint.shared.mjs @@ -23,6 +23,7 @@ export default [ }, { rules: { + 'perfectionist/sort-switch-case': 'warn', '@typescript-eslint/no-unnecessary-condition': 'off', 'perfectionist/sort-named-exports': 'warn', 'perfectionist/sort-enums': 'warn', diff --git a/packages/frontend/src/views/theme/views/error/error-view.tsx b/packages/frontend/src/views/theme/views/error/error-view.tsx index c59be145d..db67ca24e 100644 --- a/packages/frontend/src/views/theme/views/error/error-view.tsx +++ b/packages/frontend/src/views/theme/views/error/error-view.tsx @@ -9,7 +9,7 @@ import { } from '@/components/ui/card'; import { cn } from '@/helpers/classnames'; import { Link } from '@/navigation'; -import { AlertTriangle, Home } from 'lucide-react'; +import { AlertTriangle, Home, SearchX, ShieldX } from 'lucide-react'; import { useTranslations } from 'next-intl'; export interface ErrorViewProps { @@ -24,7 +24,16 @@ export const ErrorView = ({ className, code }: ErrorViewProps) => {
- + {(() => { + switch (code) { + case '403': + return ; + case '404': + return ; + default: + return ; + } + })()} {t('title')} From 5c0a8fb878f6ab2003e637c31fc4212e8fce61d2 Mon Sep 17 00:00:00 2001 From: aXenDeveloper Date: Sun, 20 Oct 2024 10:08:30 +0200 Subject: [PATCH 2/2] chore: Clean up --- .github/workflows/publish.yaml | 56 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c4ca3e4ee..517417d4b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -74,35 +74,35 @@ jobs: RELEASE_TYPE: ${{ github.event.inputs.release }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Create Pre-release - # if: github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate' && github.event.inputs.skip_bump_version == false - # run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes --prerelease - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Pre-release + if: github.event.inputs.release == 'canary' || github.event.inputs.release == 'release-candidate' && github.event.inputs.skip_bump_version == 'false' + run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes --prerelease + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Create Release - # if: github.event.inputs.release == 'stable' && github.event.inputs.skip_bump_version == false - # run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + if: github.event.inputs.release == 'stable' && github.event.inputs.skip_bump_version == 'false' + run: gh release create ${{ steps.version-bump.outputs.newTag }} --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Publish canary - # if: github.event.inputs.release == 'canary' - # run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag canary --no-git-checks - # env: - # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # NPM_CONFIG_PROVENANCE: true + - name: Publish canary + if: github.event.inputs.release == 'canary' + run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag canary --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true - # - name: Publish release candidate - # if: github.event.inputs.release == 'release-candidate' - # run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag rc --no-git-checks - # env: - # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # NPM_CONFIG_PROVENANCE: true + - name: Publish release candidate + if: github.event.inputs.release == 'release-candidate' + run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag rc --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true - # - name: Publish stable - # if: github.event.inputs.release == 'stable' - # run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --no-git-checks - # env: - # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # NPM_CONFIG_PROVENANCE: true + - name: Publish stable + if: github.event.inputs.release == 'stable' + run: pnpm publish --access public --filter vitnode-backend --filter vitnode-backend-email-resend --filter vitnode-backend-email-smtp --filter vitnode-backend-ai-google --filter vitnode-backend-ai-open-ai --filter vitnode-frontend --filter create-vitnode-app --filter eslint-config-typescript-vitnode --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true