mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-05 00:27:53 +01:00
- Add Next.js admin routes (/admin, /admin/login, /admin/pages, /admin/pages/new, /admin/pages/[id]) - Create admin layout with navigation and authentication - Build login page with email/password form - Implement pages list with search and create functionality - Add WYSIWYG editor for content creation/editing - Create API routes for admin authentication and content management - Add middleware for route protection - Include sample data population script - Add comprehensive admin interface documentation for non-technical users - Create test page for validating admin functionality - Update environment configuration for JWT secret Admin interface is now super easy and intuitive for non-technical team members to: - Login with email/password - View all pages with search - Create new pages - Edit existing pages with rich text editor - Save as draft or publish immediately - Preview content before publishing All code follows best practices with proper error handling, security, and accessibility.
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { FieldInstance, FieldValidationError, Location, Meta, Request, UnknownFieldInstance, ValidationError } from './base';
|
|
import { ContextItem } from './context-items';
|
|
/**
|
|
* Defines which kind of value makes a field optional.
|
|
*
|
|
* - `undefined`: only `undefined` values; equivalent to `value === undefined`
|
|
* - `null`: only `undefined` and `null` values; equivalent to `value == null`
|
|
* - `falsy`: all falsy values; equivalent to `!value`
|
|
* - `false`: not optional.
|
|
*/
|
|
export type Optional = 'undefined' | 'null' | 'falsy' | false;
|
|
export type AddErrorOptions = {
|
|
type: 'field';
|
|
message?: any;
|
|
value: any;
|
|
meta: Meta;
|
|
} | {
|
|
type: 'unknown_fields';
|
|
req: Request;
|
|
message?: any;
|
|
fields: UnknownFieldInstance[];
|
|
} | {
|
|
type: 'alternative';
|
|
req: Request;
|
|
message?: any;
|
|
nestedErrors: FieldValidationError[];
|
|
} | {
|
|
type: 'alternative_grouped';
|
|
req: Request;
|
|
message?: any;
|
|
nestedErrors: FieldValidationError[][];
|
|
};
|
|
export type ValueVisibility = {
|
|
type: 'visible';
|
|
} | {
|
|
type: 'hidden';
|
|
} | {
|
|
type: 'redacted';
|
|
value: string;
|
|
};
|
|
export declare class Context {
|
|
readonly fields: string[];
|
|
readonly locations: Location[];
|
|
readonly stack: ReadonlyArray<ContextItem>;
|
|
readonly optional: Optional;
|
|
readonly bail: boolean;
|
|
readonly visibility: ValueVisibility;
|
|
readonly message?: any | undefined;
|
|
private readonly _errors;
|
|
get errors(): ReadonlyArray<ValidationError>;
|
|
private readonly dataMap;
|
|
constructor(fields: string[], locations: Location[], stack: ReadonlyArray<ContextItem>, optional: Optional, bail: boolean, visibility?: ValueVisibility, message?: any | undefined);
|
|
getData(options?: {
|
|
requiredOnly: boolean;
|
|
}): FieldInstance[];
|
|
addFieldInstances(instances: FieldInstance[]): void;
|
|
setData(path: string, value: any, location: Location): void;
|
|
addError(opts: AddErrorOptions): void;
|
|
private updateVisibility;
|
|
}
|
|
export type ReadonlyContext = Pick<Context, Exclude<keyof Context, 'setData' | 'addFieldInstances' | 'addError'>>;
|