diff --git a/sigap-website/app/(pages)/layout.tsx b/sigap-website/app/(pages)/layout.tsx index acecc6d..f8a0d28 100644 --- a/sigap-website/app/(pages)/layout.tsx +++ b/sigap-website/app/(pages)/layout.tsx @@ -1,7 +1,7 @@ import { Geist } from "next/font/google"; import { ThemeProvider } from "next-themes"; import "@/app/_styles/globals.css"; -import ReactQueryProvider from "@/app/_lib/react-query-provider"; +import ReactQueryProvider from "@/app/_utils/react-query-provider"; import { Toaster } from "@/app/_components/ui/sonner"; const defaultUrl = process.env.VERCEL_URL diff --git a/sigap-website/app/_lib/const/number.ts b/sigap-website/app/_lib/const/number.ts new file mode 100644 index 0000000..37d868b --- /dev/null +++ b/sigap-website/app/_lib/const/number.ts @@ -0,0 +1,28 @@ +export class CNumbers { + // Timeout durations (in milliseconds) + static readonly SHORT_TIMEOUT = 5000; + static readonly MEDIUM_TIMEOUT = 10000; + static readonly LONG_TIMEOUT = 30000; + + // Pagination + static readonly ITEMS_PER_PAGE = 10; + static readonly MAX_ITEMS_PER_PAGE = 100; + + // Retry attempts + static readonly MAX_RETRY_ATTEMPTS = 3; + + // Status codes + static readonly STATUS_OK = 200; + static readonly STATUS_CREATED = 201; + static readonly STATUS_NO_CONTENT = 204; + static readonly STATUS_BAD_REQUEST = 400; + static readonly STATUS_UNAUTHORIZED = 401; + static readonly STATUS_FORBIDDEN = 403; + static readonly STATUS_NOT_FOUND = 404; + static readonly STATUS_INTERNAL_SERVER_ERROR = 500; + + // Other constants + static readonly MAX_UPLOAD_SIZE_MB = 50; + static readonly MIN_PASSWORD_LENGTH = 8; + static readonly MAX_PASSWORD_LENGTH = 128; +} diff --git a/sigap-website/app/_lib/const/string.ts b/sigap-website/app/_lib/const/string.ts new file mode 100644 index 0000000..d468c3f --- /dev/null +++ b/sigap-website/app/_lib/const/string.ts @@ -0,0 +1,87 @@ +export class CTexts { + // Auth texts + static readonly LOGIN = 'Login'; + static readonly LOGOUT = 'Logout'; + static readonly LOGIN_SUCCESS = 'Login successful'; + static readonly LOGIN_FAILURE = 'Login failed, please try again'; + static readonly SIGNUP = 'Sign Up'; + static readonly SIGNUP_SUCCESS = 'Account created successfully'; + static readonly SIGNUP_FAILURE = 'Account creation failed'; + + // Loading texts + static readonly LOADING = 'Loading...'; + static readonly PLEASE_WAIT = 'Please wait...'; + static readonly LOADING_DATA = 'Loading data...'; + static readonly LOADING_CONTENT = 'Loading content...'; + + // Action texts (Save, Delete, etc) + static readonly SAVE = 'Save'; + static readonly SAVE_SUCCESS = 'Saved successfully'; + static readonly SAVE_FAILURE = 'Failed to save'; + static readonly DELETE = 'Delete'; + static readonly DELETE_CONFIRM = 'Are you sure you want to delete?'; + static readonly DELETE_SUCCESS = 'Deleted successfully'; + static readonly DELETE_FAILURE = 'Failed to delete'; + static readonly UPDATE = 'Update'; + static readonly UPDATE_SUCCESS = 'Updated successfully'; + static readonly UPDATE_FAILURE = 'Failed to update'; + + // Success texts + static readonly OPERATION_SUCCESS = 'Operation completed successfully'; + static readonly DATA_SAVED = 'Data has been saved'; + static readonly ITEM_ADDED = 'Item added successfully'; + static readonly CHANGES_SAVED = 'Changes saved successfully'; + static readonly ITEM_REMOVED = 'Item removed successfully'; + static readonly PROFILE_UPDATED = 'Profile updated successfully'; + + // Failure texts + static readonly OPERATION_FAILURE = 'Operation failed'; + static readonly DATA_NOT_SAVED = 'Data could not be saved'; + static readonly ITEM_NOT_ADDED = 'Item could not be added'; + static readonly CHANGES_NOT_SAVED = 'Changes could not be saved'; + static readonly ITEM_NOT_REMOVED = 'Item could not be removed'; + static readonly PROFILE_NOT_UPDATED = 'Profile could not be updated'; + + // Error texts + static readonly GENERIC_ERROR = 'An error occurred, please try again'; + static readonly NETWORK_ERROR = 'Network error, please check your connection'; + static readonly UNAUTHORIZED = 'You are not authorized to perform this action'; + static readonly NOT_FOUND = 'Resource not found'; + static readonly SERVER_ERROR = 'Server error, please try again later'; + static readonly FORM_ERROR = 'There was an error with your form submission'; + static readonly TIMEOUT_ERROR = 'Request timed out, please try again'; + static readonly CONNECTION_ERROR = 'Connection error, please try again later'; + + // Notification texts + static readonly NEW_MESSAGE = 'You have a new message'; + static readonly NEW_NOTIFICATION = 'You have a new notification'; + static readonly DATA_UPDATED = 'Data has been updated'; + static readonly NEW_UPDATE = 'A new update is available'; + static readonly REMINDER = 'You have a reminder'; + static readonly ALERT = 'You have an alert'; + + // Form texts + static readonly FILL_REQUIRED_FIELDS = 'Please fill all required fields'; + static readonly INVALID_EMAIL = 'Please enter a valid email address'; + static readonly INVALID_PHONE = 'Please enter a valid phone number'; + static readonly PASSWORD_TOO_WEAK = 'Password is too weak'; + static readonly CONFIRM_PASSWORD = 'Please confirm your password'; + static readonly PASSWORDS_DO_NOT_MATCH = 'Passwords do not match'; + static readonly INVALID_INPUT = 'Invalid input, please check your data'; + static readonly REQUIRED_FIELD_MISSING = 'A required field is missing'; + + // User texts + static readonly USER_PROFILE = 'User Profile'; + static readonly USER_SETTINGS = 'User Settings'; + static readonly ACCOUNT_SETTINGS = 'Account Settings'; + static readonly CHANGE_PASSWORD = 'Change Password'; + static readonly LOGOUT_CONFIRM = 'Are you sure you want to log out?'; + static readonly USERNAME = 'Username'; + static readonly EMAIL = 'Email'; + static readonly PHONE_NUMBER = 'Phone Number'; + + // Sensitivie words + static readonly SENSITIVE_WORDS = [ + + ] +} diff --git a/sigap-website/app/_lib/react-query-provider.tsx b/sigap-website/app/_utils/react-query-provider.tsx similarity index 100% rename from sigap-website/app/_lib/react-query-provider.tsx rename to sigap-website/app/_utils/react-query-provider.tsx