Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): Add different icons based on error code in error view #564

Merged
merged 2 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ 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:
VERSION_TYPE: ${{ github.event.inputs.type }}
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:
Expand All @@ -75,13 +75,13 @@ jobs:
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
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
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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 11 additions & 2 deletions packages/frontend/src/views/theme/views/error/error-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -24,7 +24,16 @@ export const ErrorView = ({ className, code }: ErrorViewProps) => {
<div className={cn('mx-auto my-10 max-w-2xl px-4', className)}>
<Card>
<CardHeader className="items-center pb-2">
<AlertTriangle className="size-16" />
{(() => {
switch (code) {
case '403':
return <ShieldX className="size-16" />;
case '404':
return <SearchX className="size-16" />;
default:
return <AlertTriangle className="size-16" />;
}
})()}
</CardHeader>
<CardContent className="flex flex-col items-center pb-4 text-center">
<span className="text-muted-foreground">{t('title')}</span>
Expand Down
Loading