diff --git a/fakemui/icons/Close.tsx b/fakemui/icons/Close.tsx new file mode 100644 index 000000000..82458dc70 --- /dev/null +++ b/fakemui/icons/Close.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const Close = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/ErrorOutline.tsx b/fakemui/icons/ErrorOutline.tsx new file mode 100644 index 000000000..67bca3bbe --- /dev/null +++ b/fakemui/icons/ErrorOutline.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const ErrorOutline = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/ExpandLess.tsx b/fakemui/icons/ExpandLess.tsx new file mode 100644 index 000000000..8009052e9 --- /dev/null +++ b/fakemui/icons/ExpandLess.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const ExpandLess = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/ExpandMore.tsx b/fakemui/icons/ExpandMore.tsx new file mode 100644 index 000000000..ec13372a2 --- /dev/null +++ b/fakemui/icons/ExpandMore.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const ExpandMore = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/InfoOutlined.tsx b/fakemui/icons/InfoOutlined.tsx new file mode 100644 index 000000000..24b8c9ec1 --- /dev/null +++ b/fakemui/icons/InfoOutlined.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const InfoOutlined = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/Visibility.tsx b/fakemui/icons/Visibility.tsx new file mode 100644 index 000000000..d50b3211f --- /dev/null +++ b/fakemui/icons/Visibility.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const Visibility = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/VisibilityOff.tsx b/fakemui/icons/VisibilityOff.tsx new file mode 100644 index 000000000..7269be086 --- /dev/null +++ b/fakemui/icons/VisibilityOff.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const VisibilityOff = (props: IconProps) => ( + + + +) diff --git a/fakemui/icons/WarningAmber.tsx b/fakemui/icons/WarningAmber.tsx new file mode 100644 index 000000000..e3c72cf64 --- /dev/null +++ b/fakemui/icons/WarningAmber.tsx @@ -0,0 +1,7 @@ +import { Icon, type IconProps } from './Icon' + +export const WarningAmber = (props: IconProps) => ( + + + +) diff --git a/packages/ui_login/seed/scripts/actions.lua b/packages/ui_login/seed/scripts/actions.lua index 48fef2b43..f807e7d27 100644 --- a/packages/ui_login/seed/scripts/actions.lua +++ b/packages/ui_login/seed/scripts/actions.lua @@ -1,54 +1,3 @@ -local validate = require("validate") - ----@class LoginActions -local M = {} - ----@class LoginForm ----@field username string ----@field password string - ----@class RegisterForm ----@field username string ----@field email string ----@field password string - ----@class ValidationError ----@field field string ----@field message string - ----@class LoginSuccess ----@field success true ----@field action "login" ----@field username string - ----@class RegisterSuccess ----@field success true ----@field action "register" ----@field username string ----@field email string - ----@class ActionFailure ----@field success false ----@field errors ValidationError[] - ----@param form LoginForm ----@return LoginSuccess|ActionFailure -function M.handleLogin(form) - local result = validate.login(form) - if not result.valid then - return { success = false, errors = result.errors } - end - return { success = true, action = "login", username = form.username } -end - ----@param form RegisterForm ----@return RegisterSuccess|ActionFailure -function M.handleRegister(form) - local result = validate.register(form) - if not result.valid then - return { success = false, errors = result.errors } - end - return { success = true, action = "register", username = form.username, email = form.email } -end - -return M +-- Actions module redirect +-- Functions split into actions/ directory for 1-function-per-file pattern +return require("actions.init") diff --git a/packages/ui_login/seed/scripts/actions/handle_login.lua b/packages/ui_login/seed/scripts/actions/handle_login.lua new file mode 100644 index 000000000..76b949b7a --- /dev/null +++ b/packages/ui_login/seed/scripts/actions/handle_login.lua @@ -0,0 +1,39 @@ +-- Handle login form submission + +local validate = require("validate") + +---@class LoginForm +---@field username string +---@field password string + +---@class ValidationError +---@field field string +---@field message string + +---@class LoginSuccess +---@field success true +---@field action "login" +---@field username string + +---@class ActionFailure +---@field success false +---@field errors ValidationError[] + +local M = {} + +---Process login form and validate credentials +---@param form LoginForm +---@return LoginSuccess|ActionFailure +function M.handleLogin(form) + local result = validate.login(form) + if not result.valid then + return { success = false, errors = result.errors } + end + return { + success = true, + action = "login", + username = form.username + } +end + +return M diff --git a/packages/ui_login/seed/scripts/actions/handle_register.lua b/packages/ui_login/seed/scripts/actions/handle_register.lua new file mode 100644 index 000000000..77c28b3c0 --- /dev/null +++ b/packages/ui_login/seed/scripts/actions/handle_register.lua @@ -0,0 +1,42 @@ +-- Handle registration form submission + +local validate = require("validate") + +---@class RegisterForm +---@field username string +---@field email string +---@field password string + +---@class ValidationError +---@field field string +---@field message string + +---@class RegisterSuccess +---@field success true +---@field action "register" +---@field username string +---@field email string + +---@class ActionFailure +---@field success false +---@field errors ValidationError[] + +local M = {} + +---Process registration form and validate data +---@param form RegisterForm +---@return RegisterSuccess|ActionFailure +function M.handleRegister(form) + local result = validate.register(form) + if not result.valid then + return { success = false, errors = result.errors } + end + return { + success = true, + action = "register", + username = form.username, + email = form.email + } +end + +return M diff --git a/packages/ui_login/seed/scripts/actions/init.lua b/packages/ui_login/seed/scripts/actions/init.lua new file mode 100644 index 000000000..24e09a584 --- /dev/null +++ b/packages/ui_login/seed/scripts/actions/init.lua @@ -0,0 +1,15 @@ +-- Actions module facade +-- Re-exports all action handlers for backward compatibility + +local login = require("actions.handle_login") +local register = require("actions.handle_register") + +---@class ActionsModule +---@field handleLogin fun(form: LoginForm): LoginSuccess|ActionFailure +---@field handleRegister fun(form: RegisterForm): RegisterSuccess|ActionFailure +local M = {} + +M.handleLogin = login.handleLogin +M.handleRegister = register.handleRegister + +return M diff --git a/packages/ui_login/seed/scripts/actions/types.lua b/packages/ui_login/seed/scripts/actions/types.lua new file mode 100644 index 000000000..47684a7a7 --- /dev/null +++ b/packages/ui_login/seed/scripts/actions/types.lua @@ -0,0 +1,31 @@ +-- Type definitions for login actions module + +---@class LoginForm +---@field username string User's username +---@field password string User's password + +---@class RegisterForm +---@field username string User's username +---@field email string User's email address +---@field password string User's password + +---@class ValidationError +---@field field string Field name with error +---@field message string Error message + +---@class LoginSuccess +---@field success true Indicates success +---@field action "login" Action type +---@field username string Authenticated username + +---@class RegisterSuccess +---@field success true Indicates success +---@field action "register" Action type +---@field username string Registered username +---@field email string Registered email + +---@class ActionFailure +---@field success false Indicates failure +---@field errors ValidationError[] List of validation errors + +return {}