Skip to content
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cSpell.words": ["vitnode"],
"cSpell.words": ["sonner", "vitnode"],
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "Follow the Conventional Commits format strictly for commit messages. Use the structure below:\n\n```\n<type>[optional scope]: <gitmoji> <description>\n```\n\nGuidelines:\n\n1. **Type and Scope**: Choose an appropriate type (e.g., `feat`, `fix`, `refactor`, `docs`) and optional scope to describe the affected module or feature.\n\n2. **Gitmoji**: Include a relevant `gitmoji` that best represents the nature of the change.\n\n3. **Description**: Write a concise, informative description in the header; use backticks if referencing code or specific terms.\n\nCommit messages should be clear, informative, and professional, aiding readability and project tracking."
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/dev/config/rate-limiter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Rate limiting is a powerful feature that helps protect your API from abuse and b
export const vitNodeApiConfig = buildApiConfig({
// [!code ++:4]
rateLimiter: {
points: 20,
points: 40,
duration: 60,
},
});
Expand All @@ -27,7 +27,7 @@ import { TypeTable } from 'fumadocs-ui/components/type-table';
description:
'The number of requests allowed within the specified duration.',
type: 'number',
default: '20',
default: '40',
},
duration: {
description:
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/content/docs/dev/logging.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Logging
description: Centralized logging with VitNode
---
1 change: 1 addition & 0 deletions apps/docs/content/docs/dev/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"i18n",
"---Framework---",
"config",
"logging",
"---Advanced---",
"..."
]
Expand Down
81 changes: 81 additions & 0 deletions apps/docs/content/docs/ui/confirm-action-alert-dialog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: Confirm Action Alert Dialog
description: A dialog component for confirming destructive actions like delete operations, built on top of the Alert Dialog.
---

The Confirm Action Alert Dialog is a specialized dialog component built on top of the [Alert Dialog](/docs/ui/alert-dialog) that provides a consistent way to confirm potentially destructive or irreversible actions before they're executed.

It's particularly useful for:

- Deleting items (e.g., categories, posts, users)
- Performing actions that cannot be undone (e.g., clearing data, resetting settings)
- Confirming critical operations (e.g., account deletion, data migration)
- Any action where user confirmation is necessary to prevent accidental execution

## Usage

```tsx
import { ConfirmActionAlertDialog } from '@vitnode/core/components/confirm-action/confirm-action-alert-dialog';
import { Button } from '@vitnode/core/components/ui/button';
```

```tsx
<ConfirmActionAlertDialog
onSubmit={async ({ onClose }) => {
const result = await deleteCategoryApi(id);

if (result?.error) {
toast.error(tGlobal('errors.title'), {
description: tGlobal('errors.internal_server_error'),
});
return; // Keep dialog open on error
}

toast.success(t('success'), {
description: title,
});
onClose(); // Close dialog on success
}}
>
<Button variant="destructive">Delete Category</Button>
</ConfirmActionAlertDialog>
```

## Props

import { TypeTable } from 'fumadocs-ui/components/type-table';

<TypeTable
type={{
children: {
description:
'The trigger element that opens the dialog. This should be a button or clickable element.',
type: 'ReactNode',
required: true,
},
onSubmit: {
description:
'Function called when the user confirms the action. Receives an object with `onClose` callback.',
type: '(params: { onClose: () => void }) => Promise<void>',
required: true,
},
title: {
description:
'Custom title for the dialog. Defaults to translated "Are you sure?"',
type: 'string',
default: 'Are you sure?',
},
description: {
description:
'Custom description explaining what will happen when the action is confirmed.',
type: 'ReactNode',
default: 'This action cannot be undone.',
},
textSubmit: {
description:
'Custom text for the submit button. Defaults to translated "Confirm".',
type: 'string',
default: 'Confirm',
},
}}
/>
1 change: 1 addition & 0 deletions apps/docs/content/docs/ui/hooks/meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"title": "Hooks",
"icon": "Webhook",
"pages": ["..."]
}
21 changes: 20 additions & 1 deletion apps/docs/content/docs/ui/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,24 @@
"description": "Make it pretty",
"icon": "Paintbrush",
"root": true,
"pages": ["index", "hooks", "---Forms---", "auto-form", "..."]
"pages": [
"index",
"hooks",
"not-found",
"---Components---",
"data-table",
"confirm-action-alert-dialog",
"---Forms---",
"auto-form",
"checkbox",
"combobox-async",
"combobox",
"input",
"radio-group",
"select",
"switch",
"textarea",
"---UI---",
"..."
]
}
6 changes: 0 additions & 6 deletions apps/docs/content/docs/ui/static-pages.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"postcss": "^8.5.6",
"shiki": "^3.6.0",
"shiki": "^3.7.0",
"tailwindcss": "^4.1.10",
"typescript": "^5.8.3"
}
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
--popover: oklch(0.18 0 0);
--popover-foreground: oklch(0.98 0 0);
--primary: oklch(0.51 0.16 262.61);
--primary-foreground: oklch(0.99 0.16 262.61);
--primary-foreground: oklch(0.98 0 0);
--secondary: oklch(0.24 0.01 240);
--secondary-foreground: oklch(0.98 0.005 240);
--muted: oklch(0.22 0 0);
--muted-foreground: oklch(0.7 0 0);
--accent: oklch(0.28 0 0);
--destructive: oklch(0.704 0.191 22.216);
--destructive-foreground: oklch(0.704 0.191 22.216);
--border: oklch(0.24 0 0);
--input: oklch(0.24 0 0);
--border: oklch(0.28 0 0);
--input: oklch(0.28 0 0);
--ring: oklch(0.51 0.16 262.61);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
Expand Down
13 changes: 13 additions & 0 deletions apps/web/migrations/0002_superb_natasha_romanoff.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TYPE "public"."typeLogs" AS ENUM('info', 'warn', 'error', 'debug');--> statement-breakpoint
CREATE TABLE "core_logs" (
"id" serial PRIMARY KEY NOT NULL,
"pluginCode" varchar(255) NOT NULL,
"type" "typeLogs" DEFAULT 'info' NOT NULL,
"content" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"userId" integer,
"ipAddress" varchar(45) DEFAULT '' NOT NULL
);
--> statement-breakpoint
ALTER TABLE "core_logs" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
ALTER TABLE "core_logs" ADD CONSTRAINT "core_logs_userId_core_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."core_users"("id") ON DELETE set null ON UPDATE no action;
Loading